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 EERAM3_OPCODE_WREN 0x06
75#define EERAM3_OPCODE_WRDI 0x04
76#define EERAM3_OPCODE_WRITE 0x02
77#define EERAM3_OPCODE_READ 0x03
78#define EERAM3_OPCODE_RDLSWA 0x0A
79#define EERAM3_OPCODE_SECURE_WRITE 0x12
80#define EERAM3_OPCODE_SECURE_READ 0x13
81#define EERAM3_OPCODE_WRSR 0x01
82#define EERAM3_OPCODE_RDSR 0x05
83#define EERAM3_OPCODE_STORE 0x08
84#define EERAM3_OPCODE_RECALL 0x09
85#define EERAM3_OPCODE_WRNUR 0xC2
86#define EERAM3_OPCODE_RDNUR 0xC3
87#define EERAM3_OPCODE_HIBERNATE 0xB9
105#define EERAM3_RDY_BIT_MASK 0x01
106#define EERAM3_WEL_BIT_MASK 0x02
107#define EERAM3_BLOCK_PROTECT_BITS_MASK 0x0C
108#define EERAM3_BLOCK_PROTECT_NONE 0x00
109#define EERAM3_BLOCK_PROTECT_UPPER_QUARTER 0x04
110#define EERAM3_BLOCK_PROTECT_UPPER_HALF 0x08
111#define EERAM3_BLOCK_PROTECT_ALL 0x0C
112#define EERAM3_SWM_BIT_MASK 0x10
113#define EERAM3_PRO_BIT_MASK 0x20
114#define EERAM3_ASE_BIT_MASK 0x40
120#define EERAM3_MIN_ADDRESS 0x0000
121#define EERAM3_MAX_ADDRESS 0x7FFF
122#define EERAM3_MAX_PAGE_ADDRESS 0x3F
132#define EERAM3_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
133#define EERAM3_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
151#define EERAM3_MAP_MIKROBUS( cfg, mikrobus ) \
152 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
153 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
154 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
155 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
156 cfg.hld = MIKROBUS( mikrobus, MIKROBUS_INT )
eeram3_return_value_t
EERAM 3 Click return value data.
Definition eeram3.h:204
@ EERAM3_ERROR
Definition eeram3.h:206
@ EERAM3_OK
Definition eeram3.h:205
err_t eeram3_write_status(eeram3_t *ctx, uint8_t status)
EERAM 3 write status function.
void eeram3_wakeup_from_hibernate(eeram3_t *ctx)
EERAM 3 wake up from hibernate function.
void eeram3_set_hld_pin(eeram3_t *ctx, uint8_t state)
EERAM 3 set HLD pin function.
err_t eeram3_store_data(eeram3_t *ctx)
EERAM 3 store data function.
err_t eeram3_memory_secure_read(eeram3_t *ctx, uint16_t address, uint8_t *data_out, uint8_t len)
EERAM 3 memory secure read function.
void eeram3_default_cfg(eeram3_t *ctx)
EERAM 3 default configuration function.
err_t eeram3_memory_read(eeram3_t *ctx, uint16_t address, uint8_t *data_out, uint16_t len)
EERAM 3 memory read function.
err_t eeram3_nv_user_space_write(eeram3_t *ctx, uint16_t data_in)
EERAM 3 nv user space write function.
err_t eeram3_recall_data(eeram3_t *ctx)
EERAM 3 recall data function.
err_t eeram3_memory_write(eeram3_t *ctx, uint16_t address, uint8_t *data_in, uint16_t len)
EERAM 3 memory write function.
err_t eeram3_enable_write(eeram3_t *ctx)
EERAM 3 enable write function.
err_t eeram3_disable_write(eeram3_t *ctx)
EERAM 3 disable write function.
err_t eeram3_nv_user_space_read(eeram3_t *ctx, uint16_t *data_out)
EERAM 3 nv user space read function.
err_t eeram3_set_block_protection(eeram3_t *ctx, uint8_t block_protect)
EERAM 3 set block protection function.
err_t eeram3_init(eeram3_t *ctx, eeram3_cfg_t *cfg)
EERAM 3 initialization function.
void eeram3_cfg_setup(eeram3_cfg_t *cfg)
EERAM 3 configuration object setup function.
err_t eeram3_write_opcode(eeram3_t *ctx, uint8_t opcode)
EERAM 3 write opcode function.
err_t eeram3_autostore_disable(eeram3_t *ctx)
EERAM 3 autostore disable function.
err_t eeram3_read_status(eeram3_t *ctx, uint8_t *status)
EERAM 3 read status function.
err_t eeram3_autostore_enable(eeram3_t *ctx)
EERAM 3 autostore enable function.
err_t eeram3_read_opcode(eeram3_t *ctx, uint8_t opcode, uint8_t *data_out, uint8_t len)
EERAM 3 read opcode function.
err_t eeram3_enter_hibernate_mode(eeram3_t *ctx)
EERAM 3 enter hibernate mode function.
err_t eeram3_read_last_written_address(eeram3_t *ctx, uint16_t *address)
EERAM 3 read last written address function.
err_t eeram3_memory_secure_write(eeram3_t *ctx, uint16_t address, uint8_t *data_in, uint8_t len)
EERAM 3 memory write function.
This file contains SPI specific macros, functions, etc.
EERAM 3 Click configuration object.
Definition eeram3.h:182
pin_name_t hld
Definition eeram3.h:190
spi_master_chip_select_polarity_t cs_polarity
Definition eeram3.h:195
pin_name_t sck
Definition eeram3.h:186
spi_master_mode_t spi_mode
Definition eeram3.h:194
pin_name_t mosi
Definition eeram3.h:185
uint32_t spi_speed
Definition eeram3.h:193
pin_name_t miso
Definition eeram3.h:184
pin_name_t cs
Definition eeram3.h:187
EERAM 3 Click context object.
Definition eeram3.h:166
digital_out_t hld
Definition eeram3.h:168
spi_master_t spi
Definition eeram3.h:171
pin_name_t chip_select
Definition eeram3.h:173