audioamp4  2.0.0.0
Main Page

AudioAmp 4 click

AudioAmp 4 click is a low-power audio amplifier with a digital volume control. It is equipped with the LM4860, an audio amplifier IC capable of delivering up to 1W of continuous power to an 8 Ω load.

click Product page


Click library

  • Author : Petar Suknjaja
  • Date : Dec 2019.
  • Type : GPIO type

Software Support

We provide a library for the AudioAmp4 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 form compilers IDE(recommended way), or downloaded from our LibStock, or found on mikroE github account.

Library Description

This library contains API for AudioAmp4 Click driver.

Standard key functions :

  • Config Object Initialization function.

    void audioamp4_cfg_setup ( audioamp4_cfg_t *cfg );

  • Initialization function.

    AUDIOAMP4_RETVAL audioamp4_init ( audioamp4_t *ctx, audioamp4_cfg_t *cfg );

  • Click Default Configuration function.

    void audioamp4_default_cfg ( audioamp4_t *ctx );

Example key functions :

  • This function sets the volume channel.

    AUDIOAMP4_RETVAL audioamp4_set_channel ( audioamp4_t *ctx, uint8_t channel );

  • This function is used to switch device ON or OFF

    AUDIOAMP4_RETVAL audioamp4_shutdown ( audioamp4_t *ctx, uint8_t state );

Examples Description

This example switches device on & off and sets three different volumes.

The demo application is composed of two sections :

Application Init

Initializes GPIO interface, turns module ON and sets the volume value to 0.

void application_init ( void )
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info(&logger, "---- Application Init ----");
// Click initialization.
AUDIOAMP4_MAP_MIKROBUS( cfg, MIKROBUS_1 );
audioamp4_init( &audioamp4, &cfg );
audioamp4_default_cfg( &audioamp4 );
}

Application Task

Turns device OFF & ON and sets three different volume values.

void application_task ( void )
{
log_info( &logger, "Turn on device:" );
log_info( &logger, "Set volume channel 1:" );
Delay_ms( 2000 );
log_info( &logger, "Set volume channel 5:" );
Delay_ms( 2000 );
log_info( &logger, "Set volume channel 7:" );
Delay_ms( 2000 );
log_info( &logger, "Turn off device:" );
Delay_ms( 500 );
}

The full application code, and ready to use projects can be installed directly form compilers IDE(recommneded) or found on LibStock page or mikroE GitHub accaunt.

Other mikroE Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.AudioAmp4

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.


AUDIOAMP4_SHUTDOWN_ON
#define AUDIOAMP4_SHUTDOWN_ON
Definition: audioamp4.h:88
audioamp4_default_cfg
void audioamp4_default_cfg(audioamp4_t *ctx)
Click Default Configuration function.
AUDIOAMP4_VOLUME_CHANN_1
#define AUDIOAMP4_VOLUME_CHANN_1
Definition: audioamp4.h:75
AUDIOAMP4_SHUTDOWN_OFF
#define AUDIOAMP4_SHUTDOWN_OFF
Definition: audioamp4.h:89
audioamp4_cfg_t
Click configuration structure definition.
Definition: audioamp4.h:118
application_task
void application_task(void)
Definition: main.c:89
application_error_handler
void application_error_handler(AUDIOAMP4_RETVAL error_code)
Definition: main.c:35
audioamp4_set_channel
AUDIOAMP4_RETVAL audioamp4_set_channel(audioamp4_t *ctx, uint8_t channel)
Set channel function function.
AUDIOAMP4_MAP_MIKROBUS
#define AUDIOAMP4_MAP_MIKROBUS(cfg, mikrobus)
Definition: audioamp4.h:51
AUDIOAMP4_VOLUME_CHANN_7
#define AUDIOAMP4_VOLUME_CHANN_7
Definition: audioamp4.h:81
audioamp4_init
AUDIOAMP4_RETVAL audioamp4_init(audioamp4_t *ctx, audioamp4_cfg_t *cfg)
Initialization function.
audioamp4_cfg_setup
void audioamp4_cfg_setup(audioamp4_cfg_t *cfg)
Config Object Initialization function.
application_init
void application_init(void)
Definition: main.c:63
audioamp4_shutdown
AUDIOAMP4_RETVAL audioamp4_shutdown(audioamp4_t *ctx, uint8_t state)
Set channel function function.
AUDIOAMP4_VOLUME_CHANN_5
#define AUDIOAMP4_VOLUME_CHANN_5
Definition: audioamp4.h:79