ruuvi.drivers.c
${PROJECT_VERSION}
Drivers for external sensors and peripherals on embedded systems.
|
NFC control. More...
#include "ruuvi_driver_error.h"
#include "ruuvi_driver_sensor.h"
#include "ruuvi_interface_communication.h"
#include "ruuvi_interface_communication_nfc.h"
#include "ruuvi_interface_log.h"
Go to the source code of this file.
Functions | |
rd_status_t | rt_nfc_init (ri_comm_dis_init_t *const init_data) |
Initializes NFC and configures FW, ADDR and ID records according to application_config.h constants. More... | |
rd_status_t | rt_nfc_uninit (void) |
Uninitializes NFC. More... | |
bool | rt_nfc_is_init (void) |
check that NFC is initialized. More... | |
rd_status_t | rt_nfc_send (ri_comm_message_t *message) |
Sets given message to NFC RAM buffer. Clears previous message. More... | |
rd_status_t | rt_nfc_on_nfc (ri_comm_evt_t evt, void *p_data, size_t data_len) |
Handle Ruuvi communication events from NFC driver. More... | |
void | rt_nfc_set_on_connected_isr (const ri_comm_cb_t cb) |
Setup connection event handler. More... | |
void | rt_nfc_set_on_disconn_isr (const ri_comm_cb_t cb) |
Setup disconnection event handler. More... | |
void | rt_nfc_set_on_received_isr (const ri_comm_cb_t cb) |
Setup data received event handler. More... | |
void | rt_nfc_set_on_sent_isr (const ri_comm_cb_t cb) |
Setup data sent event handler. More... | |
bool | rt_nfc_is_connected () |
check if NFC is connected, i.e. a reader is in range. NFC data cannot be changed during connection, setup data to be sent while NFC is not connected. More... | |
NFC control.
Typical usage:
Definition in file ruuvi_task_nfc.h.
rd_status_t rt_nfc_init | ( | ri_comm_dis_init_t *const | init_data | ) |
Initializes NFC and configures FW, ADDR and ID records according to application_config.h constants.
RD_SUCCESS | on success. |
RD_ERROR_NULL | if init_data is NULL |
RD_ERROR_INVALID_STATE | if NFC is already initialized. |
Definition at line 288 of file ruuvi_task_nfc.c.
bool rt_nfc_is_connected | ( | ) |
check if NFC is connected, i.e. a reader is in range. NFC data cannot be changed during connection, setup data to be sent while NFC is not connected.
Definition at line 319 of file ruuvi_task_nfc.c.
bool rt_nfc_is_init | ( | void | ) |
check that NFC is initialized.
rd_status_t rt_nfc_on_nfc | ( | ri_comm_evt_t | evt, |
void * | p_data, | ||
size_t | data_len | ||
) |
Handle Ruuvi communication events from NFC driver.
[in] | evt | Type of event. |
[in] | p_data | pointer to data received. NULL if data was not received. |
[in] | data_len | length of data received. 0 if data was NULL. |
rd_status_t rt_nfc_send | ( | ri_comm_message_t * | message | ) |
Sets given message to NFC RAM buffer. Clears previous message.
NFC data cannot be sent while NFC is connected, setup data before reader enters range.
Definition at line 293 of file ruuvi_task_nfc.c.
void rt_nfc_set_on_connected_isr | ( | const ri_comm_cb_t | cb | ) |
Setup connection event handler.
The event handler has signature of
where event data is NULL and event_size is 0. The event handler is called in interrupt context.
[in] | cb | Callback which gets called on connection in interrupt context. |
Definition at line 298 of file ruuvi_task_nfc.c.
void rt_nfc_set_on_disconn_isr | ( | const ri_comm_cb_t | cb | ) |
Setup disconnection event handler.
The event handler has signature of
where event data is NULL and event_size is 0. The event handler is called in interrupt context.
[in] | cb | Callback which gets called on disconnection in interrupt context. |
Definition at line 304 of file ruuvi_task_nfc.c.
void rt_nfc_set_on_received_isr | ( | const ri_comm_cb_t | cb | ) |
Setup data received event handler.
The event handler has signature of
where event data is NULL and event_size is 0. The event handler is called in interrupt context.
[in] | cb | Callback which gets called on data received in interrupt context. |
Definition at line 309 of file ruuvi_task_nfc.c.
void rt_nfc_set_on_sent_isr | ( | const ri_comm_cb_t | cb | ) |
Setup data sent event handler.
The event handler has signature of
where event data is NULL and event_size is 0. The event handler is called in interrupt context.
[in] | cb | Callback which gets called on data sent in interrupt context. |
Definition at line 314 of file ruuvi_task_nfc.c.
rd_status_t rt_nfc_uninit | ( | void | ) |
Uninitializes NFC.
After uninitialization device is no longer readable with NFC reader.