feat(tx15): support for KCX BT audio (#6777)
This commit is contained in:
@@ -1,3 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "drivers/tas2505.h"
|
||||
|
||||
#include "stm32_dma.h"
|
||||
@@ -141,11 +162,20 @@ static void audio_update_dma_buffer(uint8_t tc)
|
||||
|
||||
bool audioHeadphoneDetect()
|
||||
{
|
||||
#if defined(KCX_BTAUDIO)
|
||||
return gpio_read(AUDIO_HP_DETECT_PIN) || gpio_read(BTAUDIO_LINKED_GPIO);
|
||||
#else
|
||||
return gpio_read(AUDIO_HP_DETECT_PIN);
|
||||
#endif
|
||||
}
|
||||
|
||||
void audioSetVolume(uint8_t volume)
|
||||
{
|
||||
#if defined(KCX_BTAUDIO)
|
||||
// KCX need a volume boost
|
||||
if (btAudioLinked())
|
||||
volume = volume + (volume >> 2);
|
||||
#endif
|
||||
tas2505_set_volume(&_tas2505, volume * 9 / 10, audioHeadphoneDetect()); // TX15 HP cannot handle the full power of TAS2505
|
||||
}
|
||||
|
||||
|
||||
@@ -135,6 +135,10 @@ void boardInit()
|
||||
// enable interrupts
|
||||
__enable_irq();
|
||||
|
||||
#if defined(KCX_BTAUDIO)
|
||||
btAudioInit();
|
||||
#endif
|
||||
|
||||
ledInit();
|
||||
boardInitModulePorts();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user