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

Improve BT speed

This commit is contained in:
Bertrand Songis 2019-04-25 09:46:23 +02:00
parent 1fb995b915
commit d73081425f
2 changed files with 10 additions and 2 deletions

View file

@ -30,7 +30,9 @@ volatile uint8_t btChipPresent = 0;
enum BluetoothWriteState
{
BLUETOOTH_WRITE_IDLE,
#if defined(BT_BRTS_GPIO_PIN)
BLUETOOTH_WRITE_INIT,
#endif
BLUETOOTH_WRITING,
BLUETOOTH_WRITE_DONE
};
@ -123,20 +125,25 @@ extern "C" void BT_USART_IRQHandler(void)
}
}
void bluetoothWriteWakeup(void)
void bluetoothWriteWakeup()
{
if (bluetoothWriteState == BLUETOOTH_WRITE_IDLE) {
if (!btTxFifo.isEmpty()) {
bluetoothWriteState = BLUETOOTH_WRITE_INIT;
#if defined(BT_BRTS_GPIO_PIN)
bluetoothWriteState = BLUETOOTH_WRITE_INIT;
GPIO_ResetBits(BT_BRTS_GPIO, BT_BRTS_GPIO_PIN);
#else
bluetoothWriteState = BLUETOOTH_WRITING;
USART_ITConfig(BT_USART, USART_IT_TXE, ENABLE);
#endif
}
}
#if defined(BT_BRTS_GPIO_PIN)
else if (bluetoothWriteState == BLUETOOTH_WRITE_INIT) {
bluetoothWriteState = BLUETOOTH_WRITING;
USART_ITConfig(BT_USART, USART_IT_TXE, ENABLE);
}
#endif
else if (bluetoothWriteState == BLUETOOTH_WRITE_DONE) {
bluetoothWriteState = BLUETOOTH_WRITE_IDLE;
#if defined(BT_BRTS_GPIO_PIN)