36 #include <mraa/i2c.hpp>
38 #define M24LR64E_I2C_BUS 0
39 #define M24LR64E_DEFAULT_I2C_ADDR 0x53
40 #define M24LR64E_DEFAULT_I2C_ADDR_E2 (M24LR64E_DEFAULT_I2C_ADDR | 0x04)
82 static const int EEPROM_I2C_LENGTH = 8192;
83 static const int PASSWORD_LENGTH = 4;
84 static const int SECTOR_SECURITY_STATUS_BASE_ADDR = 0x800;
86 static const uint8_t LOCK_PROTECT_BIT = 0x01;
87 static const uint8_t WRITE_READ_PROTECT_BIT = 0x02;
88 static const uint8_t PASSWORD_CTRL_BIT = 0x04;
90 static const int UID_LENGTH = 8;
92 static const unsigned int I2C_WRITE_TIME = 5;
98 I2C_PASSWORD_ADDR = 2304,
99 RF_PASSWORD_1_ADDR = 2308,
100 RF_PASSWORD_2_ADDR = 2312,
101 RF_PASSWORD_3_ADDR = 2316,
107 MEM_SIZE_ADDR = 2332,
109 PROG_COMP_ENERGY_HARVEST_ADDR = 2339
117 enum SectorAccessRight {
132 enum SectorSelectPassWd {
149 M24LR64E(
int bus, AccessMode mode = USER_MODE);
180 SectorAccessRight accessRight,
181 SectorSelectPassWd passwd);
220 void getUID(uint8_t* buf);
241 void writeByte(
unsigned int address, uint8_t data);
250 void writeBytes(
unsigned int address, uint8_t* buf,
unsigned int len);
258 uint8_t
readByte(
unsigned int address);
267 void readBytes(
unsigned int address, uint8_t* buf,
unsigned int len);
271 void EEPROM_Write_Byte(
unsigned int address, uint8_t data);
272 void EEPROM_Write_Bytes(
unsigned int address, uint8_t* data,
274 uint8_t EEPROM_Read_Byte(
unsigned int address);
275 unsigned int EEPROM_Read_Bytes(
unsigned int address,
276 uint8_t* buf,
unsigned int len);
bool writePasswd(uint32_t passwd)
Definition: m24lr64e.cxx:88
uint8_t getDSFID()
Definition: m24lr64e.cxx:156
uint8_t readByte(unsigned int address)
Definition: m24lr64e.cxx:197
void clearMemory()
Definition: m24lr64e.cxx:180
M24LR64E(int bus, AccessMode mode=USER_MODE)
Definition: m24lr64e.cxx:36
uint32_t getMemorySize()
Definition: m24lr64e.cxx:171
bool submitPasswd(uint32_t passwd)
Definition: m24lr64e.cxx:57
M24LR64E_ADDR_T
Definition: m24lr64e.h:97
~M24LR64E()
Definition: m24lr64e.cxx:53
C++ API for the M24LR64E based Grove NFC Tag.
Definition: m24lr64e.h:79
uint8_t getAFI()
Definition: m24lr64e.cxx:161
void getUID(uint8_t *buf)
Definition: m24lr64e.cxx:166
void readBytes(unsigned int address, uint8_t *buf, unsigned int len)
Definition: m24lr64e.cxx:202
void sectorProtectConfig(unsigned int sectorNumber, bool protectEnable, SectorAccessRight accessRight, SectorSelectPassWd passwd)
Definition: m24lr64e.cxx:118
void writeByte(unsigned int address, uint8_t data)
Definition: m24lr64e.cxx:187
void sectorWriteLockBit(unsigned int sectorNumber, bool sockEnable)
Definition: m24lr64e.cxx:138
void writeBytes(unsigned int address, uint8_t *buf, unsigned int len)
Definition: m24lr64e.cxx:192
void clearSectorProtect(void)
Definition: m24lr64e.cxx:131