diff --git a/include/device.h b/include/device.h index 9df09ce1..d277c36e 100644 --- a/include/device.h +++ b/include/device.h @@ -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); diff --git a/include/nfc.h b/include/nfc.h index a5f5ad15..61db157b 100644 --- a/include/nfc.h +++ b/include/nfc.h @@ -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 diff --git a/interfaces/NFC/fm.c b/interfaces/NFC/fm.c index 33d081e3..a94c8d44 100644 --- a/interfaces/NFC/fm.c +++ b/interfaces/NFC/fm.c @@ -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};