Fixes. Flash an external module should work
This commit is contained in:
@@ -59,13 +59,13 @@ void bluetoothInit(uint32_t baudrate)
|
||||
GPIO_Init(BT_BCTS_GPIO, &GPIO_InitStructure);
|
||||
#endif
|
||||
|
||||
GPIO_PinAFConfig(BT_GPIO_TXRX, BT_TX_GPIO_PinSource, BT_GPIO_AF);
|
||||
GPIO_PinAFConfig(BT_GPIO_TXRX, BT_RX_GPIO_PinSource, BT_GPIO_AF);
|
||||
GPIO_PinAFConfig(BT_USART_GPIO, BT_TX_GPIO_PinSource, BT_GPIO_AF);
|
||||
GPIO_PinAFConfig(BT_USART_GPIO, BT_RX_GPIO_PinSource, BT_GPIO_AF);
|
||||
|
||||
GPIO_InitStructure.GPIO_Pin = BT_TX_GPIO_PIN | BT_RX_GPIO_PIN;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
||||
GPIO_Init(BT_GPIO_TXRX, &GPIO_InitStructure);
|
||||
GPIO_Init(BT_USART_GPIO, &GPIO_InitStructure);
|
||||
|
||||
USART_DeInit(BT_USART);
|
||||
USART_InitTypeDef USART_InitStructure;
|
||||
|
||||
@@ -66,6 +66,8 @@ void intmoduleSerialStart(uint32_t baudrate)
|
||||
USART_Init(INTMODULE_USART, &USART_InitStructure);
|
||||
USART_Cmd(INTMODULE_USART, ENABLE);
|
||||
|
||||
intmoduleFifo.clear();
|
||||
|
||||
USART_ITConfig(INTMODULE_USART, USART_IT_RXNE, ENABLE);
|
||||
NVIC_SetPriority(INTMODULE_USART_IRQn, 6);
|
||||
NVIC_EnableIRQ(INTMODULE_USART_IRQn);
|
||||
|
||||
@@ -185,7 +185,7 @@ void extmoduleSerialStart(uint32_t /*baudrate*/, uint32_t period_half_us)
|
||||
#endif
|
||||
|
||||
#if defined(EXTMODULE_USART)
|
||||
void extmoduleSendSerialBuffer(const uint8_t * data, uint8_t size)
|
||||
void extmoduleSendBuffer(const uint8_t * data, uint8_t size)
|
||||
{
|
||||
DMA_InitTypeDef DMA_InitStructure;
|
||||
DMA_DeInit(EXTMODULE_DMA_STREAM);
|
||||
|
||||
@@ -631,7 +631,7 @@
|
||||
#define BT_USART USART6
|
||||
#define BT_GPIO_AF GPIO_AF_USART6
|
||||
#define BT_USART_IRQn USART6_IRQn
|
||||
#define BT_GPIO_TXRX GPIOG
|
||||
#define BT_USART_GPIO GPIOG
|
||||
#define BT_TX_GPIO_PIN GPIO_Pin_14 // PG.14
|
||||
#define BT_RX_GPIO_PIN GPIO_Pin_9 // PG.09
|
||||
#define BT_TX_GPIO_PinSource GPIO_PinSource14
|
||||
|
||||
@@ -192,6 +192,8 @@ void extmodulePpmStart();
|
||||
void extmodulePxxStart();
|
||||
void extmodulePxx2Start();
|
||||
void extmoduleSerialStart(uint32_t baudrate, uint32_t period_half_us);
|
||||
void extmoduleInvertedSerialStart(uint32_t baudrate);
|
||||
void extmoduleSendBuffer(const uint8_t * data, uint8_t size);
|
||||
void extmoduleSendNextFrame();
|
||||
|
||||
// Trainer driver
|
||||
|
||||
@@ -147,12 +147,14 @@ void extmoduleInvertedSerialStart(uint32_t baudrate)
|
||||
USART_Init(EXTMODULE_USART, &USART_InitStructure);
|
||||
USART_Cmd(EXTMODULE_USART, ENABLE);
|
||||
|
||||
extmoduleFifo.clear();
|
||||
|
||||
USART_ITConfig(INTMODULE_USART, USART_IT_RXNE, ENABLE);
|
||||
NVIC_SetPriority(EXTMODULE_USART_IRQn, 6);
|
||||
NVIC_EnableIRQ(EXTMODULE_USART_IRQn);
|
||||
}
|
||||
|
||||
void extmoduleSendSerialBuffer(const uint8_t * data, uint8_t size)
|
||||
void extmoduleSendBuffer(const uint8_t * data, uint8_t size)
|
||||
{
|
||||
DMA_InitTypeDef DMA_InitStructure;
|
||||
DMA_DeInit(EXTMODULE_USART_DMA_STREAM);
|
||||
@@ -295,7 +297,7 @@ void extmoduleSendNextFrame()
|
||||
#if defined(PXX2)
|
||||
else if (moduleSettings[EXTERNAL_MODULE].protocol == PROTOCOL_CHANNELS_PXX2) {
|
||||
#if defined(EXTMODULE_USART)
|
||||
extmoduleSendSerialBuffer(extmodulePulsesData.pxx2.getData(), extmodulePulsesData.pxx2.getSize());
|
||||
extmoduleSendBuffer(extmodulePulsesData.pxx2.getData(), extmodulePulsesData.pxx2.getSize());
|
||||
#else
|
||||
sportSendBuffer(extmodulePulsesData.pxx2.getData(), extmodulePulsesData.pxx2.getSize());
|
||||
#endif
|
||||
|
||||
@@ -1284,7 +1284,7 @@
|
||||
#define BT_RCC_AHB1Periph (RCC_AHB1Periph_GPIOD | RCC_AHB1Periph_GPIOE | RCC_AHB1Periph_GPIOG)
|
||||
#define BT_RCC_APB1Periph 0
|
||||
#define BT_RCC_APB2Periph RCC_APB2Periph_USART6
|
||||
#define BT_GPIO_TXRX GPIOG
|
||||
#define BT_USART_GPIO GPIOG
|
||||
#define BT_TX_GPIO_PIN GPIO_Pin_14 // PG.14
|
||||
#define BT_RX_GPIO_PIN GPIO_Pin_9 // PG.09
|
||||
#define BT_EN_GPIO GPIOD
|
||||
@@ -1306,7 +1306,7 @@
|
||||
#else
|
||||
#define BT_EN_GPIO_PIN GPIO_Pin_12 // PE.12
|
||||
#endif
|
||||
#define BT_GPIO_TXRX GPIOB
|
||||
#define BT_USART_GPIO GPIOB
|
||||
#define BT_TX_GPIO_PIN GPIO_Pin_10 // PB.10
|
||||
#define BT_RX_GPIO_PIN GPIO_Pin_11 // PB.11
|
||||
#define BT_TX_GPIO_PinSource GPIO_PinSource10
|
||||
|
||||
Reference in New Issue
Block a user