nvsram3 2.0.0.0
nvsram3.h File Reference

This file contains API for nvSRAM 3 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  nvsram3_t
 nvSRAM 3 Click context object. More...
 
struct  nvsram3_cfg_t
 nvSRAM 3 Click configuration object. More...
 
struct  nvsram3_rtc_time_t
 
struct  nvsram3_rtc_date_t
 
struct  nvsram3_rtc_alarm_t
 

Macros

#define NVSRAM3_CONTROL_REG_MEM_CTRL   0x00
 nvSRAM 3 Control Registers Map.
 
#define NVSRAM3_CONTROL_REG_SERIAL_NUMBER   0x01
 
#define NVSRAM3_CONTROL_REG_DEVICE_ID   0x09
 
#define NVSRAM3_CONTROL_REG_CMD   0xAA
 
#define NVSRAM3_RTC_REG_FLAGS   0x00
 nvSRAM 3 RTC Registers Map.
 
#define NVSRAM3_RTC_REG_TIME_KEEPING_CENTURIES   0x01
 
#define NVSRAM3_RTC_REG_ALARM_SECONDS   0x02
 
#define NVSRAM3_RTC_REG_ALARM_MINUTES   0x03
 
#define NVSRAM3_RTC_REG_ALARM_HOURS   0x04
 
#define NVSRAM3_RTC_REG_ALARM_DAY   0x05
 
#define NVSRAM3_RTC_REG_INTERRUPT_STATUS_CONTROL   0x06
 
#define NVSRAM3_RTC_REG_WATCHDOG_TIMER   0x07
 
#define NVSRAM3_RTC_REG_CALIBRATION_CONTROL   0x08
 
#define NVSRAM3_RTC_REG_TIME_KEEPING_SECONDS   0x09
 
#define NVSRAM3_RTC_REG_TIME_KEEPING_MINUTES   0x0A
 
#define NVSRAM3_RTC_REG_TIME_KEEPING_HOURS   0x0B
 
#define NVSRAM3_RTC_REG_TIME_KEEPING_DAY   0x0C
 
#define NVSRAM3_RTC_REG_TIME_KEEPING_DATE   0x0D
 
#define NVSRAM3_RTC_REG_TIME_KEEPING_MONTHS   0x0E
 
#define NVSRAM3_RTC_REG_TIME_KEEPING_YEARS   0x0F
 
#define NVSRAM3_SERIAL_NUMBER_LOCK   0x40
 nvSRAM 3 Control Registers description setting.
 
#define NVSRAM3_SERIAL_NUMBER_UNLOCK   0x00
 
#define NVSRAM3_BLOCK_PROTECT_QUARTER   0x04
 
#define NVSRAM3_BLOCK_PROTECT_HALF   0x08
 
#define NVSRAM3_BLOCK_PROTECT_FULL   0x0C
 
#define NVSRAM3_STORE_COMMAND   0x3C
 
#define NVSRAM3_RECALL_COMMAND   0x60
 
#define NVSRAM3_ASENB_COMMAND   0x59
 
#define NVSRAM3_ASDISB_COMMAND   0x19
 
#define NVSRAM3_SLEEP_COMMAND   0xB9
 
#define NVSRAM3_RTC_WRITE_ENABLE   0x02
 nvSRAM 3 RTC Registers description setting.
 
#define NVSRAM3_RTC_WRITE_DISABLE   0x00
 
#define NVSRAM3_RTC_READ_ENABLE   0x01
 
#define NVSRAM3_RTC_READ_DISABLE   0x00
 
#define NVSRAM3_MEMORY_DEV_ADDR_0   0x50
 nvSRAM 3 device address setting.
 
#define NVSRAM3_MEMORY_DEV_ADDR_1   0x52
 
#define NVSRAM3_MEMORY_DEV_ADDR_2   0x54
 
#define NVSRAM3_MEMORY_DEV_ADDR_3   0x56
 
#define NVSRAM3_RTC_DEV_ADDR_0   0x68
 
#define NVSRAM3_RTC_DEV_ADDR_1   0x6A
 
