ruuvi.drivers.c  ${PROJECT_VERSION}
Drivers for external sensors and peripherals on embedded systems.
ruuvi_task_nfc.c File Reference
#include "ruuvi_driver_enabled_modules.h"
#include "ruuvi_driver_error.h"
#include "ruuvi_interface_communication.h"
#include <stdbool.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_send (ri_comm_message_t *message)
 Sets given message to NFC RAM buffer. Clears previous message. 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 (void)
 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...
 

Detailed Description

Author
Otso Jousimaa otso@.nosp@m.ojou.nosp@m.sima..nosp@m.net
Date
2020-02-21

When NFC reader is in range return 4 UTF-textfields with content

SW: version
MAC: AA:BB:CC:DD:EE:FF
ID: 00:11:22:33:44:55:66:77
Data:

Definition in file ruuvi_task_nfc.c.

Function Documentation

◆ rt_nfc_init()

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.

Return values
RD_SUCCESSon success.
RD_ERROR_NULLif init_data is NULL
RD_ERROR_INVALID_STATEif NFC is already initialized.
Returns
error code from stack on error.

Definition at line 288 of file ruuvi_task_nfc.c.

◆ rt_nfc_is_connected()

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.

Returns
true if NFC is connected, false otherwise.

Definition at line 319 of file ruuvi_task_nfc.c.

◆ rt_nfc_send()

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.

Returns
RD_SUCCESS on success
error code from stack on error

Definition at line 293 of file ruuvi_task_nfc.c.

◆ rt_nfc_set_on_connected_isr()

void rt_nfc_set_on_connected_isr ( const ri_comm_cb_t  cb)

Setup connection event handler.

The event handler has signature of

void(*rt_comm_cb_t)(void* p_event_data, uint16_t event_size)

where event data is NULL and event_size is 0. The event handler is called in interrupt context.

Parameters
[in]cbCallback which gets called on connection in interrupt context.

Definition at line 298 of file ruuvi_task_nfc.c.

◆ rt_nfc_set_on_disconn_isr()

void rt_nfc_set_on_disconn_isr ( const ri_comm_cb_t  cb)

Setup disconnection event handler.

The event handler has signature of

void(*rt_comm_cb_t)(void* p_event_data, uint16_t event_size)

where event data is NULL and event_size is 0. The event handler is called in interrupt context.

Parameters
[in]cbCallback which gets called on disconnection in interrupt context.

Definition at line 304 of file ruuvi_task_nfc.c.

◆ rt_nfc_set_on_received_isr()

void rt_nfc_set_on_received_isr ( const ri_comm_cb_t  cb)

Setup data received event handler.

The event handler has signature of

void(*rt_comm_cb_t)(void* p_event_data, uint16_t event_size)

where event data is NULL and event_size is 0. The event handler is called in interrupt context.

Parameters
[in]cbCallback which gets called on data received in interrupt context.

Definition at line 309 of file ruuvi_task_nfc.c.

◆ rt_nfc_set_on_sent_isr()

void rt_nfc_set_on_sent_isr ( const ri_comm_cb_t  cb)

Setup data sent event handler.

The event handler has signature of

void(*rt_comm_cb_t)(void* p_event_data, uint16_t event_size)

where event data is NULL and event_size is 0. The event handler is called in interrupt context.

Parameters
[in]cbCallback which gets called on data sent in interrupt context.

Definition at line 314 of file ruuvi_task_nfc.c.