pyupm_m24lr64e module

class pyupm_m24lr64e.M24LR64E(*args)[source]

Bases: object

C++ API for the M24LR64E NFC Tag.

ID: m24lr64e

Name: Dynamic NFC/RFID Tag Module

Other Names: Grove NFC Tag

Category: other

Manufacturer: seeed

Link:http://www.seeedstudio.com/wiki/Grove_-_NFC_Tag

Connection: i2c The M24LR64E NFC tag is an 8KB electrically erasable programmable read-only memory (EEPROM) that can be written to or read from using I2C and NFC- equipped devices.

The user mode (default) allows read and write access to all 8KB of space, provided the sector security status (SSS) allows it. The root mode allows modification of the SSS data and other information, provided the proper password is submitted. The default password for a new tag is 0x00000000. See the datasheet for more details.

The Seeed Studio* wiki page for this device includes a link to an Android* application that can be used to also read and write the device via NFC, as well as set NFC passwords, which cannot be done via I2C.

C++ includes: m24lr64e.hpp

AFI_ADDR = 2321
Access_0111 = 3
Access_1100 = 2
Access_1110 = 0
Access_1111 = 1
CONFIG_ADDR = 2323
DSFID_ADDR = 2320
EEPROM_I2C_LENGTH = 8192
I2C_PASSWORD_ADDR = 2304
I2C_WRITE_TIME = 5
IC_REF_ADDR = 2335
LOCK_PROTECT_BIT = 1L
MEM_SIZE_ADDR = 2332
PASSWORD_CTRL_BIT = 4L
PASSWORD_LENGTH = 4
PROG_COMP_ENERGY_HARVEST_ADDR = 2339
RESV_ADDR = 2322
RF_PASSWORD_1_ADDR = 2308
RF_PASSWORD_2_ADDR = 2312
RF_PASSWORD_3_ADDR = 2316
ROOT_MODE = 1
SECTOR_SECURITY_STATUS_BASE_ADDR = 2048
UID_ADDR = 2324
UID_LENGTH = 8
USER_MODE = 0
WRITE_READ_PROTECT_BIT = 2L
clearMemory()[source]

void clearMemory()

Sets all memory to 0, if permissions allow

clearSectorProtect()[source]

void clearSectorProtect(void)

Clears sector protection bits. Must be in the root mode.

getAFI()[source]

uint8_t getAFI()

Returns an application family identifier (AFI) Must be in the root mode.

AFI

getDSFID()[source]

uint8_t getDSFID()

Returns a data storage family identifier (DSFID) Must be in the root mode.

DSFID

getMemorySize()[source]

uint32_t getMemorySize()

Returns the memory size Must be in the root mode.

Amount of memory present

getUID()[source]

uint8_t * getUID()

Returns a unique ID. Must be in the root mode. Maintained to preserve compatibility with older code.

buf Buffer to hold the UID. Must be UID_LENGTH bytes.

noPasswd = 0
passwd_1 = 1
passwd_2 = 2
passwd_3 = 3
readByte(address)[source]

uint8_t readByte(unsigned int address)

Reads a byte from the EEPROM

address: Address to read from

data Value read

readBytes(address, buffer, len)[source]

int readBytes(unsigned int address, uint8_t *buffer, int len)

Reads multiple bytes from the EEPROM

address: Address to read from

buffer: Buffer to store data

len: Number of bytes to read

sectorProtectConfig(sectorNumber, protectEnable, accessRight, passwd)[source]

void sectorProtectConfig(unsigned int sectorNumber, bool protectEnable, SectorAccessRight accessRight, SectorSelectPassWd passwd)

Sets a protection bit for a sector. Must be in the root mode

sectorNumber: Sector whose protection you are modifying

protectEnable: True if you are enabling protection

accessRight: Access rights to set

passwd: Password number to enable, if any

sectorWriteLockBit(sectorNumber, sockEnable)[source]

void sectorWriteLockBit(unsigned int sectorNumber, bool sockEnable)

Sets or clears a sector security status lock bit for a sector. Must be in the root mode.

sectorNumber: Sector whose SSS you want to modify

sockEnable: True to set the bit, false to clear it

submitPasswd(passwd)[source]

bool submitPasswd(uint32_t passwd)

Submits an I2C access password

passwd: 4-byte access password

writeByte(address, data)[source]

mraa::Result writeByte(unsigned int address, uint8_t data)

Writes a byte to the EEPROM

address: Address to write to

data: Data to write

writeBytes(address, buffer, len)[source]

mraa::Result writeBytes(unsigned int address, uint8_t *buffer, int len)

Writes bytes to the EEPROM

address: Address to write to

buffer: Data to write

len: Length of the data buffer

writePasswd(passwd)[source]

bool writePasswd(uint32_t passwd)

Writes a new I2C password

passwd: 4-byte access password