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 :
gainamp_cfg_setup
Config Object Initialization function.
void gainamp_cfg_setup(gainamp_cfg_t *cfg)
GainAMP configuration object setup function.
GainAMP Click configuration object.
Definition gainamp.h:155
gainamp_init
Initialization function.
err_t gainamp_init(gainamp_t *ctx, gainamp_cfg_t *cfg)
GainAMP initialization function.
GainAMP Click context object.
Definition gainamp.h:138
gainamp_default_cfg
Click Default Configuration function. err_t gainamp_default_cfg (
gainamp_t *ctx );
Example key functions :
gainamp_read_an_pin_value
GainAMP read AN pin value function.
err_t gainamp_read_an_pin_value(gainamp_t *ctx, uint16_t *data_out)
GainAMP read AN pin value function.
gainamp_read_an_pin_voltage
GainAMP read AN pin voltage level function.
err_t gainamp_read_an_pin_voltage(gainamp_t *ctx, float *data_out)
GainAMP read AN pin voltage level function.
gainamp_set_gain
Function for sets gain of the GainAMP Click.
void gainamp_set_gain(gainamp_t *ctx, uint8_t gain)
Function for sets gain of the GainAMP Click.
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.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
if ( ( SPI_MASTER_ERROR == init_flag ) || ( ADC_ERROR == init_flag ) ) {
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
Delay_ms ( 100 );
log_info( &logger, " Application Task " );
}
#define GAINAMP_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition gainamp.h:122
void gainamp_reset(gainamp_t *ctx)
Function for reset chip of the GainAMP Click.
void application_init(void)
Definition main.c:28
Application Task
Sets the gain for both channels, channel A and channel B.
{
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 );
}
#define GAINAMP_CHANNEL_A_x10
Definition gainamp.h:79
#define GAINAMP_CHANNEL_A_x1
Definition gainamp.h:76
#define GAINAMP_CHANNEL_B_x5
Definition gainamp.h:88
#define GAINAMP_CHANNEL_B_x100
Definition gainamp.h:92
void application_task(void)
Definition main.c:63
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.