22 #ifndef AT24CM0X_HAL_PLATFORM
32 #define AT24CM0X_HAL_PLATFORM avr0
35 #ifndef AT24CM0X_MEMORY_SIZE
44 #define AT24CM0X_MEMORY_SIZE 262144UL
47 #ifndef AT24CM0X_PAGES
56 #define AT24CM0X_PAGES 1024UL
59 #ifndef AT24CM0X_PAGE_SIZE
68 #define AT24CM0X_PAGE_SIZE 256UL
71 #ifndef AT24CM0X_ENABLE_INTEGRITY_CHECK
83 #define AT24CM0X_ENABLE_INTEGRITY_CHECK
87 #ifndef AT24CM0X_WRITE_ACKNOWLEDGE_POLLING
99 #define AT24CM0X_WRITE_ACKNOWLEDGE_POLLING
111 #ifndef AT24CM0X_BASE_ADDRESS
112 #define AT24CM0X_BASE_ADDRESS 0x50
122 #ifndef AT24CM0X_ADDRESS_MASK
123 #if AT24CM0X_MEMORY_SIZE < 262144UL
124 #define AT24CM0X_ADDRESS_MASK 0x06
126 #define AT24CM0X_ADDRESS_MASK 0x04
139 #ifndef AT24CM0X_ADDRESS_HIGH_MASK
140 #if AT24CM0X_MEMORY_SIZE < 262144UL
141 #define AT24CM0X_ADDRESS_HIGH_MASK 0x01
143 #define AT24CM0X_ADDRESS_HIGH_MASK 0x03
148 #ifndef AT24CM0X_MULTI_DEVICES
159 #define AT24CM0X_MULTI_DEVICES
163 #ifndef AT24CM0X_MULTI_DEVICES
172 #ifndef AT24CM0X_ADDRESS_A2
173 #define AT24CM0X_ADDRESS_A2 1
176 #ifndef AT24CM0X_ADDRESS
186 #if AT24CM0X_MEMORY_SIZE < 262144UL
187 #ifndef AT24CM0X_ADDRESS_A1
188 #define AT24CM0X_ADDRESS_A1 1
199 #define AT24CM0X_ADDRESS (AT24CM0X_BASE_ADDRESS | (AT24CM0X_ADDRESS_A2<<2) | (AT24CM0X_ADDRESS_A1<<1))
209 #define AT24CM0X_ADDRESS (AT24CM0X_BASE_ADDRESS | (AT24CM0X_ADDRESS_A2<<2))
215 #ifndef AT24CM0X_WP_CONTROL_EN
227 #define AT24CM0X_WP_CONTROL_EN
231 #ifndef AT24CM0X_WRITE_CYCLE_MS
240 #define AT24CM0X_WRITE_CYCLE_MS 10UL
245 #include _STR(../../../hal/AT24CM0X_HAL_PLATFORM/twi/twi.h)
249 #ifdef AT24CM0X_WP_CONTROL_EN
294 #ifdef AT24CM0X_MULTI_DEVICES
298 #ifdef AT24CM0X_WP_CONTROL_EN
enum AT24CM0X_WP_Mode_t AT24CM0X_WP_Mode
Alias for enum AT24CM0X_WP_Mode_t representing WP control modes.
Definition at24cm0x.h:266
AT24CM0X_Status at24cm0x_read_sequential(unsigned long address, unsigned char *data, unsigned int size)
Reads a sequence of bytes from the AT24CM0X EEPROM.
Definition at24cm0x.c:322
AT24CM0X_Status_t
Status codes returned by AT24CM0X driver operations.
Definition at24cm0x.h:277
@ AT24CM0X_Status_Data_Error
Definition at24cm0x.h:282
@ AT24CM0X_Status_Page_Error
Definition at24cm0x.h:280
@ AT24CM0X_Status_General_Error
Definition at24cm0x.h:284
@ AT24CM0X_Status_TWI_Error
Definition at24cm0x.h:283
@ AT24CM0X_Status_Address_Error
Definition at24cm0x.h:279
@ AT24CM0X_Status_Done
Definition at24cm0x.h:278
@ AT24CM0X_Status_Size_Error
Definition at24cm0x.h:281
AT24CM0X_Status at24cm0x_write_page(unsigned int page, unsigned char *data, unsigned int size)
Writes a sequence of bytes to a single EEPROM page.
Definition at24cm0x.c:172
void at24cm0x_init(void)
Initializes the AT24CM0X EEPROM driver.
Definition at24cm0x.c:32
AT24CM0X_Status at24cm0x_write_byte(unsigned long address, unsigned char data)
Writes a single byte to the AT24CM0X EEPROM.
Definition at24cm0x.c:104
enum AT24CM0X_Status_t AT24CM0X_Status
Alias for enum AT24CM0X_Status_t representing driver status codes.
Definition at24cm0x.h:290
void at24cm0x_wp(AT24CM0X_WP_Mode mode)
AT24CM0X_Status at24cm0x_read_current_byte(unsigned char *data)
Reads the current byte from the AT24CM0X EEPROM.
Definition at24cm0x.c:248
AT24CM0X_Status at24cm0x_read_byte(unsigned long address, unsigned char *data)
Reads a single byte from the AT24CM0X EEPROM.
Definition at24cm0x.c:280
AT24CM0X_WP_Mode_t
Specifies the write-protect mode for the AT24CM0X device.
Definition at24cm0x.h:258
@ AT24CM0X_WP_Mode_Enabled
Definition at24cm0x.h:259
@ AT24CM0X_WP_Mode_Disabled
Definition at24cm0x.h:260
void at24cm0x_device(unsigned char identifier)
Selects the active AT24CM0X device.
Definition at24cm0x.c:54
Helper macros for stringification in C preprocessor.
Header file with declarations and macros for systick utility.