42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
66#define BTAUDIO_MAP_MIKROBUS( cfg, mikrobus ) \
67 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
68 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
69 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
70 cfg.pwr = MIKROBUS( mikrobus, MIKROBUS_CS ); \
71 cfg.cmd = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
72 cfg.frs = MIKROBUS( mikrobus, MIKROBUS_INT ); \
73 cfg.baud = MIKROBUS( mikrobus, MIKROBUS_AN )
80#define BTAUDIO_RETVAL uint8_t
82#define BTAUDIO_OK 0x00
83#define BTAUDIO_INIT_ERROR 0xFF
90#define DRV_RX_BUFFER_SIZE 600
91#define DRV_TX_BUFFER_SIZE 100
98#define BTAUDIO_ERR 0x00
99#define BTAUDIO_STATUS_FALSE 0x00
100#define BTAUDIO_STATUS_TRUE 0x01
#define DRV_RX_BUFFER_SIZE
Definition btaudio.h:90
#define DRV_TX_BUFFER_SIZE
Definition btaudio.h:91
#define BTAUDIO_RETVAL
Definition btaudio.h:80
void btaudio_cfg_setup(btaudio_cfg_t *cfg)
Config Object Initialization function.
void btaudio_set_audio_output(btaudio_t *ctx, a2dp_routing_values_t setting, bit_res_t bit_res, sample_rate_t sample_rate)
Set audio output function.
void btaudio_write_byte(btaudio_t *ctx, uint8_t input)
Write Single byte function.
void btaudio_set_extended_features(btaudio_t *ctx, extended_features_bitmask_values ext_features)
Set extended features function.
void btaudio_get_firmware_version(btaudio_t *ctx)
Get firmware version function.
uint8_t btaudio_mute_hold_call(btaudio_t *ctx, uint8_t mute)
Mute hold call function.
void btaudio_cnnct_two_calls(btaudio_t *ctx)
Connect two calls function.
void btaudio_query_connection_status(btaudio_t *ctx)
Query connection status function.
void btaudio_increase_volume(btaudio_t *ctx)
Increase volume function.
BTAUDIO_RETVAL btaudio_init(btaudio_t *ctx, btaudio_cfg_t *cfg)
Initialization function.
void btaudio_get_basic_settings(btaudio_t *ctx)
Get basic settings function.
void btaudio_dfu_mode(btaudio_t *ctx)
DFU mode function.
void btaudio_dial_last_phone_number(btaudio_t *ctx)
Dial last phone number function.
void btaudio_get_gpio_dirr(btaudio_t *ctx)
Get GPIO DIRR function.
void btaudio_reject_call(btaudio_t *ctx)
Reject call function.
void btaudio_set_mode(btaudio_t *ctx, uint8_t mode)
Set mode function.
uint8_t btaudio_answer_keyboard(btaudio_t *ctx, uint8_t answer)
Answer the keyboard function.
void btaudio_set_hold_accept_incoming(btaudio_t *ctx)
Set hold accept incoming function.
void btaudio_get_help(btaudio_t *ctx)
Get help status function.
void btaudio_set_toneain_lvl(btaudio_t *ctx, uint8_t tone_gain_lvl)
Set tone gain levels function.
uint8_t btaudio_set_security_pin(btaudio_t *ctx, uint8_t *security_pin)
Set the security pin code function.
int32_t btaudio_generic_read(btaudio_t *ctx, char *data_buf, uint16_t max_len)
Generic read function.
uint8_t btaudio_call_phone_number(btaudio_t *ctx, char *p_number)
Call phone number function.
void btaudio_set_power_on(btaudio_t *ctx)
Power On function.
void btaudio_toggle_local_echo(btaudio_t *ctx)
Toggle local echo function.
void btaudio_show_track_metadata(btaudio_t *ctx)
Show track metadata function.
void btaudio_get_gpio_level(btaudio_t *ctx)
Get GPIO level function.
void btaudio_next_track(btaudio_t *ctx)
Play next track function.
void btaudio_enable_voice_commands(btaudio_t *ctx)
Enable voice commands function.
void btaudio_accept_held_call(btaudio_t *ctx)
Accept held call function.
void btaudio_set_power_off(btaudio_t *ctx)
Power Off function.
void btaudio_accept_call(btaudio_t *ctx)
Accept call function.
void btaudio_decrease_volume(btaudio_t *ctx)
Decrease volume function.
void btaudio_set_factory_defaults(btaudio_t *ctx)
Set factory defaults settings function.
void btaudio_get_reg_settings(btaudio_t *ctx, char cmd)
Get register settings function.
uint8_t btaudio_set_device_name(btaudio_t *ctx, uint8_t *name)
Set device name function.
void btaudio_reboot(btaudio_t *ctx)
Reboot function.
void btaudio_set_authentication(btaudio_t *ctx, uint8_t authentication)
Set authentication function.
uint8_t btaudio_toggle_discoverable(btaudio_t *ctx, uint8_t discoverable)
Toggle discoverable function.
uint8_t btaudio_set_automatic_shutdown(btaudio_t *ctx, uint16_t seconds)
Set automatic shutdown function.
void btaudio_reset_prev_paired_devices(btaudio_t *ctx)
Reset prev paired devices function.
uint8_t btaudio_interrupt(btaudio_t *ctx)
Get interrupt state function.
void btaudio_disconnect_current_connection(btaudio_t *ctx, profile_bitmask_values profile)
Disconnect current connection function.
void btaudio_add_held_call(btaudio_t *ctx)
Add held call function.
void btaudio_pause_play_track(btaudio_t *ctx)
Pause track function.
void btaudio_get_battery_status(btaudio_t *ctx)
Get battery status function.
void btaudio_set_cmd_mode(btaudio_t *ctx, uint8_t mode)
Set command mode function.
void btaudio_set_discovery_mask(btaudio_t *ctx, uint8_t discovery_mask)
Set discovery mask enabled for discovery function.
void btaudio_set_speaker_gain_lvl(btaudio_t *ctx, uint8_t speaker_gain_lvl)
Set speaker gain levels function.
void btaudio_reconnect_most_recent(btaudio_t *ctx)
Reconnect most recent function.
void btaudio_display_caller_id(btaudio_t *ctx)
Display caller Id function.
void btaudio_generic_write(btaudio_t *ctx, char *data_buf, uint16_t len)
Generic write function.
void btaudio_previous_track(btaudio_t *ctx)
Play previous track function.
uint8_t btaudio_set_service_class_device(btaudio_t *ctx, uint8_t *sc_device)
Set service class of device function.
void btaudio_reset(btaudio_t *ctx)
Reset function.
void btaudio_userBusy(btaudio_t *ctx)
User busy function.
void btaudio_get_all_settings(btaudio_t *ctx)
Get all settings function.
void btaudio_transfer_active_calls(btaudio_t *ctx)
Transfer active calls function.
void btaudio_write_command(btaudio_t *ctx, char *data_buf)
Write command function.
bit_res_t
Definition btaudio.h:168
a2dp_routing_values_t
Definition btaudio.h:159
uint8_t btaudio_error_t
Error type.
Definition btaudio.h:215
sample_rate_t
Definition btaudio.h:175
extended_features_bitmask_values
Definition btaudio.h:193
profile_bitmask_values
Definition btaudio.h:184
@ RES_24
Definition btaudio.h:169
@ RES_32
Definition btaudio.h:170
@ ANALOG_OUTPUT
Definition btaudio.h:160
@ S_PDIF_OUPUT
Definition btaudio.h:162
@ INTERCOM_DAC
Definition btaudio.h:163
@ I2S_OUPUT
Definition btaudio.h:161
@ RATE_8K
Definition btaudio.h:176
@ RATE_32K
Definition btaudio.h:177
@ RATE_44K1
Definition btaudio.h:178
@ RATE_48K
Definition btaudio.h:179
@ ENABLE_PLAYBACK_TONE
Definition btaudio.h:207
@ ENABLE_INDICATOR
Definition btaudio.h:205
@ RECONNECT_PWR_ON
Definition btaudio.h:195
@ RESET_PWR_OFF
Definition btaudio.h:203
@ RECONNECT_PANIC
Definition btaudio.h:204
@ MUTE_VOLUME
Definition btaudio.h:199
@ PWR_OFF_P_TIMEOUT
Definition btaudio.h:202
@ ENABLE_TRACK_CHANGE
Definition btaudio.h:206
@ DISABLE_SYS_TONES
Definition btaudio.h:201
@ DISCOVERABLE
Definition btaudio.h:196
@ REBOOT_DIS
Definition btaudio.h:198
@ AVRCP_EK
Definition btaudio.h:194
@ AAC_APTX
Definition btaudio.h:197
@ ENABLE_PIO4
Definition btaudio.h:200
@ AUTO_ACCEPT
Definition btaudio.h:208
@ A2DP_MODE
Definition btaudio.h:187
@ IAP_MODE
Definition btaudio.h:185
@ HFP_MODE
Definition btaudio.h:188
@ SPP_MODE
Definition btaudio.h:186
Click configuration structure definition.
Definition btaudio.h:134
pin_name_t baud
Definition btaudio.h:146
uint32_t baud_rate
Definition btaudio.h:150
bool uart_blocking
Definition btaudio.h:151
pin_name_t cmd
Definition btaudio.h:144
pin_name_t frs
Definition btaudio.h:145
uart_data_bits_t data_bit
Definition btaudio.h:152
pin_name_t tx_pin
Definition btaudio.h:138
pin_name_t pwr
Definition btaudio.h:143
pin_name_t rx_pin
Definition btaudio.h:137
uart_stop_bits_t stop_bit
Definition btaudio.h:154
uart_parity_t parity_bit
Definition btaudio.h:153
pin_name_t rst
Definition btaudio.h:142
Click ctx object definition.
Definition btaudio.h:113
digital_out_t pwr
Definition btaudio.h:117
digital_out_t cmd
Definition btaudio.h:118
digital_out_t baud
Definition btaudio.h:119
uart_t uart
Definition btaudio.h:124
digital_out_t frs
Definition btaudio.h:120
digital_out_t rst
Definition btaudio.h:116