btaudio 2.0.0.0
main.c File Reference

BtAudio Click example. More...

#include "board.h"
#include "log.h"
#include "btaudio.h"
#include "string.h"
#include "generic_pointer.h"

Macros

#define RESPONSE_CMD   "CMD"
 
#define RESPONSE_END   "END"
 
#define RESPONSE_AOK   "AOK"
 
#define RESPONSE_ERR   "ERR"
 
#define RESPONSE_NULL   0
 
#define COMMAND_VOLUME_UP   "volume up"
 
#define COMMAND_VOLUME_DOWN   "volume down"
 
#define COMMAND_NEXT   "next"
 
#define COMMAND_PREVIOUS   "previous"
 
#define COMMAND_PLAY   "play"
 
#define COMMAND_PAUSE   "pause"
 
#define PROCESS_COUNTER   50
 
#define PROCESS_RX_BUFFER_SIZE   600
 
#define PROCESS_PARSER_BUFFER_SIZE   600
 

Functions

void application_init (void)
 
void application_task (void)
 
int main (void)
 

Detailed Description

BtAudio Click example.

Description

This example reads and processes data from BT Audio clicks.

The demo application is composed of two sections :

Application Init

Initializes the driver and configures the click board.

Application Task

Checks if there's any command received, then parses it and performs adequate actions.

Additional Function

  • btaudio_process ( ) - Logs all the received messages on UART. Also checks if there's any command received in data mode, if so, parses it and performs adequate actions.
Note
We have used the Serial Bluetooth Terminal smartphone application for the test. A smartphone and the click board must be paired in order to exchange messages with each other. So make sure to pair your device with the click board and connect to it using the Serial Bluetooth Terminal application, then you will be able to send commands listed below.
Author
MikroE Team

Macro Definition Documentation

◆ COMMAND_NEXT

#define COMMAND_NEXT   "next"

◆ COMMAND_PAUSE

#define COMMAND_PAUSE   "pause"

◆ COMMAND_PLAY

#define COMMAND_PLAY   "play"

◆ COMMAND_PREVIOUS

#define COMMAND_PREVIOUS   "previous"

◆ COMMAND_VOLUME_DOWN

#define COMMAND_VOLUME_DOWN   "volume down"

◆ COMMAND_VOLUME_UP

#define COMMAND_VOLUME_UP   "volume up"

◆ PROCESS_COUNTER

#define PROCESS_COUNTER   50

◆ PROCESS_PARSER_BUFFER_SIZE

#define PROCESS_PARSER_BUFFER_SIZE   600

◆ PROCESS_RX_BUFFER_SIZE

#define PROCESS_RX_BUFFER_SIZE   600

◆ RESPONSE_AOK

#define RESPONSE_AOK   "AOK"

◆ RESPONSE_CMD

#define RESPONSE_CMD   "CMD"

◆ RESPONSE_END

#define RESPONSE_END   "END"

◆ RESPONSE_ERR

#define RESPONSE_ERR   "ERR"

◆ RESPONSE_NULL

#define RESPONSE_NULL   0

Function Documentation

◆ application_init()

void application_init ( void )

Logger initialization. Default baud rate: 115200 Default log level: LOG_LEVEL_DEBUG

Note
If USB_UART_RX and USB_UART_TX are defined as HAL_PIN_NC, you will need to define them manually for log to work. See LOG_MAP_USB_UART macro definition for detailed explanation.

◆ application_task()

void application_task ( void )

◆ main()

int main ( void )