Skip to content

Commit

Permalink
fix NFC warnings and rename constants
Browse files Browse the repository at this point in the history
  • Loading branch information
dangfan committed Dec 15, 2023
1 parent 7cba71a commit 31c1410
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion include/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void fm_csn_low(void);
*/
void fm_csn_high(void);
#if NFC_CHIP == NFC_CHIP_FM11NC
void spi_transmit(uint8_t *buf, uint8_t len);
void spi_transmit(const uint8_t *buf, uint8_t len);
void spi_receive(uint8_t *buf, uint8_t len);
#elif NFC_CHIP == NFC_CHIP_FM11NT
void i2c_start(void);
Expand Down
3 changes: 3 additions & 0 deletions include/nfc.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
#define FM_REG_NFC_CFG 0xD
#define FM_REG_REGU_CFG 0xE

#define FM_EEPROM_ATQA 0x03A0
#define FM_EEPROM_ATS 0x03B0

#define RF_STATE_MASK 0xE0

#elif NFC_CHIP == NFC_CHIP_FM11NT
Expand Down
16 changes: 8 additions & 8 deletions interfaces/NFC/fm.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,16 @@ void fm_write_fifo(uint8_t *buf, uint8_t len) {
void fm11_init(void) {
#if NFC_CHIP == NFC_CHIP_FM11NC
uint8_t buf[7];
uint8_t data1[] = {0x44, 0x00, 0x04, 0x20};
uint8_t data2[] = {0x05, 0x72, 0x02, 0x00, 0xB3, 0x99, 0x00};
uint8_t atqa_sak[] = {0x44, 0x00, 0x04, 0x20};
uint8_t ats[] = {0x05, 0x72, 0x02, 0x00, 0xB3, 0x99, 0x00};
do {
fm_write_eeprom(0x3A0, data1, sizeof(data1));
fm_read_eeprom(0x3A0, buf, sizeof(data1));
} while (memcmp(data1, buf, sizeof(data1)) != 0);
fm_write_eeprom(FM_EEPROM_ATQA, atqa_sak, sizeof(atqa_sak));
fm_read_eeprom(FM_EEPROM_ATQA, buf, sizeof(atqa_sak));
} while (memcmp(atqa_sak, buf, sizeof(atqa_sak)) != 0);
do {
fm_write_eeprom(0x3B0, data2, sizeof(data2));
fm_read_eeprom(0x3B0, buf, sizeof(data2));
} while (memcmp(data2, buf, sizeof(data2)) != 0);
fm_write_eeprom(FM_EEPROM_ATS, ats, sizeof(ats));
fm_read_eeprom(FM_EEPROM_ATS, buf, sizeof(ats));
} while (memcmp(ats, buf, sizeof(ats)) != 0);
#elif NFC_CHIP == NFC_CHIP_FM11NT
uint8_t crc_buffer[13];
const uint8_t user_cfg[] = {0x91, 0x82, 0x21, 0xCD};
Expand Down

0 comments on commit 31c1410

Please sign in to comment.