42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_spi_master.h"
67#define EEPROM4_MAP_MIKROBUS( cfg, mikrobus ) \
68 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
69 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
70 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
71 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
72 cfg.wp = MIKROBUS( mikrobus, MIKROBUS_RST ); \
73 cfg.hld = MIKROBUS( mikrobus, MIKROBUS_PWM )
80#define EEPROM4_RETVAL uint8_t
82#define EEPROM4_OK 0x00
83#define EEPROM4_INIT_ERROR 0xFF
90#define EEPROM4_LOGIC_HIGH 1
91#define EEPROM4_LOGIC_LOW 0
98#define EEPROM4_READY_BIT 0x01
99#define EEPROM4_WRITE_ENABLE_LATCH_BIT 0x02
100#define EEPROM4_WRITE_PROTECT_ENABLE_BIT 0x80
107#define EEPROM4_LOW_POWER_WRITE_POLL_COMMAND 0x08
108#define EEPROM4_SET_WRITE_ENABLE_LATCH_COMMAND 0x06
109#define EEPROM4_RESET_WRITE_ENABLE_LATCH_COMMAND 0x04
116#define EEPROM4_FIRST_MEMORY_LOCATION 0x00000000
117#define EEPROM4_ONE_QUARTER_MEMORY_LOCATION 0x0000FFFF
118#define EEPROM4_HALF_MEMORY_LOCATION 0x0001FFFF
119#define EEPROM4_TWO_QUARTER_MEMORY_LOCATION 0x0002FFFF
120#define EEPROM4_LAST_MEMORY_LOCATION 0x0003FFFF
127#define EEPROM4_NONE_PROTECTED_MEMORY_LOCATION 0x00
128#define EEPROM4_ONE_QUARTER_PROTECTED_MEMORY_LOCATION 0x04
129#define EEPROM4_HALF_PROTECTED_MEMORY_LOCATION 0x08
130#define EEPROM4_ALL_PROTECTED_MEMORY_LOCATION 0x0C
235 uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len );
#define EEPROM4_RETVAL
Definition eeprom4.h:80
void eeprom4_enable_write_protect(eeprom4_t *ctx, uint8_t state)
Write Protect enable function.
void eeprom4_read_memory(eeprom4_t *ctx, uint32_t memory_address, uint8_t *data_output, uint8_t n_bytes)
Memory array read function.
void eeprom4_default_cfg(eeprom4_t *ctx)
Click Default Configuration function.
void eeprom4_write_status_reg(eeprom4_t *ctx, uint8_t data_value)
Status register write function.
void eeprom4_generic_transfer(eeprom4_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
Generic transfer function.
uint8_t eeprom4_check_status_reg(eeprom4_t *ctx, uint8_t check_bit)
Status register bits check function.
void eeprom4_cfg_setup(eeprom4_cfg_t *cfg)
Config Object Initialization function.
void eeprom4_write_memory(eeprom4_t *ctx, uint32_t memory_address, uint8_t *data_input, uint8_t n_bytes)
Memory array write function.
uint8_t eeprom4_read_status_reg(eeprom4_t *ctx)
Status register read function.
uint8_t eeprom4_send_command(eeprom4_t *ctx, uint8_t command_byte)
Command send function.
EEPROM4_RETVAL eeprom4_init(eeprom4_t *ctx, eeprom4_cfg_t *cfg)
Initialization function.
void eeprom4_enable_hold_operation(eeprom4_t *ctx, uint8_t state)
Hold operation enable function.
Click configuration structure definition.
Definition eeprom4.h:162
pin_name_t hld
Definition eeprom4.h:173
spi_master_chip_select_polarity_t cs_polarity
Definition eeprom4.h:179
pin_name_t sck
Definition eeprom4.h:167
spi_master_mode_t spi_mode
Definition eeprom4.h:178
pin_name_t mosi
Definition eeprom4.h:166
uint32_t spi_speed
Definition eeprom4.h:177
pin_name_t wp
Definition eeprom4.h:172
pin_name_t miso
Definition eeprom4.h:165
pin_name_t cs
Definition eeprom4.h:168
Click ctx object definition.
Definition eeprom4.h:144
digital_out_t cs
Definition eeprom4.h:147
digital_out_t hld
Definition eeprom4.h:149
spi_master_t spi
Definition eeprom4.h:153
pin_name_t chip_select
Definition eeprom4.h:154
digital_out_t wp
Definition eeprom4.h:148