nvsram 2.0.0.0
nvsram.h File Reference

This file contains API for nvSRAM Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  nvsram_t
 nvSRAM Click context object. More...
 
struct  nvsram_cfg_t
 nvSRAM Click configuration object. More...
 

Macros

#define NVSRAM_MEM_CTL_REG   0x00
 nvSRAM description of control registers.
 
#define NVSRAM_SERIAL_NUM_REG_1   0x01
 
#define NVSRAM_SERIAL_NUM_REG_2   0x02
 
#define NVSRAM_SERIAL_NUM_REG_3   0x03
 
#define NVSRAM_SERIAL_NUM_REG_4   0x04
 
#define NVSRAM_SERIAL_NUM_REG_5   0x05
 
#define NVSRAM_SERIAL_NUM_REG_6   0x06
 
#define NVSRAM_SERIAL_NUM_REG_7   0x07
 
#define NVSRAM_SERIAL_NUM_REG_8   0x08
 
#define NVSRAM_DEV_ID_REG_1   0x09
 
#define NVSRAM_DEV_ID_REG_2   0x0A
 
#define NVSRAM_DEV_ID_REG_3   0x0B
 
#define NVSRAM_DEV_ID_REG_4   0x0C
 
#define NVSRAM_CMD_REG   0xAA
 
#define NVSRAM_I2C_MEM_SEL   0x50
 nvSRAM description setting.
 
#define NVSRAM_CMD_STORE   0x3C
 nvSRAM description of commands.
 
#define NVSRAM_CMD_RECALL   0x60
 
#define NVSRAM_CMD_ASENB   0x59
 
#define NVSRAM_CMD_ASDISB   0x19
 
#define NVSRAM_CMD_SLEEP   0xB9
 
#define NVSRAM_BP_NONE   0x00
 nvSRAM description of block protection.
 
#define NVSRAM_BP_QUARTER   0x04
 
#define NVSRAM_BP_HALF   0x08
 
#define NVSRAM_BP_ALL   0x0C
 
#define NVSRAM_NO_SNL   0x00
 
#define NVSRAM_SNL   0x40
 
#define NVSRAM_WRITE_MEMORY_DISABLE   0x00
 nvSRAM description of memory enable and disable.
 
#define NVSRAM_WRITE_MEMORY_ENABLE   0x01
 
#define NVSRAM_I2C_SLAVE_ADDR_0   0x18
 nvSRAM control registers slave.
 
#define NVSRAM_I2C_SLAVE_ADDR_1   0x1A
 
#define NVSRAM_I2C_SLAVE_ADDR_2   0x1C
 
#define NVSRAM_I2C_SLAVE_ADDR_3   0x1E
 
#define NVSRAM_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  nvsram_return_value_t { NVSRAM_OK = 0 , NVSRAM_ERROR = -1 }
 nvSRAM Click return value data. More...
 

Functions

void nvsram_cfg_setup (nvsram_cfg_t *cfg)
 nvSRAM configuration object setup function.
 
err_t nvsram_init (nvsram_t *ctx, nvsram_cfg_t *cfg)
 nvSRAM initialization function.
 
err_t nvsram_generic_write (nvsram_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
 nvSRAM I2C writing function.
 
err_t nvsram_generic_read (nvsram_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
 nvSRAM I2C reading function.
 
void nvsram_reg_write (nvsram_t *ctx, uint8_t reg, uint8_t tx_data)
 Generic write the byte of data function.
 
uint8_t nvsram_reg_read (nvsram_t *ctx, uint8_t reg)
 Generic read the byte of data 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.
 
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_send_cmd (nvsram_t *ctx, uint8_t cmd)
 Send command function.
 
uint32_t nvsram_read_dev_id (nvsram_t *ctx)
 Read device ID function.
 
void nvsram_memory_write (nvsram_t *ctx, uint32_t mem_adr, uint8_t *p_tx_data, uint16_t n_bytes)
 Write memory function.
 
void nvsram_memory_read (nvsram_t *ctx, uint32_t mem_adr, uint8_t *p_rx_data, uint16_t n_bytes)
 Read memory function.
 
void nvsram_enable_memory_write (nvsram_t *ctx, uint8_t en_wr_mem)
 Enable memory write function.
 

Detailed Description

This file contains API for nvSRAM Click Driver.

Enumeration Type Documentation

◆ nvsram_return_value_t

nvSRAM Click return value data.

Predefined enum values for driver return values.

Enumerator
NVSRAM_OK 
NVSRAM_ERROR