nvsram4 2.0.0.0
nvsram4.h File Reference

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

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_spi_master.h"

Go to the source code of this file.

Data Structures

struct  nvsram4_t
 nvSRAM 4 Click context object. More...
 
struct  nvsram4_cfg_t
 nvSRAM 4 Click configuration object. More...
 
struct  nvsram4_rtc_time_t
 
struct  nvsram4_rtc_date_t
 
struct  nvsram4_rtc_alarm_t
 

Macros

#define NVSRAM4_STATUS_RDY   0x01
 nvSRAM 4 description Status and RTC Register Map.
 
#define NVSRAM4_STATUS_WEN   0x02
 
#define NVSRAM4_STATUS_BP0   0x04
 
#define NVSRAM4_STATUS_BP1   0x08
 
#define NVSRAM4_STATUS_SNL   0x40
 
#define NVSRAM4_STATUS_WPEN   0x80
 
#define NVSRAM4_RTC_FLAGS   0x00
 
#define NVSRAM4_RTC_TK_CENTURIES   0x01
 
#define NVSRAM4_RTC_ALARM_SECONDS   0x02
 
#define NVSRAM4_RTC_ALARM_MINUTES   0x03
 
#define NVSRAM4_RTC_ALARM_HOURS   0x04
 
#define NVSRAM4_RTC_ALARM_DAY   0x05
 
#define NVSRAM4_RTC_INTERRUPT_STATUS   0x06
 
#define NVSRAM4_RTC_WATCHDOG_TIMER   0x07
 
#define NVSRAM4_RTC_CALIBRATION   0x08
 
#define NVSRAM4_RTC_TK_SECONDS   0x09
 
#define NVSRAM4_RTC_TK_MINUTES   0x0A
 
#define NVSRAM4_RTC_TK_HOURS   0x0B
 
#define NVSRAM4_RTC_TK_DAY   0x0C
 
#define NVSRAM4_RTC_TK_DATE   0x0D
 
#define NVSRAM4_RTC_TK_MONTHS   0x0E
 
#define NVSRAM4_RTC_TK_YEARS   0x0F
 
#define NVSRAM4_STATUS_RDSR   0x05
 nvSRAM 4 Status Register Control Instructions setting.
 
#define NVSRAM4_STATUS_FRDSR   0x0A
 
#define NVSRAM4_STATUS_WRSR   0x01
 
#define NVSRAM4_STATUS_WREN   0x06
 
#define NVSRAM4_STATUS_WRDI   0x04
 
#define NVSRAM4_SRAM_READ   0x03
 nvSRAM 4 SRAM Read/Write Instructions setting.
 
#define NVSRAM4_SRAM_FREAD   0x0B
 
#define NVSRAM4_SRAM_WRITE   0x02
 
#define NVSRAM4_SRAM_RDRTC   0x13
 nvSRAM 4 RTC Read/Write Instructions setting.
 
#define NVSRAM4_SRAM_FAST_RDRTC   0x1D
 
#define NVSRAM4_SRAM_WRTC   0x12
 
#define NVSRAM4_SPEC_NV_STORE   0x3C
 nvSRAM 4 Special NV Instructions setting.
 
#define NVSRAM4_SPEC_NV_RECALL   0x60
 
#define NVSRAM4_SPEC_NV_ASENB   0x59
 
#define NVSRAM4_SPEC_NV_ASDISB   0x19
 
#define NVSRAM4_SPEC_SLEEP   0xB9
 nvSRAM 4 Special Instructions setting.
 
#define NVSRAM4_SPEC_WRSN   0xC2
 
#define NVSRAM4_SPEC_RDSN   0xC3
 
#define NVSRAM4_SPEC_FRDSN   0xC9
 
#define NVSRAM4_SPEC_RDID   0x9F
 
#define NVSRAM4_SPEC_FRDID   0x99
 
#define NVSRAM4_STATUS_RDY   0x01
 nvSRAM 4 description Status and RTC Register Map.
 
#define NVSRAM4_STATUS_WEN   0x02
 
#define NVSRAM4_STATUS_BP0   0x04
 
#define NVSRAM4_STATUS_BP1   0x08
 
#define NVSRAM4_STATUS_SNL   0x40
 
#define NVSRAM4_STATUS_WPEN   0x80
 
