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_spi_master.h"
73#define EEPROM7_OPCODE_STATUS_RDSR 0x05
74#define EEPROM7_OPCODE_STATUS_WRBP 0x08
75#define EEPROM7_OPCODE_STATUS_WREN 0x06
76#define EEPROM7_OPCODE_STATUS_WRDI 0x04
77#define EEPROM7_OPCODE_STATUS_WRSR 0x01
83#define EEPROM7_OPCODE_EEPROM_SECURITY_READ 0x03
84#define EEPROM7_OPCODE_EEPROM_SECURITY_WRITE 0x02
85#define EEPROM7_OPCODE_EEPROM_SECURITY_RDEX 0x83
86#define EEPROM7_OPCODE_EEPROM_SECURITY_WREX 0x82
87#define EEPROM7_OPCODE_EEPROM_SECURITY_LOCK 0x82
88#define EEPROM7_OPCODE_EEPROM_SECURITY_CHLK 0x83
94#define EEPROM7_OPCODE_MP_REG_RMPR 0x31
95#define EEPROM7_OPCODE_MP_REG_PRWE 0x07
96#define EEPROM7_OPCODE_MP_REG_PRWD 0x0A
97#define EEPROM7_OPCODE_MP_REG_WMPR 0x32
98#define EEPROM7_OPCODE_MP_REG_PPAB 0x34
99#define EEPROM7_OPCODE_MP_REG_FRZR 0x37
105#define EEPROM7_OPCODE_MP_REG_SPID 0x9F
111#define EEPROM7_OPCODE_SW_RESET_SRST 0x7C
117#define EEPROM7_SEC_WRITE_DISABLE 0x00
118#define EEPROM7_SEC_WRITE_ENABLE 0x01
124#define EEPROM7_PIN_WRITE_PROTECT_DISABLE 0x00
125#define EEPROM7_PIN_WRITE_PROTECT_ENABLE 0x01
126#define EEPROM7_PIN_HOLD_PROTECT_DISABLE 0x00
127#define EEPROM7_PIN_HOLD_PROTECT_ENABLE 0x01
133#define EEPROM7_STATUS_ERROR 0x00
134#define EEPROM7_STATUS_SUCCESS 0x01
135#define EEPROM7_DUMMY 0x00
136#define EEPROM7_ENABLE_WRITE_DISABLE 0x00
137#define EEPROM7_ENABLE_WRITE_ENABLE 0x01
138#define EEPROM7_DEVICE_NOT_READY 0x00
139#define EEPROM7_DEVICE_IS_READY 0x01
157#define EEPROM7_MAP_MIKROBUS( cfg, mikrobus ) \
158 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
159 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
160 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
161 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
162 cfg.wp = MIKROBUS( mikrobus, MIKROBUS_RST ); \
163 cfg.hld = MIKROBUS( mikrobus, MIKROBUS_PWM )
eeprom7_return_value_t
EEPROM 7 Click return value data.
Definition eeprom7.h:213
@ EEPROM7_ERROR
Definition eeprom7.h:215
@ EEPROM7_OK
Definition eeprom7.h:214
uint16_t eeprom7_read_status(eeprom7_t *ctx)
Read status function.
void eeprom7_write_memory(eeprom7_t *ctx, uint32_t addr, uint8_t *p_tx_data, uint8_t n_bytes)
Write EEPROM memory function.
void eeprom7_set_status(eeprom7_t *ctx, uint8_t status)
Set status function.
void eeprom7_sw_reset(eeprom7_t *ctx)
Software device reset function.
uint8_t eeprom7_get_status(eeprom7_t *ctx)
Get status function.
err_t eeprom7_init(eeprom7_t *ctx, eeprom7_cfg_t *cfg)
EEPROM 7 initialization function.
void eeprom7_enable_write_protect(eeprom7_t *ctx, uint8_t en_write_protect)
Enable write protect function.
err_t eeprom7_send_cmd(eeprom7_t *ctx, uint8_t cmd)
Send command function.
uint8_t eeprom7_is_device_ready(eeprom7_t *ctx)
Check the device is ready function.
err_t eeprom7_generic_read(eeprom7_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
EEPROM 7 data reading function.
void eeprom7_enable_hold_operation(eeprom7_t *ctx, uint8_t en_hold)
Enable hold operation function.
void eeprom7_enable_write(eeprom7_t *ctx, uint8_t en_write)
Enable write function.
err_t eeprom7_default_cfg(eeprom7_t *ctx)
EEPROM 7 default configuration function.
err_t eeprom7_check_status(eeprom7_t *ctx, uint8_t check_bit)
Status register bits check function.
void eeprom7_cfg_setup(eeprom7_cfg_t *cfg)
EEPROM 7 configuration object setup function.
void eeprom7_read_memory(eeprom7_t *ctx, uint32_t addr, uint8_t *p_rx_data, uint8_t n_bytes)
Read EEPROM memory function.
err_t eeprom7_generic_write(eeprom7_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
EEPROM 7 data writing function.
err_t eeprom7_generic_write_then_read(eeprom7_t *ctx, uint8_t *data_in, uint8_t len_in, uint8_t *data_out, uint8_t len_out)
EEPROM 7 data writing function.
EEPROM 7 Click configuration object.
Definition eeprom7.h:190
pin_name_t hld
Definition eeprom7.h:199
spi_master_chip_select_polarity_t cs_polarity
Definition eeprom7.h:204
pin_name_t sck
Definition eeprom7.h:194
spi_master_mode_t spi_mode
Definition eeprom7.h:203
pin_name_t mosi
Definition eeprom7.h:193
uint32_t spi_speed
Definition eeprom7.h:202
pin_name_t wp
Definition eeprom7.h:198
pin_name_t miso
Definition eeprom7.h:192
pin_name_t cs
Definition eeprom7.h:195
EEPROM 7 Click context object.
Definition eeprom7.h:173
digital_out_t hld
Definition eeprom7.h:176
spi_master_t spi
Definition eeprom7.h:179
pin_name_t chip_select
Definition eeprom7.h:181
digital_out_t wp
Definition eeprom7.h:175