nRF52 only: Hardware abstraction layer for the NFC Type 2 Tag library. More...
Typedefs |
|
| typedef void(* | hal_nfc_callback )(void *context, hal_nfc_event event, const char *data, size_t dataLength) |
|
Callback from HAL_NFC layer into upper layer.
More...
|
|
Enumerations |
|
| enum |
hal_nfc_retval
{
HAL_NFC_RETVAL_OK , HAL_NFC_RETVAL_ERROR , HAL_NFC_RETVAL_INVALID_SIZE , HAL_NFC_RETVAL_TIMEOUT } |
|
Return values generated by HAL_NFC functions.
|
|
| enum |
hal_nfc_event
{
HAL_NFC_EVENT_FIELD_ON , HAL_NFC_EVENT_FIELD_OFF , HAL_NFC_EVENT_DATA_RECEIVED , HAL_NFC_EVENT_DATA_TRANSMITTED } |
|
Events passed to upper-layer callback function.
|
|
| enum |
hal_nfc_param_id
{
HAL_NFC_PARAM_ID_TESTING , HAL_NFC_PARAM_ID_UNKNOWN } |
|
Parameter IDs for set/get function.
|
|
Functions |
|
| hal_nfc_retval | hal_nfc_setup ( hal_nfc_callback callback, void *cbContext) |
|
Function for initializing the NFC layer.
More...
|
|
| hal_nfc_retval | hal_nfc_set_parameter ( hal_nfc_param_id id, void *data, size_t dataLength) |
|
Function for setting a HAL_NFC parameter.
More...
|
|
| hal_nfc_retval | hal_nfc_get_parameter ( hal_nfc_param_id id, void *data, size_t *maxDataLength) |
|
Function for querying a HAL_NFC parameter value.
More...
|
|
| hal_nfc_retval | hal_nfc_start (void) |
|
Function for starting the NFC subsystem.
More...
|
|
| hal_nfc_retval | hal_nfc_send (const char *data, size_t dataLength) |
|
Function for sending a packet to the connected NFC reader.
More...
|
|
| hal_nfc_retval | hal_nfc_stop (void) |
|
Function for stopping the NFC subsystem.
More...
|
|
| hal_nfc_retval | hal_nfc_done (void) |
|
Function for releasing resources.
More...
|
|
Detailed Description
nRF52 only: Hardware abstraction layer for the NFC Type 2 Tag library.
Typedef Documentation
| typedef void(* hal_nfc_callback)(void *context, hal_nfc_event event, const char *data, size_t dataLength) |
Callback from HAL_NFC layer into upper layer.
If event == HAL_NFC_EVENT_DATA_RECEIVED: data points to the received packet. The memory belongs to the HAL_NFC layer and is guaranteed to be valid only until the callback returns.
If event == HAL_NFC_EVENT_DATA_TRANSMITTED: data points to the transmitted packet. The memory belongs to the application.
If event == <Other event>: data definition is event-specific (to be defined).
- Parameters
-
context Context for callback execution. event The event that occurred. data Received/transmitted data or NULL. dataLength Size of the received/transmitted packet.
Function Documentation
| hal_nfc_retval hal_nfc_done | ( | void | ) |
Function for releasing resources.
After this call returns, the callback is considered invalid and no more events will be posted to it.
- Return values
-
OK This function always succeeds.
| hal_nfc_retval hal_nfc_get_parameter | ( | hal_nfc_param_id | id , |
| void * | data , | ||
| size_t * | maxDataLength | ||
| ) |
Function for querying a HAL_NFC parameter value.
The queried value will be placed into the passed data buffer. If the buffer is too small, maxDataLength will contain the required buffer size.
- Parameters
-
id ID of the parameter to query. data Pointer to a buffer receiving the queried data. maxDataLength Size of the buffer, receives needed size if buffer is too small.
- Return values
-
OK If the parameter was received successfully. If one of the arguments was invalid (for example, the buffer was too small), an error code is returned.
| hal_nfc_retval hal_nfc_send | ( | const char * | data , |
| size_t | dataLength | ||
| ) |
Function for sending a packet to the connected NFC reader.
The provided data buffer belongs to the caller and is guaranteed to be valid until the HAL_NFC_EVENT_DATA_TRANSMITTED event is received by the callback.
- Parameters
-
data The data packet to send. dataLength Size of the packet in bytes.
- Return values
-
OK If the packet was sent. Otherwise, an error code is returned.
| hal_nfc_retval hal_nfc_set_parameter | ( | hal_nfc_param_id | id , |
| void * | data , | ||
| size_t | dataLength | ||
| ) |
Function for setting a HAL_NFC parameter.
This function allows to set any parameter defined as available by HAL_NFC.
- Parameters
-
id ID of the parameter to set. data Pointer to a buffer containing the data to set. dataLength Size of the buffer containing the data to set.
- Return values
-
OK If the parameter was set successfully. If one of the arguments was invalid (for example, a wrong data length), an error code is returned.
| hal_nfc_retval hal_nfc_setup | ( | hal_nfc_callback | callback , |
| void * | cbContext | ||
| ) |
Function for initializing the NFC layer.
This function provides a pointer to a callback function and the callback context to the NFC layer.
- Parameters
-
callback Pointer to the callback function. cbContext Context of callback.
- Return values
-
OK If the NFC layer was initialized successfully. If one of the arguments was invalid, an error code is returned.
| hal_nfc_retval hal_nfc_start | ( | void | ) |
Function for starting the NFC subsystem.
After this function completes, NFC readers will be able to detect the chip.
- Return values
-
OK If the NFC subsystem was started successfully. If the NFC subsystem could not be started, an error code is returned.
| hal_nfc_retval hal_nfc_stop | ( | void | ) |
Function for stopping the NFC subsystem.
After this function returns, NFC readers will no longer be able to connect to the chip.
- Return values
-
OK If the NFC subsystem was stopped. Otherwise, an error code is returned.