#define NVSRAM4_HOLD_ENABLE   0x00
 nvSRAM 4 HLD pin state.
 
#define NVSRAM4_HOLD_DISABLE   0x01
 
#define NVSRAM4_HSB_ENABLE   0x00
 nvSRAM 4 HSB pin state.
 
#define NVSRAM4_HSB_DISABLE   0x01
 
#define NVSRAM4_WP_ENABLE   0x00
 nvSRAM 4 WP pin state.
 
#define NVSRAM4_WP_DISABLE   0x01
 
#define NVSRAM4_SUCCESS   0
 nvSRAM 4 error status.
 
#define NVSRAM4_ERROR   -1
 
#define NVSRAM4_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Functions

void nvsram4_cfg_setup (nvsram4_cfg_t *cfg)
 nvSRAM 4 configuration object setup function.
 
err_t nvsram4_init (nvsram4_t *ctx, nvsram4_cfg_t *cfg)
 nvSRAM 4 initialization function.
 
void nvsram4_default_cfg (nvsram4_t *ctx)
 nvSRAM 4 default configuration function.
 
err_t nvsram4_generic_write (nvsram4_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 nvSRAM 4 data writing function.
 
err_t nvsram4_generic_read (nvsram4_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 nvSRAM 4 data reading function.
 
err_t nvsram4_set_cmd (nvsram4_t *ctx, uint8_t cmd)
 nvSRAM 4 set command function.
 
uint8_t nvsram4_read_status (nvsram4_t *ctx)
 nvSRAM 4 read status function.
 
void nvsram4_write_status (nvsram4_t *ctx, uint8_t st_data)
 nvSRAM 4 write status function.
 
err_t nvsram4_burst_read_memory (nvsram4_t *ctx, uint32_t mem_addr, uint8_t *data_out, uint8_t n_bytes)
 nvSRAM 4 burst read memory function.
 
err_t nvsram4_burst_write_memory (nvsram4_t *ctx, uint32_t mem_addr, uint8_t *data_in, uint8_t n_bytes)
 nvSRAM 4 burst write memory function.
 
uint32_t nvsram4_read_id (nvsram4_t *ctx)
 nvSRAM 4 read device ID function.
 
uint8_t nvsram4_rtc_read_reg (nvsram4_t *ctx, uint8_t rtc_reg)
 nvSRAM 4 rtc read register function.
 
void nvsram4_rtc_write_reg (nvsram4_t *ctx, uint8_t rtc_reg, uint8_t data_in)
 nvSRAM 4 rtc write register function.
 
void nvsram4_enable_rtc_write (nvsram4_t *ctx)
 nvSRAM 4 enable rtc register write function.
 
void nvsram4_disable_rtc_write (nvsram4_t *ctx)
 nvSRAM 4 disable rtc register write function.
 
void nvsram4_get_rtc_time (nvsram4_t *ctx, nvsram4_rtc_time_t *rtc_time)
 nvSRAM 4 get RTC time function.
 
err_t nvsram4_set_rtc_time (nvsram4_t *ctx, nvsram4_rtc_time_t rtc_time)
 nvSRAM 4 set RTC time function.
 
void nvsram4_get_rtc_date (nvsram4_t *ctx, nvsram4_rtc_date_t *rtc_date)
 nvSRAM 4 get RTC date function.
 
err_t nvsram4_set_rtc_date (nvsram4_t *ctx, nvsram4_rtc_date_t rtc_date)
 nvSRAM 4 set RTC date function.
 
void nvsram4_get_rtc_alarm (nvsram4_t *ctx, nvsram4_rtc_alarm_t *rtc_alarm)
 nvSRAM 4 get RTC alarm function.
 
err_t nvsram4_set_rtc_alarm (nvsram4_t *ctx, nvsram4_rtc_alarm_t rtc_alarm)
 nvSRAM 4 set RTC alarm function.
 
err_t nvsram4_hold (nvsram4_t *ctx, uint8_t en_hold)
 nvSRAM 4 set hold function.
 
err_t nvsram4_hardware_store (nvsram4_t *ctx, uint8_t en_hw_store)
 nvSRAM 4 hardware store function.
 
err_t nvsram4_hw_write_protection (nvsram4_t *ctx, uint8_t en_wp)
 nvSRAM 4 write protection function.
 

Detailed Description

This file contains API for nvSRAM 4 Click Driver.