at24c.h 1.0 KB

1234567891011121314151617181920212223242526272829
  1. #ifndef _DEV_AT24C_H_
  2. #define _DEV_AT24C_H_
  3. #include <sys/types.h>
  4. #include <stdint.h>
  5. #include <cfg/eeprom.h>
  6. #ifndef NUT_CONFIG_AT24_ADR
  7. #define NUT_CONFIG_AT24_ADR 0x50
  8. #endif
  9. struct at24c{
  10. uint8_t SlaveAddress; /*< Slave address on the bus */
  11. uint8_t IAddrW; /*< With of slaves address register in bytes */
  12. uint8_t PageSize; /*< Size of pages that can be written at once */
  13. uint32_t EepromSize; /*< Size of the eeprom memory in total */
  14. uint8_t Timeout; /*< Timeout of internal programming in ms*/
  15. #ifdef AT24C_BLOCK_ADDR
  16. uint8_t BlInSla; /*< Block in slave address (lower 3 bits used
  17. for internal high byte of address) */
  18. #endif
  19. HANDLE ee_mutex; /*< Mutex to avoid concurrent access to same EEPROM */
  20. // unsigned int EepromName;
  21. };
  22. extern int At24cWrite( struct at24c *at24cs, uint8_t *buffer, uint16_t len, uint16_t addr);
  23. extern int At24cRead( struct at24c *at24cs, uint8_t *buffer, uint16_t len, uint16_t addr );
  24. #endif