Go to the documentation of this file.
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 #include "drv_spi_master.h"
60 #define NVSRAM4_STATUS_RDY 0x01
61 #define NVSRAM4_STATUS_WEN 0x02
62 #define NVSRAM4_STATUS_BP0 0x04
63 #define NVSRAM4_STATUS_BP1 0x08
64 #define NVSRAM4_STATUS_SNL 0x40
65 #define NVSRAM4_STATUS_WPEN 0x80
67 #define NVSRAM4_RTC_FLAGS 0x00
68 #define NVSRAM4_RTC_TK_CENTURIES 0x01
69 #define NVSRAM4_RTC_ALARM_SECONDS 0x02
70 #define NVSRAM4_RTC_ALARM_MINUTES 0x03
71 #define NVSRAM4_RTC_ALARM_HOURS 0x04
72 #define NVSRAM4_RTC_ALARM_DAY 0x05
73 #define NVSRAM4_RTC_INTERRUPT_STATUS 0x06
74 #define NVSRAM4_RTC_WATCHDOG_TIMER 0x07
75 #define NVSRAM4_RTC_CALIBRATION 0x08
76 #define NVSRAM4_RTC_TK_SECONDS 0x09
77 #define NVSRAM4_RTC_TK_MINUTES 0x0A
78 #define NVSRAM4_RTC_TK_HOURS 0x0B
79 #define NVSRAM4_RTC_TK_DAY 0x0C
80 #define NVSRAM4_RTC_TK_DATE 0x0D
81 #define NVSRAM4_RTC_TK_MONTHS 0x0E
82 #define NVSRAM4_RTC_TK_YEARS 0x0F
111 #define NVSRAM4_STATUS_RDSR 0x05
112 #define NVSRAM4_STATUS_FRDSR 0x0A
113 #define NVSRAM4_STATUS_WRSR 0x01
114 #define NVSRAM4_STATUS_WREN 0x06
115 #define NVSRAM4_STATUS_WRDI 0x04
129 #define NVSRAM4_SRAM_READ 0x03
130 #define NVSRAM4_SRAM_FREAD 0x0B
131 #define NVSRAM4_SRAM_WRITE 0x02
145 #define NVSRAM4_SRAM_RDRTC 0x13
146 #define NVSRAM4_SRAM_FAST_RDRTC 0x1D
147 #define NVSRAM4_SRAM_WRTC 0x12
161 #define NVSRAM4_SPEC_NV_STORE 0x3C
162 #define NVSRAM4_SPEC_NV_RECALL 0x60
163 #define NVSRAM4_SPEC_NV_ASENB 0x59
164 #define NVSRAM4_SPEC_NV_ASDISB 0x19
178 #define NVSRAM4_SPEC_SLEEP 0xB9
179 #define NVSRAM4_SPEC_WRSN 0xC2
180 #define NVSRAM4_SPEC_RDSN 0xC3
181 #define NVSRAM4_SPEC_FRDSN 0xC9
182 #define NVSRAM4_SPEC_RDID 0x9F
183 #define NVSRAM4_SPEC_FRDID 0x99
197 #define NVSRAM4_STATUS_RDY 0x01
198 #define NVSRAM4_STATUS_WEN 0x02
199 #define NVSRAM4_STATUS_BP0 0x04
200 #define NVSRAM4_STATUS_BP1 0x08
201 #define NVSRAM4_STATUS_SNL 0x40
202 #define NVSRAM4_STATUS_WPEN 0x80
216 #define NVSRAM4_HOLD_ENABLE 0x00
217 #define NVSRAM4_HOLD_DISABLE 0x01
232 #define NVSRAM4_HSB_ENABLE 0x00
233 #define NVSRAM4_HSB_DISABLE 0x01
248 #define NVSRAM4_WP_ENABLE 0x00
249 #define NVSRAM4_WP_DISABLE 0x01
267 #define NVSRAM4_SUCCESS 0
268 #define NVSRAM4_ERROR -1
287 #define NVSRAM4_MAP_MIKROBUS( cfg, mikrobus ) \
288 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
289 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
290 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
291 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
292 cfg.hld = MIKROBUS( mikrobus, MIKROBUS_AN ); \
293 cfg.hsb = MIKROBUS( mikrobus, MIKROBUS_RST ); \
294 cfg.wp = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
295 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
314 digital_in_t int_pin;
320 pin_name_t chip_select;
347 spi_master_mode_t spi_mode;
348 spi_master_chip_select_polarity_t cs_polarity;
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_set_rtc_alarm(nvsram4_t *ctx, nvsram4_rtc_alarm_t rtc_alarm)
nvSRAM 4 set RTC alarm function.
void nvsram4_disable_rtc_write(nvsram4_t *ctx)
nvSRAM 4 disable rtc register write function.
void nvsram4_get_rtc_date(nvsram4_t *ctx, nvsram4_rtc_date_t *rtc_date)
nvSRAM 4 get RTC date function.
uint8_t nvsram4_rtc_read_reg(nvsram4_t *ctx, uint8_t rtc_reg)
nvSRAM 4 rtc read register function.
err_t nvsram4_set_rtc_date(nvsram4_t *ctx, nvsram4_rtc_date_t rtc_date)
nvSRAM 4 set RTC date function.
uint32_t nvsram4_read_id(nvsram4_t *ctx)
nvSRAM 4 read device ID function.
void nvsram4_get_rtc_alarm(nvsram4_t *ctx, nvsram4_rtc_alarm_t *rtc_alarm)
nvSRAM 4 get RTC alarm function.
Definition: nvsram4.h:351
void nvsram4_write_status(nvsram4_t *ctx, uint8_t st_data)
nvSRAM 4 write status function.
void nvsram4_cfg_setup(nvsram4_cfg_t *cfg)
nvSRAM 4 configuration object setup function.
err_t nvsram4_hardware_store(nvsram4_t *ctx, uint8_t en_hw_store)
nvSRAM 4 hardware store function.
uint8_t nvsram4_read_status(nvsram4_t *ctx)
nvSRAM 4 read status function.
nvSRAM 4 Click configuration object.
Definition: nvsram4.h:327
void nvsram4_rtc_write_reg(nvsram4_t *ctx, uint8_t rtc_reg, uint8_t data_in)
nvSRAM 4 rtc write register function.
nvSRAM 4 Click context object.
Definition: nvsram4.h:303
err_t nvsram4_set_cmd(nvsram4_t *ctx, uint8_t cmd)
nvSRAM 4 set command function.
void nvsram4_enable_rtc_write(nvsram4_t *ctx)
nvSRAM 4 enable rtc register write function.
err_t nvsram4_hold(nvsram4_t *ctx, uint8_t en_hold)
nvSRAM 4 set hold 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_generic_read(nvsram4_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
nvSRAM 4 data reading function.
err_t nvsram4_set_rtc_time(nvsram4_t *ctx, nvsram4_rtc_time_t rtc_time)
nvSRAM 4 set RTC time function.
Definition: nvsram4.h:371
void nvsram4_get_rtc_time(nvsram4_t *ctx, nvsram4_rtc_time_t *rtc_time)
nvSRAM 4 get RTC time 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.
err_t nvsram4_generic_write(nvsram4_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
nvSRAM 4 data writing function.
Definition: nvsram4.h:360
err_t nvsram4_hw_write_protection(nvsram4_t *ctx, uint8_t en_wp)
nvSRAM 4 write protection function.