EEPROM

EEPROM

TWELITE Reads and writes to the built-in EEPROM of the wireless microcontroller.

The built-in EEPROM has 3480 bytes available from address 0x000 to 0xEFF.

The first part is Settings (Interactive settings mode), so it is recommended to use the second half of the address when used together. The amount of space consumed by the settings (Interactive settings mode) depends on its implementation. Even with minimal settings, up to 256 bytes are used from the beginning, so use of the later addresses is recommended.

Methods

read()

uint8_t read(uint16_t address)

Read the data corresponding to address from EEPROM.

write()

void write(uint16_t address, uint8_t value)

Write value from EEPROM to address.

update()

void update(uint16_t address, uint8_t value)

This function is used when you want to reduce the number of rewrites in consideration of the rewrite life of EEPROM.

get_stream_helper()

Obtain a helper object to read and write using mwx::stream described below.

mwx::streamインタフェースを用いた入出力

stream_helper helper object mwx::stream operators and methods. Using mwx::stream, you can read and write integer types such as uint16_t and uint32_t types, read and write fixed-length array types such as uint8_t, and format them using format() objects.

Interfaces defined in mwx::stream, such as the << operator, can be used on this object.

.seek() is used to move the EEPROM address to 1024.

The above writes an 8-byte string (00bc614e), a 4-byte integer (0x12ab34cd), a 16-byte byte string (HELLO WORLD!.... ), and a 1-byte terminating character.

Move the EEPROM address to 1024 using .seek().

Reads the data sequence written out earlier. In order, 8-byte characters, 4-byte integers, and 16-byte strings are read out using the >> operator.

最終更新