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)
83 static const int EEPROM_I2C_LENGTH = 8192;
84 static const int PASSWORD_LENGTH = 4;
85 static const int SECTOR_SECURITY_STATUS_BASE_ADDR = 0x800;
87 static const uint8_t LOCK_PROTECT_BIT = 0x01;
88 static const uint8_t WRITE_READ_PROTECT_BIT = 0x02;
89 static const uint8_t PASSWORD_CTRL_BIT = 0x04;
91 static const int UID_LENGTH = 8;
93 static const unsigned int I2C_WRITE_TIME = 5;
99 I2C_PASSWORD_ADDR = 2304,
100 RF_PASSWORD_1_ADDR = 2308,
101 RF_PASSWORD_2_ADDR = 2312,
102 RF_PASSWORD_3_ADDR = 2316,
108 MEM_SIZE_ADDR = 2332,
110 PROG_COMP_ENERGY_HARVEST_ADDR = 2339
118 enum SectorAccessRight {
133 enum SectorSelectPassWd {
150 M24LR64E(
int bus, AccessMode mode = USER_MODE);
181 SectorAccessRight accessRight,
182 SectorSelectPassWd passwd);
243 mraa::Result
writeByte(
unsigned int address, uint8_t data);
252 mraa::Result
writeBytes(
unsigned int address, uint8_t* buffer,
int len);
260 uint8_t
readByte(
unsigned int address);
269 int readBytes(
unsigned int address, uint8_t* buffer,
int len);
273 mraa::Result EEPROM_Write_Byte(
unsigned int address, uint8_t data);
274 mraa::Result EEPROM_Write_Bytes(
unsigned int address, uint8_t* data,
276 uint8_t EEPROM_Read_Byte(
unsigned int address);
277 int EEPROM_Read_Bytes(
unsigned int address,
278 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
~M24LR64E()
Definition: m24lr64e.cxx:53
C++ API for the M24LR64E-based Grove NFC Tag.
Definition: m24lr64e.h:80
mraa::Result writeBytes(unsigned int address, uint8_t *buffer, int len)
Definition: m24lr64e.cxx:197
M24LR64E_ADDR_T
Definition: m24lr64e.h:98
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