39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
73#define SMARTNFC_FRAME_STX 0xF5
79#define SMARTNFC_CMD_ACK 0x00
80#define SMARTNFC_CMD_DUMMY 0x01
81#define SMARTNFC_CMD_GET_TAG_COUNT 0x02
82#define SMARTNFC_CMD_GET_TAG_UID 0x03
83#define SMARTNFC_CMD_ACTIVATE_TAG 0x04
84#define SMARTNFC_CMD_HALT 0x05
85#define SMARTNFC_CMD_SET_POLLING 0x06
86#define SMARTNFC_CMD_SET_KEY 0x07
87#define SMARTNFC_CMD_SAVE_KEYS 0x08
88#define SMARTNFC_CMD_NET_CONFIG 0x09
89#define SMARTNFC_CMD_REBOOT 0x0A
90#define SMARTNFC_CMD_GET_VERSION 0x0B
91#define SMARTNFC_CMD_UART_PASSTHRU 0x0C
92#define SMARTNFC_CMD_SLEEP 0x0D
93#define SMARTNFC_CMD_GPIO 0x0E
94#define SMARTNFC_CMD_SET_ACTIVE_ANT 0x0F
95#define SMARTNFC_CMD_WPAN_PIN 0x10
96#define SMARTNFC_CMD_FACTORY_RESET 0x11
97#define SMARTNFC_CMD_PROTOCOL_AUTH 0x12
98#define SMARTNFC_CMD_PROTOCOL_CFG 0x13
99#define SMARTNFC_CMD_LED 0x14
100#define SMARTNFC_CMD_WPAN_DATA 0x15
101#define SMARTNFC_CMD_POLLING_SETUP 0x16
102#define SMARTNFC_CMD_LOG_FORWARDING 0xE4
103#define SMARTNFC_CMD_ERROR 0xFF
109#define SMARTNFC_RSP_TIMEOUT_1000MS 1000
110#define SMARTNFC_RSP_NUM_TRIES 3
117#define SMARTNFC_TX_DRV_BUFFER_SIZE 200
118#define SMARTNFC_RX_DRV_BUFFER_SIZE 500
119#define SMARTNFC_PAYLOAD_BUFFER_SIZE 500
137#define SMARTNFC_MAP_MIKROBUS( cfg, mikrobus ) \
138 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
139 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
140 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
#define SMARTNFC_TX_DRV_BUFFER_SIZE
Smart NFC driver buffer size.
Definition smartnfc.h:117
#define SMARTNFC_PAYLOAD_BUFFER_SIZE
Definition smartnfc.h:119
#define SMARTNFC_RX_DRV_BUFFER_SIZE
Definition smartnfc.h:118
void smartnfc_set_rst_pin(smartnfc_t *ctx, uint8_t state)
Smart NFC set RST pin function.
err_t smartnfc_send_frame(smartnfc_t *ctx)
Smart NFC send frame function.
err_t smartnfc_generic_write(smartnfc_t *ctx, uint8_t *data_in, uint16_t len)
Smart NFC data writing function.
void smartnfc_cfg_setup(smartnfc_cfg_t *cfg)
Smart NFC configuration object setup function.
err_t smartnfc_init(smartnfc_t *ctx, smartnfc_cfg_t *cfg)
Smart NFC initialization function.
err_t smartnfc_reset_device(smartnfc_t *ctx)
Smart NFC reset device function.
err_t smartnfc_read_ack_frame(smartnfc_t *ctx, uint8_t cmd)
Smart NFC read ack frame function.
void smartnfc_clear_buffers(smartnfc_t *ctx)
Smart NFC clear buffers function.
err_t smartnfc_read_frame(smartnfc_t *ctx)
Smart NFC read frame function.
err_t smartnfc_generic_read(smartnfc_t *ctx, uint8_t *data_out, uint16_t len)
Smart NFC data reading function.
smartnfc_return_value_t
Smart NFC Click return value data.
Definition smartnfc.h:205
@ SMARTNFC_ERROR_TIMEOUT
Definition smartnfc.h:208
@ SMARTNFC_OK
Definition smartnfc.h:206
@ SMARTNFC_ERROR
Definition smartnfc.h:207
Smart NFC Click configuration object.
Definition smartnfc.h:183
uint32_t baud_rate
Definition smartnfc.h:192
bool uart_blocking
Definition smartnfc.h:193
uart_data_bits_t data_bit
Definition smartnfc.h:194
pin_name_t tx_pin
Definition smartnfc.h:186
pin_name_t rx_pin
Definition smartnfc.h:185
uart_stop_bits_t stop_bit
Definition smartnfc.h:196
uart_parity_t parity_bit
Definition smartnfc.h:195
pin_name_t rst
Definition smartnfc.h:189
Smart NFC Click command frame structure object.
Definition smartnfc.h:150
uint16_t payload_len
Definition smartnfc.h:153
uint8_t cmd
Definition smartnfc.h:151
uint8_t payload[SMARTNFC_PAYLOAD_BUFFER_SIZE]
Definition smartnfc.h:152
Smart NFC Click context object.
Definition smartnfc.h:162
smartnfc_frame_t cmd_frame
Definition smartnfc.h:173
smartnfc_frame_t rsp_frame
Definition smartnfc.h:174
uart_t uart
Definition smartnfc.h:167
uint8_t uart_rx_buffer[SMARTNFC_RX_DRV_BUFFER_SIZE]
Definition smartnfc.h:170
uint8_t uart_tx_buffer[SMARTNFC_TX_DRV_BUFFER_SIZE]
Definition smartnfc.h:171
digital_out_t rst
Definition smartnfc.h:164