nvsram4 2.0.0.0
nvSRAM 4 Click Driver

API for configuring and manipulating nvSRAM 4 Click driver. More...

Topics

 nvSRAM 4 Registers List
 List of registers of nvSRAM 4 Click driver.
 
 nvSRAM 4 Registers Settings
 Settings for registers of nvSRAM 4 Click driver.
 
 nvSRAM 4 MikroBUS Map
 MikroBUS pin mapping of nvSRAM 4 Click driver.
 
 Status
 

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

API for configuring and manipulating nvSRAM 4 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ nvsram4_burst_read_memory()

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.

This function reads a desired memory address of data bytes starting from the selected register by using SPI serial interface of the CY14B101P, 1-Mbit (128K × 8) Serial (SPI) nvSRAM with Real-Time Clock on the nvSRAM 4 click.

Parameters
[in]ctx: Click context object. See nvsram4_t object definition for detailed explanation.
[in]mem_addr: Start memory address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ nvsram4_burst_write_memory()

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.

This function burst write memory a desired number address of data bytes starting from the selected memory address by using SPI serial interface of the CY14B101P, 1-Mbit (128K × 8) Serial (SPI) nvSRAM with Real-Time Clock on the nvSRAM 4 click.

Parameters
[in]ctx: Click context object. See nvsram4_t object definition for detailed explanation.
[in]mem_addr: Start memory address.
[in]data_in: Data to be written.
[in]n_bytes: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ nvsram4_cfg_setup()

void nvsram4_cfg_setup ( nvsram4_cfg_t * cfg)

nvSRAM 4 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See nvsram4_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ nvsram4_default_cfg()

void nvsram4_default_cfg ( nvsram4_t * ctx)

nvSRAM 4 default configuration function.

This function executes a default configuration of nvSRAM 4 click board.

Parameters
[in]ctx: Click context object. See nvsram4_t object definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ nvsram4_disable_rtc_write()

void nvsram4_disable_rtc_write ( nvsram4_t * ctx)

nvSRAM 4 disable rtc register write function.

This function disable write rtc register of the CY14B101P, 1-Mbit (128K × 8) Serial (SPI) nvSRAM with Real-Time Clock on the nvSRAM 4 click.

Parameters
[in]ctx: Click context object. See nvsram4_t object definition for detailed explanation.
Returns
Nothing.

See #err_t definition for detailed explanation.

Note
None.

◆ nvsram4_enable_rtc_write()

void nvsram4_enable_rtc_write ( nvsram4_t * ctx)

nvSRAM 4 enable rtc register write function.

This function enable write rtc register of the CY14B101P, 1-Mbit (128K × 8) Serial (SPI) nvSRAM with Real-Time Clock on the nvSRAM 4 click.

Parameters
[in]ctx: Click context object. See nvsram4_t object definition for detailed explanation.
Returns
Nothing.

See #err_t definition for detailed explanation.

Note
None.

◆ nvsram4_generic_read()

