• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef  NFCFORUM_H_
2 #define  NFCFORUM_H_
3 
4 #include <stdbool.h>
5 
6 #include "rtdTypes.h"
7 #include "NT3H.h"
8 
9 #define NDEF_START_BYTE 0x03
10 #define NDEF_END_BYTE 	0xFE
11 
12 #define NTAG_ERASED 	0xD0
13 
14 typedef struct {
15     uint8_t startByte;
16     uint8_t payloadLength;
17 }NDEFHeaderStr;
18 
19 #define BIT_MB (1<<7)
20 #define BIT_ME (1<<6)
21 #define BIT_CF (1<<5)
22 #define BIT_SR (1<<4)
23 #define BIT_IL (1<<3)
24 #define BIT_TNF (1<<0)
25 #define MASK_MB  0x80
26 #define MASK_ME  0x40
27 #define MASK_CF  0x20
28 #define MASK_SR  0x10
29 #define MASK_IL  0x08
30 #define MASK_TNF 0x07
31 
32 #define TEXT_RECORD_LEN  7
33 #define URI_RECORD_LEN  5
34 
35 typedef enum {
36     HEADER,
37     TYPE_LENGTH,
38     PALOAD_LENGTH,
39     TYPE_CODE,
40     TYPE_PAYLOAD
41 }I2CMsgNum;
42 
43 typedef struct {
44     uint8_t     header;
45     uint8_t		typeLength;
46     uint8_t		payloadLength;
47     RTDTypeStr type;
48 }NDEFRecordStr;
49 
50 uint8_t composeRtdText(const NDEFDataStr *ndef, NDEFRecordStr *ndefRecord, uint8_t *I2CMsg);
51 uint8_t composeRtdUri(const NDEFDataStr *ndef, NDEFRecordStr *ndefRecord, uint8_t *I2CMsg);
52 
53 void composeNDEFMBME(bool isFirstRecord, bool isLastRecord, NDEFRecordStr *ndefRecord);
54 
55 #endif /* NFCFORUM.H_H_ */
56