1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-26 01:35:21 +03:00

Bluetooth flash firmware continued

This commit is contained in:
Bertrand Songis 2019-04-25 15:08:38 +02:00
parent 798ee0ffee
commit 3323b0a82f
18 changed files with 112 additions and 45 deletions

View file

@ -39,7 +39,7 @@ enum BluetoothWriteState
volatile uint8_t bluetoothWriteState = BLUETOOTH_WRITE_IDLE;
void bluetoothInit(uint32_t baudrate)
void bluetoothInit(uint32_t baudrate, bool enable)
{
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = BT_EN_GPIO_PIN;
@ -88,10 +88,12 @@ void bluetoothInit(uint32_t baudrate)
btTxFifo.clear();
bluetoothWriteState = BLUETOOTH_WRITE_IDLE;
GPIO_ResetBits(BT_EN_GPIO, BT_EN_GPIO_PIN); // open bluetooth
if (enable) {
GPIO_ResetBits(BT_EN_GPIO, BT_EN_GPIO_PIN); // open bluetooth
}
}
void bluetoothDone()
void bluetoothDisable()
{
GPIO_SetBits(BT_EN_GPIO, BT_EN_GPIO_PIN); // close bluetooth (recent modules will go to bootloader mode)
}
@ -107,7 +109,7 @@ extern "C" void BT_USART_IRQHandler(void)
if (!btChipPresent) {
// This is to differentiate X7 and X7S and X-Lite with/without BT
btChipPresent = 1;
bluetoothDone();
bluetoothDisable();
}
#endif
}