42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
54#include "drv_spi_master.h"
67#define SRAM_MAP_MIKROBUS( cfg, mikrobus ) \
68 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
69 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
70 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
71 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
72 cfg.hld = MIKROBUS( mikrobus, MIKROBUS_RST )
79#define SRAM_RETVAL uint8_t
82#define SRAM_INIT_ERROR 0xFF
89#define SRAM_CMD_WRMR 0x01
90#define SRAM_CMD_WRITE 0x02
91#define SRAM_CMD_READ 0x03
92#define SRAM_CMD_RDMR 0x05
93#define SRAM_CMD_EQIO 0x38
94#define SRAM_CMD_EDIO 0x3B
95#define SRAM_CMD_RSTIO 0xFF
102#define SRAM_MODE_REG_BM 0x00
103#define SRAM_MODE_REG_PM 0x80
104#define SRAM_MODE_REG_SM 0x40
164 // End constants group
173 // End variable group
#define SRAM_RETVAL
Definition sram.h:79
void sram_generic_transfer(sram_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
Generic transfer function.
SRAM_RETVAL sram_init(sram_t *ctx, sram_cfg_t *cfg)
Initialization function.
void sram_soft_reset(sram_t *ctx)
Soft reset funcion.
uint8_t sram_read_mode_reg_ins(sram_t *ctx)
Read mode register instruction funcion.
void sram_write_byte(sram_t *ctx, uint32_t reg_address, uint8_t write_data)
Generic write byte of data funcion.
void sram_cfg_setup(sram_cfg_t *cfg)
Config Object Initialization function.
void sram_generic_write(sram_t *ctx, uint8_t *wr_buf, uint16_t wr_len)
Generic write function.
uint8_t sram_read_byte(sram_t *ctx, uint32_t reg_address)
Generic read byte of data funcion.
void sram_hold_transmission(sram_t *ctx)
Suspend transmission funcion.
void sram_write_mode_reg_ins(sram_t *ctx, uint8_t ins_data)
Write mode register instruction funcion.
Click configuration structure definition.
Definition sram.h:135
uint8_t spi_mode
Definition sram.h:150
pin_name_t hld
Definition sram.h:145
spi_master_chip_select_polarity_t cs_polarity
Definition sram.h:151
pin_name_t sck
Definition sram.h:140
pin_name_t mosi
Definition sram.h:139
uint32_t spi_speed
Definition sram.h:149
pin_name_t miso
Definition sram.h:138
pin_name_t cs
Definition sram.h:141
Click ctx object definition.
Definition sram.h:118
digital_out_t cs
Definition sram.h:122
digital_out_t hld
Definition sram.h:121
spi_master_t spi
Definition sram.h:126
pin_name_t chip_select
Definition sram.h:127