gainamp 2.0.0.0
GainAMP Click Driver

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

Topics

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

Functions

void gainamp_cfg_setup (gainamp_cfg_t *cfg)
 GainAMP configuration object setup function.
 
err_t gainamp_init (gainamp_t *ctx, gainamp_cfg_t *cfg)
 GainAMP initialization function.
 
err_t gainamp_generic_write (gainamp_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 GainAMP data writing function.
 
err_t gainamp_generic_read (gainamp_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 GainAMP data reading function.
 
err_t gainamp_read_an_pin_value (gainamp_t *ctx, uint16_t *data_out)
 GainAMP read AN pin value function.
 
err_t gainamp_read_an_pin_voltage (gainamp_t *ctx, float *data_out)
 GainAMP read AN pin voltage level function.
 
void gainamp_reset (gainamp_t *ctx)
 Function for reset chip of the GainAMP Click.
 
void gainamp_set_gain (gainamp_t *ctx, uint8_t gain)
 Function for sets gain of the GainAMP Click.
 

Detailed Description

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

◆ gainamp_cfg_setup()

void gainamp_cfg_setup ( gainamp_cfg_t * cfg)

GainAMP configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ gainamp_generic_read()

err_t gainamp_generic_read ( gainamp_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

GainAMP 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 gainamp_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.

◆ gainamp_generic_write()

err_t gainamp_generic_write ( gainamp_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

GainAMP 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 gainamp_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.

◆ gainamp_init()

err_t gainamp_init ( gainamp_t * ctx,
gainamp_cfg_t * cfg )

GainAMP initialization function.

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

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

◆ gainamp_read_an_pin_value()

err_t gainamp_read_an_pin_value ( gainamp_t * ctx,
uint16_t * data_out )

GainAMP read AN pin value function.

This function reads results of AD conversion of the AN pin.

Parameters
[in]ctx: Click context object. See gainamp_t object definition for detailed explanation.
[out]data_out: Output ADC result.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ gainamp_read_an_pin_voltage()

err_t gainamp_read_an_pin_voltage ( gainamp_t * ctx,
float * data_out )

GainAMP read AN pin voltage level function.

This function reads results of AD conversion of the AN pin and converts them to proportional voltage level.

Parameters
[in]ctx: Click context object. See gainamp_t object definition for detailed explanation.
[out]data_out: Output voltage level of the analog pin [V].
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
The conversion to voltage depends on the entered configuration of the ADC (resolution, reference voltage).

◆ gainamp_reset()

void gainamp_reset ( gainamp_t * ctx)

Function for reset chip of the GainAMP Click.

This function performs hardware reset.

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

◆ gainamp_set_gain()

void gainamp_set_gain ( gainamp_t * ctx,
uint8_t gain )

Function for sets gain of the GainAMP Click.

This function sets gain of the GainAMP Click.

Parameters
[in]ctx: Click context object. See gainamp_t object definition for detailed explanation.
[in]gain: Gain that will be set.
Returns
Nothing.