42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_i2c_master.h"
66#define EEPROM_BLOCK_ADDR_START 0x00
67#define EEPROM_BLOCK_ADDR_MIDDLE 0x80
68#define EEPROM_BLOCK_ADDR_END 0xFF
75#define EEPROM_NBYTES_MIN 1
76#define EEPROM_NBYTES_PAGE 16
77#define EEPROM_NBYTES_MAX 256
84#define EEPROM_MAP_MIKROBUS( cfg, mikrobus ) \
85 cfg.wp = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
86 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
87 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA )
void eeprom_write_page(eeprom_t *context, uint8_t reg_addr, uint8_t *data_in)
Page Write function.
void eeprom_write_enable(eeprom_t *context)
Write Enable function.
uint8_t eeprom_read_byte(eeprom_t *context, uint8_t reg_addr)
Byte Read function.
eeprom_retval_t eeprom_read_sequential(eeprom_t *context, uint8_t reg_addr, uint16_t n_bytes, uint8_t *data_out)
Sequential Read function.
void eeprom_cfg_setup(eeprom_cfg_t *cfg)
Config Structure Setup function.
void eeprom_write_byte(eeprom_t *context, uint8_t reg_addr, uint8_t data_in)
Byte Write function.
eeprom_retval_t eeprom_init(eeprom_t *context, eeprom_cfg_t *cfg)
Click Initialization function.
void eeprom_write_protect(eeprom_t *context)
Write Protect function.
eeprom_i2c_address_selector_t
Click address (memory block) selection.
Definition eeprom.h:97
eeprom_retval_t
Click error code.
Definition eeprom.h:113
@ EEPROM_I2C_ADDR_SEL_2
Definition eeprom.h:100
@ EEPROM_I2C_ADDR_SEL_6
Definition eeprom.h:104
@ EEPROM_I2C_ADDR_SEL_5
Definition eeprom.h:103
@ EEPROM_I2C_ADDR_SEL_4
Definition eeprom.h:102
@ EEPROM_I2C_ADDR_SEL_0
Definition eeprom.h:98
@ EEPROM_I2C_ADDR_SEL_3
Definition eeprom.h:101
@ EEPROM_I2C_ADDR_SEL_1
Definition eeprom.h:99
@ EEPROM_I2C_ADDR_SEL_7
Definition eeprom.h:105
@ EEPROM_RETVAL_OK
Definition eeprom.h:114
@ EEPROM_RETVAL_ERR_DRV_INIT
Definition eeprom.h:115
@ EEPROM_RETVAL_ERR_NBYTES
Definition eeprom.h:116
Click configuration structure definition.
Definition eeprom.h:137
eeprom_i2c_address_selector_t addr_sel
Definition eeprom.h:143
uint32_t i2c_speed
Definition eeprom.h:145
pin_name_t wp
Definition eeprom.h:139
pin_name_t scl
Definition eeprom.h:140
pin_name_t sda
Definition eeprom.h:141
uint8_t i2c_address
Definition eeprom.h:146
Click context object definition.
Definition eeprom.h:124
i2c_master_t i2c
Definition eeprom.h:127
uint8_t slave_addr
Definition eeprom.h:129
digital_out_t wp
Definition eeprom.h:126