39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_i2c_master.h"
73#define EEPROM13_REG_DEV_TYPE_IDENTIFIER 0xE000u
74#define EEPROM13_REG_CFG_DEVICE_ADDRESS 0xC000u
75#define EEPROM13_REG_SW_WRITE_PROTECTION 0xA000u
76#define EEPROM13_REG_IDENTIFICATION_PAGE 0x0000u
77#define EEPROM13_REG_IDENTIFICATION_PAGE_LOCK 0x6000u
96#define EEPROM13_MEMORY_ADDRESS_MIN 0x00000000ul
97#define EEPROM13_MEMORY_ADDRESS_MAX 0x0001FFFFul
98#define EEPROM13_MEMORY_ADDRESS_16_BIT_MASK 0x00010000ul
99#define EEPROM13_MEMORY_ADDRESS_16_BIT 0x01
100#define EEPROM13_PAGE_SIZE 256
101#define EEPROM13_PAGE_MAX 512
107#define EEPROM13_CDA_DAL_BIT_MASK 0x01
108#define EEPROM13_CDA_CEA_BIT_MASK 0x03
114#define EEPROM13_SWP_WPL_MODIFIED 0x00
115#define EEPROM13_SWP_WPL_FROZEN 0x01
116#define EEPROM13_SWP_WPL_BIT_MASK 0x01
117#define EEPROM13_SWP_BP_UPPER_QUARTE 0x00
118#define EEPROM13_SWP_BP_UPPER_HALF 0x01
119#define EEPROM13_SWP_BP_UPPER_THREE_QUARTE 0x02
120#define EEPROM13_SWP_BP_WHOLE_MEM 0x03
121#define EEPROM13_SWP_BP_BIT_MASK 0x06
122#define EEPROM13_SWP_WPA_WRITE_ENABLE 0x00
123#define EEPROM13_SWP_WPA_BLOCK_WRITE 0x01
124#define EEPROM13_SWP_WPA_BIT_MASK 0x08
130#define EEPROM13_DEFAULT_CHIP_ENABLE_ADDRESS 0x00
137#define EEPROM13_DEVICE_ADDRESS_MEMORY 0x50
138#define EEPROM13_DEVICE_ADDRESS_PAGE 0x58
156#define EEPROM13_MAP_MIKROBUS( cfg, mikrobus ) \
157 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
158 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
159 cfg.wc = MIKROBUS( mikrobus, MIKROBUS_RST )
eeprom13_return_value_t
EEPROM 13 Click return value data.
Definition eeprom13.h:203
@ EEPROM13_OK
Definition eeprom13.h:204
@ EEPROM13_ERROR
Definition eeprom13.h:205
err_t eeprom13_get_lock_status(eeprom13_t *ctx, uint8_t *lock_status)
EEPROM 13 get lock/unlock status of the identification function.
err_t eeprom13_id_page_read(eeprom13_t *ctx, uint16_t id_page_addr, uint8_t *data_out)
EEPROM 13 identification page read function.
err_t eeprom13_memory_read(eeprom13_t *ctx, uint32_t mem_addr, uint8_t *data_out, uint8_t len)
EEPROM 13 memory write function.
err_t eeprom13_sw_write_protect(eeprom13_t *ctx, uint8_t wpa, uint8_t bp, uint8_t wpl)
EEPROM 13 software write protection function.
err_t eeprom13_generic_write(eeprom13_t *ctx, uint16_t reg, uint8_t *data_in, uint8_t len)
EEPROM 13 I2C writing function.
err_t eeprom13_memory_page_read(eeprom13_t *ctx, uint16_t page_addr, uint8_t *data_out, uint8_t len)
EEPROM 13 memory page read function.
void eeprom13_hw_write_enable(eeprom13_t *ctx)
EEPROM 13 hardware write enable function.
err_t eeprom13_id_page_write(eeprom13_t *ctx, uint16_t id_page_addr, uint8_t *data_in)
EEPROM 13 identification page write function.
err_t eeprom13_memory_page_write(eeprom13_t *ctx, uint16_t page_addr, uint8_t *data_in, uint8_t len)
EEPROM 13 memory page write function.
void eeprom13_hw_write_disable(eeprom13_t *ctx)
EEPROM 13 hardware write enable function.
err_t eeprom13_config_dev_addr(eeprom13_t *ctx, uint8_t cda, uint8_t dal)
EEPROM 13 configuate device address function.
err_t eeprom13_init(eeprom13_t *ctx, eeprom13_cfg_t *cfg)
EEPROM 13 initialization function.
void eeprom13_cfg_setup(eeprom13_cfg_t *cfg)
EEPROM 13 configuration object setup function.
err_t eeprom13_generic_read(eeprom13_t *ctx, uint16_t reg, uint8_t *data_out, uint8_t len)
EEPROM 13 I2C reading function.
err_t eeprom13_memory_write(eeprom13_t *ctx, uint32_t mem_addr, uint8_t *data_in, uint8_t len)
EEPROM 13 memory write function.
EEPROM 13 Click configuration object.
Definition eeprom13.h:187
uint32_t i2c_speed
Definition eeprom13.h:193
pin_name_t wc
Definition eeprom13.h:191
pin_name_t scl
Definition eeprom13.h:188
pin_name_t sda
Definition eeprom13.h:189
uint8_t i2c_address
Definition eeprom13.h:194
EEPROM 13 Click context object.
Definition eeprom13.h:169
digital_out_t wc
Definition eeprom13.h:171
uint8_t chip_en_addr
Definition eeprom13.h:178
i2c_master_t i2c
Definition eeprom13.h:174
uint8_t slave_address
Definition eeprom13.h:177