Go to the documentation of this file.
35 #include "mikrosdk_version.h"
38 #if mikroSDK_GET_VERSION < 20800ul
39 #include "rcu_delays.h"
45 #include "drv_digital_out.h"
46 #include "drv_digital_in.h"
47 #include "drv_i2c_master.h"
69 #define NVSRAM_MEM_CTL_REG 0x00
70 #define NVSRAM_SERIAL_NUM_REG_1 0x01
71 #define NVSRAM_SERIAL_NUM_REG_2 0x02
72 #define NVSRAM_SERIAL_NUM_REG_3 0x03
73 #define NVSRAM_SERIAL_NUM_REG_4 0x04
74 #define NVSRAM_SERIAL_NUM_REG_5 0x05
75 #define NVSRAM_SERIAL_NUM_REG_6 0x06
76 #define NVSRAM_SERIAL_NUM_REG_7 0x07
77 #define NVSRAM_SERIAL_NUM_REG_8 0x08
78 #define NVSRAM_DEV_ID_REG_1 0x09
79 #define NVSRAM_DEV_ID_REG_2 0x0A
80 #define NVSRAM_DEV_ID_REG_3 0x0B
81 #define NVSRAM_DEV_ID_REG_4 0x0C
82 #define NVSRAM_CMD_REG 0xAA
100 #define NVSRAM_I2C_MEM_SEL 0x50
106 #define NVSRAM_CMD_STORE 0x3C
107 #define NVSRAM_CMD_RECALL 0x60
108 #define NVSRAM_CMD_ASENB 0x59
109 #define NVSRAM_CMD_ASDISB 0x19
110 #define NVSRAM_CMD_SLEEP 0xB9
116 #define NVSRAM_BP_NONE 0x00
117 #define NVSRAM_BP_QUARTER 0x04
118 #define NVSRAM_BP_HALF 0x08
119 #define NVSRAM_BP_ALL 0x0C
120 #define NVSRAM_NO_SNL 0x00
121 #define NVSRAM_SNL 0x40
127 #define NVSRAM_WRITE_MEMORY_DISABLE 0x00
128 #define NVSRAM_WRITE_MEMORY_ENABLE 0x01
134 #define NVSRAM_I2C_SLAVE_ADDR_0 0x18
135 #define NVSRAM_I2C_SLAVE_ADDR_1 0x1A
136 #define NVSRAM_I2C_SLAVE_ADDR_2 0x1C
137 #define NVSRAM_I2C_SLAVE_ADDR_3 0x1E
155 #define NVSRAM_MAP_MIKROBUS( cfg, mikrobus ) \
156 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
157 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
158 cfg.wp = MIKROBUS( mikrobus, MIKROBUS_PWM )
err_t nvsram_generic_read(nvsram_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
nvSRAM I2C reading function.
uint8_t i2c_address
Definition: nvsram.h:192
uint32_t i2c_speed
Definition: nvsram.h:191
err_t nvsram_init(nvsram_t *ctx, nvsram_cfg_t *cfg)
nvSRAM initialization function.
void nvsram_burst_reg_read(nvsram_t *ctx, uint8_t reg, uint8_t *p_rx_data, uint8_t n_bytes)
Burst register read function.
void nvsram_enable_memory_write(nvsram_t *ctx, uint8_t en_wr_mem)
Enable memory write function.
void nvsram_burst_reg_write(nvsram_t *ctx, uint8_t reg, uint8_t *p_tx_data, uint8_t n_bytes)
Burst register write function.
nvSRAM Click context object.
Definition: nvsram.h:168
@ NVSRAM_OK
Definition: nvsram.h:202
uint8_t nvsram_reg_read(nvsram_t *ctx, uint8_t reg)
Generic read the byte of data function.
err_t nvsram_generic_write(nvsram_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
nvSRAM I2C writing function.
void nvsram_memory_write(nvsram_t *ctx, uint32_t mem_adr, uint8_t *p_tx_data, uint16_t n_bytes)
Write memory function.
@ NVSRAM_ERROR
Definition: nvsram.h:203
void nvsram_memory_read(nvsram_t *ctx, uint32_t mem_adr, uint8_t *p_rx_data, uint16_t n_bytes)
Read memory function.
nvSRAM Click configuration object.
Definition: nvsram.h:185
digital_out_t wp
Definition: nvsram.h:170
uint8_t slave_address
Definition: nvsram.h:176
pin_name_t scl
Definition: nvsram.h:186
nvsram_return_value_t
nvSRAM Click return value data.
Definition: nvsram.h:201
void nvsram_reg_write(nvsram_t *ctx, uint8_t reg, uint8_t tx_data)
Generic write the byte of data function.
pin_name_t sda
Definition: nvsram.h:187
void nvsram_send_cmd(nvsram_t *ctx, uint8_t cmd)
Send command function.
void nvsram_cfg_setup(nvsram_cfg_t *cfg)
nvSRAM configuration object setup function.
i2c_master_t i2c
Definition: nvsram.h:173
uint32_t nvsram_read_dev_id(nvsram_t *ctx)
Read device ID function.
pin_name_t wp
Definition: nvsram.h:189