EEPROM reader/writer.
More...
#include <PropWare/memory/eeprom.h>
|
| Eeprom (const I2CMaster &driver=pwI2c, const uint16_t initialMemoryAddress=DEFAULT_INITIAL_MEMORY_ADDRESS, const uint8_t deviceAddress=DEFAULT_DEVICE_ADDRESS, const bool autoIncrement=true) |
| Construct an instance that, by default, will read from and write to the standard EEPROM. More...
|
|
bool | ping () const |
| Check that the EEPROM is responding. More...
|
|
bool | put (const uint16_t address, const uint8_t byte) const |
| Place a byte of data into a specific address. More...
|
|
bool | put (const uint16_t startAddress, const uint8_t bytes[], const size_t length) const |
| Place multiple bytes of data into sequential memory locations in EEPROM. More...
|
|
virtual void | put_char (const char c) |
|
virtual void | puts (const char *string) |
|
uint8_t | get (const uint16_t address) const |
| Read a byte from EEPROM. More...
|
|
bool | get (const uint16_t address, uint8_t *buffer, const size_t length) const |
| Read an array of sequential bytes from EEPROM. More...
|
|
virtual char | get_char () |
|
uint16_t | get_memory_address () const |
| Retrieve the current address of the internal pointer. More...
|
|
void | set_memory_address (const uint16_t address) |
| Set the current address of the internal pointer. More...
|
|
bool | is_auto_increment () const |
| Determine if auto incrementing of the internal address pointer is enabled. More...
|
|
void | set_auto_increment (const bool autoIncrement) |
| Set auto incrementing of the internal address pointer to enabled or disabled. More...
|
|
virtual void | puts (const char string[])=0 |
| Send a null-terminated character array. Though this method could be created using put_char, some objects (such as PropWare::UART), have optimized methods for sending a string and PrintCapable::puts can utilize them. More...
|
|
EEPROM reader/writer.
- Examples
- Eeprom_Demo.cpp.
Definition at line 33 of file eeprom.h.
◆ Eeprom()
Construct an instance that, by default, will read from and write to the standard EEPROM.
- Parameters
-
[in] | driver | I2C bus driver |
[in] | initialMemoryAddress | Byte of EEPROM that should be read from or written to first when using methods that do not accept an address as a parameter |
[in] | deviceAddress | EEPROM address on the I2C bus (for instance, the default device address would be passed in as 0x50 << 1 , not 0x50 ) |
[in] | autoIncrement | Should the memory address pointer be automatically incremented upon reading and writing bytes from and to the EEPROM, similar to reading/writing files |
Definition at line 54 of file eeprom.h.
◆ get() [1/2]
uint8_t PropWare::Eeprom::get |
( |
const uint16_t |
address | ) |
const |
◆ get() [2/2]
bool PropWare::Eeprom::get |
( |
const uint16_t |
address, |
|
|
uint8_t * |
buffer, |
|
|
const size_t |
length |
|
) |
| const |
Read an array of sequential bytes from EEPROM.
- Parameters
-
[in] | address | Address of the first byte in EEPROM |
[in] | *buffer | Address in HUB memory to store data |
[in] | length | Number of bytes to read |
- Returns
- True if successful, false otherwise
Definition at line 149 of file eeprom.h.
◆ get_char()
virtual char PropWare::Eeprom::get_char |
( |
| ) |
|
|
virtual |
- See also
- PropWare::PrintCapable::get_char
- Postcondition
- Internal memory address pointer will be incremented
Implements PropWare::ScanCapable.
Definition at line 161 of file eeprom.h.
◆ get_memory_address()
uint16_t PropWare::Eeprom::get_memory_address |
( |
| ) |
const |
Retrieve the current address of the internal pointer.
- Returns
- Address in EEPROM used for reading or writing the next byte
Definition at line 173 of file eeprom.h.
◆ is_auto_increment()
bool PropWare::Eeprom::is_auto_increment |
( |
| ) |
const |
Determine if auto incrementing of the internal address pointer is enabled.
- Returns
- True if enabled, false otherwise
Definition at line 191 of file eeprom.h.
◆ ping()
bool PropWare::Eeprom::ping |
( |
| ) |
const |
Check that the EEPROM is responding.
- Returns
- True if the EEPROM is responding, false otherwise
Definition at line 68 of file eeprom.h.
◆ put() [1/2]
bool PropWare::Eeprom::put |
( |
const uint16_t |
address, |
|
|
const uint8_t |
byte |
|
) |
| const |
Place a byte of data into a specific address.
- Parameters
-
[in] | address | Address in EEPROM to place data |
[in] | byte | Data to be written to EEPROM |
- Returns
- True if the data was successfully written, false otherwise
Definition at line 80 of file eeprom.h.
◆ put() [2/2]
bool PropWare::Eeprom::put |
( |
const uint16_t |
startAddress, |
|
|
const uint8_t |
bytes[], |
|
|
const size_t |
length |
|
) |
| const |
Place multiple bytes of data into sequential memory locations in EEPROM.
- Parameters
-
[in] | startAddress | Address to store the first byte of data |
[in] | bytes[] | Array of data - no null-terminator necessary |
[in] | length | Number of bytes in the array that should be sent |
- Returns
- True if the data was successfully written, false otherwise
Definition at line 96 of file eeprom.h.
◆ put_char()
virtual void PropWare::Eeprom::put_char |
( |
const char |
c | ) |
|
|
virtual |
◆ puts() [1/2]
virtual void PropWare::Eeprom::puts |
( |
const char * |
string | ) |
|
|
virtual |
◆ puts() [2/2]
virtual void PropWare::PrintCapable::puts |
( |
const char |
string[] | ) |
|
|
pure virtualinherited |
◆ set_auto_increment()
void PropWare::Eeprom::set_auto_increment |
( |
const bool |
autoIncrement | ) |
|
Set auto incrementing of the internal address pointer to enabled or disabled.
- Parameters
-
[in] | autoIncrement | True to enabled, false to disable |
Definition at line 200 of file eeprom.h.
◆ set_memory_address()
void PropWare::Eeprom::set_memory_address |
( |
const uint16_t |
address | ) |
|
Set the current address of the internal pointer.
- Parameters
-
[in] | address | Address in EEPROM used for reading or writing the next byte |
Definition at line 182 of file eeprom.h.
◆ DEFAULT_DEVICE_ADDRESS
const uint8_t PropWare::Eeprom::DEFAULT_DEVICE_ADDRESS = 0x50 << 1 |
|
static |
Standard EEPROM I2C address used for Propeller microcontrollers
Definition at line 39 of file eeprom.h.
◆ DEFAULT_INITIAL_MEMORY_ADDRESS
const uint16_t PropWare::Eeprom::DEFAULT_INITIAL_MEMORY_ADDRESS = 32 * 1024 |
|
static |
First byte above the standard 32kB EEPROM
Definition at line 37 of file eeprom.h.
The documentation for this class was generated from the following file: