42#include "px_cat25m_cfg.h"
45#ifndef PX_CAT25M_CFG_DEVICE
46#error "PX_CAT25M_CFG_DEVICE not specified"
60#if (PX_CAT25M_CFG_DEVICE == PX_CAT25M01)
61#define PX_CAT25M_PAGES 512ul
62#define PX_CAT25M_PAGE_SIZE 256ul
63#elif (PX_CAT25M_CFG_DEVICE == PX_CAT25M02)
64#define PX_CAT25M_PAGES 1024ul
65#define PX_CAT25M_PAGE_SIZE 256ul
67#error "Invalid CAT25M device specified"
71#define PX_CAT25M_EEPROM_SIZE_BYTES (PX_CAT25M_PAGES * PX_CAT25M_PAGE_SIZE)
74#define PX_CAT25M_ADR_MAX (PX_CAT25M_EEPROM_SIZE_BYTES - 1)
78#define PX_CAT25M_STATUS_WPEN 7
79#define PX_CAT25M_STATUS_IPL 6
80#define PX_CAT25M_STATUS_LIP 4
81#define PX_CAT25M_STATUS_BP1 3
82#define PX_CAT25M_STATUS_BP0 2
83#define PX_CAT25M_STATUS_WEL 1
84#define PX_CAT25M_STATUS_RDY 0
88#define PX_CAT25M_MAX_SPI_CLOCK_HZ 10000000
90#define PX_CAT25M_SPI_MODE PX_SPI_MODE0
92#define PX_CAT25M_SPI_DATA_ORDER PX_SPI_DATA_ORDER_MSB
155 uint8_t start_byte_in_page,
194 uint8_t start_byte_in_page,
void px_cat25m_rd_page(void *buf, uint16_t page)
Read a page from EEPROM.
void px_cat25m_wr_page(const void *buf, uint16_t page)
Write a page from EEPROM.
bool px_cat25m_ready(void)
Check if EEPROM is ready for the next read or write access.
void px_cat25m_rd(void *buf, px_cat25m_adr_t adr, size_t nr_of_bytes)
Read data from EEPROM.
void px_cat25m_wr_page_offset(const void *buf, uint16_t page, uint8_t start_byte_in_page, size_t nr_of_bytes)
Partial write of data in a page of EEPROM.
uint8_t px_cat25m_status_rd(void)
Read the status register of the EEPROM.
void px_cat25m_wr_en(void)
Enable writing.
uint32_t px_cat25m_adr_t
Address size.
void px_cat25m_status_wr(uint8_t status)
Write to the status register of the EEPROM.
void px_cat25m_wr_dis(void)
Disable writing.
void px_cat25m_init(px_spi_handle_t *handle)
Initialise driver.
void px_cat25m_rd_page_offset(void *buf, uint16_t page, uint8_t start_byte_in_page, size_t nr_of_bytes)
Partial read of data in a page of EEPROM.