btaudio3 2.0.0.0
BT Audio 3 Click Driver

API for configuring and manipulating BT Audio 3 Click driver. More...

Topics

 BT Audio 3 Device Settings
 Settings for registers of BT Audio 3 Click driver.
 
 BT Audio 3 MikroBUS Map
 MikroBUS pin mapping of BT Audio 3 Click driver.
 

Functions

void btaudio3_cfg_setup (btaudio3_cfg_t *cfg)
 BT Audio 3 configuration object setup function.
 
err_t btaudio3_init (btaudio3_t *ctx, btaudio3_cfg_t *cfg)
 BT Audio 3 initialization function.
 
err_t btaudio3_default_cfg (btaudio3_t *ctx)
 BT Audio 3 default configuration function.
 
err_t btaudio3_generic_write (btaudio3_t *ctx, uint8_t *data_buf, uint16_t len)
 BT Audio 3 data writing function.
 
err_t btaudio3_generic_read (btaudio3_t *ctx, uint8_t *data_buf, uint16_t max_len)
 BT Audio 3 data reading function.
 
void btaudio3_set_mfb_pin (btaudio3_t *ctx, uint8_t state)
 BT Audio 3 set MFB pin function.
 
void btaudio3_set_rst_pin (btaudio3_t *ctx, uint8_t state)
 BT Audio 3 set RST pin function.
 
void btaudio3_set_application_mode (btaudio3_t *ctx)
 BT Audio 3 set application mode function.
 
void btaudio3_set_test_mode (btaudio3_t *ctx)
 BT Audio 3 set test mode function.
 
void btaudio3_reset_device (btaudio3_t *ctx)
 BT Audio 3 reset device function.
 
void btaudio3_soft_mute_output (btaudio3_t *ctx)
 BT Audio 3 soft mute output function.
 
void btaudio3_soft_unmute_output (btaudio3_t *ctx)
 BT Audio 3 soft unmute output function.
 
void btaudio3_send_command (btaudio3_t *ctx)
 BT Audio 3 send command function.
 
err_t btaudio3_send_command_with_ack_check (btaudio3_t *ctx)
 BT Audio 3 send command with ack check function.
 
err_t btaudio3_read_event (btaudio3_t *ctx)
 BT Audio 3 read event function.
 
void btaudio3_wait_for_event (btaudio3_t *ctx, uint8_t opcode)
 BT Audio 3 wait for event function.
 
void btaudio3_clear_events (btaudio3_t *ctx)
 BT Audio 3 clear events function.
 
err_t btaudio3_send_mmi_action (btaudio3_t *ctx, uint8_t database_index, uint8_t action)
 BT Audio 3 send MMI action function.
 
err_t btaudio3_power_on_device (btaudio3_t *ctx)
 BT Audio 3 power ON device function.
 
err_t btaudio3_power_off_device (btaudio3_t *ctx)
 BT Audio 3 power OFF device function.
 
err_t btaudio3_enter_pairing_mode (btaudio3_t *ctx)
 BT Audio 3 enter pairing mode function.
 
err_t btaudio3_reset_to_default (btaudio3_t *ctx)
 BT Audio 3 reset to default function.
 
err_t btaudio3_set_device_name (btaudio3_t *ctx, uint8_t *device_name)
 BT Audio 3 set device name function.
 
err_t btaudio3_music_control (btaudio3_t *ctx, btaudio3_music_control_t action)
 BT Audio 3 music control function.
 
err_t btaudio3_make_call (btaudio3_t *ctx, uint8_t database_index, uint8_t *phone_number)
 BT Audio 3 make call function.
 
err_t btaudio3_volume_up (btaudio3_t *ctx, uint8_t database_index, uint8_t mask)
 BT Audio 3 volume up function.
 
err_t btaudio3_volume_down (btaudio3_t *ctx, uint8_t database_index, uint8_t mask)
 BT Audio 3 volume down function.
 
err_t btaudio3_enable_advertising (btaudio3_t *ctx)
 BT Audio 3 enable advertising function.
 
err_t btaudio3_disable_advertising (btaudio3_t *ctx)
 BT Audio 3 disable advertising function.
 
err_t btaudio3_set_eq_mode (btaudio3_t *ctx, btaudio3_eq_mode_t eq_mode)
 BT Audio 3 set equalizer mode function.
 

Detailed Description

API for configuring and manipulating BT Audio 3 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ btaudio3_cfg_setup()

void btaudio3_cfg_setup ( btaudio3_cfg_t * cfg)

BT Audio 3 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See btaudio3_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ btaudio3_clear_events()

void btaudio3_clear_events ( btaudio3_t * ctx)

BT Audio 3 clear events function.

This function clears all events from the ring buffer. The last cleared event will be stored in the click context object.

Parameters
[in]ctx: Click context object. See btaudio3_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ btaudio3_default_cfg()

err_t btaudio3_default_cfg ( btaudio3_t * ctx)

BT Audio 3 default configuration function.

This function executes a default configuration of BT Audio 3 click board.

