Header file for M24512 EEPROM driver.
More...
#include <stdint.h>
#include <stdbool.h>
#include "no_os_i2c.h"
#include "no_os_gpio.h"
#include "no_os_error.h"
#include "no_os_eeprom.h"
|
| int32_t | m24512_init (struct no_os_eeprom_desc **desc, const struct no_os_eeprom_init_param *param) |
| | Initialize the M24512 EEPROM device.
|
| |
| int32_t | m24512_remove (struct no_os_eeprom_desc *desc) |
| | Free resources allocated by M24512 device.
|
| |
| int32_t | m24512_read_data (struct no_os_eeprom_desc *desc, uint32_t address, uint8_t *data, uint16_t len) |
| | Read multiple bytes from EEPROM.
|
| |
| int32_t | m24512_write_data (struct no_os_eeprom_desc *desc, uint32_t address, uint8_t *data, uint16_t len) |
| | Write multiple bytes to EEPROM (handles page boundaries)
|
| |
| bool | m24512_is_ready (struct m24512_dev *dev) |
| | Check if EEPROM is ready (write cycle completed)
|
| |
| int | m24512_wait_ready (struct m24512_dev *dev, uint32_t timeout_ms) |
| | Wait for write cycle completion.
|
| |
| int | m24512_get_info (struct m24512_dev *dev, uint32_t *memory_size, uint16_t *page_size, uint16_t *num_pages) |
| | Get device information.
|
| |
Header file for M24512 EEPROM driver.
- Author
- rober.nosp@m.t.bu.nosp@m.dai@a.nosp@m.nalo.nosp@m.g.com
Copyright 2025(c) Analog Devices, Inc.
SPDX-License-Identifier: BSD-3-Clause
◆ M24512_ADDR_HIGH_BYTE
| #define M24512_ADDR_HIGH_BYTE |
( |
| addr | ) |
|
Value:((uint8_t)((addr >> 8) & 0xFF))
◆ M24512_ADDR_LOW_BYTE
| #define M24512_ADDR_LOW_BYTE |
( |
| addr | ) |
|
◆ M24512_BYTE_WRITE_TIME
| #define M24512_BYTE_WRITE_TIME 5U |
◆ M24512_MAX_ADDRESS
◆ M24512_MEMORY_SIZE
| #define M24512_MEMORY_SIZE 65536U |
◆ M24512_NUM_PAGES
| #define M24512_NUM_PAGES 512U |
◆ M24512_PAGE_SIZE
| #define M24512_PAGE_SIZE 128U |
◆ M24512_PAGE_WRITE_TIME
| #define M24512_PAGE_WRITE_TIME 5U |
◆ M24512_WRITE_CYCLE_TIME
| #define M24512_WRITE_CYCLE_TIME 5U |
◆ m24512_get_info()
| int m24512_get_info |
( |
struct m24512_dev * | dev, |
|
|
uint32_t * | memory_size, |
|
|
uint16_t * | page_size, |
|
|
uint16_t * | num_pages ) |
Get device information.
- Parameters
-
| dev | - Device descriptor |
| memory_size | - Pointer to store memory size |
| page_size | - Pointer to store page size |
| num_pages | - Pointer to store number of pages |
- Returns
- 0 in case of success, negative error code otherwise
◆ m24512_init()
Initialize the M24512 EEPROM device.
- Parameters
-
| desc | - Pointer to device descriptor |
| param | - Initialization parameters |
- Returns
- 0 in case of success, negative error code otherwise
◆ m24512_is_ready()
Check if EEPROM is ready (write cycle completed)
- Parameters
-
- Returns
- true if ready, false if busy
◆ m24512_read_data()
| int32_t m24512_read_data |
( |
struct no_os_eeprom_desc * | desc, |
|
|
uint32_t | address, |
|
|
uint8_t * | data, |
|
|
uint16_t | len ) |
Read multiple bytes from EEPROM.
- Parameters
-
| desc | - Device descriptor |
| address | - Starting memory address |
| data | - Buffer to store read data |
| len | - Number of bytes to read |
- Returns
- 0 in case of success, negative error code otherwise
◆ m24512_remove()
Free resources allocated by M24512 device.
- Parameters
-
- Returns
- 0 in case of success, negative error code otherwise
◆ m24512_wait_ready()
| int m24512_wait_ready |
( |
struct m24512_dev * | dev, |
|
|
uint32_t | timeout_ms ) |
Wait for write cycle completion.
- Parameters
-
| dev | - Device descriptor |
| timeout_ms | - Maximum timeout in milliseconds |
- Returns
- 0 if ready, negative error code on timeout
◆ m24512_write_data()
| int32_t m24512_write_data |
( |
struct no_os_eeprom_desc * | desc, |
|
|
uint32_t | address, |
|
|
uint8_t * | data, |
|
|
uint16_t | len ) |
Write multiple bytes to EEPROM (handles page boundaries)
- Parameters
-
| desc | - Device descriptor |
| address | - Starting memory address |
| data | - Data buffer to write |
| len | - Number of bytes to write |
- Returns
- 0 in case of success, negative error code otherwise
◆ eeprom_m24512_ops
M24512 EEPROM specific ops structure.
M24512 EEPROM specific ops structure