COSA
An Object-Oriented Platform for Arduino Programming
EEPROM Class Reference

#include <EEPROM.hh>

Collaboration diagram for EEPROM:
Collaboration graph

Classes

class  Device
 

Public Member Functions

 EEPROM (Device *dev=&Device::eeprom)
 
bool is_ready ()
 
void write_await ()
 
int read (void *dest, const void *src, size_t size)
 
template<class T >
int read (T *dest, const T *src)
 
int read (unsigned char *dest, const unsigned char *src)
 
int read (unsigned short *dest, const unsigned short *src)
 
int read (unsigned int *dest, const unsigned int *src)
 
int read (unsigned long *dest, const unsigned long *src)
 
int read (char *dest, const char *src)
 
int read (short *dest, const short *src)
 
int read (int *dest, const int *src)
 
int read (long *dest, const long *src)
 
int read (float *dest, const float *src)
 
int write (void *dest, const void *src, size_t size)
 
template<class T >
int write (T *dest, const T *src)
 
int write (unsigned char *dest, unsigned char src)
 
int write (unsigned short *dest, unsigned short src)
 
int write (unsigned int *dest, unsigned int src)
 
int write (unsigned long *dest, unsigned long src)
 
int write (char *dest, char src)
 
int write (short *dest, short src)
 
int write (int *dest, int src)
 
int write (long *dest, long src)
 
int write (float *dest, float src)
 

Detailed Description

Driver for the ATmega/ATtiny internal EEPROM and abstraction of EEPROM devices. See AT24CXX for an example of driver for external EEPROM memory. The default device is the internal EEPROM. The class EEPROM delegates to the EEPROM:Device class instance.

Definition at line 33 of file EEPROM.hh.

Constructor & Destructor Documentation

EEPROM::EEPROM ( Device dev = &Device::eeprom)
inline

Construct access object for EEPROM given device. Default device is the internal EEPROM memory.

Parameters
[in]devdevice.

Definition at line 84 of file EEPROM.hh.

Member Function Documentation

bool EEPROM::is_ready ( )
inline

Return true(1) if the device is ready, write cycle is completed, otherwise false(0).

Returns
bool.

Definition at line 91 of file EEPROM.hh.

int EEPROM::read ( void *  dest,
const void *  src,
size_t  size 
)
inline

Read rom block with the given size into the buffer from the address. Return number of bytes read or negative error code.

Parameters
[out]destbuffer to write to.
[in]srcaddress in rom to read from.
[in]sizenumber of bytes to read.
Returns
number of bytes or negative error code.

Definition at line 115 of file EEPROM.hh.

template<class T >
int EEPROM::read ( T *  dest,
const T *  src 
)
inline

Template function to read a rom block with the given type to given value reference. Returns number of bytes read or negative error code.

Parameters
[out]destaddress variable.
[in]srcaddress in rom to read from.
Returns
number of bytes or negative error code.

Definition at line 128 of file EEPROM.hh.

int EEPROM::read ( unsigned char *  dest,
const unsigned char *  src 
)
inline

Definition at line 133 of file EEPROM.hh.

int EEPROM::read ( unsigned short *  dest,
const unsigned short *  src 
)
inline

Definition at line 139 of file EEPROM.hh.

int EEPROM::read ( unsigned int *  dest,
const unsigned int *  src 
)
inline

Definition at line 145 of file EEPROM.hh.

int EEPROM::read ( unsigned long *  dest,
const unsigned long *  src 
)
inline

Definition at line 151 of file EEPROM.hh.

int EEPROM::read ( char *  dest,
const char *  src 
)
inline

Definition at line 157 of file EEPROM.hh.

int EEPROM::read ( short *  dest,
const short *  src 
)
inline

Definition at line 163 of file EEPROM.hh.

int EEPROM::read ( int *  dest,
const int *  src 
)
inline

Definition at line 169 of file EEPROM.hh.

int EEPROM::read ( long *  dest,
const long *  src 
)
inline

Definition at line 175 of file EEPROM.hh.

int EEPROM::read ( float *  dest,
const float *  src 
)
inline

Definition at line 181 of file EEPROM.hh.

int EEPROM::write ( void *  dest,
const void *  src,
size_t  size 
)
inline

Write rom block at given address with the contents from the buffer. Return number of bytes written or negative error code.

Parameters
[out]destaddress in rom to read write to.
[in]srcbuffer to write to rom.
[in]sizenumber of bytes to write.
Returns
number of bytes or negative error code.

Definition at line 195 of file EEPROM.hh.

template<class T >
int EEPROM::write ( T *  dest,
const T *  src 
)
inline

Write rom block at given address with the given value of given data type. Returns number of bytes written or negative error code.

Parameters
[in]destaddress in rom to read write to.
[in]srcbuffer to write to rom.
[in]sizenumber of bytes to write.
Returns
number of bytes or negative error code.

Definition at line 209 of file EEPROM.hh.

int EEPROM::write ( unsigned char *  dest,
unsigned char  src 
)
inline

Definition at line 214 of file EEPROM.hh.

int EEPROM::write ( unsigned short *  dest,
unsigned short  src 
)
inline

Definition at line 220 of file EEPROM.hh.

int EEPROM::write ( unsigned int *  dest,
unsigned int  src 
)
inline

Definition at line 226 of file EEPROM.hh.

int EEPROM::write ( unsigned long *  dest,
unsigned long  src 
)
inline

Definition at line 232 of file EEPROM.hh.

int EEPROM::write ( char *  dest,
char  src 
)
inline

Definition at line 238 of file EEPROM.hh.

int EEPROM::write ( short *  dest,
short  src 
)
inline

Definition at line 244 of file EEPROM.hh.

int EEPROM::write ( int *  dest,
int  src 
)
inline

Definition at line 250 of file EEPROM.hh.

int EEPROM::write ( long *  dest,
long  src 
)
inline

Definition at line 256 of file EEPROM.hh.

int EEPROM::write ( float *  dest,
float  src 
)
inline

Definition at line 262 of file EEPROM.hh.

void EEPROM::write_await ( )
inline

Wait for write to complete.

Parameters
[in]modeof sleep.

Definition at line 101 of file EEPROM.hh.


The documentation for this class was generated from the following file: