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 EEPROM5_CMD_WREN 0x06
74#define EEPROM5_CMD_WRDI 0x04
75#define EEPROM5_CMD_RDSR 0x05
76#define EEPROM5_CMD_WRSR 0x01
77#define EEPROM5_CMD_READ 0x03
78#define EEPROM5_CMD_WRITE 0x02
79#define EEPROM5_CMD_READ_ID 0x83
80#define EEPROM5_CMD_WRITE_ID 0x82
81#define EEPROM5_CMD_READ_LOCK_STATUS 0x83
82#define EEPROM5_CMD_LOCK_ID 0x82
88#define EEPROM5_WRITE_MEMORY_DISABLE 0x00
89#define EEPROM5_WRITE_MEMORY_ENABLE 0x01
95#define EEPROM5_IDENT_PAGE_ADDR_START 0x0000
96#define EEPROM5_IDENT_PAGE_ADDR_END 0x01FF
102#define EEPROM5_SIGNIFICANT_ADDR_BIT_0 0xFB
103#define EEPROM5_SIGNIFICANT_ADDR_BIT_1 0x04
109#define EEPROM5_MEMORY_ADDR_START 0x00000000ul
110#define EEPROM5_MEMORY_ADDR_END 0x0007FFFFul
116#define EEPROM5_HOLD_DISABLE 0x00
117#define EEPROM5_HOLD_ENABLE 0x01
123#define EEPROM5_WRITE_PROTECT_DISABLE 0x00
124#define EEPROM5_WRITE_PROTECT_ENABLE 0x01
130#define EEPROM5_DUMMY 0xFF
148#define EEPROM5_MAP_MIKROBUS( cfg, mikrobus ) \
149 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
150 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
151 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
152 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
153 cfg.hld = MIKROBUS( mikrobus, MIKROBUS_RST ); \
154 cfg.wp = MIKROBUS( mikrobus, MIKROBUS_PWM )
eeprom5_return_value_t
EEPROM 5 Click return value data.
Definition eeprom5.h:217
@ EEPROM5_OK
Definition eeprom5.h:218
@ EEPROM5_ERROR
Definition eeprom5.h:219
void eeprom5_write_memory(eeprom5_t *ctx, uint32_t addr, uint8_t *p_tx_data, uint8_t n_bytes)
Write EEPROM memory function.
void eeprom5_write_ident_page(eeprom5_t *ctx, uint16_t addr, uint8_t ident_data)
Write dentification page function.
uint8_t eeprom5_read_ident_page(eeprom5_t *ctx, uint16_t addr)
Read identification page function.
void eeprom5_get_status(eeprom5_t *ctx, status_data_t *stat_data)
Get status function.
void eeprom5_enable_memory_write(eeprom5_t *ctx, uint8_t en_wr_mem)
Enable memory write function.
void eeprom5_lock_id(eeprom5_t *ctx, uint8_t lock_id)
Lock ID function.
uint8_t eeprom5_read_lock_status(eeprom5_t *ctx)
Reads the identification page lock status function.
void eeprom5_send_cmd(eeprom5_t *ctx, uint8_t cmd)
Send command function.
void eeprom5_read_memory(eeprom5_t *ctx, uint32_t addr, uint8_t *p_rx_data, uint8_t n_bytes)
Read EEPROM memory function.
void eeprom5_set_write_protect(eeprom5_t *ctx, uint8_t en_wr_prot)
Enable write protect function.
void eeprom5_set_hold(eeprom5_t *ctx, uint8_t en_hold)
Enable hold operation function.
void eeprom5_set_status(eeprom5_t *ctx, status_data_t stat_data)
Set status function.
err_t eeprom5_init(eeprom5_t *ctx, eeprom5_cfg_t *cfg)
EEPROM 5 initialization function.
void eeprom5_cfg_setup(eeprom5_cfg_t *cfg)
EEPROM 5 configuration object setup function.
uint8_t eeprom5_generic_read(eeprom5_t *ctx, uint32_t addr)
EEPROM 5 data reading function.
void eeprom5_generic_write(eeprom5_t *ctx, uint32_t addr, uint8_t tx_data)
EEPROM 5 data writing function.
EEPROM 5 Click configuration object.
Definition eeprom5.h:181
pin_name_t hld
Definition eeprom5.h:189
spi_master_chip_select_polarity_t cs_polarity
Definition eeprom5.h:195
pin_name_t sck
Definition eeprom5.h:185
spi_master_mode_t spi_mode
Definition eeprom5.h:194
pin_name_t mosi
Definition eeprom5.h:184
uint32_t spi_speed
Definition eeprom5.h:193
pin_name_t wp
Definition eeprom5.h:190
pin_name_t miso
Definition eeprom5.h:183
pin_name_t cs
Definition eeprom5.h:186
EEPROM 5 Click context object.
Definition eeprom5.h:164
digital_out_t hld
Definition eeprom5.h:166
spi_master_t spi
Definition eeprom5.h:170
pin_name_t chip_select
Definition eeprom5.h:172
digital_out_t wp
Definition eeprom5.h:167
EEPROM 5 Click status data object.
Definition eeprom5.h:204
uint8_t block_protect
Definition eeprom5.h:207
uint8_t write_protect
Definition eeprom5.h:208
uint8_t write_in_progress
Definition eeprom5.h:205
uint8_t write_enable_latch
Definition eeprom5.h:206