#define NVSRAM3_RTC_DEV_ADDR_2   0x6C
 
#define NVSRAM3_RTC_DEV_ADDR_3   0x6E
 
#define NVSRAM3_CONTROL_DEV_ADDR_0   0x18
 
#define NVSRAM3_CONTROL_DEV_ADDR_1   0x1A
 
#define NVSRAM3_CONTROL_DEV_ADDR_2   0x1C
 
#define NVSRAM3_CONTROL_DEV_ADDR_3   0x1E
 
#define NVSRAM3_HSB_ENABLE   0x00
 nvSRAM 3 pins setting.
 
#define NVSRAM3_HSB_DISABLE   0x01
 
#define NVSRAM3_WP_ENABLE   0x00
 
#define NVSRAM3_WP_DISABLE   0x01
 
#define NVSRAM3_SUCCESS   0
 nvSRAM 3 error status.
 
#define NVSRAM3_ERROR   -1
 
#define NVSRAM3_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Functions

void nvsram3_cfg_setup (nvsram3_cfg_t *cfg)
 nvSRAM 3 configuration object setup function.
 
err_t nvsram3_init (nvsram3_t *ctx, nvsram3_cfg_t *cfg)
 nvSRAM 3 initialization function.
 
err_t nvsram3_default_cfg (nvsram3_t *ctx)
 nvSRAM 3 default configuration function.
 
err_t nvsram3_generic_write (nvsram3_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
 nvSRAM 3 I2C writing function.
 
err_t nvsram3_generic_read (nvsram3_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
 nvSRAM 3 I2C reading function.
 
err_t nvsram3_send_cmd (nvsram3_t *ctx, uint8_t cmd)
 nvSRAM 3 send command function.
 
err_t nvsram3_memory_write (nvsram3_t *ctx, uint32_t mem_addr, uint8_t *data_in, uint8_t n_bytes)
 nvSRAM 3 write memory function.
 
err_t nvsram3_memory_read (nvsram3_t *ctx, uint32_t mem_addr, uint8_t *data_out, uint8_t n_bytes)
 nvSRAM 3 read memory function.
 
uint32_t nvsram3_get_device_id (nvsram3_t *ctx)
 nvSRAM 3 get device ID function.
 
err_t nvsram3_rtc_read_reg (nvsram3_t *ctx, uint8_t rtc_reg, uint8_t *data_out)
 nvSRAM 3 RTC read register function.
 
err_t nvsram3_rtc_write_reg (nvsram3_t *ctx, uint8_t rtc_reg, uint8_t data_in)
 nvSRAM 3 RTC write register function.
 
void nvsram3_get_rtc_time (nvsram3_t *ctx, nvsram3_rtc_time_t *rtc_time)
 nvSRAM 3 get RTC time function.
 
err_t nvsram3_set_rtc_time (nvsram3_t *ctx, nvsram3_rtc_time_t rtc_time)
 nvSRAM 3 set RTC time function.
 
void nvsram3_get_rtc_date (nvsram3_t *ctx, nvsram3_rtc_date_t *rtc_date)
 nvSRAM 3 get RTC date function.
 
err_t nvsram3_set_rtc_date (nvsram3_t *ctx, nvsram3_rtc_date_t rtc_date)
 nvSRAM 3 set RTC date function.
 
void nvsram3_get_rtc_alarm (nvsram3_t *ctx, nvsram3_rtc_alarm_t *rtc_alarm)
 nvSRAM 3 get RTC alarm function.
 
err_t nvsram3_set_rtc_alarm (nvsram3_t *ctx, nvsram3_rtc_alarm_t rtc_alarm)
 nvSRAM 3 set RTC alarm function.
 
err_t nvsram3_hardware_store (nvsram3_t *ctx, uint8_t state)
 nvSRAM 3 hardware store function.
 
err_t nvsram3_hw_write_protection (nvsram3_t *ctx, uint8_t state)
 nvSRAM 3 write protection function.
 

Detailed Description

This file contains API for nvSRAM 3 Click Driver.