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"
74#define EEPROM9_HOLD_DISABLE 0x00
75#define EEPROM9_HOLD_ENABLE 0x01
76#define EEPROM9_WRITE_PROTECT_DISABLE 0x00
77#define EEPROM9_WRITE_PROTECT_ENABLE 0x01
78#define EEPROM9_WRITE_ENABLE 0x00
79#define EEPROM9_WRITE_DISABLE 0x01
85#define EEPROM9_SRWD_MASK 0x80
86#define EEPROM9_TB_MASK 0x40
87#define EEPROM9_BP2_MASK 0x10
88#define EEPROM9_BP1_MASK 0x08
89#define EEPROM9_BP0_MASK 0x04
90#define EEPROM9_WEL_MASK 0x02
91#define EEPROM9_WIP_MASK 0x01
97#define EEPROM9_ST_MANUFACTURER_CODE 0x20
103#define EEPROM9_MEMORY_ADDR_START 0x00000000ul
104#define EEPROM9_MEMORY_ADDR_END 0x003FFFFFul
110#define EEPROM9_CMD_WREN 0x06
111#define EEPROM9_CMD_WRDI 0x04
112#define EEPROM9_CMD_RDSR 0x05
113#define EEPROM9_CMD_WRSR 0x01
114#define EEPROM9_CMD_READ 0x03
115#define EEPROM9_CMD_FREAD 0x0B
116#define EEPROM9_CMD_FDREAD 0x3B
117#define EEPROM9_CMD_FQREAD 0x6B
118#define EEPROM9_CMD_PGWR 0x02
119#define EEPROM9_CMD_PGPR 0x0A
120#define EEPROM9_CMD_PGER 0xDB
121#define EEPROM9_CMD_SCER 0x20
122#define EEPROM9_CMD_BKER 0xD8
123#define EEPROM9_CMD_CHER 0xC7
124#define EEPROM9_CMD_RDID 0x83
125#define EEPROM9_CMD_FRDID 0x8B
126#define EEPROM9_CMD_WRID 0x82
127#define EEPROM9_CMD_DPD 0xB9
128#define EEPROM9_CMD_RDPD 0xAB
129#define EEPROM9_CMD_JEDPC 0x9F
130#define EEPROM9_CMD_RDCR 0x15
131#define EEPROM9_CMD_RDVR 0x85
132#define EEPROM9_CMD_WRVR 0x81
133#define EEPROM9_CMD_CLRSF 0x50
134#define EEPROM9_CMD_RDSFDP 0x5A
135#define EEPROM9_CMD_RSTEN 0x66
136#define EEPROM9_CMD_RESET 0x99
146#define EEPROM9_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
147#define EEPROM9_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
165#define EEPROM9_MAP_MIKROBUS( cfg, mikrobus ) \
166 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
167 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
168 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
169 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
170 cfg.wp = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
171 cfg.hld = MIKROBUS( mikrobus, MIKROBUS_INT )
eeprom9_return_value_t
EEPROM 9 Click return value data.
Definition eeprom9.h:232
@ EEPROM9_OK
Definition eeprom9.h:233
@ EEPROM9_ERROR
Definition eeprom9.h:234
err_t eeprom9_write_memory(eeprom9_t *ctx, uint32_t mem_addr, uint8_t *data_in, uint8_t len)
EEPROM 9 memory writing function.
void eeprom9_set_hold(eeprom9_t *ctx, uint8_t en_hold)
EEPROM 9 set hold pin state function.
err_t eeprom5_get_status_reg(eeprom9_t *ctx, uint8_t *status_data)
EEPROM 9 read status function.
err_t eeprom9_generic_read(eeprom9_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
EEPROM 9 data reading function.
err_t eeprom9_chip_erase(eeprom9_t *ctx)
EEPROM 9 chip memory erase function.
void eeprom9_set_write_protection(eeprom9_t *ctx, uint8_t en_wp)
EEPROM 9 set write protection state function.
err_t eeprom9_generic_write(eeprom9_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
EEPROM 9 data writing function.
err_t eeprom9_init(eeprom9_t *ctx, eeprom9_cfg_t *cfg)
EEPROM 9 initialization function.
void eeprom9_cfg_setup(eeprom9_cfg_t *cfg)
EEPROM 9 configuration object setup function.
err_t eeprom9_block_erase(eeprom9_t *ctx, uint32_t block_addr)
EEPROM 9 memory block erase function.
err_t eeprom9_sector_erase(eeprom9_t *ctx, uint32_t sector_addr)
EEPROM 9 memory sector erase function.
err_t eeprom9_read_identification(eeprom9_t *ctx, id_data_t *id_data)
EEPROM 9 read identification function.
err_t eeprom9_read_memory(eeprom9_t *ctx, uint32_t mem_addr, uint8_t *data_out, uint8_t len)
EEPROM 9 memory reading function.
err_t eeprom9_set_write_enable(eeprom9_t *ctx, uint8_t en_write)
EEPROM 9 enable write function.
err_t eeprom9_page_erase(eeprom9_t *ctx, uint32_t page_addr)
EEPROM 9 memory page erase function.
err_t eeprom9_send_cmd(eeprom9_t *ctx, uint8_t cmd)
EEPROM 9 send command function.
This file contains SPI specific macros, functions, etc.
EEPROM 9 Click configuration object.
Definition eeprom9.h:198
pin_name_t hld
Definition eeprom9.h:207
spi_master_chip_select_polarity_t cs_polarity
Definition eeprom9.h:212
pin_name_t sck
Definition eeprom9.h:202
spi_master_mode_t spi_mode
Definition eeprom9.h:211
pin_name_t mosi
Definition eeprom9.h:201
uint32_t spi_speed
Definition eeprom9.h:210
pin_name_t wp
Definition eeprom9.h:206
pin_name_t miso
Definition eeprom9.h:200
pin_name_t cs
Definition eeprom9.h:203
EEPROM 9 Click context object.
Definition eeprom9.h:181
digital_out_t hld
Definition eeprom9.h:184
spi_master_t spi
Definition eeprom9.h:187
pin_name_t chip_select
Definition eeprom9.h:189
digital_out_t wp
Definition eeprom9.h:183
EEPROM 9 Click identification data.
Definition eeprom9.h:221
uint8_t spi_code
Definition eeprom9.h:223
uint8_t memory_density
Definition eeprom9.h:224
uint8_t manufact_code
Definition eeprom9.h:222