gainamp  2.0.0.0
Main Page

GainAMP Click

GainAMP Click carries the LTC6912 dual channel, low noise, digitally programmable gain amplifier (PGA).

Click Product page


Click library

  • Author : Stefan Ilic
  • Date : Sep 2021.
  • Type : SPI type

Software Support

We provide a library for the GainAMP Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Library Description

This library contains API for GainAMP Click driver.

Standard key functions :

Example key functions :

Example Description

This is an example that demonstrates the use of the GainAMP Click board.

The demo application is composed of two sections :

Application Init

Initializes SPI module and set CS pin and RST pin as OUTPUT, initialization driver init and resets chip.

void application_init ( void )
{
log_cfg_t log_cfg;
gainamp_cfg_t gainamp_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
gainamp_cfg_setup( &gainamp_cfg );
GAINAMP_MAP_MIKROBUS( gainamp_cfg, MIKROBUS_1 );
err_t init_flag = gainamp_init( &gainamp, &gainamp_cfg );
if ( ( SPI_MASTER_ERROR == init_flag ) || ( ADC_ERROR == init_flag ) ) {
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
gainamp_reset( &gainamp );
Delay_ms ( 100 );
log_info( &logger, " Application Task " );
}

Application Task

Sets the gain for both channels, channel A and channel B.

void application_task ( void )
{
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Other Mikroe Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.GainAMP

Additional notes and informations

Depending on the development board you are using, you may need USB UART Click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.


gainamp_reset
void gainamp_reset(gainamp_t *ctx)
Function for reset chip of the GainAMP Click.
GAINAMP_CHANNEL_B_x5
#define GAINAMP_CHANNEL_B_x5
Definition: gainamp.h:88
gainamp_cfg_setup
void gainamp_cfg_setup(gainamp_cfg_t *cfg)
GainAMP configuration object setup function.
application_task
void application_task(void)
Definition: main.c:63
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.
GAINAMP_CHANNEL_A_x10
#define GAINAMP_CHANNEL_A_x10
Definition: gainamp.h:79
gainamp_cfg_t
GainAMP Click configuration object.
Definition: gainamp.h:155
gainamp_init
err_t gainamp_init(gainamp_t *ctx, gainamp_cfg_t *cfg)
GainAMP initialization function.
GAINAMP_MAP_MIKROBUS
#define GAINAMP_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: gainamp.h:122
application_init
void application_init(void)
Definition: main.c:28
gainamp_set_gain
void gainamp_set_gain(gainamp_t *ctx, uint8_t gain)
Function for sets gain of the GainAMP Click.
GAINAMP_CHANNEL_A_x1
#define GAINAMP_CHANNEL_A_x1
Definition: gainamp.h:76
GAINAMP_CHANNEL_B_x100
#define GAINAMP_CHANNEL_B_x100
Definition: gainamp.h:92
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.
gainamp_t
GainAMP Click context object.
Definition: gainamp.h:138