sram4 2.0.0.0
SRAM 4 Click Driver

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

Topics

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

Functions

void sram4_cfg_setup (sram4_cfg_t *cfg)
 SRAM 4 configuration object setup function.
 
err_t sram4_init (sram4_t *ctx, sram4_cfg_t *cfg)
 SRAM 4 initialization function.
 
err_t sram4_default_cfg (sram4_t *ctx)
 SRAM 4 default configuration function.
 
err_t sram4_generic_command (sram4_t *ctx, uint8_t cmd)
 SRAM 4 command writing function.
 
err_t sram4_generic_write (sram4_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 SRAM 4 data writing function.
 
err_t sram4_generic_read (sram4_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 SRAM 4 data reading function.
 
err_t sram4_generic_write_then_read (sram4_t *ctx, uint8_t *data_in, uint8_t in_len, uint8_t *data_out, uint8_t out_len)
 SRAM 4 data writing and reading function.
 
err_t sram4_memory_write (sram4_t *ctx, uint16_t memory_adr, uint8_t *write_data, uint8_t write_len)
 Write data to memory.
 
err_t sram4_memory_read (sram4_t *ctx, uint16_t memory_adr, uint8_t *read_data, uint8_t read_len)
 Read data from memory.
 
void sram4_set_hold (sram4_t *ctx, uint8_t state)
 Set HOLD pin state.
 

Detailed Description

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

◆ sram4_cfg_setup()

void sram4_cfg_setup ( sram4_cfg_t * cfg)

SRAM 4 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ sram4_default_cfg()

err_t sram4_default_cfg ( sram4_t * ctx)

SRAM 4 default configuration function.

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

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

◆ sram4_generic_command()

err_t sram4_generic_command ( sram4_t * ctx,
uint8_t cmd )

SRAM 4 command writing function.

This function writes a data byte by using SPI serial interface.

Parameters
[in]ctx: Click context object. See sram4_t object definition for detailed explanation.
[in]cmd: Command to send.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ sram4_generic_read()

err_t sram4_generic_read ( sram4_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

SRAM 4 data reading function.

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

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

◆ sram4_generic_write()

err_t sram4_generic_write ( sram4_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

SRAM 4 data writing function.

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

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

◆ sram4_generic_write_then_read()

err_t sram4_generic_write_then_read ( sram4_t * ctx,
uint8_t * data_in,
uint8_t in_len,
uint8_t * data_out,
uint8_t out_len )

SRAM 4 data writing and reading function.

This function writes a desired number of data bytes, and then reads a desired number of data bytes by using SPI serial interface.

Parameters
[in]ctx: Click context object. See sram4_t object definition for detailed explanation.
[in]data_in: Data to be written.
[in]in_len: Number of bytes to be written.
[out]data_out: Output read data.
[in]out_len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ sram4_init()

err_t sram4_init ( sram4_t * ctx,
sram4_cfg_t * cfg )

SRAM 4 initialization function.

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

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

◆ sram4_memory_read()

err_t sram4_memory_read ( sram4_t * ctx,
uint16_t memory_adr,
uint8_t * read_data,
uint8_t read_len )

Read data from memory.

This function reads a data starting from selected memory address.

Parameters
[in]ctx: Click context object. See sram4_t object definition for detailed explanation.
[in]memory_adr: Memory address to start reading data from.
[out]read_data: Read data.
[in]read_len: Number of bytes to read starting from selected memory address.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ sram4_memory_write()

err_t sram4_memory_write ( sram4_t * ctx,
uint16_t memory_adr,
uint8_t * write_data,
uint8_t write_len )

Write data to memory.

This function writes a data starting from selected memory address.

Parameters
[in]ctx: Click context object. See sram4_t object definition for detailed explanation.
[in]memory_adr: Memory address to start writeing data to.
[in]write_data: Data to write.
[in]write_len: Number of bytes to write starting from selected memory address.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ sram4_set_hold()

void sram4_set_hold ( sram4_t * ctx,
uint8_t state )

Set HOLD pin state.

This function sets hold pin to selected state.

Parameters
[in]ctx: Click context object. See sram4_t object definition for detailed explanation.
[in]state: Pin state to set.
Returns
Nothing