err_t nvsram4_generic_read ( nvsram4_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

nvSRAM 4 data reading function.

This function reads a desired number of data bytes starting from the selected register by using SPI serial interface of the CY14B101P, 1-Mbit (128K × 8) Serial (SPI) nvSRAM with Real-Time Clock on the nvSRAM 4 click.

Parameters
[in]ctx: Click context object. See nvsram4_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ nvsram4_generic_write()

err_t nvsram4_generic_write ( nvsram4_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

nvSRAM 4 data writing function.

This function writes a desired number of data bytes starting from the selected register by using SPI serial interface of the CY14B101P, 1-Mbit (128K × 8) Serial (SPI) nvSRAM with Real-Time Clock on the nvSRAM 4 click.

Parameters
[in]ctx: Click context object. See nvsram4_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ nvsram4_get_rtc_alarm()

void nvsram4_get_rtc_alarm ( nvsram4_t * ctx,
nvsram4_rtc_alarm_t * rtc_alarm )

nvSRAM 4 get RTC alarm function.

This function get RTC alarm structure of the CY14B101P, 1-Mbit (128K × 8) Serial (SPI) nvSRAM with Real-Time Clock on the nvSRAM 4 click.

Parameters
[in]ctx: Click context object. See nvsram4_t object definition for detailed explanation.
[out]rtc_alarm: RTC alarm context object.
Returns
Nothing.

See #err_t definition for detailed explanation.

Note
None.

◆ nvsram4_get_rtc_date()

void nvsram4_get_rtc_date ( nvsram4_t * ctx,
nvsram4_rtc_date_t * rtc_date )

nvSRAM 4 get RTC date function.

This function get RTC date data structure of the CY14B101P, 1-Mbit (128K × 8) Serial (SPI) nvSRAM with Real-Time Clock on the nvSRAM 4 click.

Parameters
[in]ctx: Click context object. See nvsram4_t object definition for detailed explanation.
[out]rtc_date: RTC date context object.
Returns
Nothing.

See #err_t definition for detailed explanation.

Note
None.

◆ nvsram4_get_rtc_time()

void nvsram4_get_rtc_time ( nvsram4_t * ctx,
nvsram4_rtc_time_t * rtc_time )

nvSRAM 4 get RTC time function.

This function get RTC time data structure of the CY14B101P, 1-Mbit (128K × 8) Serial (SPI) nvSRAM with Real-Time Clock on the nvSRAM 4 click.

Parameters
[in]ctx: Click context object. See nvsram4_t object definition for detailed explanation.
[out]rtc_time: RTC time context object.
Returns
Nothing.

See #err_t definition for detailed explanation.

Note
None.

◆ nvsram4_hardware_store()

err_t nvsram4_hardware_store ( nvsram4_t * ctx,
uint8_t en_hw_store )

nvSRAM 4 hardware store function.

This function set hardware store by setting the HSB pin state of the CY14B101P, 1-Mbit (128K × 8) Serial (SPI) nvSRAM with Real-Time Clock on the nvSRAM 4 click.

Parameters
[in]ctx: Click context object. See nvsram4_t object definition for detailed explanation.
[in]en_hw_store:
  • 0 ( NVSRAM4_HSB_ENABLE ) - Store operations,
  • 1 ( NVSRAM4_HSB_DISABLE )- Resume the serial communication.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ nvsram4_hold()

err_t nvsram4_hold ( nvsram4_t * ctx,
uint8_t en_hold )

nvSRAM 4 set hold function.

This function set hold by setting the HLD pin state of the CY14B101P, 1-Mbit (128K × 8) Serial (SPI) nvSRAM with Real-Time Clock on the nvSRAM 4 click.

Parameters
[in]ctx: Click context object. See nvsram4_t object definition for detailed explanation.
[in]en_hold:
  • 0 ( NVSRAM4_HOLD_ENABLE ) - Enable hold and pause the serial communication,
  • 1 ( NVSRAM4_HOLD_DISABLE )- Disable hold and resume the serial communication.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ nvsram4_hw_write_protection()

err_t nvsram4_hw_write_protection ( nvsram4_t * ctx,
uint8_t en_wp )

nvSRAM 4 write protection function.

This function set write protection by setting the WP pin state of the CY14B101P, 1-Mbit (128K × 8) Serial (SPI) nvSRAM with Real-Time Clock on the nvSRAM 4 click.

Parameters
[in]ctx: Click context object. See nvsram4_t object definition for detailed explanation.
[in]en_wp:
  • 0 ( NVSRAM4_WP_ENABLE ) - Store operations,
  • 1 ( NVSRAM4_WP_DISABLE )- Resume the serial communication.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ nvsram4_init()

err_t nvsram4_init ( nvsram4_t * ctx,
nvsram4_cfg_t * cfg )

nvSRAM 4 initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See nvsram4_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See nvsram4_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ nvsram4_read_id()

uint32_t nvsram4_read_id ( nvsram4_t * ctx)

nvSRAM 4 read device ID function.

This function reads a device ID by using SPI serial interface of the CY14B101P, 1-Mbit (128K × 8) Serial (SPI) nvSRAM with Real-Time Clock on the nvSRAM 4 click.

Parameters
[in]ctx: Click context object. See nvsram4_t object definition for detailed explanation.
Returns
Device ID.

See #err_t definition for detailed explanation.

Note
None.

◆ nvsram4_read_status()

uint8_t nvsram4_read_status ( nvsram4_t * ctx)

nvSRAM 4 read status function.

This function reads a status register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See nvsram4_t object definition for detailed explanation.
Returns
Output read status data.

See #err_t definition for detailed explanation.

Note
None.

◆ nvsram4_rtc_read_reg()

uint8_t nvsram4_rtc_read_reg ( nvsram4_t * ctx,
uint8_t rtc_reg )

nvSRAM 4 rtc read register function.

This function reads a desired the bytes of data from the selected rtc register by using SPI serial interface of the CY14B101P, 1-Mbit (128K × 8) Serial (SPI) nvSRAM with Real-Time Clock on the nvSRAM 4 click.

Parameters
[in]ctx: Click context object. See nvsram4_t object definition for detailed explanation.
[in]rtc_reg: RTC register address.
Returns
Output read data.

See #err_t definition for detailed explanation.

Note
None.

◆ nvsram4_rtc_write_reg()

void nvsram4_rtc_write_reg ( nvsram4_t * ctx,
uint8_t rtc_reg,
uint8_t data_in )

nvSRAM 4 rtc write register function.

This function writes a desired the bytes of data from the selected rtc register by using SPI serial interface of the CY14B101P, 1-Mbit (128K × 8) Serial (SPI) nvSRAM with Real-Time Clock on the nvSRAM 4 click.

Parameters
[in]ctx: Click context object. See nvsram4_t object definition for detailed explanation.
[in]rtc_reg: RTC register address.
[in]data_in: Data to be written.
Returns
Nothing.

See #err_t definition for detailed explanation.

Note
None.

◆ nvsram4_set_cmd()

err_t nvsram4_set_cmd ( nvsram4_t * ctx,
uint8_t cmd )

nvSRAM 4 set command function.

This function writes a desired command by using SPI serial interface.

Parameters
[in]ctx: Click context object. See nvsram4_t object definition for detailed explanation.
[in]cmd: Desired command.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ nvsram4_set_rtc_alarm()

err_t nvsram4_set_rtc_alarm ( nvsram4_t * ctx,
nvsram4_rtc_alarm_t rtc_alarm )

nvSRAM 4 set RTC alarm function.

This function set RTC date alarm structure of the CY14B101P, 1-Mbit (128K × 8) Serial (SPI) nvSRAM with Real-Time Clock on the nvSRAM 4 click.

Parameters
[in]ctx: Click context object. See nvsram4_t object definition for detailed explanation.
[in]rtc_alarm: RTC alarm context object.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ nvsram4_set_rtc_date()

err_t nvsram4_set_rtc_date ( nvsram4_t * ctx,
nvsram4_rtc_date_t rtc_date )

nvSRAM 4 set RTC date function.

This function set RTC date data structure of the CY14B101P, 1-Mbit (128K × 8) Serial (SPI) nvSRAM with Real-Time Clock on the nvSRAM 4 click.

Parameters
[in]ctx: Click context object. See nvsram4_t object definition for detailed explanation.
[in]rtc_date: RTC date context object.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ nvsram4_set_rtc_time()

err_t nvsram4_set_rtc_time ( nvsram4_t * ctx,
nvsram4_rtc_time_t rtc_time )

nvSRAM 4 set RTC time function.

This function set RTC time data structure of the CY14B101P, 1-Mbit (128K × 8) Serial (SPI) nvSRAM with Real-Time Clock on the nvSRAM 4 click.

Parameters
[in]ctx: Click context object. See nvsram4_t object definition for detailed explanation.
[in]rtc_time: RTC time context object.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ nvsram4_write_status()

void nvsram4_write_status ( nvsram4_t * ctx,
uint8_t st_data )

nvSRAM 4 write status function.

This function writes a status register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See nvsram4_t object definition for detailed explanation.
[in]st_data: Status data.

See #err_t definition for detailed explanation.

Note
None.