HWA
Bare metal programming with style
24CXX I²C EEPROM

This is a generic class that implements 24CXX I²C EEPROMs.

Header file:

#include <hwa/ext/24cxx.h>

Interface

#define EEPROM HW_24CXX( interface, twi0, \
address, 0x50, \
addresssize, 2, \
pagesize, 8 )


The implementation of this device focuses on code size rather than on speed, so it relies on extern C functions. These functions are declared with HW_DECLARE(...) and defined with HW_IMPLEMENT(...):
HW_DECLARE( EEPROM ); // Declare the functions that implement the device
HW_IMPLEMENT( EEPROM ); // Define the functions that implement the device
uint8_t r ;
r = hw( read, EEPROM,
address, a,
size, s,
buffer, b );
if (r < s)
error();
uint8_t r ;
r = hw( write, EEPROM,
address, a,
size, s,
buffer, b );
if (r < s)
error();
HW_DECLARE
#define HW_DECLARE(...)
Declares the functions that implement an object.
Definition: hwa_1.h:526
hw
#define hw(...)
hw( action, object [,...] ) executes an action immediately on an object.
Definition: hwa_macros.h:523
24cxx.h
24CXX I²C EEPROM
HW_IMPLEMENT
#define HW_IMPLEMENT(...)
Defines the functions that implement an object.
Definition: hwa_1.h:548