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"
68#define MRAM_MAP_MIKROBUS( cfg, mikrobus ) \
69 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
70 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
71 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
72 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
73 cfg.wp = MIKROBUS( mikrobus, MIKROBUS_RST ); \
74 cfg.hld = MIKROBUS( mikrobus, MIKROBUS_INT )
89#define MRAM_WRITE_ENABLE_BIT 0x02
90#define MRAM_MEMORY_BLOCK_BIT0 0x04
91#define MRAM_MEMORY_BLOCK_BIT1 0x08
92#define MRAM_STATUS_WRITE_DISABLE_BIT 0x80
93#define MRAM_FIRST_ADDRESS_LOCATION 0x0000
94#define MRAM_ADDRESS_LOCATION_0 0x000F
95#define MRAM_ADDRESS_LOCATION_1 0x00FF
96#define MRAM_ADDRESS_LOCATION_2 0x0FFF
97#define MRAM_LAST_ADDRESS_LOCATION 0x7FFF
98#define MRAM_LOGIC_HIGH 0x01
99#define MRAM_LOGIC_LOW 0x00
100#define MRAM_NONE_PROTECTED_MEMORY 0x82
101#define MRAM_UPPER_QUARTER_PROTECTED_MEMORY 0x86
102#define MRAM_UPPER_HALF_PROTECTED_MEMORY 0x8A
103#define MRAM_ALL_PROTECTED_MEMORY 0x8E
void mram_write_status_reg(mram_t *ctx, uint8_t transfer_data)
Write status reg.
uint8_t mram_check_status_bit(mram_t *ctx, uint8_t status_bit)
Check status bit.
void mram_wake_up_mode(mram_t *ctx)
Wake up.
void mram_enable_write_protect(mram_t *ctx, uint8_t state)
Enable write protection.
void mram_enter_sleep_mode(mram_t *ctx)
Sleep mode.
void mram_default_cfg(mram_t *ctx)
Click Default Configuration function.
void mram_enable_hold_mode(mram_t *ctx, uint8_t state)
Enable hold mode.
void mram_cfg_setup(mram_cfg_t *cfg)
Config Object Initialization function.
uint8_t mram_disable_write(mram_t *ctx)
Disable write.
err_t mram_init(mram_t *ctx, mram_cfg_t *cfg)
Initialization function.
uint8_t mram_enable_write(mram_t *ctx)
Enable write.
void mram_write_data_bytes(mram_t *ctx, const uint16_t address, uint8_t *buffer, const uint16_t n_bytes)
Write n byte data.
uint8_t mram_read_status_reg(mram_t *ctx)
Read status reg.
void mram_generic_transfer(mram_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
Generic transfer function.
void mram_read_data_bytes(mram_t *ctx, const uint16_t address, uint8_t *buffer, const uint16_t n_bytes)
Read n byte data.
Click configuration structure definition.
Definition mram.h:134
pin_name_t hld
Definition mram.h:145
spi_master_chip_select_polarity_t cs_polarity
Definition mram.h:151
pin_name_t sck
Definition mram.h:139
spi_master_mode_t spi_mode
Definition mram.h:150
pin_name_t mosi
Definition mram.h:138
uint32_t spi_speed
Definition mram.h:149
pin_name_t wp
Definition mram.h:144
pin_name_t miso
Definition mram.h:137
pin_name_t cs
Definition mram.h:140
Click ctx object definition.
Definition mram.h:117
digital_out_t cs
Definition mram.h:122
digital_out_t hld
Definition mram.h:121
spi_master_t spi
Definition mram.h:125
pin_name_t chip_select
Definition mram.h:126
digital_out_t wp
Definition mram.h:120