btaudio4 2.2.0
Loading...
Searching...
No Matches
btaudio4


BT Audio 4 Click

BT Audio 4 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : Stefan Filipovic
  • Date : May 2025.
  • Type : UART type

Software Support

Example Description

This example demonstrates how to communicate with the BT Audio 4 Click board over UART. It initializes the device, resets it, retrieves the device name, and then continuously processes and logs any incoming UART messages from the device.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.BTAudio4

Example Key Functions

  • btaudio4_cfg_setup This function initializes Click configuration structure to initial values.
    void btaudio4_cfg_setup(btaudio4_cfg_t *cfg)
    BT Audio 4 configuration object setup function.
    BT Audio 4 Click configuration object.
    Definition btaudio4.h:265
  • btaudio4_init This function initializes all necessary pins and peripherals used for this Click board.
    err_t btaudio4_init(btaudio4_t *ctx, btaudio4_cfg_t *cfg)
    BT Audio 4 initialization function.
    BT Audio 4 Click context object.
    Definition btaudio4.h:242
  • btaudio4_cmd_run This function sends a specified command to the Click module.
    void btaudio4_cmd_run ( btaudio4_t *ctx, uint8_t *cmd );
    void btaudio4_cmd_run(btaudio4_t *ctx, uint8_t *cmd)
    BT Audio 4 cmd run function.
  • btaudio4_cmd_set This function sets a value to a specified command parameter of the Click module.
    void btaudio4_cmd_set ( btaudio4_t *ctx, uint8_t *param, uint8_t *value );
    void btaudio4_cmd_set(btaudio4_t *ctx, uint8_t *param, uint8_t *value)
    BT Audio 4 cmd set function.
  • btaudio4_cmd_get This function is used to get the value of a given command parameter from the Click module.
    void btaudio4_cmd_get ( btaudio4_t *ctx, uint8_t *param );
    void btaudio4_cmd_get(btaudio4_t *ctx, uint8_t *param)
    BT Audio 4 cmd get function.

Application Init

Initializes the logger and the BT Audio 4 Click driver, performs a device reset, and reads the device name.

void application_init ( void )
{
log_cfg_t log_cfg;
btaudio4_cfg_t btaudio4_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
btaudio4_cfg_setup( &btaudio4_cfg );
BTAUDIO4_MAP_MIKROBUS( btaudio4_cfg, MIKROBUS_1 );
if ( UART_ERROR == btaudio4_init( &btaudio4, &btaudio4_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_printf( &logger, ">>> Reset Device\r\n" );
btaudio4_reset_device ( &btaudio4 );
btaudio4_read_response ( &btaudio4, BTAUDIO4_RSP_READY );
log_printf( &logger, ">>> Get Device Name\r\n" );
btaudio4_read_response ( &btaudio4, BTAUDIO4_RSP_OK );
btaudio4_clear_app_buf ( );
log_info( &logger, " Application Task " );
}
#define BTAUDIO4_PARAM_NAME
Definition btaudio4.h:146
#define BTAUDIO4_RSP_READY
Definition btaudio4.h:201
#define BTAUDIO4_RSP_OK
BT Audio 4 device response to commands.
Definition btaudio4.h:199
#define BTAUDIO4_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition btaudio4.h:227
void btaudio4_reset_device(btaudio4_t *ctx)
BT Audio 4 reset device function.
void application_init(void)
Definition main.c:84

Application Task

Continuously processes UART data received from the Click board and logs it to the terminal. Acts as a passive receiver of incoming messages, useful for monitoring notifications.

void application_task ( void )
{
if ( BTAUDIO4_OK == btaudio4_process ( &btaudio4 ) )
{
btaudio4_log_app_buf ( );
btaudio4_clear_app_buf ( );
}
}
@ BTAUDIO4_OK
Definition btaudio4.h:290
void application_task(void)
Definition main.c:123

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.