42 #define CHIP_NAME "NXP MFRC522"
43 #define MANUFACTURER_NAME "NXP"
44 #define SUPPLY_VOLTAGE_MIN 2.5f
45 #define SUPPLY_VOLTAGE_MAX 3.6f
46 #define MAX_CURRENT 100.0f
47 #define TEMPERATURE_MIN -25.0f
48 #define TEMPERATURE_MAX 85.0f
49 #define DRIVER_VERSION 1000
54 #define MFRC522_REG_COMMAND 0x01
55 #define MFRC522_REG_COMIEN 0x02
56 #define MFRC522_REG_DIVIEN 0x03
57 #define MFRC522_REG_COMIRQ 0x04
58 #define MFRC522_REG_DIVIRQ 0x05
59 #define MFRC522_REG_ERROR 0x06
60 #define MFRC522_REG_STATUS1 0x07
61 #define MFRC522_REG_STATUS2 0x08
62 #define MFRC522_REG_FIFO_DATA 0x09
63 #define MFRC522_REG_FIFO_LEVEL 0x0A
64 #define MFRC522_REG_WATER_LEVEL 0x0B
65 #define MFRC522_REG_CONTROL 0x0C
66 #define MFRC522_REG_BIT_FRAMING 0x0D
67 #define MFRC522_REG_COLL 0x0E
68 #define MFRC522_REG_MODE 0x11
69 #define MFRC522_REG_TX_MODE 0x12
70 #define MFRC522_REG_RX_MODE 0x13
71 #define MFRC522_REG_TX_CONTROL 0x14
72 #define MFRC522_REG_TX_ASK 0x15
73 #define MFRC522_REG_TX_SEL 0x16
74 #define MFRC522_REG_RX_SEL 0x17
75 #define MFRC522_REG_RX_THRESHOLD 0x18
76 #define MFRC522_REG_DEMOD 0x19
77 #define MFRC522_REG_MFTX 0x1C
78 #define MFRC522_REG_MFRX 0x1D
79 #define MFRC522_REG_SERIAL_SPEED 0x1F
80 #define MFRC522_REG_CRC_RESULT_H 0x21
81 #define MFRC522_REG_CRC_RESULT_L 0x22
82 #define MFRC522_REG_MOD_WIDTH 0x24
83 #define MFRC522_REG_RFCFG 0x26
84 #define MFRC522_REG_GSN 0x27
85 #define MFRC522_REG_CWGSP 0x28
86 #define MFRC522_REG_MODGSP 0x29
87 #define MFRC522_REG_TMODE 0x2A
88 #define MFRC522_REG_TPRESCALER 0x2B
89 #define MFRC522_REG_TRELOAD_H 0x2C
90 #define MFRC522_REG_TRELOAD_L 0x2D
91 #define MFRC522_REG_TCOUNTER_VAL_H 0x2E
92 #define MFRC522_REG_TCOUNTER_VAL_L 0x2F
93 #define MFRC522_REG_TEST_SEL1 0x31
94 #define MFRC522_REG_TEST_SEL2 0x32
95 #define MFRC522_REG_TEST_PIN_EN 0x33
96 #define MFRC522_REG_TEST_PIN_VALUE 0x34
97 #define MFRC522_REG_TEST_BUS 0x35
98 #define MFRC522_REG_AUTO_TEST 0x36
99 #define MFRC522_REG_VERSION 0x37
100 #define MFRC522_REG_ANALOG_TEST 0x38
101 #define MFRC522_REG_TEST_DAC1 0x39
102 #define MFRC522_REG_TEST_DAC2 0x3A
103 #define MFRC522_REG_TEST_ADC 0x3B
116 static uint8_t a_mfrc522_read(
mfrc522_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
124 for (i = 0; i< len; i++)
139 for (i = 0; i< len; i++)
141 addr = (uint8_t)((1 << 7) | (((reg + i) & 0x3F) << 1));
142 if (handle->
spi_read(addr, buf + i, 1) != 0)
154 for (i = 0; i< len; i++)
156 addr = (uint8_t)((1 << 7) | (((reg + i) & 0x3F) << 0));
191 static uint8_t a_mfrc522_write(
mfrc522_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
199 for (i = 0; i< len; i++)
215 for (i = 0; i< len; i++)
217 addr = (uint8_t)((0 << 7) | (((reg + i) & 0x3F) << 1));
218 if (handle->
spi_write(addr, buf + i, 1) != 0)
231 for (i = 0; i< len; i++)
233 addr = ((reg + i) & 0x3F) << 0;
309 handle->
iic_addr = (uint8_t)addr_pin;
330 *addr_pin = (uint8_t)(handle->
iic_addr);
365 handle->
debug_print(
"mfrc522: reset_gpio_init is null.\n");
371 handle->
debug_print(
"mfrc522: reset_gpio_deinit is null.\n");
377 handle->
debug_print(
"mfrc522: reset_gpio_write is null.\n");
383 handle->
debug_print(
"mfrc522: iic_init is null.\n");
389 handle->
debug_print(
"mfrc522: iic_deinit is null.\n");
395 handle->
debug_print(
"mfrc522: iic_read is null.\n");
401 handle->
debug_print(
"mfrc522: iic_write is null.\n");
407 handle->
debug_print(
"mfrc522: uart_init is null.\n");
413 handle->
debug_print(
"mfrc522: uart_deinit is null.\n");
419 handle->
debug_print(
"mfrc522: uart_read is null.\n");
425 handle->
debug_print(
"mfrc522: uart_write is null.\n");
431 handle->
debug_print(
"mfrc522: uart_flush is null.\n");
437 handle->
debug_print(
"mfrc522: spi_init is null.\n");
443 handle->
debug_print(
"mfrc522: spi_deinit is null.\n");
449 handle->
debug_print(
"mfrc522: spi_read is null.\n");
455 handle->
debug_print(
"mfrc522: spi_write is null.\n");
461 handle->
debug_print(
"mfrc522: delay_ms is null.\n");
467 handle->
debug_print(
"mfrc522: receive_callback is null.\n");
474 handle->
debug_print(
"mfrc522: reset gpio init failed.\n");
482 handle->
debug_print(
"mfrc522: iic init failed.\n");
492 handle->
debug_print(
"mfrc522: spi init failed.\n");
502 handle->
debug_print(
"mfrc522: uart init failed.\n");
510 handle->
debug_print(
"mfrc522: interface is invalid.\n");
517 handle->
debug_print(
"mfrc522: reset gpio write failed.\n");
525 handle->
debug_print(
"mfrc522: reset gpio write failed.\n");
534 handle->
debug_print(
"mfrc522: read command failed.\n");
544 handle->
debug_print(
"mfrc522: write command failed.\n");
556 handle->
debug_print(
"mfrc522: read command failed.\n");
563 if ((prev & (1 << 4)) == 0)
583 if (((
id >> 4) & 0xF) != 9)
585 handle->
debug_print(
"mfrc522: check id failed.\n");
644 handle->
debug_print(
"mfrc522: read command failed.\n");
653 handle->
debug_print(
"mfrc522: write command failed.\n");
660 handle->
debug_print(
"mfrc522: reset gpio write failed.\n");
668 handle->
debug_print(
"mfrc522: iic deinit failed.\n");
677 handle->
debug_print(
"mfrc522: spi deinit failed.\n");
686 handle->
debug_print(
"mfrc522: uart deinit failed.\n");
693 handle->
debug_print(
"mfrc522: interface is invalid.\n");
699 handle->
debug_print(
"mfrc522: reset gpio deinit failed.\n");
747 handle->
debug_print(
"mfrc522: read comirq failed.\n");
754 handle->
debug_print(
"mfrc522: read divirq failed.\n");
759 if ((prev & (1 << 4)) != 0)
764 handle->
debug_print(
"mfrc522: read comirq failed.\n");
772 handle->
debug_print(
"mfrc522: write comirq failed.\n");
779 handle->
debug_print(
"mfrc522: read divirq failed.\n");
787 handle->
debug_print(
"mfrc522: write divirq failed.\n");
893 uint8_t *in_buf, uint8_t in_len,
894 uint8_t *out_buf, uint8_t *out_len,
895 uint8_t *err, uint32_t ms)
911 if ((in_buf == NULL) || (out_buf == NULL))
919 handle->
debug_print(
"mfrc522: in_len is over 64.\n");
928 handle->
debug_print(
"mfrc522: read command failed.\n");
937 handle->
debug_print(
"mfrc522: write command failed.\n");
946 handle->
debug_print(
"mfrc522: read fifo level failed.\n");
954 handle->
debug_print(
"mfrc522: write fifo level failed.\n");
960 for (i = 0; i < in_len; i++)
965 handle->
debug_print(
"mfrc522: write fifo data failed.\n");
976 handle->
debug_print(
"mfrc522: read comirq failed.\n");
984 handle->
debug_print(
"mfrc522: write comirq failed.\n");
991 handle->
debug_print(
"mfrc522: read divirq failed.\n");
999 handle->
debug_print(
"mfrc522: write divirq failed.\n");
1008 handle->
debug_print(
"mfrc522: read command failed.\n");
1012 prev &= ~(0xF << 0);
1017 handle->
debug_print(
"mfrc522: write command failed.\n");
1028 handle->
debug_print(
"mfrc522: read bit framing failed.\n");
1036 handle->
debug_print(
"mfrc522: write bit framing failed.\n");
1064 while (timeout != 0)
1068 if ((handle->
irq_flag & wait_for) != 0)
1086 handle->
debug_print(
"mfrc522: read bit framing failed.\n");
1094 handle->
debug_print(
"mfrc522: write bit framing failed.\n");
1114 handle->
debug_print(
"mfrc522: read error failed.\n");
1131 handle->
debug_print(
"mfrc522: read fifo level failed.\n");
1136 *out_len = level > (*out_len) ? (*out_len) : level;
1137 for (i = 0; i < (*out_len); i++)
1142 handle->
debug_print(
"mfrc522: read fifo data failed.\n");
1155 handle->
debug_print(
"mfrc522: read fifo level failed.\n");
1159 *out_len = level > (*out_len) ? (*out_len) : level;
1160 for (i = 0; i < (*out_len); i++)
1165 handle->
debug_print(
"mfrc522: read fifo data failed.\n");
1176 handle->
debug_print(
"mfrc522: read control failed.\n");
1184 handle->
debug_print(
"mfrc522: write control failed.\n");
1193 handle->
debug_print(
"mfrc522: read command failed.\n");
1197 prev &= ~(0xF << 0);
1202 handle->
debug_print(
"mfrc522: write command failed.\n");
1239 handle->
debug_print(
"mfrc522: read command failed.\n");
1248 handle->
debug_print(
"mfrc522: write command failed.\n");
1284 handle->
debug_print(
"mfrc522: read command failed.\n");
1321 handle->
debug_print(
"mfrc522: read command failed.\n");
1330 handle->
debug_print(
"mfrc522: write command failed.\n");
1366 handle->
debug_print(
"mfrc522: read command failed.\n");
1403 handle->
debug_print(
"mfrc522: read command failed.\n");
1407 prev &= ~(0xF << 0);
1412 handle->
debug_print(
"mfrc522: write command failed.\n");
1448 handle->
debug_print(
"mfrc522: read command failed.\n");
1486 handle->
debug_print(
"mfrc522: read comien failed.\n");
1490 prev &= ~(1 << type);
1491 prev |= (enable << type);
1495 handle->
debug_print(
"mfrc522: write comien failed.\n");
1532 handle->
debug_print(
"mfrc522: read comien failed.\n");
1569 handle->
debug_print(
"mfrc522: read comien failed.\n");
1574 prev |= (enable << 7);
1578 handle->
debug_print(
"mfrc522: write comien failed.\n");
1614 handle->
debug_print(
"mfrc522: read comien failed.\n");
1651 handle->
debug_print(
"mfrc522: read comirq failed.\n");
1656 prev |= (mark << 7);
1660 handle->
debug_print(
"mfrc522: write comirq failed.\n");
1697 handle->
debug_print(
"mfrc522: read divien failed.\n");
1701 prev &= ~(1 << type);
1702 prev |= (enable << type);
1706 handle->
debug_print(
"mfrc522: write divien failed.\n");
1743 handle->
debug_print(
"mfrc522: read divien failed.\n");
1780 handle->
debug_print(
"mfrc522: read divien failed.\n");
1785 prev |= (type << 7);
1789 handle->
debug_print(
"mfrc522: write divien failed.\n");
1825 handle->
debug_print(
"mfrc522: read divien failed.\n");
1862 handle->
debug_print(
"mfrc522: read divirq failed.\n");
1867 prev |= (mark << 7);
1871 handle->
debug_print(
"mfrc522: write divirq failed.\n");
1907 handle->
debug_print(
"mfrc522: read comirq failed.\n");
1911 *status = prev & (~(1 << 7));
1944 handle->
debug_print(
"mfrc522: read divirq failed.\n");
1948 *status = prev & (~(1 << 7));
1981 handle->
debug_print(
"mfrc522: read error failed.\n");
2018 handle->
debug_print(
"mfrc522: read status1 failed.\n");
2055 handle->
debug_print(
"mfrc522: read status2 failed.\n");
2059 *status = prev & (1 << 3);
2092 handle->
debug_print(
"mfrc522: read status2 failed.\n");
2129 handle->
debug_print(
"mfrc522: read status2 failed.\n");
2134 prev |= (enable << 3);
2138 handle->
debug_print(
"mfrc522: write status2 failed.\n");
2174 handle->
debug_print(
"mfrc522: read status2 failed.\n");
2179 prev |= (enable << 6);
2183 handle->
debug_print(
"mfrc522: write status2 failed.\n");
2219 handle->
debug_print(
"mfrc522: read status2 failed.\n");
2256 handle->
debug_print(
"mfrc522: read status2 failed.\n");
2261 prev |= (enable << 7);
2265 handle->
debug_print(
"mfrc522: write status2 failed.\n");
2301 handle->
debug_print(
"mfrc522: read status2 failed.\n");
2338 handle->
debug_print(
"mfrc522: len is over 64.\n");
2343 for (i = 0; i < len; i++)
2348 handle->
debug_print(
"mfrc522: write fifo data failed.\n");
2385 handle->
debug_print(
"mfrc522: len is over 64.\n");
2390 for (i = 0; i < len; i++)
2395 handle->
debug_print(
"mfrc522: read fifo data failed.\n");
2431 handle->
debug_print(
"mfrc522: read fifo level failed.\n");
2466 handle->
debug_print(
"mfrc522: read fifo level failed.\n");
2474 handle->
debug_print(
"mfrc522: write fifo level failed.\n");
2509 handle->
debug_print(
"mfrc522: read water level failed.\n");
2513 *level &= ~(3 << 6);
2544 handle->
debug_print(
"mfrc522: level is over 0x3F.\n");
2552 handle->
debug_print(
"mfrc522: write water level failed.\n");
2587 handle->
debug_print(
"mfrc522: read control failed.\n");
2595 handle->
debug_print(
"mfrc522: write control failed.\n");
2630 handle->
debug_print(
"mfrc522: read control failed.\n");
2638 handle->
debug_print(
"mfrc522: write control failed.\n");
2674 handle->
debug_print(
"mfrc522: read control failed.\n");
2678 *bits = prev & (0x7 << 0);
2710 handle->
debug_print(
"mfrc522: read bit framing failed.\n");
2719 handle->
debug_print(
"mfrc522: write bit framing failed.\n");
2754 handle->
debug_print(
"mfrc522: read bit framing failed.\n");
2762 handle->
debug_print(
"mfrc522: write bit framing failed.\n");
2798 handle->
debug_print(
"mfrc522: read bit framing failed.\n");
2802 *bits = prev & (0x7 << 0);
2834 handle->
debug_print(
"mfrc522: bits is over 7.\n");
2842 handle->
debug_print(
"mfrc522: read bit framing failed.\n");
2851 handle->
debug_print(
"mfrc522: write bit framing failed.\n");
2887 handle->
debug_print(
"mfrc522: read bit framing failed.\n");
2896 handle->
debug_print(
"mfrc522: write bit framing failed.\n");
2932 handle->
debug_print(
"mfrc522: read bit framing failed.\n");
2969 handle->
debug_print(
"mfrc522: read coll failed.\n");
2974 prev |= (!enable) << 7;
2978 handle->
debug_print(
"mfrc522: write coll failed.\n");
3014 handle->
debug_print(
"mfrc522: read coll failed.\n");
3051 handle->
debug_print(
"mfrc522: read coll failed.\n");
3088 handle->
debug_print(
"mfrc522: read coll failed.\n");
3125 handle->
debug_print(
"mfrc522: read mode failed.\n");
3130 prev |= enable << 7;
3134 handle->
debug_print(
"mfrc522: write mode failed.\n");
3170 handle->
debug_print(
"mfrc522: read mode failed.\n");
3207 handle->
debug_print(
"mfrc522: read mode failed.\n");
3212 prev |= enable << 5;
3216 handle->
debug_print(
"mfrc522: write mode failed.\n");
3252 handle->
debug_print(
"mfrc522: read mode failed.\n");
3289 handle->
debug_print(
"mfrc522: read mode failed.\n");
3294 prev |= polarity << 3;
3298 handle->
debug_print(
"mfrc522: write mode failed.\n");
3334 handle->
debug_print(
"mfrc522: read mode failed.\n");
3371 handle->
debug_print(
"mfrc522: read mode failed.\n");
3376 prev |= preset << 0;
3380 handle->
debug_print(
"mfrc522: write mode failed.\n");
3416 handle->
debug_print(
"mfrc522: read mode failed.\n");
3453 handle->
debug_print(
"mfrc522: read tx mode failed.\n");
3458 prev |= enable << 7;
3462 handle->
debug_print(
"mfrc522: write tx mode failed.\n");
3498 handle->
debug_print(
"mfrc522: read tx mode failed.\n");
3535 handle->
debug_print(
"mfrc522: read tx mode failed.\n");
3544 handle->
debug_print(
"mfrc522: write tx mode failed.\n");
3580 handle->
debug_print(
"mfrc522: read tx mode failed.\n");
3617 handle->
debug_print(
"mfrc522: read tx mode failed.\n");
3622 prev |= enable << 3;
3626 handle->
debug_print(
"mfrc522: write tx mode failed.\n");
3662 handle->
debug_print(
"mfrc522: read tx mode failed.\n");
3699 handle->
debug_print(
"mfrc522: read rx mode failed.\n");
3704 prev |= enable << 7;
3708 handle->
debug_print(
"mfrc522: write rx mode failed.\n");
3744 handle->
debug_print(
"mfrc522: read rx mode failed.\n");
3781 handle->
debug_print(
"mfrc522: read rx mode failed.\n");
3790 handle->
debug_print(
"mfrc522: write rx mode failed.\n");
3826 handle->
debug_print(
"mfrc522: read rx mode failed.\n");
3863 handle->
debug_print(
"mfrc522: read rx mode failed.\n");
3868 prev |= enable << 3;
3872 handle->
debug_print(
"mfrc522: write rx mode failed.\n");
3908 handle->
debug_print(
"mfrc522: read rx mode failed.\n");
3945 handle->
debug_print(
"mfrc522: read rx mode failed.\n");
3950 prev |= enable << 2;
3954 handle->
debug_print(
"mfrc522: write rx mode failed.\n");
3990 handle->
debug_print(
"mfrc522: read rx mode failed.\n");
4028 handle->
debug_print(
"mfrc522: read tx control failed.\n");
4032 prev &= ~(1 << driver);
4033 prev |= enable << driver;
4037 handle->
debug_print(
"mfrc522: write tx control failed.\n");
4074 handle->
debug_print(
"mfrc522: read tx control failed.\n");
4111 handle->
debug_print(
"mfrc522: read tx ask failed.\n");
4116 prev |= enable << 6;
4120 handle->
debug_print(
"mfrc522: write tx ask failed.\n");
4156 handle->
debug_print(
"mfrc522: read tx ask failed.\n");
4193 handle->
debug_print(
"mfrc522: read tx sel failed.\n");
4202 handle->
debug_print(
"mfrc522: write tx sel failed.\n");
4238 handle->
debug_print(
"mfrc522: read tx sel failed.\n");
4275 handle->
debug_print(
"mfrc522: read tx sel failed.\n");
4279 prev &= ~(0xF << 0);
4284 handle->
debug_print(
"mfrc522: write tx sel failed.\n");
4320 handle->
debug_print(
"mfrc522: read tx sel failed.\n");
4357 handle->
debug_print(
"mfrc522: read rx sel failed.\n");
4366 handle->
debug_print(
"mfrc522: write rx sel failed.\n");
4402 handle->
debug_print(
"mfrc522: read rx sel failed.\n");
4438 handle->
debug_print(
"mfrc522: t is over 0x3F.\n");
4446 handle->
debug_print(
"mfrc522: read rx sel failed.\n");
4450 prev &= ~(0x3F << 0);
4455 handle->
debug_print(
"mfrc522: write rx sel failed.\n");
4491 handle->
debug_print(
"mfrc522: read rx sel failed.\n");
4527 handle->
debug_print(
"mfrc522: level is over 0xF.\n");
4535 handle->
debug_print(
"mfrc522: read rx threshold failed.\n");
4539 prev &= ~(0xF << 4);
4544 handle->
debug_print(
"mfrc522: write rx threshold failed.\n");
4580 handle->
debug_print(
"mfrc522: read rx threshold failed.\n");
4584 *level = (prev >> 4) & 0xF;
4616 handle->
debug_print(
"mfrc522: level is over 7.\n");
4624 handle->
debug_print(
"mfrc522: read rx threshold failed.\n");
4628 prev &= ~(0x7 << 0);
4633 handle->
debug_print(
"mfrc522: write rx threshold failed.\n");
4669 handle->
debug_print(
"mfrc522: read rx threshold failed.\n");
4673 *level = prev & 0x07;
4706 handle->
debug_print(
"mfrc522: read demod failed.\n");
4710 prev &= ~(0x3 << 6);
4711 prev |= reception << 6;
4715 handle->
debug_print(
"mfrc522: write demod failed.\n");
4751 handle->
debug_print(
"mfrc522: read demod failed.\n");
4788 handle->
debug_print(
"mfrc522: read demod failed.\n");
4793 prev |= enable << 5;
4797 handle->
debug_print(
"mfrc522: write demod failed.\n");
4833 handle->
debug_print(
"mfrc522: read demod failed.\n");
4870 handle->
debug_print(
"mfrc522: read demod failed.\n");
4875 prev |= enable << 4;
4879 handle->
debug_print(
"mfrc522: write demod failed.\n");
4915 handle->
debug_print(
"mfrc522: read demod failed.\n");
4959 handle->
debug_print(
"mfrc522: read demod failed.\n");
4968 handle->
debug_print(
"mfrc522: write demod failed.\n");
5004 handle->
debug_print(
"mfrc522: read demod failed.\n");
5008 *t = (prev >> 2) & 0x3;
5048 handle->
debug_print(
"mfrc522: read demod failed.\n");
5057 handle->
debug_print(
"mfrc522: write demod failed.\n");
5093 handle->
debug_print(
"mfrc522: read demod failed.\n");
5097 *t = (prev >> 0) & 0x3;
5137 handle->
debug_print(
"mfrc522: read mftx failed.\n");
5146 handle->
debug_print(
"mfrc522: write mftx failed.\n");
5182 handle->
debug_print(
"mfrc522: read mftx failed.\n");
5219 handle->
debug_print(
"mfrc522: read mfrx failed.\n");
5224 prev |= enable << 4;
5228 handle->
debug_print(
"mfrc522: write mfrx failed.\n");
5264 handle->
debug_print(
"mfrc522: read mfrx failed.\n");
5314 handle->
debug_print(
"mfrc522: t0 is over 0x7.\n");
5320 handle->
debug_print(
"mfrc522: t1 is over 0x1F.\n");
5328 handle->
debug_print(
"mfrc522: read serial speed failed.\n");
5332 prev = ((t0 & 0x7) << 5) | (t1 & 0x1F);
5336 handle->
debug_print(
"mfrc522: write serial speed failed.\n");
5373 handle->
debug_print(
"mfrc522: read serial speed failed.\n");
5377 *t0 = (prev >> 5) & 0xF;
5378 *t1 = (prev >> 0) & 0x1F;
5411 handle->
debug_print(
"mfrc522: read crc result failed.\n");
5415 *crc = ((uint16_t)buf[0] << 8) | buf[1];
5447 handle->
debug_print(
"mfrc522: write mod width failed.\n");
5482 handle->
debug_print(
"mfrc522: read mod width failed.\n");
5518 handle->
debug_print(
"mfrc522: read rf cfg failed.\n");
5527 handle->
debug_print(
"mfrc522: write rf cfg failed.\n");
5563 handle->
debug_print(
"mfrc522: read rf cfg failed.\n");
5607 handle->
debug_print(
"mfrc522: read gsn failed.\n");
5611 prev &= ~(0xF << 4);
5616 handle->
debug_print(
"mfrc522: write gsn failed.\n");
5652 handle->
debug_print(
"mfrc522: read gsn failed.\n");
5656 *n = (prev >> 4) & 0xF;
5696 handle->
debug_print(
"mfrc522: read gsn failed.\n");
5700 prev &= ~(0xF << 0);
5705 handle->
debug_print(
"mfrc522: write gsn failed.\n");
5741 handle->
debug_print(
"mfrc522: read gsn failed.\n");
5745 *n = (prev >> 0) & 0xF;
5777 handle->
debug_print(
"mfrc522: n is over 0x3F.\n");
5785 handle->
debug_print(
"mfrc522: read cwgsp failed.\n");
5789 prev &= ~(0x3F << 0);
5794 handle->
debug_print(
"mfrc522: write cwgsp failed.\n");
5830 handle->
debug_print(
"mfrc522: read cwgsp failed.\n");
5866 handle->
debug_print(
"mfrc522: n is over 0x3F.\n");
5874 handle->
debug_print(
"mfrc522: read modgsp failed.\n");
5878 prev &= ~(0x3F << 0);
5883 handle->
debug_print(
"mfrc522: write modgsp failed.\n");
5919 handle->
debug_print(
"mfrc522: read modgsp failed.\n");
5956 handle->
debug_print(
"mfrc522: read tmode failed.\n");
5961 prev |= enable << 7;
5965 handle->
debug_print(
"mfrc522: write tmode failed.\n");
6001 handle->
debug_print(
"mfrc522: read tmode failed.\n");
6038 handle->
debug_print(
"mfrc522: read tmode failed.\n");
6047 handle->
debug_print(
"mfrc522: write tmode failed.\n");
6083 handle->
debug_print(
"mfrc522: read tmode failed.\n");
6120 handle->
debug_print(
"mfrc522: read tmode failed.\n");
6125 prev |= enable << 4;
6129 handle->
debug_print(
"mfrc522: write tmode failed.\n");
6165 handle->
debug_print(
"mfrc522: read tmode failed.\n");
6201 handle->
debug_print(
"mfrc522: t is over 0xFFF.\n");
6209 handle->
debug_print(
"mfrc522: read tmode failed.\n");
6213 prev &= ~(0xF << 0);
6214 prev |= ((t >> 8) & 0xF) << 0;
6218 handle->
debug_print(
"mfrc522: write tmode failed.\n");
6226 handle->
debug_print(
"mfrc522: write tprescaler failed.\n");
6248 uint8_t prev1, prev2;
6262 handle->
debug_print(
"mfrc522: read tmode failed.\n");
6269 handle->
debug_print(
"mfrc522: read tprescaler failed.\n");
6273 *t = (uint16_t)((prev1 >> 0) & 0xF) << 8 | prev2;
6303 buf[0] = (reload >> 8) & 0xFF;
6304 buf[1] = (reload >> 0) & 0xFF;
6308 handle->
debug_print(
"mfrc522: write treload failed.\n");
6344 handle->
debug_print(
"mfrc522: read treload failed.\n");
6348 *reload = (uint16_t)buf[0] << 8 | buf[1];
6381 handle->
debug_print(
"mfrc522: read tcounter failed.\n");
6385 *cnt = (uint16_t)buf[0] << 8 | buf[1];
6425 handle->
debug_print(
"mfrc522: read test sel 1 failed.\n");
6429 prev &= ~(0x7 << 0);
6434 handle->
debug_print(
"mfrc522: write test sel 1 failed.\n");
6470 handle->
debug_print(
"mfrc522: read test sel 1 failed.\n");
6474 *s = (prev >> 0) & 0x7;
6506 handle->
debug_print(
"mfrc522: s is over 0x1F.\n");
6514 handle->
debug_print(
"mfrc522: read test sel 2 failed.\n");
6518 prev &= ~(0x1F << 0);
6523 handle->
debug_print(
"mfrc522: write test sel 2 failed.\n");
6559 handle->
debug_print(
"mfrc522: read test sel 2 failed.\n");
6563 *s = (prev >> 0) & 0x1F;
6596 handle->
debug_print(
"mfrc522: read test sel 2 failed.\n");
6601 prev |= enable << 7;
6605 handle->
debug_print(
"mfrc522: write test sel 2 failed.\n");
6641 handle->
debug_print(
"mfrc522: read test sel 2 failed.\n");
6678 handle->
debug_print(
"mfrc522: read test sel 2 failed.\n");
6683 prev |= enable << 6;
6687 handle->
debug_print(
"mfrc522: write test sel 2 failed.\n");
6723 handle->
debug_print(
"mfrc522: read test sel 2 failed.\n");
6760 handle->
debug_print(
"mfrc522: read test sel 2 failed.\n");
6765 prev |= enable << 5;
6769 handle->
debug_print(
"mfrc522: write test sel 2 failed.\n");
6805 handle->
debug_print(
"mfrc522: read test sel 2 failed.\n");
6842 handle->
debug_print(
"mfrc522: read test pin en failed.\n");
6847 prev |= enable << 7;
6851 handle->
debug_print(
"mfrc522: write test pin en failed.\n");
6887 handle->
debug_print(
"mfrc522: read test pin en failed.\n");
6923 handle->
debug_print(
"mfrc522: pin is over 0x3F.\n");
6931 handle->
debug_print(
"mfrc522: read test pin en failed.\n");
6935 prev &= ~(0x3F << 1);
6940 handle->
debug_print(
"mfrc522: write test pin en failed.\n");
6976 handle->
debug_print(
"mfrc522: read test pin en failed.\n");
6980 *pin = (prev >> 1) & 0x3F;
7013 handle->
debug_print(
"mfrc522: read test pin value failed.\n");
7018 prev |= enable << 7;
7022 handle->
debug_print(
"mfrc522: write test pin value failed.\n");
7058 handle->
debug_print(
"mfrc522: read test pin value failed.\n");
7094 handle->
debug_print(
"mfrc522: value is over 0x3F.\n");
7102 handle->
debug_print(
"mfrc522: read test pin value failed.\n");
7106 prev &= ~(0x3F << 1);
7111 handle->
debug_print(
"mfrc522: write test pin value failed.\n");
7147 handle->
debug_print(
"mfrc522: read test pin value failed.\n");
7151 *value = (prev >> 1) & 0x3F;
7183 handle->
debug_print(
"mfrc522: read test bus failed.\n");
7219 handle->
debug_print(
"mfrc522: read auto test failed.\n");
7224 prev |= enable << 6;
7228 handle->
debug_print(
"mfrc522: write auto test failed.\n");
7264 handle->
debug_print(
"mfrc522: read auto test failed.\n");
7300 handle->
debug_print(
"mfrc522: test is over 0xF.\n");
7308 handle->
debug_print(
"mfrc522: read auto test failed.\n");
7312 prev &= ~(0xF << 0);
7317 handle->
debug_print(
"mfrc522: write auto test failed.\n");
7353 handle->
debug_print(
"mfrc522: read auto test failed.\n");
7391 handle->
debug_print(
"mfrc522: read version failed.\n");
7395 *
id = (prev >> 4) & 0xF;
7396 *version= (prev >> 0) & 0xF;
7429 handle->
debug_print(
"mfrc522: read analog test failed.\n");
7433 prev &= ~(0xF << 4);
7434 prev |= control << 4;
7438 handle->
debug_print(
"mfrc522: write analog test failed.\n");
7474 handle->
debug_print(
"mfrc522: read analog test failed.\n");
7511 handle->
debug_print(
"mfrc522: read analog test failed.\n");
7515 prev &= ~(0xF << 0);
7516 prev |= control << 0;
7520 handle->
debug_print(
"mfrc522: write analog test failed.\n");
7556 handle->
debug_print(
"mfrc522: read analog test failed.\n");
7592 handle->
debug_print(
"mfrc522: dac is over 0x3F.\n");
7601 handle->
debug_print(
"mfrc522: write test dac1 failed.\n");
7637 handle->
debug_print(
"mfrc522: read test dac1 failed.\n");
7673 handle->
debug_print(
"mfrc522: dac is over 0x3F.\n");
7682 handle->
debug_print(
"mfrc522: write test dac2 failed.\n");
7718 handle->
debug_print(
"mfrc522: read test dac2 failed.\n");
7756 handle->
debug_print(
"mfrc522: read test dac2 failed.\n");
7760 *adc_i = (prev >> 4) & 0xF;
7761 *adc_q = (prev >> 0) & 0xF;
7790 return a_mfrc522_write(handle, reg, buf, len);
7817 return a_mfrc522_read(handle, reg, buf, len);
7838 strncpy(info->
interface,
"IIC SPI UART", 32);
#define MFRC522_REG_TMODE
#define MFRC522_REG_TX_MODE
#define MFRC522_REG_TX_SEL
#define MFRC522_REG_TEST_SEL1
#define MFRC522_REG_DIVIRQ
#define MFRC522_REG_CWGSP
#define MFRC522_REG_TCOUNTER_VAL_H
#define MFRC522_REG_TX_ASK
#define MFRC522_REG_FIFO_DATA
#define MFRC522_REG_RX_MODE
#define MFRC522_REG_SERIAL_SPEED
#define MFRC522_REG_DEMOD
#define MFRC522_REG_TEST_ADC
#define MFRC522_REG_TEST_DAC2
#define MFRC522_REG_TEST_BUS
#define MFRC522_REG_STATUS2
#define MFRC522_REG_ANALOG_TEST
#define MFRC522_REG_FIFO_LEVEL
#define SUPPLY_VOLTAGE_MAX
#define MFRC522_REG_TEST_PIN_VALUE
#define MFRC522_REG_RX_SEL
#define MFRC522_REG_TPRESCALER
#define MFRC522_REG_CRC_RESULT_H
#define MFRC522_REG_COMIRQ
#define MFRC522_REG_RFCFG
#define MFRC522_REG_BIT_FRAMING
#define MFRC522_REG_VERSION
#define MFRC522_REG_MOD_WIDTH
#define MFRC522_REG_COMMAND
chip register definition
#define MFRC522_REG_TEST_PIN_EN
#define MFRC522_REG_STATUS1
#define MANUFACTURER_NAME
#define SUPPLY_VOLTAGE_MIN
#define MFRC522_REG_TX_CONTROL
#define MFRC522_REG_TRELOAD_H
#define MFRC522_REG_TEST_DAC1
#define MFRC522_REG_AUTO_TEST
#define MFRC522_REG_RX_THRESHOLD
#define MFRC522_REG_DIVIEN
#define MFRC522_REG_WATER_LEVEL
#define CHIP_NAME
chip information definition
#define MFRC522_REG_CONTROL
#define MFRC522_REG_COMIEN
#define MFRC522_REG_MODGSP
#define MFRC522_REG_TEST_SEL2
#define MFRC522_REG_ERROR
driver mfrc522 header file
uint8_t mfrc522_get_timer_auto(mfrc522_handle_t *handle, mfrc522_bool_t *enable)
get the timer auto status
mfrc522_interface_t
mfrc522 interface enumeration definition
uint8_t mfrc522_get_force_100_ask(mfrc522_handle_t *handle, mfrc522_bool_t *enable)
get the force 100 ask status
uint8_t mfrc522_get_water_level(mfrc522_handle_t *handle, uint8_t *level)
get the water level
mfrc522_command_t
mfrc522 command enumeration definition
uint8_t mfrc522_set_interrupt2(mfrc522_handle_t *handle, mfrc522_interrupt2_t type, mfrc522_bool_t enable)
enable or disable the interrupt2
uint8_t mfrc522_set_fix_iq(mfrc522_handle_t *handle, mfrc522_bool_t enable)
enable or disable fix iq
uint8_t mfrc522_get_collision_level(mfrc522_handle_t *handle, uint8_t *level)
get the collision level
uint8_t mfrc522_get_modulation_invert(mfrc522_handle_t *handle, mfrc522_bool_t *enable)
get the modulation invert status
uint8_t mfrc522_get_interrupt2(mfrc522_handle_t *handle, mfrc522_interrupt2_t type, mfrc522_bool_t *enable)
get the interrupt2 status
uint8_t mfrc522_get_timer_constant_sync(mfrc522_handle_t *handle, uint8_t *t)
get the timer constant sync
uint8_t mfrc522_get_timer_counter(mfrc522_handle_t *handle, uint16_t *cnt)
get the timer counter
mfrc522_test_analog_control_t
mfrc522 test analog control enumeration definition
mfrc522_bool_t
mfrc522 bool enumeration definition
uint8_t mfrc522_init(mfrc522_handle_t *handle)
initialize the chip
uint8_t mfrc522_set_mifare_crypto1_on(mfrc522_handle_t *handle, mfrc522_bool_t enable)
enable or disable mifare crypto1 on
uint8_t mfrc522_get_clear_temperature_error(mfrc522_handle_t *handle, mfrc522_bool_t *enable)
get the clear temperature error status
uint8_t mfrc522_set_rx_multiple(mfrc522_handle_t *handle, mfrc522_bool_t enable)
enable or disable rx multiple
uint8_t mfrc522_get_modulation_width(mfrc522_handle_t *handle, uint8_t *width)
get the modulation width
uint8_t mfrc522_get_timer_prescal_even(mfrc522_handle_t *handle, mfrc522_bool_t *enable)
get the timer prescal even status
uint8_t mfrc522_set_timer_constant_sync(mfrc522_handle_t *handle, uint8_t t)
set the timer constant sync
uint8_t mfrc522_set_interface(mfrc522_handle_t *handle, mfrc522_interface_t interface)
set the chip interface
uint8_t mfrc522_get_serial_speed(mfrc522_handle_t *handle, uint8_t *t0, uint8_t *t1)
get the serial speed
uint8_t mfrc522_set_interrupt_pin_type(mfrc522_handle_t *handle, mfrc522_interrupt_pin_type_t type)
set the interrupt pin type
uint8_t mfrc522_get_crc_preset(mfrc522_handle_t *handle, mfrc522_crc_preset_t *preset)
get the crc preset
uint8_t mfrc522_get_tx_wait_rf(mfrc522_handle_t *handle, mfrc522_bool_t *enable)
get the rf tx wait status
uint8_t mfrc522_set_force_iic_high_speed(mfrc522_handle_t *handle, mfrc522_bool_t enable)
enable or disable force iic high speed
uint8_t mfrc522_set_channel_reception(mfrc522_handle_t *handle, mfrc522_channel_reception_t reception)
set the channel reception
uint8_t mfrc522_set_rx_wait(mfrc522_handle_t *handle, uint8_t t)
set the rx wait
mfrc522_timer_gated_mode_t
mfrc522 timer gated mode enumeration definition
uint8_t mfrc522_irq_handler(mfrc522_handle_t *handle)
irq handler
uint8_t mfrc522_get_mfout_input(mfrc522_handle_t *handle, mfrc522_mfout_input_t *input)
get the mfout input
uint8_t mfrc522_set_force_100_ask(mfrc522_handle_t *handle, mfrc522_bool_t enable)
enable or disable force 100 ask
uint8_t mfrc522_get_rx_no_error(mfrc522_handle_t *handle, mfrc522_bool_t *enable)
get the rx no error status
uint8_t mfrc522_get_status2(mfrc522_handle_t *handle, uint8_t *status)
get the status2
uint8_t mfrc522_get_error(mfrc522_handle_t *handle, uint8_t *err)
get the error
uint8_t mfrc522_flush_fifo(mfrc522_handle_t *handle)
flush the fifo
uint8_t mfrc522_get_fix_iq(mfrc522_handle_t *handle, mfrc522_bool_t *enable)
get the fix iq status
uint8_t mfrc522_get_collision_position_not_valid(mfrc522_handle_t *handle, mfrc522_bool_t *enable)
get the collision position not valid bit status
uint8_t mfrc522_set_interrupt1(mfrc522_handle_t *handle, mfrc522_interrupt1_t type, mfrc522_bool_t enable)
enable or disable the interrupt1
uint8_t mfrc522_set_rx_speed(mfrc522_handle_t *handle, mfrc522_speed_t speed)
set the rx speed
uint8_t mfrc522_set_parity_disable(mfrc522_handle_t *handle, mfrc522_bool_t enable)
enable or disable parity disable
uint8_t mfrc522_set_crc_preset(mfrc522_handle_t *handle, mfrc522_crc_preset_t preset)
set the crc preset
uint8_t mfrc522_get_crc(mfrc522_handle_t *handle, uint16_t *crc)
get the crc
uint8_t mfrc522_get_tx_last_bits(mfrc522_handle_t *handle, uint8_t *bits)
get the tx last bits
uint8_t mfrc522_get_tx_input(mfrc522_handle_t *handle, mfrc522_tx_input_t *input)
get the tx input
uint8_t mfrc522_set_water_level(mfrc522_handle_t *handle, uint8_t level)
set the water level
uint8_t mfrc522_set_tx_last_bits(mfrc522_handle_t *handle, uint8_t bits)
set the tx last bits
uint8_t mfrc522_set_interrupt1_pin_invert(mfrc522_handle_t *handle, mfrc522_bool_t enable)
enable or disable interrupt1 pin invert
uint8_t mfrc522_transceiver(mfrc522_handle_t *handle, mfrc522_command_t command, uint8_t *in_buf, uint8_t in_len, uint8_t *out_buf, uint8_t *out_len, uint8_t *err, uint32_t ms)
mfrc522 transceiver
uint8_t mfrc522_set_rx_align(mfrc522_handle_t *handle, mfrc522_rx_align_t align)
set the rx align
uint8_t mfrc522_set_antenna_driver(mfrc522_handle_t *handle, mfrc522_antenna_driver_t driver, mfrc522_bool_t enable)
enable or disable the antenna driver
uint8_t mfrc522_set_modgsp(mfrc522_handle_t *handle, uint8_t n)
set the modgsp
mfrc522_tx_input_t
mfrc522 tx input enumeration definition
uint8_t mfrc522_get_interrupt1_pin_invert(mfrc522_handle_t *handle, mfrc522_bool_t *enable)
get the interrupt1 pin invert status
uint8_t mfrc522_get_rx_align(mfrc522_handle_t *handle, mfrc522_rx_align_t *align)
get the rx align
uint8_t mfrc522_get_rx_last_bits(mfrc522_handle_t *handle, uint8_t *bits)
get the rx last bits
mfrc522_channel_reception_t
mfrc522 channel reception enumeration definition
mfrc522_interrupt_pin_type_t
mfrc522 interrupt pin type enumeration definition
uint8_t mfrc522_info(mfrc522_info_t *info)
get chip information
uint8_t mfrc522_get_timer_reload(mfrc522_handle_t *handle, uint16_t *reload)
get the timer reload
uint8_t mfrc522_set_mfin_polarity(mfrc522_handle_t *handle, mfrc522_mfin_polarity_t polarity)
set the mfin polarity
uint8_t mfrc522_get_rx_multiple(mfrc522_handle_t *handle, mfrc522_bool_t *enable)
get the rx multiple status
uint8_t mfrc522_start_timer(mfrc522_handle_t *handle)
start the timer
mfrc522_crc_preset_t
mfrc522 crc preset enumeration definition
uint8_t mfrc522_set_timer_auto_restart(mfrc522_handle_t *handle, mfrc522_bool_t enable)
enable or disable timer auto restart
uint8_t mfrc522_set_clear_temperature_error(mfrc522_handle_t *handle, mfrc522_bool_t enable)
enable or disable clear temperature error
uint8_t mfrc522_get_rx_gain(mfrc522_handle_t *handle, mfrc522_rx_gain_t *gain)
get the rx gain
uint8_t mfrc522_get_timer_auto_restart(mfrc522_handle_t *handle, mfrc522_bool_t *enable)
get the timer auto restart status
uint8_t mfrc522_set_modulation_invert(mfrc522_handle_t *handle, mfrc522_bool_t enable)
enable or disable the modulation invert
uint8_t mfrc522_set_interrupt2_mark(mfrc522_handle_t *handle, mfrc522_interrupt_mark_t mark)
set the interrupt2 mark
uint8_t mfrc522_set_modulation_width(mfrc522_handle_t *handle, uint8_t width)
set the modulation width
mfrc522_modem_state_t
mfrc522 modem state enumeration definition
uint8_t mfrc522_get_modgsn(mfrc522_handle_t *handle, uint8_t *n)
get the modgsn
uint8_t mfrc522_set_value_clear_after_coll(mfrc522_handle_t *handle, mfrc522_bool_t enable)
enable or disable value clear after coll
mfrc522_contactless_uart_input_t
mfrc522 contactless uart input enumeration definition
uint8_t mfrc522_get_status1(mfrc522_handle_t *handle, uint8_t *status)
get the status1
mfrc522_rx_gain_t
mfrc522 rx gain enumeration definition
mfrc522_antenna_driver_t
mfrc522 antenna driver enumeration definition
uint8_t mfrc522_set_fifo_data(mfrc522_handle_t *handle, uint8_t *data, uint8_t len)
set the fifo data
uint8_t mfrc522_get_collision_position(mfrc522_handle_t *handle, uint8_t *pos)
get the collision position
uint8_t mfrc522_get_tx_crc_generation(mfrc522_handle_t *handle, mfrc522_bool_t *enable)
get the tx crc generation status
uint8_t mfrc522_set_tx_input(mfrc522_handle_t *handle, mfrc522_tx_input_t input)
set the tx input
uint8_t mfrc522_set_rx_crc_generation(mfrc522_handle_t *handle, mfrc522_bool_t enable)
enable or disable the rx crc generation
uint8_t mfrc522_set_tx_wait(mfrc522_handle_t *handle, uint8_t t)
set the tx wait
uint8_t mfrc522_stop_timer(mfrc522_handle_t *handle)
stop the timer
uint8_t mfrc522_get_tx_speed(mfrc522_handle_t *handle, mfrc522_speed_t *speed)
get the tx speed
uint8_t mfrc522_get_interface(mfrc522_handle_t *handle, mfrc522_interface_t *interface)
get the chip interface
uint8_t mfrc522_set_cwgsn(mfrc522_handle_t *handle, uint8_t n)
set the cwgsn
uint8_t mfrc522_get_value_clear_after_coll(mfrc522_handle_t *handle, mfrc522_bool_t *enable)
get the value clear after coll status
mfrc522_rx_align_t
mfrc522 rx align enumeration definition
uint8_t mfrc522_get_parity_disable(mfrc522_handle_t *handle, mfrc522_bool_t *enable)
get the parity disable status
uint8_t mfrc522_get_addr_pin(mfrc522_handle_t *handle, uint8_t *addr_pin)
get the iic address pin
uint8_t mfrc522_get_command(mfrc522_handle_t *handle, mfrc522_command_t *command)
get the command
uint8_t mfrc522_set_cwgsp(mfrc522_handle_t *handle, uint8_t n)
set the cwgsp
uint8_t mfrc522_set_timer_gated_mode(mfrc522_handle_t *handle, mfrc522_timer_gated_mode_t mode)
set the timer gated mode
uint8_t mfrc522_set_tx_speed(mfrc522_handle_t *handle, mfrc522_speed_t speed)
set the tx speed
uint8_t mfrc522_get_interrupt1_status(mfrc522_handle_t *handle, uint8_t *status)
get the interrupt1 status
mfrc522_interrupt2_t
mfrc522 interrupt2 enumeration definition
uint8_t mfrc522_get_min_level(mfrc522_handle_t *handle, uint8_t *level)
get the min level
uint8_t mfrc522_get_mfin_polarity(mfrc522_handle_t *handle, mfrc522_mfin_polarity_t *polarity)
get the mfin polarity
uint8_t mfrc522_get_rx_wait(mfrc522_handle_t *handle, uint8_t *t)
get the rx wait
uint8_t mfrc522_get_timer_gated_mode(mfrc522_handle_t *handle, mfrc522_timer_gated_mode_t *mode)
get the timer gated mode
uint8_t mfrc522_get_cwgsn(mfrc522_handle_t *handle, uint8_t *n)
get the cwgsn
uint8_t mfrc522_set_addr_pin(mfrc522_handle_t *handle, uint8_t addr_pin)
set the iic address pin
uint8_t mfrc522_get_crc_msb_first(mfrc522_handle_t *handle, mfrc522_bool_t *enable)
get the crc msb first
uint8_t mfrc522_set_tx_crc_generation(mfrc522_handle_t *handle, mfrc522_bool_t enable)
enable or disable tx crc generation
uint8_t mfrc522_set_rx_gain(mfrc522_handle_t *handle, mfrc522_rx_gain_t gain)
set the rx gain
uint8_t mfrc522_get_timer_prescaler(mfrc522_handle_t *handle, uint16_t *t)
get the timer prescaler
uint8_t mfrc522_set_timer_auto(mfrc522_handle_t *handle, mfrc522_bool_t enable)
enable or disable timer auto
uint8_t mfrc522_set_timer_reload(mfrc522_handle_t *handle, uint16_t reload)
set the timer reload
mfrc522_interrupt1_t
mfrc522 interrupt1 enumeration definition
uint8_t mfrc522_get_contactless_uart_input(mfrc522_handle_t *handle, mfrc522_contactless_uart_input_t *input)
get the contactless uart input
uint8_t mfrc522_set_command(mfrc522_handle_t *handle, mfrc522_command_t command)
set the command
uint8_t mfrc522_get_interrupt_pin_type(mfrc522_handle_t *handle, mfrc522_interrupt_pin_type_t *type)
get the interrupt pin type
uint8_t mfrc522_get_channel_reception(mfrc522_handle_t *handle, mfrc522_channel_reception_t *reception)
get the channel reception
uint8_t mfrc522_get_modem_state(mfrc522_handle_t *handle, mfrc522_modem_state_t *state)
get the modem state
uint8_t mfrc522_get_cwgsp(mfrc522_handle_t *handle, uint8_t *n)
get the cwgsp
uint8_t mfrc522_set_tx_wait_rf(mfrc522_handle_t *handle, mfrc522_bool_t enable)
enable or disable the rf tx wait
uint8_t mfrc522_get_fifo_data(mfrc522_handle_t *handle, uint8_t *data, uint8_t len)
get the fifo data
uint8_t mfrc522_get_interrupt1(mfrc522_handle_t *handle, mfrc522_interrupt1_t type, mfrc522_bool_t *enable)
get the interrupt1 status
uint8_t mfrc522_set_serial_speed(mfrc522_handle_t *handle, uint8_t t0, uint8_t t1)
set the serial speed
uint8_t mfrc522_get_antenna_driver(mfrc522_handle_t *handle, mfrc522_antenna_driver_t driver, mfrc522_bool_t *enable)
get the antenna driver status
uint8_t mfrc522_set_receiver_analog(mfrc522_handle_t *handle, mfrc522_bool_t enable)
enable or disable the analog part of the receiver
uint8_t mfrc522_get_fifo_level(mfrc522_handle_t *handle, uint8_t *level)
get the fifo level
uint8_t mfrc522_set_crc_msb_first(mfrc522_handle_t *handle, mfrc522_bool_t enable)
enable or disable the crc msb first
uint8_t mfrc522_set_rx_no_error(mfrc522_handle_t *handle, mfrc522_bool_t enable)
enable or disable rx no error
uint8_t mfrc522_get_interrupt2_status(mfrc522_handle_t *handle, uint8_t *status)
get the interrupt2 status
uint8_t mfrc522_get_rx_crc_generation(mfrc522_handle_t *handle, mfrc522_bool_t *enable)
get the rx crc generation status
uint8_t mfrc522_set_collision_level(mfrc522_handle_t *handle, uint8_t level)
set the collision level
uint8_t mfrc522_set_min_level(mfrc522_handle_t *handle, uint8_t level)
set the min level
uint8_t mfrc522_deinit(mfrc522_handle_t *handle)
close the chip
uint8_t mfrc522_set_modgsn(mfrc522_handle_t *handle, uint8_t n)
set the modgsn
uint8_t mfrc522_get_modgsp(mfrc522_handle_t *handle, uint8_t *n)
get the modgsp
uint8_t mfrc522_get_receiver_analog(mfrc522_handle_t *handle, mfrc522_bool_t *enable)
get the analog part of the receiver status
uint8_t mfrc522_get_force_iic_high_speed(mfrc522_handle_t *handle, mfrc522_bool_t *enable)
get the iic high speed status
uint8_t mfrc522_start_send(mfrc522_handle_t *handle)
start the transmission of data
uint8_t mfrc522_get_rx_speed(mfrc522_handle_t *handle, mfrc522_speed_t *speed)
get the rx speed
uint8_t mfrc522_set_interrupt1_mark(mfrc522_handle_t *handle, mfrc522_interrupt_mark_t mark)
set the interrupt1 mark
uint8_t mfrc522_set_timer_prescaler(mfrc522_handle_t *handle, uint16_t t)
set the timer prescaler
mfrc522_speed_t
mfrc522 speed enumeration definition
uint8_t mfrc522_set_timer_constant_reception(mfrc522_handle_t *handle, uint8_t t)
set the timer constant reception
uint8_t mfrc522_stop_send(mfrc522_handle_t *handle)
stop the transmission of data
mfrc522_mfin_polarity_t
mfrc522 mfin polarity enumeration definition
uint8_t mfrc522_get_power_down(mfrc522_handle_t *handle, mfrc522_bool_t *enable)
get power down status
uint8_t mfrc522_get_tx_wait(mfrc522_handle_t *handle, uint8_t *t)
get the tx wait
mfrc522_mfout_input_t
mfrc522 mfout input enumeration definition
uint8_t mfrc522_set_contactless_uart_input(mfrc522_handle_t *handle, mfrc522_contactless_uart_input_t input)
set the contactless uart input
uint8_t mfrc522_get_timer_constant_reception(mfrc522_handle_t *handle, uint8_t *t)
get the timer constant reception
uint8_t mfrc522_set_timer_prescal_even(mfrc522_handle_t *handle, mfrc522_bool_t enable)
enable or disable timer prescal even
uint8_t mfrc522_set_power_down(mfrc522_handle_t *handle, mfrc522_bool_t enable)
enable or disable power down
mfrc522_interrupt_mark_t
mfrc522 interrupt mark enumeration definition
uint8_t mfrc522_set_mfout_input(mfrc522_handle_t *handle, mfrc522_mfout_input_t input)
set the mfout input
@ MFRC522_COMMAND_MF_AUTHENT
@ MFRC522_COMMAND_TRANSCEIVE
@ MFRC522_COMMAND_NO_CHANGE
@ MFRC522_COMMAND_SOFT_RESET
@ MFRC522_COMMAND_CALC_CRC
@ MFRC522_INTERRUPT2_MFIN_ACT
@ MFRC522_INTERRUPT_MFIN_ACT
@ MFRC522_INTERRUPT_LO_ALERT
@ MFRC522_INTERRUPT_TIMER
@ MFRC522_INTERRUPT_HI_ALERT
uint8_t mfrc522_set_test_port_io(mfrc522_handle_t *handle, mfrc522_bool_t enable)
enable or disable test port io
uint8_t mfrc522_set_test_bus_signal_1(mfrc522_handle_t *handle, uint8_t s)
set the test bus signal 1
uint8_t mfrc522_get_test_bus_signal_1(mfrc522_handle_t *handle, uint8_t *s)
get the test bus signal 1
uint8_t mfrc522_set_test_dac_2(mfrc522_handle_t *handle, uint8_t dac)
set the test dac 2
uint8_t mfrc522_set_test_prbs15(mfrc522_handle_t *handle, mfrc522_bool_t enable)
enable or disable test prbs15
uint8_t mfrc522_get_test_prbs9(mfrc522_handle_t *handle, mfrc522_bool_t *enable)
get the test prbs9 status
uint8_t mfrc522_get_test_dac_2(mfrc522_handle_t *handle, uint8_t *dac)
get the test dac 2
uint8_t mfrc522_get_self_test(mfrc522_handle_t *handle, uint8_t *test)
get the self test
uint8_t mfrc522_get_test_pin_enable(mfrc522_handle_t *handle, uint8_t *pin)
get the test pin enable
uint8_t mfrc522_get_test_adc(mfrc522_handle_t *handle, uint8_t *adc_i, uint8_t *adc_q)
get the test adc
uint8_t mfrc522_get_test_port_io(mfrc522_handle_t *handle, mfrc522_bool_t *enable)
get the test port io status
uint8_t mfrc522_get_test_analog_control_aux_1(mfrc522_handle_t *handle, mfrc522_test_analog_control_t *control)
get the test analog control aux 1
uint8_t mfrc522_set_test_bus_signal_2(mfrc522_handle_t *handle, uint8_t s)
set the test bus signal 2
uint8_t mfrc522_set_test_analog_control_aux_2(mfrc522_handle_t *handle, mfrc522_test_analog_control_t control)
set the test analog control aux 2
uint8_t mfrc522_get_test_pin_value(mfrc522_handle_t *handle, uint8_t *value)
get the test pin value
uint8_t mfrc522_get_test_analog_control_aux_2(mfrc522_handle_t *handle, mfrc522_test_analog_control_t *control)
get the test analog control aux 2
uint8_t mfrc522_set_test_analog_control_aux_1(mfrc522_handle_t *handle, mfrc522_test_analog_control_t control)
set the test analog control aux 1
uint8_t mfrc522_get_test_amp_rcv(mfrc522_handle_t *handle, mfrc522_bool_t *enable)
get the test amp rcv status
uint8_t mfrc522_get_test_bus(mfrc522_handle_t *handle, uint8_t *bus)
get the test bus
uint8_t mfrc522_get_test_prbs15(mfrc522_handle_t *handle, mfrc522_bool_t *enable)
get the test prbs15 status
uint8_t mfrc522_set_test_amp_rcv(mfrc522_handle_t *handle, mfrc522_bool_t enable)
enable or disable test amp rcv
uint8_t mfrc522_get_test_bus_flip(mfrc522_handle_t *handle, mfrc522_bool_t *enable)
get the test bus flip status
uint8_t mfrc522_set_self_test(mfrc522_handle_t *handle, uint8_t test)
set the self test
uint8_t mfrc522_get_version(mfrc522_handle_t *handle, uint8_t *id, uint8_t *version)
get the version
uint8_t mfrc522_get_test_dac_1(mfrc522_handle_t *handle, uint8_t *dac)
get the test dac 1
uint8_t mfrc522_set_test_prbs9(mfrc522_handle_t *handle, mfrc522_bool_t enable)
enable or disable test prbs9
uint8_t mfrc522_set_test_pin_enable(mfrc522_handle_t *handle, uint8_t pin)
set the test pin enable
uint8_t mfrc522_get_test_bus_signal_2(mfrc522_handle_t *handle, uint8_t *s)
get the test bus signal 2
uint8_t mfrc522_set_test_dac_1(mfrc522_handle_t *handle, uint8_t dac)
set the test dac 1
uint8_t mfrc522_set_test_rs232_line(mfrc522_handle_t *handle, mfrc522_bool_t enable)
enable or disable test rs232 line
uint8_t mfrc522_set_test_pin_value(mfrc522_handle_t *handle, uint8_t value)
set the test pin value
uint8_t mfrc522_set_test_bus_flip(mfrc522_handle_t *handle, mfrc522_bool_t enable)
enable or disable test bus flip
uint8_t mfrc522_get_test_rs232_line(mfrc522_handle_t *handle, mfrc522_bool_t *enable)
get the test rs232 line status
uint8_t mfrc522_set_reg(mfrc522_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
set the chip register
uint8_t mfrc522_get_reg(mfrc522_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
get the chip register
mfrc522 handle structure definition
uint8_t(* uart_flush)(void)
uint8_t(* uart_write)(uint8_t *buf, uint16_t len)
uint8_t(* spi_init)(void)
void(* delay_ms)(uint32_t ms)
uint8_t(* spi_read)(uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* spi_write)(uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* uart_deinit)(void)
uint8_t(* reset_gpio_deinit)(void)
void(* debug_print)(const char *const fmt,...)
void(* receive_callback)(uint16_t type)
uint8_t(* iic_init)(void)
uint8_t(* spi_deinit)(void)
uint16_t(* uart_read)(uint8_t *buf, uint16_t len)
uint8_t(* reset_gpio_init)(void)
uint8_t(* uart_init)(void)
uint8_t(* iic_write)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* reset_gpio_write)(uint8_t data)
uint8_t(* iic_read)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* iic_deinit)(void)
mfrc522 information structure definition
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v