Go to the documentation of this file.
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 #include "drv_spi_master.h"
60 #define NFC6_CONTROL_SEND_COMMAND 0x00
61 #define NFC6_CONTROL_READ_DATA 0x02
62 #define NFC6_CONTROL_POLL_READY 0x03
63 #define NFC6_CONTROL_RESET_DEVICE 0x01
64 #define NFC6_CONTROL_POLL_READY_FLAG 0x08
70 #define NFC6_CMD_IDN 0x01
71 #define NFC6_CMD_PROTOCOL_SELECT 0x02
72 #define NFC6_CMD_POLL_FIELD 0x03
73 #define NFC6_CMD_SEND_RECV 0x04
74 #define NFC6_CMD_LISTEN 0x05
75 #define NFC6_CMD_SEND 0x06
76 #define NFC6_CMD_IDLE 0x07
77 #define NFC6_CMD_RD_REG 0x08
78 #define NFC6_CMD_WR_REG 0x09
79 #define NFC6_CMD_SUB_FREQ_RES 0x0B
80 #define NFC6_CMD_AC_FILTER 0x0D
81 #define NFC6_CMD_ECHO 0x55
99 #define NFC6_RSP_FIXED_BYTES 0x80
100 #define NFC6_RSP_FIXED_BYTES_MASK 0x8F
101 #define NFC6_RSP_LONG_FRAME_MASK 0x60
102 #define NFC6_RSP_OK 0x00
103 #define NFC6_RSP_ECHO 0x55
104 #define NFC6_RSP_MAX_DATA_LEN 528u
105 #define NFC6_RSP_READY_TIMEOUT_MS 5000ul
111 #define NFC6_IDLE_CMD_LENGTH 14
112 #define NFC6_IDLE_CMD_WU_SOURCE 0x03
113 #define NFC6_IDLE_CMD_ENTER_CTRL_L 0xA1
114 #define NFC6_IDLE_CMD_ENTER_CTRL_H 0x00
115 #define NFC6_IDLE_CMD_WU_CTRL_L 0xF8
116 #define NFC6_IDLE_CMD_WU_CTRL_H 0x01
117 #define NFC6_IDLE_CMD_LEAVE_CTRL_L 0x18
118 #define NFC6_IDLE_CMD_LEAVE_CTRL_H 0x00
119 #define NFC6_IDLE_CMD_WU_PERIOD 0x20
120 #define NFC6_IDLE_CMD_OSC_START 0x60
121 #define NFC6_IDLE_CMD_DAC_START 0x60
122 #define NFC6_IDLE_CMD_DAC_DATA_L 0x00
123 #define NFC6_IDLE_CMD_DAC_DATA_H 0x00
124 #define NFC6_IDLE_CMD_DAC_DATA_H_MIN 0x00
125 #define NFC6_IDLE_CMD_DAC_DATA_H_MAX 0xFC
126 #define NFC6_IDLE_CMD_SWINGS_CNT 0x3F
127 #define NFC6_IDLE_CMD_MAX_SLEEP 0x01
128 #define NFC6_IDLE_RSP_TIMEOUT 0x01
129 #define NFC6_IDLE_RSP_TAG_DETECT 0x02
130 #define NFC6_IDLE_RSP_LENGTH 1
131 #define NFC6_IDLE_CALIB_START 0x80
137 #define NFC6_PROTOCOL_FIELD_OFF 0
138 #define NFC6_PROTOCOL_ISO_15693 1
139 #define NFC6_PROTOCOL_ISO_14443A 2
140 #define NFC6_PROTOCOL_ISO_14443B 3
141 #define NFC6_PROTOCOL_FELICA 4
147 #define NFC6_TAG_UID_RSP_MAX_DATA_LEN 10
148 #define NFC6_TAG_UID_MAX_LEN 7
149 #define NFC6_MIFARE_REQA 0x26
150 #define NFC6_MIFARE_REQA_LEN 0x07
151 #define NFC6_MIFARE_WUPA 0x52
152 #define NFC6_MIFARE_CL1 0x93
153 #define NFC6_MIFARE_CL2 0x95
154 #define NFC6_MIFARE_ANTICOLLISION 0x20
155 #define NFC6_MIFARE_ANTICOLLISION_LEN 0x08
156 #define NFC6_MIFARE_SELECT 0x70
157 #define NFC6_MIFARE_CASCADE_TAG 0x88
158 #define NFC6_MIFARE_READ 0x30
159 #define NFC6_MIFARE_WRITE 0xA0
169 #define NFC6_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
170 #define NFC6_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
188 #define NFC6_MAP_MIKROBUS( cfg, mikrobus ) \
189 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
190 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
191 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
192 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
193 cfg.irq_in = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
194 cfg.irq_out = MIKROBUS( mikrobus, MIKROBUS_INT )
pin_name_t irq_in
Definition: nfc6.h:233
err_t nfc6_select_protocol(nfc6_t *ctx, uint8_t protocol)
NFC 6 select protocol function.
digital_out_t irq_in
Definition: nfc6.h:206
uint8_t nfc6_get_irq_out_pin(nfc6_t *ctx)
NFC 6 get irq out pin function.
@ NFC6_OK
Definition: nfc6.h:249
digital_in_t irq_out
Definition: nfc6.h:209
pin_name_t sck
Definition: nfc6.h:229
NFC 6 Click configuration object.
Definition: nfc6.h:225
This file contains SPI specific macros, functions, etc.
pin_name_t cs
Definition: nfc6.h:230
err_t nfc6_poll_ready(nfc6_t *ctx)
NFC 6 poll ready function.
nfc6_return_value_t
NFC 6 Click return value data.
Definition: nfc6.h:248
err_t nfc6_send_command(nfc6_t *ctx, uint8_t cmd, uint8_t *data_in, uint8_t len)
NFC 6 send command function.
err_t nfc6_reset_device(nfc6_t *ctx)
NFC 6 reset device function.
spi_master_chip_select_polarity_t cs_polarity
Definition: nfc6.h:239
err_t nfc6_read_mifare_tag_uid(nfc6_t *ctx, uint8_t *tag_uid, uint8_t *tag_uid_len)
NFC 6 get MIFARE tag UID function.
NFC 6 Click context object.
Definition: nfc6.h:204
err_t nfc6_read_data(nfc6_t *ctx, uint8_t *data_out, uint16_t buffer_size, uint16_t *rx_len)
NFC 6 read data function.
pin_name_t miso
Definition: nfc6.h:227
pin_name_t chip_select
Definition: nfc6.h:214
void nfc6_pulse_irq_in(nfc6_t *ctx)
NFC 6 pulse irq in function.
@ NFC6_ERROR
Definition: nfc6.h:250
err_t nfc6_calibrate_device(nfc6_t *ctx)
NFC 6 calibrate device function.
spi_master_mode_t spi_mode
Definition: nfc6.h:238
err_t nfc6_check_command_echo(nfc6_t *ctx)
NFC 6 check command echo function.
void nfc6_set_irq_in_pin(nfc6_t *ctx, uint8_t state)
NFC 6 set irq in pin function.
err_t nfc6_init(nfc6_t *ctx, nfc6_cfg_t *cfg)
NFC 6 initialization function.
uint8_t cal_dac_data_h
Definition: nfc6.h:216
pin_name_t mosi
Definition: nfc6.h:228
err_t nfc6_poll_ready_irq(nfc6_t *ctx)
NFC 6 poll ready irq function.
err_t nfc6_default_cfg(nfc6_t *ctx)
NFC 6 default configuration function.
pin_name_t irq_out
Definition: nfc6.h:234
spi_master_t spi
Definition: nfc6.h:212
void nfc6_cfg_setup(nfc6_cfg_t *cfg)
NFC 6 configuration object setup function.
uint32_t spi_speed
Definition: nfc6.h:237