Skip to content

Commit

Permalink
[WiP] drivers/at24cxxx: add support for st25dv04k
Browse files Browse the repository at this point in the history
  • Loading branch information
benpicco committed Jan 5, 2023
1 parent 46135f3 commit eeb03f1
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ifneq (,$(filter apds99%,$(USEMODULE)))
USEMODULE += apds99xx
endif

ifneq (,$(filter at24c%,$(USEMODULE)))
ifneq (,$(filter at24c% st25dv%,$(USEMODULE)))
USEMODULE += at24cxxx
endif

Expand Down
1 change: 1 addition & 0 deletions drivers/at24cxxx/Makefile.include
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
PSEUDOMODULES += at24c%
PSEUDOMODULES += st25dv%
# handle at24cxxx being a distinct module
NO_PSEUDOMODULES += at24cxxx

Expand Down
27 changes: 27 additions & 0 deletions drivers/at24cxxx/include/at24cxxx_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,29 @@ extern "C" {
/ AT24CXXX_POLL_DELAY_US))
/** @} */

/**
* @name ST25DV04K constants
* @{
*/
/**
* @brief 256 byte memory
*/
#define ST25DV04K_EEPROM_SIZE (512U)
/**
* @brief 16 pages of 16 bytes each
*/
#define ST25DV04K_PAGE_SIZE (4U)
/**
* @brief Delay to complete write operation
*/
#define ST25DV04K_PAGE_WRITE_DELAY_US (5000U)
/**
* @brief Number of poll attempts
*/
#define ST25DV04K_MAX_POLLS (1 + (ST25DV04K_PAGE_WRITE_DELAY_US \
/ AT24CXXX_POLL_DELAY_US))
/** @} */

/**
* @name Set constants depending on module
* @{
Expand Down Expand Up @@ -373,6 +396,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_ST25DV04K)
#define AT24CXXX_EEPROM_SIZE (ST25DV04K_EEPROM_SIZE)
#define AT24CXXX_PAGE_SIZE (ST25DV04K_PAGE_SIZE)
#define AT24CXXX_MAX_POLLS (ST25DV04K_MAX_POLLS)
#else /* minimal */
#define AT24CXXX_EEPROM_SIZE (128U) /**< EEPROM size */
#define AT24CXXX_PAGE_SIZE (4U) /**< page size */
Expand Down

0 comments on commit eeb03f1

Please sign in to comment.