36 #include <mraa/common.hpp> 37 #include <mraa/i2c.hpp> 39 #define M24LR64E_I2C_BUS 0 40 #define M24LR64E_DEFAULT_I2C_ADDR 0x53 41 #define M24LR64E_DEFAULT_I2C_ADDR_E2 (M24LR64E_DEFAULT_I2C_ADDR | 0x04) 85 static const int EEPROM_I2C_LENGTH = 8192;
86 static const int PASSWORD_LENGTH = 4;
87 static const int SECTOR_SECURITY_STATUS_BASE_ADDR = 0x800;
89 static const uint8_t LOCK_PROTECT_BIT = 0x01;
90 static const uint8_t WRITE_READ_PROTECT_BIT = 0x02;
91 static const uint8_t PASSWORD_CTRL_BIT = 0x04;
93 static const int UID_LENGTH = 8;
95 static const unsigned int I2C_WRITE_TIME = 5;
101 I2C_PASSWORD_ADDR = 2304,
102 RF_PASSWORD_1_ADDR = 2308,
103 RF_PASSWORD_2_ADDR = 2312,
104 RF_PASSWORD_3_ADDR = 2316,
110 MEM_SIZE_ADDR = 2332,
112 PROG_COMP_ENERGY_HARVEST_ADDR = 2339
120 enum SectorAccessRight {
135 enum SectorSelectPassWd {
152 M24LR64E(
int bus, AccessMode mode = USER_MODE);
183 SectorAccessRight accessRight,
184 SectorSelectPassWd passwd);
245 mraa::Result
writeByte(
unsigned int address, uint8_t data);
254 mraa::Result
writeBytes(
unsigned int address, uint8_t* buffer,
int len);
262 uint8_t
readByte(
unsigned int address);
271 int readBytes(
unsigned int address, uint8_t* buffer,
int len);
275 mraa::Result EEPROM_Write_Byte(
unsigned int address, uint8_t data);
276 mraa::Result EEPROM_Write_Bytes(
unsigned int address, uint8_t* data,
278 uint8_t EEPROM_Read_Byte(
unsigned int address);
279 int EEPROM_Read_Bytes(
unsigned int address,
280 uint8_t* buffer,
int len);
bool writePasswd(uint32_t passwd)
Definition: m24lr64e.cxx:89
uint8_t getDSFID()
Definition: m24lr64e.cxx:158
int readBytes(unsigned int address, uint8_t *buffer, int len)
Definition: m24lr64e.cxx:207
uint8_t readByte(unsigned int address)
Definition: m24lr64e.cxx:202
void clearMemory()
Definition: m24lr64e.cxx:185
uint8_t * getUID()
Definition: m24lr64e.cxx:168
M24LR64E(int bus, AccessMode mode=USER_MODE)
Definition: m24lr64e.cxx:36
uint32_t getMemorySize()
Definition: m24lr64e.cxx:176
bool submitPasswd(uint32_t passwd)
Definition: m24lr64e.cxx:57
C++ API wrapper for the bh1749 driver.
Definition: a110x.hpp:29
~M24LR64E()
Definition: m24lr64e.cxx:53
C++ API for the M24LR64E NFC Tag.
Definition: m24lr64e.hpp:82
mraa::Result writeBytes(unsigned int address, uint8_t *buffer, int len)
Definition: m24lr64e.cxx:197
M24LR64E_ADDR_T
Definition: m24lr64e.hpp:100
uint8_t getAFI()
Definition: m24lr64e.cxx:163
mraa::Result writeByte(unsigned int address, uint8_t data)
Definition: m24lr64e.cxx:192
void sectorProtectConfig(unsigned int sectorNumber, bool protectEnable, SectorAccessRight accessRight, SectorSelectPassWd passwd)
Definition: m24lr64e.cxx:120
void sectorWriteLockBit(unsigned int sectorNumber, bool sockEnable)
Definition: m24lr64e.cxx:140
void clearSectorProtect(void)
Definition: m24lr64e.cxx:133