Parameters
[in]ctx: Click context object. See btaudio3_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ btaudio3_disable_advertising()

err_t btaudio3_disable_advertising ( btaudio3_t * ctx)

BT Audio 3 disable advertising function.

This function disables advertising of LE signaling.

Parameters
[in]ctx: Click context object. See btaudio3_t object definition for detailed explanation.
Returns
  • >=0 - Command ACK event response,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ btaudio3_enable_advertising()

err_t btaudio3_enable_advertising ( btaudio3_t * ctx)

BT Audio 3 enable advertising function.

This function enables advertising of LE signaling.

Parameters
[in]ctx: Click context object. See btaudio3_t object definition for detailed explanation.
Returns
  • >=0 - Command ACK event response,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ btaudio3_enter_pairing_mode()

err_t btaudio3_enter_pairing_mode ( btaudio3_t * ctx)

BT Audio 3 enter pairing mode function.

This function enters pairing mode and waits for the pairing state BTM event to occur.

Parameters
[in]ctx: Click context object. See btaudio3_t object definition for detailed explanation.
Returns
  • >=0 - Command ACK event response,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ btaudio3_generic_read()

err_t btaudio3_generic_read ( btaudio3_t * ctx,
uint8_t * data_buf,
uint16_t max_len )

BT Audio 3 data reading function.

This function reads a desired number of data bytes by using UART serial interface.

Parameters
[in]ctx: Click context object. See btaudio3_t object definition for detailed explanation.
[out]data_buf: Output read data.
[in]max_len: Number of bytes to be read.
Returns
  • >0 - Number of data bytes read,
  • <=0 - Error/Empty Ring buffer.
See #err_t definition for detailed explanation.
Note
None.

◆ btaudio3_generic_write()

err_t btaudio3_generic_write ( btaudio3_t * ctx,
uint8_t * data_buf,
uint16_t len )

BT Audio 3 data writing function.

This function writes a desired number of data bytes by using UART serial interface.

Parameters
[in]ctx: Click context object. See btaudio3_t object definition for detailed explanation.
[in]data_buf: Data buffer for sending.
[in]len: Number of bytes for sending.
Returns
  • >=0 - Success,
  • <0 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ btaudio3_init()

err_t btaudio3_init ( btaudio3_t * ctx,
btaudio3_cfg_t * cfg )

BT Audio 3 initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See btaudio3_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See btaudio3_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ btaudio3_make_call()

err_t btaudio3_make_call ( btaudio3_t * ctx,
uint8_t database_index,
uint8_t * phone_number )

BT Audio 3 make call function.

This function makes a call to the specified phone number.

Parameters
[in]ctx: Click context object. See btaudio3_t object definition for detailed explanation.
[in]database_index: Database index.
[in]phone_number: Phone number (up to 19 characters).
Returns
  • >=0 - Command ACK event response,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ btaudio3_music_control()

err_t btaudio3_music_control ( btaudio3_t * ctx,
btaudio3_music_control_t action )

BT Audio 3 music control function.

This function sends a music control command with a desired action.

Parameters
[in]ctx: Click context object. See btaudio3_t object definition for detailed explanation.
[in]action: Action for music control command. See btaudio3_music_control_t enum definition for detailed explanation.
Returns
  • >=0 - Command ACK event response,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ btaudio3_power_off_device()

err_t btaudio3_power_off_device ( btaudio3_t * ctx)

BT Audio 3 power OFF device function.

This function powers OFF the device and waits for the power OFF BTM event to occur.

Parameters
[in]ctx: Click context object. See btaudio3_t object definition for detailed explanation.
Returns
  • >=0 - Command ACK event response,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ btaudio3_power_on_device()

err_t btaudio3_power_on_device ( btaudio3_t * ctx)

BT Audio 3 power ON device function.

This function powers ON the device and waits for the power ON BTM event to occur.

Parameters
[in]ctx: Click context object. See btaudio3_t object definition for detailed explanation.
Returns
  • >=0 - Command ACK event response,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ btaudio3_read_event()

err_t btaudio3_read_event ( btaudio3_t * ctx)

BT Audio 3 read event function.

This function reads an event from the ring buffer and stores it in the click context object. It waits 200ms for an event, and if there's no event received it returns an error.

Parameters
[in]ctx: Click context object. See btaudio3_t object definition for detailed explanation.
Returns
  • 0 - Correct event received,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ btaudio3_reset_device()

void btaudio3_reset_device ( btaudio3_t * ctx)

BT Audio 3 reset device function.

This function resets the device via the RST pin.

Parameters
[in]ctx: Click context object. See btaudio3_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ btaudio3_reset_to_default()

err_t btaudio3_reset_to_default ( btaudio3_t * ctx)

BT Audio 3 reset to default function.

This function resets the device to default state and waits for an appropriate event to occur.

Parameters
[in]ctx: Click context object. See btaudio3_t object definition for detailed explanation.
Returns
  • >=0 - Command ACK event response,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ btaudio3_send_command()

void btaudio3_send_command ( btaudio3_t * ctx)

