nvsram 2.0.0.0
nvSRAM Click Driver

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

Topics

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

Functions

void nvsram_cfg_setup (nvsram_cfg_t *cfg)
 nvSRAM configuration object setup function.
 
err_t nvsram_init (nvsram_t *ctx, nvsram_cfg_t *cfg)
 nvSRAM initialization function.
 
err_t nvsram_generic_write (nvsram_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
 nvSRAM I2C writing function.
 
err_t nvsram_generic_read (nvsram_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
 nvSRAM I2C reading function.
 
void nvsram_reg_write (nvsram_t *ctx, uint8_t reg, uint8_t tx_data)
 Generic write the byte of data function.
 
uint8_t nvsram_reg_read (nvsram_t *ctx, uint8_t reg)
 Generic read the byte of data function.
 
void nvsram_burst_reg_write (nvsram_t *ctx, uint8_t reg, uint8_t *p_tx_data, uint8_t n_bytes)
 Burst register write function.
 
void nvsram_burst_reg_read (nvsram_t *ctx, uint8_t reg, uint8_t *p_rx_data, uint8_t n_bytes)
 Burst register read function.
 
void nvsram_send_cmd (nvsram_t *ctx, uint8_t cmd)
 Send command function.
 
uint32_t nvsram_read_dev_id (nvsram_t *ctx)
 Read device ID function.
 
void nvsram_memory_write (nvsram_t *ctx, uint32_t mem_adr, uint8_t *p_tx_data, uint16_t n_bytes)
 Write memory function.
 
void nvsram_memory_read (nvsram_t *ctx, uint32_t mem_adr, uint8_t *p_rx_data, uint16_t n_bytes)
 Read memory function.
 
void nvsram_enable_memory_write (nvsram_t *ctx, uint8_t en_wr_mem)
 Enable memory write function.
 

Detailed Description

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

◆ nvsram_burst_reg_read()

void nvsram_burst_reg_read ( nvsram_t * ctx,
uint8_t reg,
uint8_t * p_rx_data,
uint8_t n_bytes )

Burst register read function.

The function read a sequential data starting from the targeted 8-bit register address of the CY14B101J2 1-Mbit (128K � 8) Serial (I2C) nvSRAM on nvSRAM click board.

Parameters
[in]ctx: Click context object. See nvsram_t object definition for detailed explanation.
[in]reg: Start register address.
[out]p_rx_data: Pointer to the memory location where data be stored.
[in]n_bytes: number of bytes to be read.
Returns
Nothing.
Note
None.

◆ nvsram_burst_reg_write()

void nvsram_burst_reg_write ( nvsram_t * ctx,
uint8_t reg,
uint8_t * p_tx_data,
uint8_t n_bytes )

Burst register write function.

The function writes a sequential data starting of the targeted 8-bit register address of the CY14B101J2 1-Mbit (128K � 8) Serial (I2C) nvSRAM on nvSRAM click board.

Parameters
[in]ctx: Click context object. See nvsram_t object definition for detailed explanation.
[in]reg: Start register address.
[in]p_tx_data: Pointer to the data to be written.
[in]n_bytes: Number of bytes to be written.
Returns
Nothing.
Note
None.

◆ nvsram_cfg_setup()

void nvsram_cfg_setup ( nvsram_cfg_t * cfg)

nvSRAM configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ nvsram_enable_memory_write()

void nvsram_enable_memory_write ( nvsram_t * ctx,
uint8_t en_wr_mem )

Enable memory write function.

The function enable write depending on the function argument of the CY14B101J2 1-Mbit (128K � 8) Serial (I2C) nvSRAM on nvSRAM click board.

Parameters
[in]ctx: Click context object. See nvsram_t object definition for detailed explanation.
[in]en_wr_mem: Write enable or disable.
Returns
Nothing.
Note
None.

◆ nvsram_generic_read()

err_t nvsram_generic_read ( nvsram_t * ctx,
uint8_t reg,
uint8_t * rx_buf,
uint8_t rx_len )

nvSRAM 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 nvsram_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.

◆ nvsram_generic_write()

err_t nvsram_generic_write ( nvsram_t * ctx,
uint8_t reg,
uint8_t * tx_buf,
uint8_t tx_len )

nvSRAM 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 nvsram_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.

◆ nvsram_init()

err_t nvsram_init ( nvsram_t * ctx,
nvsram_cfg_t * cfg )

nvSRAM initialization function.

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

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

◆ nvsram_memory_read()

void nvsram_memory_read ( nvsram_t * ctx,
uint32_t mem_adr,
uint8_t * p_rx_data,
uint16_t n_bytes )

Read memory function.

The function read a sequential data starting from the targeted 17-bit memory address of the CY14B101J2 1-Mbit (128K � 8) Serial (I2C) nvSRAM on nvSRAM click board.

Parameters
[in]ctx: Click context object. See nvsram_t object definition for detailed explanation.
[in]mem_adr: 17-bit start memory address.
[out]p_rx_data: Pointer to the memory location where data be stored.
[in]n_bytes: Number of bytes to be read.
Returns
Nothing.
Note
None.

◆ nvsram_memory_write()

void nvsram_memory_write ( nvsram_t * ctx,
uint32_t mem_adr,
uint8_t * p_tx_data,
uint16_t n_bytes )

Write memory function.

The function writes a sequential data starting of the targeted 17-bit memory address of the CY14B101J2 1-Mbit (128K � 8) Serial (I2C) nvSRAM on nvSRAM click board.

Parameters
[in]ctx: Click context object. See nvsram_t object definition for detailed explanation.
[in]mem_adr: 17-bit start memory address.
[in]p_tx_data: Pointer to the data to be written.
[in]n_bytes: Number of bytes to be written.
Returns
Nothing.
Note
None.

◆ nvsram_read_dev_id()

uint32_t nvsram_read_dev_id ( nvsram_t * ctx)

Read device ID function.

The function read a device ID of the CY14B101J2 1-Mbit (128K � 8) Serial (I2C) nvSRAM on nvSRAM click board.

Parameters
[in]ctx: Click context object. See nvsram_t object definition for detailed explanation.
Returns
32-bit read device ID.
Note
None.

◆ nvsram_reg_read()

uint8_t nvsram_reg_read ( nvsram_t * ctx,
uint8_t reg )

Generic read the byte of data function.

The function read a the byte of data from the targeted 8-bit register address of the CY14B101J2 1-Mbit (128K � 8) Serial (I2C) nvSRAM on nvSRAM click board.

Parameters
[in]ctx: Click context object. See nvsram_t object definition for detailed explanation.
[in]reg: Start register address.
Returns
8-bit read data.
Note
None.

◆ nvsram_reg_write()

void nvsram_reg_write ( nvsram_t * ctx,
uint8_t reg,
uint8_t tx_data )

Generic write the byte of data function.

The function writes the byte of data to the targeted 8-bit register address of the CY14B101J2 1-Mbit (128K � 8) Serial (I2C) nvSRAM on nvSRAM click board.

Parameters
[in]ctx: Click context object. See nvsram_t object definition for detailed explanation.
[in]reg: Start register address.
[in]tx_data: Data to be written.
Returns
Nothing.
Note
None.

◆ nvsram_send_cmd()

void nvsram_send_cmd ( nvsram_t * ctx,
uint8_t cmd )

Send command function.

The function sends the desired command to the CY14B101J2 1-Mbit (128K � 8) Serial (I2C) nvSRAM on nvSRAM click board.

Parameters
[in]ctx: Click context object. See nvsram_t object definition for detailed explanation.
[in]cmd: Command that is being sent.
Returns
Nothing.
Note
None.