Config NFC

Defines

EEPROM_USERMEM_FIRST_BLOCK

Index of the first 16-byte block of unprotected user memory.

NDEF_RECORDTYPE_TEXT

NDEF text record type.

PAYLOADSTART_SHORTREC_INDEX

NDEF record payload starts at this byte within EEPROM block 1.

RECORDTYPE_SHORTREC_INDEX

Index corresponding to NDEF record type. Only correct for short NDEF records.

PAYLOADLEN_SHORTREC_INDEX

Index corresponding to NDEF record length. Only correct for short NDEF records.

CONFIGSTR_STARTCHAR

Marks the start of a configuration string.

CONFIGSTR_DELIMCHAR

Separates the ID from a value in a configuration string.

CONFIGSTR_ENDCHAR

Marks the end of a configuration string.

Enums

enum parserstate_t

Values:

enumerator findstartchar

Search for the config string start character.

enumerator storeid

Read the ID byte.

enumerator checkdelimiter

Check for the delimiter byte.

enumerator storevalue

Copy the configuration string value into msgblock.

Functions

int confignfc_check()

Read the first block of NFC EEPROM user memory. Check if it contains an NDEF text record.

Configuration data are written as strings in the text record.

Returns

1 if a short text record is present, otherwise 0.

int confignfc_parse()

Parse the NDEF text record into configuration strings. Writing configuration to NVM.

Configuration strings are formatted as:

<c:xyz>

Where:

‘<’ is the start character.

‘c’ is the ID.

‘:’ is the delimiter.

‘xyz’ is the value.

‘>’ is the end character.

The text record can contain one or more strings. There is no separator character between them.

Configuration strings are written to non-volatile memory with nvparams_write().

Variables

static char readbuffer[BLKSIZE]

Holds one 16-byte EEPROM block.

unsigned char msgblock[64]

Re-use an array declared as part of cuplcodec for calculating the MD5 checksum.