PropWare  3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Public Member Functions | Static Public Attributes | List of all members
PropWare::Eeprom Class Referenceabstract

EEPROM reader/writer. More...

#include <PropWare/memory/eeprom.h>

+ Inheritance diagram for PropWare::Eeprom:
+ Collaboration diagram for PropWare::Eeprom:

Public Member Functions

 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...
 

Static Public Attributes

static const uint16_t DEFAULT_INITIAL_MEMORY_ADDRESS = 32 * 1024
 
static const uint8_t DEFAULT_DEVICE_ADDRESS = 0x50 << 1
 

Detailed Description

EEPROM reader/writer.

Examples
Eeprom_Demo.cpp.

Definition at line 33 of file eeprom.h.

Constructor & Destructor Documentation

◆ Eeprom()

PropWare::Eeprom::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.

Parameters
[in]driverI2C bus driver
[in]initialMemoryAddressByte of EEPROM that should be read from or written to first when using methods that do not accept an address as a parameter
[in]deviceAddressEEPROM address on the I2C bus (for instance, the default device address would be passed in as 0x50 << 1, not 0x50)
[in]autoIncrementShould 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.

Member Function Documentation

◆ get() [1/2]

uint8_t PropWare::Eeprom::get ( const uint16_t  address) const

Read a byte from EEPROM.

Parameters
[in]addressAddress in EEPROM to be read
Returns
Data in EEPROM

Definition at line 133 of file eeprom.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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]addressAddress of the first byte in EEPROM
[in]*bufferAddress in HUB memory to store data
[in]lengthNumber of bytes to read
Returns
True if successful, false otherwise

Definition at line 149 of file eeprom.h.

+ Here is the call graph for this function:

◆ 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.

+ Here is the call graph for this function:

◆ 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.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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]addressAddress in EEPROM to place data
[in]byteData to be written to EEPROM
Returns
True if the data was successfully written, false otherwise

Definition at line 80 of file eeprom.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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]startAddressAddress to store the first byte of data
[in]bytes[]Array of data - no null-terminator necessary
[in]lengthNumber 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.

+ Here is the call graph for this function:

◆ put_char()

virtual void PropWare::Eeprom::put_char ( const char  c)
virtual
See also
PropWare::PrintCapable::put_char
Postcondition
Internal memory address pointer will be incremented

Implements PropWare::PrintCapable.

Definition at line 108 of file eeprom.h.

+ Here is the call graph for this function:

◆ puts() [1/2]

virtual void PropWare::Eeprom::puts ( const char string)
virtual
See also
PropWare::PrintCapable::puts
Postcondition
Internal memory address pointer will be incremented by the length of the string

Definition at line 119 of file eeprom.h.

+ Here is the call graph for this function:

◆ puts() [2/2]

virtual void PropWare::PrintCapable::puts ( const char  string[])
pure virtualinherited

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.

Precondition
string[] must be terminated with a null terminator
Parameters
[in]string[]Array of data words with the final word being 0 - the null terminator

Implemented in PropWare::SPI, PropWare::HD44780, PropWare::UARTTX, PropWare::FullDuplexSerial, PropWare::FileWriter, PropWare::StringBuilder, PropWare::StaticStringBuilder, and SimplePrinter.

+ Here is the caller graph for this function:

◆ 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]autoIncrementTrue 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]addressAddress in EEPROM used for reading or writing the next byte

Definition at line 182 of file eeprom.h.

Member Data Documentation

◆ 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: