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

#include <AT24CXX.hh>

Inheritance diagram for AT24CXX:
Inheritance graph
Collaboration diagram for AT24CXX:
Collaboration graph

Public Member Functions

 AT24CXX (uint8_t subaddr=0, const size_t size=32, const uint16_t page_max=32)
 
virtual bool is_ready ()
 
virtual int read (void *dest, const void *src, size_t size)
 
virtual int write (void *dest, const void *src, size_t size)
 

Public Attributes

const size_t SIZE
 
const uint16_t PAGE_MAX
 

Static Public Attributes

static Device eeprom
 

Private Member Functions

bool is_async () const
 
void sync_request ()
 
void async_request ()
 
virtual void on_completion (uint8_t type, int count)
 

Private Attributes

uint8_t m_addr
 
bool m_async
 

Detailed Description

Driver for the AT24CXX 2-Wire Serial EEPROM. Allows page write and block read. Supports device AT24C32 (8K) to AT24C512 (64K). Default AT24CXX device is AT24C32.

Circuit

The TinyRTC with DS1307 also contains a 24C32 EEPROM.

TinyRTC(24C32)
+------------+
1-|SQ |
2-|DS DS|-1
(A5/SCL)------------3-|SCL SCL|-2
(A4/SDA)------------4-|SDA SDA|-3
(VCC)---------------5-|VCC VCC|-4
(GND)---------------6-|GND GND|-5
7-|BAT |
+------------+

Definition at line 48 of file AT24CXX.hh.

Constructor & Destructor Documentation

AT24CXX::AT24CXX ( uint8_t  subaddr = 0,
const size_t  size = 32,
const uint16_t  page_max = 32 
)
inline

Construct AT24CXX serial TWI EEPROM device access to given chip address, page and memory size.

Parameters
[in]subaddrchip address (0..7, default 0).
[in]sizein Kbits (default 32).
[in]page_maxsize of memory page (default 32 byte).

Definition at line 67 of file AT24CXX.hh.

Member Function Documentation

bool AT24CXX::is_ready ( )
virtual

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

Returns
bool

Reimplemented from EEPROM::Device.

Definition at line 47 of file AT24CXX.cpp.

int AT24CXX::read ( void *  dest,
const void *  src,
size_t  size 
)
virtual

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

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

Reimplemented from EEPROM::Device.

Definition at line 57 of file AT24CXX.cpp.

int AT24CXX::write ( void *  dest,
const void *  src,
size_t  size 
)
virtual

Write rom block at given address with the contents from the buffer. Return 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.

Reimplemented from EEPROM::Device.

Definition at line 66 of file AT24CXX.cpp.

Member Data Documentation

EEPROM::Device EEPROM::Device::eeprom
staticinherited

Default EEPROM device; handling of internal EEPROM Data Memory.

Definition at line 75 of file EEPROM.hh.

const uint16_t AT24CXX::PAGE_MAX

Number of bytes in max write page size.

Definition at line 58 of file AT24CXX.hh.

const size_t AT24CXX::SIZE

Number of bytes on device.

Definition at line 53 of file AT24CXX.hh.


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