43#define CHIP_NAME "Microchip AT24CXX"
44#define MANUFACTURER_NAME "Microchip"
45#define SUPPLY_VOLTAGE_MIN 1.7f
46#define SUPPLY_VOLTAGE_MAX 5.5f
47#define MAX_CURRENT 5.0f
48#define TEMPERATURE_MIN -40.0f
49#define TEMPERATURE_MAX 85.0f
50#define DRIVER_VERSION 2000
74 handle->
debug_print(
"at24cxx: iic_init is null.\n");
80 handle->
debug_print(
"at24cxx: iic_deinit is null.\n");
86 handle->
debug_print(
"at24cxx: iic_read is null.\n");
92 handle->
debug_print(
"at24cxx: iic_write is null.\n");
98 handle->
debug_print(
"at24cxx: iic_read_address16 is null.\n");
104 handle->
debug_print(
"at24cxx: iic_write_address16 is null.\n");
110 handle->
debug_print(
"at24cxx: delay_ms is null.\n");
117 handle->
debug_print(
"at24cxx: iic init failed.\n");
149 handle->
debug_print(
"at24cxx: iic deinit failed.\n");
174 handle->
id = (uint32_t)type;
267 if ((address + len) > handle->
id)
269 handle->
debug_print(
"at24cxx: read out of range.\n");
277 address % 65536, buf,
287 if (handle->
iic_read((uint8_t)(handle->
iic_addr + ((address / 256) << 1)), address % 256,
315 uint16_t page_remain;
317 uint16_t page_delay_ms;
327 if ((address + len) > handle->
id)
329 handle->
debug_print(
"at24cxx: write out of range.\n");
334 switch ((uint32_t)handle->
id)
429 page_remain = (uint16_t)(page_div - address % page_div);
430 if (len <= page_remain)
432 page_remain = (uint16_t)len;
439 address % 65536, buf,
447 if (page_remain == len)
453 address += page_remain;
458 page_remain = (uint16_t)len;
462 page_remain = page_div;
471 if (handle->
iic_write((uint8_t)(handle->
iic_addr + ((address / 256) << 1)), address % 256, buf,
479 if (page_remain == len)
485 address += page_remain;
490 page_remain = (uint16_t)len;
494 page_remain = page_div;
#define SUPPLY_VOLTAGE_MAX
#define MANUFACTURER_NAME
#define SUPPLY_VOLTAGE_MIN
#define CHIP_NAME
chip information definition
driver at24cxx header file
uint8_t at24cxx_set_type(at24cxx_handle_t *handle, at24cxx_t type)
set the chip type
uint8_t at24cxx_get_addr_pin(at24cxx_handle_t *handle, at24cxx_address_t *addr_pin)
get the chip address pin
uint8_t at24cxx_init(at24cxx_handle_t *handle)
initialize the chip
struct at24cxx_info_s at24cxx_info_t
at24cxx information structure definition
uint8_t at24cxx_read(at24cxx_handle_t *handle, uint32_t address, uint8_t *buf, uint16_t len)
read bytes from the chip
at24cxx_t
at24cxx type enumeration definition
uint8_t at24cxx_deinit(at24cxx_handle_t *handle)
close the chip
struct at24cxx_handle_s at24cxx_handle_t
at24cxx handle structure definition
uint8_t at24cxx_write(at24cxx_handle_t *handle, uint32_t address, uint8_t *buf, uint16_t len)
write bytes to the chip
at24cxx_address_t
at24cxx address enumeration definition
uint8_t at24cxx_info(at24cxx_info_t *info)
get chip's information
uint8_t at24cxx_set_addr_pin(at24cxx_handle_t *handle, at24cxx_address_t addr_pin)
set the chip address pin
uint8_t at24cxx_get_type(at24cxx_handle_t *handle, at24cxx_t *type)
get the chip type
void(* delay_ms)(uint32_t ms)
uint8_t(* iic_read_address16)(uint8_t addr, uint16_t reg, uint8_t *buf, uint16_t len)
void(* debug_print)(const char *const fmt,...)
uint8_t(* iic_init)(void)
uint8_t(* iic_write_address16)(uint8_t addr, uint16_t reg, uint8_t *buf, uint16_t len)
uint8_t(* iic_write)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* iic_read)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* iic_deinit)(void)
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v