1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-29 16:31:18 +01:00

drivers/at24cxxx: add defines for M24C01

This commit is contained in:
crasbe 2024-04-16 13:26:52 +02:00
parent 3c3c5c281c
commit 6d1bfd63c6
3 changed files with 33 additions and 0 deletions

View File

@ -104,6 +104,10 @@ ifneq (,$(filter ltc4150_%,$(USEMODULE)))
USEMODULE += ltc4150
endif
ifneq (,$(filter m24c%,$(USEMODULE)))
USEMODULE += at24cxxx
endif
ifneq (,$(filter mhz19_%,$(USEMODULE)))
USEMODULE += mhz19
endif

View File

@ -1,5 +1,7 @@
PSEUDOMODULES += at24c%
PSEUDOMODULES += mtd_at24cxxx
PSEUDOMODULES += m24c%
# handle at24cxxx being a distinct module
NO_PSEUDOMODULES += at24cxxx

View File

@ -367,6 +367,29 @@ extern "C" {
/ AT24CXXX_POLL_DELAY_US))
/** @} */
/**
* @name M24C01 constants
* @{
*/
/**
* @brief 128 byte memory
*/
#define M24C01_EEPROM_SIZE (128U)
/**
* @brief 16 pages of 16 bytes each
*/
#define M24C01_PAGE_SIZE (16U)
/**
* @brief Delay to complete write operation
*/
#define M24C01_PAGE_WRITE_DELAY_US (5000U)
/**
* @brief Number of poll attempts
*/
#define M24C01_MAX_POLLS (1 + (M24C01_PAGE_WRITE_DELAY_US \
/ AT24CXXX_POLL_DELAY_US))
/** @} */
/**
* @name Set constants depending on module
* @{
@ -427,6 +450,10 @@ extern "C" {
#define AT24CXXX_EEPROM_SIZE (AT24MAC_EEPROM_SIZE)
#define AT24CXXX_PAGE_SIZE (AT24MAC_PAGE_SIZE)
#define AT24CXXX_MAX_POLLS (AT24MAC_MAX_POLLS)
#elif IS_USED(MODULE_M24C01)
#define AT24CXXX_EEPROM_SIZE (M24C01_EEPROM_SIZE)
#define AT24CXXX_PAGE_SIZE (M24C01_PAGE_SIZE)
#define AT24CXXX_MAX_POLLS (M24C01_MAX_POLLS)
#else /* minimal */
#define AT24CXXX_EEPROM_SIZE (128U) /**< EEPROM size */
#define AT24CXXX_PAGE_SIZE (4U) /**< page size */