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 SRAM4_REG_RDSR 0x05
75#define SRAM4_REG_FAST_RDSR 0x09
76#define SRAM4_REG_WRSR 0x01
77#define SRAM4_REG_WREN 0x06
78#define SRAM4_REG_WRDI 0x04
79#define SRAM4_REG_READ 0x03
80#define SRAM4_REG_FAST_READ 0x0B
81#define SRAM4_REG_WRITE 0x02
82#define SRAM4_REG_STORE 0x3C
83#define SRAM4_REG_RECALL 0x60
84#define SRAM4_REG_ASENB 0x59
85#define SRAM4_REG_ASDISB 0x19
86#define SRAM4_REG_SLEEP 0xB9
87#define SRAM4_REG_WRSN 0xC2
88#define SRAM4_REG_RDSN 0xC3
89#define SRAM4_REG_FAST_RDSN 0xC9
90#define SRAM4_REG_RDID 0x9F
91#define SRAM4_REG_FAST_RDID 0x9E
109#define SRAM4_DEVICE_ID 0x06818818
119#define SRAM4_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
120#define SRAM4_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
138#define SRAM4_MAP_MIKROBUS( cfg, mikrobus ) \
139 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
140 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
141 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
142 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
143 cfg.hold = MIKROBUS( mikrobus, MIKROBUS_PWM );
err_t sram4_generic_read(sram4_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
SRAM 4 data reading function.
err_t sram4_default_cfg(sram4_t *ctx)
SRAM 4 default configuration function.
err_t sram4_generic_write_then_read(sram4_t *ctx, uint8_t *data_in, uint8_t in_len, uint8_t *data_out, uint8_t out_len)
SRAM 4 data writing and reading function.
err_t sram4_init(sram4_t *ctx, sram4_cfg_t *cfg)
SRAM 4 initialization function.
void sram4_cfg_setup(sram4_cfg_t *cfg)
SRAM 4 configuration object setup function.
err_t sram4_generic_command(sram4_t *ctx, uint8_t cmd)
SRAM 4 command writing function.
void sram4_set_hold(sram4_t *ctx, uint8_t state)
Set HOLD pin state.
err_t sram4_memory_read(sram4_t *ctx, uint16_t memory_adr, uint8_t *read_data, uint8_t read_len)
Read data from memory.
err_t sram4_generic_write(sram4_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
SRAM 4 data writing function.
err_t sram4_memory_write(sram4_t *ctx, uint16_t memory_adr, uint8_t *write_data, uint8_t write_len)
Write data to memory.
This file contains SPI specific macros, functions, etc.
sram4_return_value_t
SRAM 4 Click return value data.
Definition sram4.h:192
@ SRAM4_ERROR
Definition sram4.h:194
@ SRAM4_OK
Definition sram4.h:193
SRAM 4 Click configuration object.
Definition sram4.h:170
spi_master_chip_select_polarity_t cs_polarity
Definition sram4.h:183
pin_name_t sck
Definition sram4.h:174
spi_master_mode_t spi_mode
Definition sram4.h:182
pin_name_t mosi
Definition sram4.h:173
uint32_t spi_speed
Definition sram4.h:181
pin_name_t miso
Definition sram4.h:172
pin_name_t hold
Definition sram4.h:178
pin_name_t cs
Definition sram4.h:175
SRAM 4 Click context object.
Definition sram4.h:153
spi_master_t spi
Definition sram4.h:158
digital_out_t hold
Definition sram4.h:155
uint32_t device_id
Definition sram4.h:161
pin_name_t chip_select
Definition sram4.h:160