Firmware SDK
twr_tag_nfc.h
1 #ifndef _TWR_TAG_NFC_H
2 #define _TWR_TAG_NFC_H
3 
4 #include <twr_i2c.h>
5 
9 
11 
12 #define TWR_TAG_NFC_I2C_ADDRESS_DEFAULT 0x08
13 
14 #define TWR_TAG_NFC_BUFFER_SIZE 864
15 
17 
18 typedef struct
19 {
20  twr_i2c_channel_t _i2c_channel;
21  uint8_t _i2c_address;
22 
24 
26 
27 typedef struct
28 {
29  size_t _length;
30  int _last_tnf_pos;
31  uint16_t _encoded_size;
32  uint8_t _buffer[TWR_TAG_NFC_BUFFER_SIZE];
33 
35 
40 
41 bool twr_tag_nfc_init(twr_tag_nfc_t *self, twr_i2c_channel_t i2c_channel, uint8_t i2c_address);
42 
49 
50 bool twr_tag_nfc_memory_read(twr_tag_nfc_t *self, void *buffer, size_t length);
51 
58 
59 bool twr_tag_nfc_memory_write(twr_tag_nfc_t *self, void *buffer, size_t length);
60 
66 
68 
71 
73 
78 
79 bool twr_tag_nfc_ndef_add_text(twr_tag_nfc_ndef_t *self, const char *text, const char *encoding);
80 
84 
85 bool twr_tag_nfc_ndef_add_uri(twr_tag_nfc_ndef_t *self, const char *uri);
86 
88 
89 #endif // _TWR_TAG_NFC_H
twr_i2c_channel_t
I2C channels.
Definition: twr_i2c.h:16
void twr_tag_nfc_ndef_init(twr_tag_nfc_ndef_t *self)
Initialize NDEF.
Definition: twr_tag_nfc.c:156
bool twr_tag_nfc_init(twr_tag_nfc_t *self, twr_i2c_channel_t i2c_channel, uint8_t i2c_address)
Initialize NFC Tag.
Definition: twr_tag_nfc.c:10
bool twr_tag_nfc_ndef_add_text(twr_tag_nfc_ndef_t *self, const char *text, const char *encoding)
Add ndef text record.
Definition: twr_tag_nfc.c:171
bool twr_tag_nfc_memory_read(twr_tag_nfc_t *self, void *buffer, size_t length)
Read from memory.
Definition: twr_tag_nfc.c:66
bool twr_tag_nfc_memory_write(twr_tag_nfc_t *self, void *buffer, size_t length)
Write to memory.
Definition: twr_tag_nfc.c:102
bool twr_tag_nfc_memory_write_ndef(twr_tag_nfc_t *self, twr_tag_nfc_ndef_t *ndef)
Write to memory.
Definition: twr_tag_nfc.c:144
bool twr_tag_nfc_ndef_add_uri(twr_tag_nfc_ndef_t *self, const char *uri)
Add ndef uri record.
Definition: twr_tag_nfc.c:199
NDEF Instance.
Definition: twr_tag_nfc.h:28
Instance.
Definition: twr_tag_nfc.h:19