nvsram3 2.0.0.0
nvSRAM 3 Click Driver

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

Topics

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

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

API for configuring and manipulating nvSRAM 3 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

◆ nvsram3_cfg_setup()

void nvsram3_cfg_setup ( nvsram3_cfg_t * cfg)

nvSRAM 3 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ nvsram3_default_cfg()

err_t nvsram3_default_cfg ( nvsram3_t * ctx)

nvSRAM 3 default configuration function.

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

Parameters
[in]ctx: Click context object. See nvsram3_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ nvsram3_generic_read()

err_t nvsram3_generic_read ( nvsram3_t * ctx,
uint8_t reg,
uint8_t * rx_buf,
uint8_t rx_len )

nvSRAM 3 I2C reading function.

This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.

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

◆ nvsram3_generic_write()

err_t nvsram3_generic_write ( nvsram3_t * ctx,
uint8_t reg,
uint8_t * tx_buf,
uint8_t tx_len )

nvSRAM 3 I2C writing function.

This function writes a desired number of data bytes starting from the selected register by using I2C serial interface.

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

◆ nvsram3_get_device_id()

uint32_t nvsram3_get_device_id ( nvsram3_t * ctx)

nvSRAM 3 get device ID function.

This function reads the device ID register.

Parameters
[in]ctx: Click context object. See nvsram3_t object definition for detailed explanation.
Returns
device_id : Device ID (4 bytes).

◆ nvsram3_get_rtc_alarm()

void nvsram3_get_rtc_alarm ( nvsram3_t * ctx,
nvsram3_rtc_alarm_t * rtc_alarm )

nvSRAM 3 get RTC alarm function.

This function get RTC alarm structure.

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

See #err_t definition for detailed explanation.

Note
None.

◆ nvsram3_get_rtc_date()

void nvsram3_get_rtc_date ( nvsram3_t * ctx,
nvsram3_rtc_date_t * rtc_date )

nvSRAM 3 get RTC date function.

This function get RTC date data structure.

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

See #err_t definition for detailed explanation.

Note
None.

◆ nvsram3_get_rtc_time()

void nvsram3_get_rtc_time ( nvsram3_t * ctx,
nvsram3_rtc_time_t * rtc_time )

nvSRAM 3 get RTC time function.

This function get RTC time data structure.

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

See #err_t definition for detailed explanation.

Note
None.

◆ nvsram3_hardware_store()

err_t nvsram3_hardware_store ( nvsram3_t * ctx,
uint8_t state )

nvSRAM 3 hardware store function.

This function set hardware store by setting the HSB pin state.

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

◆ nvsram3_hw_write_protection()

err_t nvsram3_hw_write_protection ( nvsram3_t * ctx,
uint8_t state )

nvSRAM 3 write protection function.

This function set write protection by setting the WP pin state.

Parameters
[in]ctx: Click context object. See nvsram3_t object definition for detailed explanation.
[in]state:
  • 0 ( NVSRAM3_WP_ENABLE ) - Enable write protection,
  • 1 ( NVSRAM3_WP_DISABLE ) - Disable write protection.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ nvsram3_init()

err_t nvsram3_init ( nvsram3_t * ctx,
nvsram3_cfg_t * cfg )

nvSRAM 3 initialization function.

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

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

◆ nvsram3_memory_read()

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.

This function reads a desired number of data bytes starting from the selected memory address by using I2C serial interface.

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

◆ nvsram3_memory_write()

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.

This function write a desired number of data bytes starting from the selected memory address by using I2C serial interface.

Parameters
[in]ctx: Click context object. See nvsram3_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.

◆ nvsram3_rtc_read_reg()

err_t nvsram3_rtc_read_reg ( nvsram3_t * ctx,
uint8_t rtc_reg,
uint8_t * data_out )

nvSRAM 3 RTC read register function.

This function reads data byte from the selected RTC register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See nvsram3_t object definition for detailed explanation.
[in]rtc_reg: RTC register address.
[out]data_out: data read from the selected register.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ nvsram3_rtc_write_reg()

err_t nvsram3_rtc_write_reg ( nvsram3_t * ctx,
uint8_t rtc_reg,
uint8_t data_in )

nvSRAM 3 RTC write register function.

This function writes data byte to the selected RTC register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See nvsram3_t object definition for detailed explanation.
[in]rtc_reg: RTC register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ nvsram3_send_cmd()

err_t nvsram3_send_cmd ( nvsram3_t * ctx,
uint8_t cmd )

nvSRAM 3 send command function.

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

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

◆ nvsram3_set_rtc_alarm()

err_t nvsram3_set_rtc_alarm ( nvsram3_t * ctx,
nvsram3_rtc_alarm_t rtc_alarm )

nvSRAM 3 set RTC alarm function.

This function set RTC date alarm structure.

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.

◆ nvsram3_set_rtc_date()

err_t nvsram3_set_rtc_date ( nvsram3_t * ctx,
nvsram3_rtc_date_t rtc_date )

nvSRAM 3 set RTC date function.

This function set RTC date data structure.

Parameters
[in]ctx: Click context object. See nvsram3_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.

◆ nvsram3_set_rtc_time()

err_t nvsram3_set_rtc_time ( nvsram3_t * ctx,
nvsram3_rtc_time_t rtc_time )

nvSRAM 3 set RTC time function.

This function set RTC time data structure.

Parameters
[in]ctx: Click context object. See nvsram3_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.