Low-level driver for the AT24MACXX Series EEPROM controller.
This driver provides access to the main features of the AT24MACXX Series EEPROM.
Modules | |
Related Project(s) | |
In this section you can find all the projects related to the EEPROM AT24Cxx Series. | |
Macros | |
#define | at24mac_build_word_address(p_u8, addr) |
Functions | |
static void | at24macxx_acknowledge_polling (twihs_package_t *twihs_package) |
Poll the acknowledge from AT24MACXX. More... | |
uint32_t | at24macxx_fill_pattern (uint32_t u32_start_address, uint32_t u32_end_address, uint8_t u8_pattern) |
Fill the specified pattern to AT24MACXX. More... | |
uint32_t | at24macxx_read_byte (uint32_t u32_address, uint8_t *p_rd_byte) |
Read single byte from AT24MACXX. More... | |
uint32_t | at24macxx_read_continuous (uint32_t u32_start_address, uint16_t u16_length, uint8_t *p_rd_buffer) |
Read multiple bytes continuously from AT24MACXX. More... | |
uint32_t | at24macxx_read_page (uint32_t u32_page_address, uint32_t u32_page_size, uint8_t *p_rd_buffer) |
Read data from the specified page in AT24MACXX. More... | |
void | at24macxx_reset (void) |
Reset AT24MACXX. More... | |
uint32_t | at24macxx_write_byte (uint32_t u32_address, uint8_t u8_value) |
Write single byte to AT24MACXX. More... | |
uint32_t | at24macxx_write_continuous (uint32_t u32_start_address, uint16_t u16_length, uint8_t const *p_wr_buffer) |
Write multiple bytes continuously to AT24MACXX. More... | |
uint32_t | at24macxx_write_page (uint32_t u32_page_address, uint32_t u32_page_size, uint8_t const *p_wr_buffer) |
Write data to the specified page in AT24MACXX. More... | |
#define at24mac_build_word_address | ( | p_u8, | |
addr | |||
) |
Referenced by at24macxx_read_byte(), at24macxx_read_continuous(), at24macxx_read_page(), at24macxx_write_byte(), and at24macxx_write_page().
|
static |
Poll the acknowledge from AT24MACXX.
twihs_package | Pointer to TWI data package. Only the slave address is used in the acknowledge polling. |
References twihs_packet::addr, addr, twihs_packet::addr_length, BOARD_AT24MAC_TWIHS_INSTANCE, twihs_packet::buffer, twihs_packet::length, twihs_master_write(), and TWIHS_SUCCESS.
Referenced by at24macxx_write_byte(), and at24macxx_write_page().
uint32_t at24macxx_fill_pattern | ( | uint32_t | u32_start_address, |
uint32_t | u32_end_address, | ||
uint8_t | u8_pattern | ||
) |
Fill the specified pattern to AT24MACXX.
u32_start_address | The first address to be filled. |
u32_end_address | The last address to be filled. |
u8_pattern | The pattern to be filled. |
References addr, AT24MAC_WRITE_FAIL, AT24MAC_WRITE_SUCCESS, and at24macxx_write_byte().
Referenced by main().
uint32_t at24macxx_read_byte | ( | uint32_t | u32_address, |
uint8_t * | p_rd_byte | ||
) |
Read single byte from AT24MACXX.
u32_address | Address of the byte to read. |
p_rd_byte | Pointer to memory where the read byte will be stored. |
References twihs_packet::addr, twihs_packet::addr_length, at24mac_build_word_address, AT24MAC_MEM_ADDR_LEN, AT24MAC_READ_FAIL, AT24MAC_READ_SUCCESS, BOARD_AT24MAC_ADDRESS, BOARD_AT24MAC_TWIHS_INSTANCE, twihs_packet::buffer, twihs_packet::chip, twihs_packet::length, twihs_master_read(), and TWIHS_SUCCESS.
uint32_t at24macxx_read_continuous | ( | uint32_t | u32_start_address, |
uint16_t | u16_length, | ||
uint8_t * | p_rd_buffer | ||
) |
Read multiple bytes continuously from AT24MACXX.
u32_start_address | Address of the first byte to read. |
u16_length | Number of bytes to read. |
p_rd_buffer | Pointer to memory where the read bytes will be stored. |
References twihs_packet::addr, twihs_packet::addr_length, at24mac_build_word_address, AT24MAC_MEM_ADDR_LEN, AT24MAC_READ_FAIL, AT24MAC_READ_SUCCESS, BOARD_AT24MAC_ADDRESS, BOARD_AT24MAC_TWIHS_INSTANCE, twihs_packet::buffer, twihs_packet::chip, twihs_packet::length, twihs_master_read(), and TWIHS_SUCCESS.
Referenced by main().
uint32_t at24macxx_read_page | ( | uint32_t | u32_page_address, |
uint32_t | u32_page_size, | ||
uint8_t * | p_rd_buffer | ||
) |
Read data from the specified page in AT24MACXX.
u32_page_address | The page number. |
u32_page_size | The size of the page (which varies with the chips). |
p_rd_buffer | Pointer to array where the bytes read are to be stored. |
References twihs_packet::addr, twihs_packet::addr_length, at24mac_build_word_address, AT24MAC_MEM_ADDR_LEN, AT24MAC_READ_FAIL, AT24MAC_READ_SUCCESS, BOARD_AT24MAC_ADDRESS, BOARD_AT24MAC_TWIHS_INSTANCE, twihs_packet::buffer, twihs_packet::chip, twihs_packet::length, twihs_master_read(), and TWIHS_SUCCESS.
Referenced by main().
void at24macxx_reset | ( | void | ) |
Reset AT24MACXX.
Send 9 clock cycles to reset memory state.
References BOARD_CLK_TWIHS_EEPROM, BOARD_CLK_TWIHS_MUX_EEPROM, delay_us, IOPORT_DIR_OUTPUT, ioport_disable_pin(), ioport_enable_pin(), ioport_set_pin_dir(), ioport_set_pin_level(), and ioport_set_pin_mode().
Referenced by main().
uint32_t at24macxx_write_byte | ( | uint32_t | u32_address, |
uint8_t | u8_value | ||
) |
Write single byte to AT24MACXX.
u32_address | Address of the byte to write. |
u8_value | Value that will be written to the specified address. |
References twihs_packet::addr, twihs_packet::addr_length, at24mac_build_word_address, AT24MAC_MEM_ADDR_LEN, AT24MAC_WRITE_FAIL, AT24MAC_WRITE_SUCCESS, at24macxx_acknowledge_polling(), BOARD_AT24MAC_ADDRESS, BOARD_AT24MAC_TWIHS_INSTANCE, twihs_packet::buffer, twihs_packet::chip, twihs_packet::length, twihs_master_write(), and TWIHS_SUCCESS.
Referenced by at24macxx_fill_pattern(), and at24macxx_write_continuous().
uint32_t at24macxx_write_continuous | ( | uint32_t | u32_start_address, |
uint16_t | u16_length, | ||
uint8_t const * | p_wr_buffer | ||
) |
Write multiple bytes continuously to AT24MACXX.
u32_start_address | Address of the first byte in transaction. |
u16_length | Number of bytes to write. |
p_wr_buffer | Pointer to array where the bytes to be written are stored. |
References AT24MAC_WRITE_FAIL, AT24MAC_WRITE_SUCCESS, and at24macxx_write_byte().
Referenced by main().
uint32_t at24macxx_write_page | ( | uint32_t | u32_page_address, |
uint32_t | u32_page_size, | ||
uint8_t const * | p_wr_buffer | ||
) |
Write data to the specified page in AT24MACXX.
u32_page_address | The page number. |
u32_page_size | The size of the page (which varies with the chips). |
p_wr_buffer | Pointer to array where the bytes to be written are stored. |
References twihs_packet::addr, twihs_packet::addr_length, at24mac_build_word_address, AT24MAC_MEM_ADDR_LEN, AT24MAC_WRITE_FAIL, AT24MAC_WRITE_SUCCESS, at24macxx_acknowledge_polling(), BOARD_AT24MAC_ADDRESS, BOARD_AT24MAC_TWIHS_INSTANCE, twihs_packet::buffer, twihs_packet::chip, twihs_packet::length, twihs_master_write(), and TWIHS_SUCCESS.
Referenced by main().