Go to the documentation of this file.
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 #include "drv_i2c_master.h"
59 #define NFC2_RF_DISCOVER_MAP_CMD 0x00
60 #define NFC2_RF_DISCOVER_MAP_RSP 0x00
61 #define NFC2_RF_SET_LISTEN_MODE_ROUTING_CMD 0x01
62 #define NFC2_RF_SET_LISTEN_MODE_ROUTING_RSP 0x01
63 #define NFC2_RF_GET_LISTEN_MODE_ROUTING_CMD 0x02
64 #define NFC2_RF_GET_LISTEN_MODE_ROUTING_RSP 0x02
65 #define NFC2_RF_GET_LISTEN_MODE_ROUTING_NTF 0x02
66 #define NFC2_RF_DISCOVER_CMD 0x03
67 #define NFC2_RF_DISCOVER_RSP 0x03
68 #define NFC2_RF_DISCOVER_NTF 0x03
69 #define NFC2_RF_DISCOVER_SELECT_CMD 0x04
70 #define NFC2_RF_DISCOVER_SELECT_RSP 0x04
71 #define NFC2_RF_INTF_ACTIVATED_NTF 0x05
72 #define NFC2_RF_DEACTIVATE_CMD 0x06
73 #define NFC2_RF_DEACTIVATE_RSP 0x06
74 #define NFC2_RF_DEACTIVATE_NTF 0x06
75 #define NFC2_RF_FIELD_INFO_NTF 0x07
76 #define NFC2_RF_T3T_POLLING_CMD 0x08
77 #define NFC2_RF_T3T_POLLING_RSP 0x08
78 #define NFC2_RF_T3T_POLLING_NTF 0x08
79 #define NFC2_RF_NFCEE_ACTION_NTF 0x09
80 #define NFC2_RF_NFCEE_DISCOVERY_REQ_NTF 0x0A
81 #define NFC2_RF_PARAMETER_UPDATE_CMD 0x0B
82 #define NFC2_RF_PARAMETER_UPDATE_RSP 0x0B
84 #define NFC2_NFCEE_DISCOVER_CMD 0x00
85 #define NFC2_NFCEE_DISCOVER_RSP 0x00
86 #define NFC2_NFCEE_DISCOVER_NTF 0x00
87 #define NFC2_NFCEE_MODE_SET_CMD 0x01
88 #define NFC2_NFCEE_MODE_SET_RSP 0x01
90 #define NFC2_NCI_PROPRIETARY_ACT_CMD 0x02
91 #define NFC2_NCI_PROPRIETARY_ACT_RSP 0x02
92 #define NFC2_RESET_KEEP_CONFIG 0x00
93 #define NFC2_RESET_CLEAR_CONFIG 0x01
99 #define NFC2_STATUS_OK 0x00
100 #define NFC2_STATUS_REJECTED 0x01
101 #define NFC2_STATUS_RF_FRAME_CORRUPTED 0x02
102 #define NFC2_STATUS_FAILED 0x03
103 #define NFC2_STATUS_NOT_INITIALIZED 0x04
104 #define NFC2_STATUS_SYNTAX_ERROR 0x05
105 #define NFC2_STATUS_SEMANTIC_ERROR 0x06
107 #define NFC2_STATUS_INVALID_PARAM 0x09
108 #define NFC2_STATUS_MESSAGE_SIZE_EXCEEDED 0x0A
110 #define NFC2_DISCOVERY_ALREADY_STARTED 0xA0
111 #define NFC2_DISCOVERY_TARGET_ACTIVATION_FAILED 0xA1
112 #define NFC2_DISCOVERY_TEAR_DOWN 0xA2
114 #define NFC2_RF_TRANSMISSION_ERROR 0xB0
115 #define NFC2_RF_PROTOCOL_ERROR 0xB1
116 #define NFC2_RF_TIMEOUT_ERROR 0xB2
118 #define NFC2_NFCEE_INTERFACE_ACTIVATION_FAILED 0xC0
119 #define NFC2_NFCEE_TRANSMISSION_ERROR 0xC1
120 #define NFC2_NFCEE_PROTOCOL_ERROR 0xC2
121 #define NFC2_NFCEE_TIMEOUT_ERROR 0xC3
123 #define NFC2_NFC_RF_TECHNOLOGY_A 0x00
124 #define NFC2_NFC_RF_TECHNOLOGY_B 0x01
125 #define NFC2_NFC_RF_TECHNOLOGY_F 0x02
126 #define NFC2_NFC_RF_TECHNOLOGY_15693 0x03
132 #define NFC2_NFC_A_PASSIVE_POLL_MODE 0x00
133 #define NFC2_NFC_B_PASSIVE_POLL_MODE 0x01
134 #define NFC2_NFC_F_PASSIVE_POLL_MODE 0x02
135 #define NFC2_NFC_A_ACTIVE_POLL_MODE 0x03
136 #define NFC2_NFC_F_ACTIVE_POLL_MODE 0x05
137 #define NFC2_NFC_15693_PASSIVE_POLL_MODE 0x06
139 #define NFC2_NFC_A_PASSIVE_LISTEN_MODE 0x80
140 #define NFC2_NFC_B_PASSIVE_LISTEN_MODE 0x81
141 #define NFC2_NFC_F_PASSIVE_LISTEN_MODE 0x82
142 #define NFC2_NFC_A_ACTIVE_LISTEN_MODE 0x83
143 #define NFC2_NFC_F_ACTIVE_LISTEN_MODE 0x85
144 #define NFC2_NFC_15693_PASSIVE_LISTEN_MODE 0x86
150 #define NFC2_PROTOCOL_UNDETERMINED 0x00
151 #define NFC2_PROTOCOL_T1T 0x01
152 #define NFC2_PROTOCOL_T2T 0x02
153 #define NFC2_PROTOCOL_T3T 0x03
154 #define NFC2_PROTOCOL_ISO_DEP 0x04
155 #define NFC2_PROTOCOL_NFC_DEP 0x05
157 #define NFC2_NFCEE_DIRECT_RF_INTERFACE 0x00
158 #define NFC2_FRAME_RF_INTERFACE 0x01
159 #define NFC2_ISO_DEP_RF_INTERFACE 0x02
160 #define NFC2_NFC_DEP_RF_INTERFACE 0x03
166 #define NFC2_APDU 0x00
167 #define NFC2_HCI_ACCES 0x01
168 #define NFC2_TYPE_3_TAG_COMMAND_SET 0x02
169 #define NFC2_TRANSPARENT 0x03
175 #define NFC2_NFC_BIT_RATE_106 0x00
176 #define NFC2_NFC_BIT_RATE_212 0x01
177 #define NFC2_NFC_BIT_RATE_424 0x02
178 #define NFC2_NFC_BIT_RATE_848 0x03
179 #define NFC2_NFC_BIT_RATE_1695 0x04
180 #define NFC2_NFC_BIT_RATE_3390 0x05
181 #define NFC2_NFC_BIT_RATE_6780 0x06
187 #define NFC2_IRQ_STATE_LOW 0x00
188 #define NFC2_IRQ_STATE_HIGH 0x01
194 #define NFC2_GROUP_ID_CORE 0x00
195 #define NFC2_GROUP_ID_RF_MANAGEMENT 0x01
196 #define NFC2_GROUP_ID_NFC_MANAGEMENT 0x02
197 #define NFC2_GROUP_ID_PROPRIETARY 0x0F
203 #define NFC2_CORE_RESET_CMD 0x00
204 #define NFC2_CORE_RESET_RSP 0x00
205 #define NFC2_CORE_RESET_NTF 0x00
206 #define NFC2_CORE_INIT_CMD 0x01
207 #define NFC2_CORE_INIT_RSP 0x01
208 #define NFC2_CORE_SET_CONFIG_CMD 0x02
209 #define NFC2_CORE_SET_CONFIG_RSP 0x02
210 #define NFC2_CORE_GET_CONFIG_CMD 0x03
211 #define NFC2_CORE_GET_CONFIG_RSP 0x03
212 #define NFC2_CORE_CONN_CREATE_CMD 0x04
213 #define NFC2_CORE_CONN_CREATE_RSP 0x04
214 #define NFC2_CORE_CONN_CLOSE_CMD 0x05
215 #define NFC2_CORE_CONN_CLOSE_RSP 0x05
216 #define NFC2_CORE_CONN_CREDITS_NTF 0x06
217 #define NFC2_CORE_GENERIC_ERROR_NTF 0x07
218 #define NFC2_CORE_INTERFACE_ERROR_NTF 0x08
225 #define NFC2_I2C_ADDR_0 0x28
226 #define NFC2_I2C_ADDR_1 0x29
227 #define NFC2_I2C_ADDR_2 0x2A
228 #define NFC2_I2C_ADDR_3 0x2B
246 #define NFC2_MAP_MIKROBUS( cfg, mikrobus ) \
247 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
248 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
249 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
250 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
265 digital_in_t int_pin;
271 uint8_t slave_address;
298 uint8_t message_type;
299 uint8_t pck_bound_flag;
301 uint8_t opcode_ident;
302 uint8_t payload_length;
303 uint8_t payload[ 256 ];
312 uint8_t message_type;
313 uint8_t pck_bound_flag;
315 uint8_t payload_length;
316 uint8_t payload[ 256 ];
err_t nfc2_generic_write(nfc2_t *ctx, uint8_t *p_tx_data, uint8_t n_bytes)
NFC 2 I2C writing function.
void nfc2_cfg_setup(nfc2_cfg_t *cfg)
NFC 2 configuration object setup function.
void nfc2_cmd_card_disconnected(nfc2_t *ctx)
Card disconnected command function.
NFC 2 Click configuration object.
Definition: nfc2.h:278
void nfc2_activate_rmt_mifare_card(nfc2_t *ctx)
Activate remote mifare card command function.
err_t nfc2_init(nfc2_t *ctx, nfc2_cfg_t *cfg)
NFC 2 initialization function.
void nfc2_cmd_core_init(nfc2_t *ctx)
Core init command function.
NFC 2 Click data packet object.
Definition: nfc2.h:309
void nfc2_cmd_test_procedure(nfc2_t *ctx)
NFC test procedure command function.
NFC 2 Click control packet object.
Definition: nfc2.h:295
uint8_t nfc2_get_data(nfc2_t *ctx, uint8_t *p_rx_data)
Get data function.
void nfc2_write_ctrl_packet_data(nfc2_t *ctx, control_packet_t ctrl_pck)
Write control packet data function.
void nfc2_cmd_core_reset(nfc2_t *ctx)
Core reset command function.
void nfc2_cmd_antenna_test(nfc2_t *ctx, uint8_t sel_ant)
Antenna test function.
NFC 2 Click context object.
Definition: nfc2.h:258
uint8_t nfc2_check_irq(nfc2_t *ctx)
Check IRQ ststus function.
void nfc2_core_set_default_config(nfc2_t *ctx)
Set default configuration function.
void nfc2_core_reset(nfc2_t *ctx)
Core reset command function.
err_t nfc2_generic_read(nfc2_t *ctx, uint8_t *p_rx_h_data, uint8_t *p_rx_p_data)
NFC 2 I2C reading function.
void nfc2_default_cfg(nfc2_t *ctx, control_packet_t *ctrl_pck)
NFC 2 default configuration function.
void nfc2_init_core(nfc2_t *ctx)
Core initialization command function.
void nfc2_cmd_disable_standby_mode(nfc2_t *ctx)
Disable standby mode command function.
void nfc2_cmd_start_discovery(nfc2_t *ctx)
Start discovery command function.
void nfc2_cmd_authenticate_sector(nfc2_t *ctx, uint8_t sel_sect_addr)
Authenticate sector command function.
void nfc2_core_set_protocol_config(nfc2_t *ctx)
Set protocol configuration function.
nfc2_return_value_t
NFC 2 Click return value data.
Definition: nfc2.h:322
void nfc2_read_ctrl_packet_data(nfc2_t *ctx, control_packet_t *ctrl_pck)
Read control packet data function.
void nfc2_hw_reset(nfc2_t *ctx)
HW reset function.