BT Audio 3 send command function.

This function sends a desired command from the click context object.

Parameters
[in]ctx: Click context object. See btaudio3_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ btaudio3_send_command_with_ack_check()

err_t btaudio3_send_command_with_ack_check ( btaudio3_t * ctx)

BT Audio 3 send command with ack check function.

This function sends a desired command from the click context object, and waits for the command acknowledge event, if there's no ACK event received it resends the command once again.

Parameters
[in]ctx: Click context object. See btaudio3_t object definition for detailed explanation.
Returns
  • >=0 - Command ACK event response,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ btaudio3_send_mmi_action()

err_t btaudio3_send_mmi_action ( btaudio3_t * ctx,
uint8_t database_index,
uint8_t action )

BT Audio 3 send MMI action function.

This function sends a desired MMI action to specific index database.

Parameters
[in]ctx: Click context object. See btaudio3_t object definition for detailed explanation.
[in]database_index: Database index.
[in]action: MMI action byte.
Returns
  • >=0 - Command ACK event response,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ btaudio3_set_application_mode()

void btaudio3_set_application_mode ( btaudio3_t * ctx)

BT Audio 3 set application mode function.

This function enters the application mode by setting the MOD pin to high logic state.

Parameters
[in]ctx: Click context object. See btaudio3_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ btaudio3_set_device_name()

err_t btaudio3_set_device_name ( btaudio3_t * ctx,
uint8_t * device_name )

BT Audio 3 set device name function.

This function sets the local device name.

Parameters
[in]ctx: Click context object. See btaudio3_t object definition for detailed explanation.
[in]device_name: Device name (up to 32 characters).
Returns
  • >=0 - Command ACK event response,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ btaudio3_set_eq_mode()

err_t btaudio3_set_eq_mode ( btaudio3_t * ctx,
btaudio3_eq_mode_t eq_mode )

BT Audio 3 set equalizer mode function.

This function sets the equalizer mode.

Parameters
[in]ctx: Click context object. See btaudio3_t object definition for detailed explanation.
[in]eq_mode: Equalizer mode byte. See btaudio3_eq_mode_t enum definition for detailed explanation.
Returns
  • >=0 - Command ACK event response,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ btaudio3_set_mfb_pin()

void btaudio3_set_mfb_pin ( btaudio3_t * ctx,
uint8_t state )

BT Audio 3 set MFB pin function.

This function sets the MFB pin to a desired logic state.

Parameters
[in]ctx: Click context object. See btaudio3_t object definition for detailed explanation.
[in]state: Pin logic state.
Returns
None.
Note
None.

◆ btaudio3_set_rst_pin()

void btaudio3_set_rst_pin ( btaudio3_t * ctx,
uint8_t state )

BT Audio 3 set RST pin function.

This function sets the RST pin to a desired logic state.

Parameters
[in]ctx: Click context object. See btaudio3_t object definition for detailed explanation.
[in]state: Pin logic state.
Returns
None.
Note
None.

◆ btaudio3_set_test_mode()

void btaudio3_set_test_mode ( btaudio3_t * ctx)

BT Audio 3 set test mode function.

This function enters the test mode by setting the MOD pin to low logic state.

Parameters
[in]ctx: Click context object. See btaudio3_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ btaudio3_soft_mute_output()

void btaudio3_soft_mute_output ( btaudio3_t * ctx)

BT Audio 3 soft mute output function.

This function soft mutes output by setting the SM pin to high logic state.

Parameters
[in]ctx: Click context object. See btaudio3_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ btaudio3_soft_unmute_output()

void btaudio3_soft_unmute_output ( btaudio3_t * ctx)

BT Audio 3 soft unmute output function.

This function soft unmutes output by setting the SM pin to low logic state.

Parameters
[in]ctx: Click context object. See btaudio3_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ btaudio3_volume_down()

err_t btaudio3_volume_down ( btaudio3_t * ctx,
uint8_t database_index,
uint8_t mask )

BT Audio 3 volume down function.

This function decreases the volume of a specified gain mask.

Parameters
[in]ctx: Click context object. See btaudio3_t object definition for detailed explanation.
[in]database_index: Database index.
[in]mask: Gain mask.
Returns
  • >=0 - Command ACK event response,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ btaudio3_volume_up()

err_t btaudio3_volume_up ( btaudio3_t * ctx,
uint8_t database_index,
uint8_t mask )

BT Audio 3 volume up function.

This function increases the volume of a specified gain mask.

Parameters
[in]ctx: Click context object. See btaudio3_t object definition for detailed explanation.
[in]database_index: Database index.
[in]mask: Gain mask.
Returns
  • >=0 - Command ACK event response,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ btaudio3_wait_for_event()

void btaudio3_wait_for_event ( btaudio3_t * ctx,
uint8_t opcode )

BT Audio 3 wait for event function.

This function waits for the desired event to occur and stores it in the click context object.

Parameters
[in]ctx: Click context object. See btaudio3_t object definition for detailed explanation.
[in]opcode: Expected event opcode.
Returns
None.
Note
None.