fix(flysky gimbals): mask first 4 channels when FS gimbals are detected (#3778)
* fix(flysky gimbals): mask first 4 channels when FS gimbals are detected. * re-adjust center value to 4096 (2^12).This prevents values higher than necessary being displayed.
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "stm32_usart_driver.h"
|
||||
#include "stm32_gpio_driver.h"
|
||||
#include "stm32_dma.h"
|
||||
|
||||
#include <string.h>
|
||||
@@ -178,6 +179,7 @@ void stm32_usart_init_rx_dma(const stm32_usart_t* usart, const void* buffer, uin
|
||||
NVIC_DisableIRQ(usart->IRQn);
|
||||
}
|
||||
|
||||
stm32_dma_enable_clock(usart->rxDMA);
|
||||
LL_DMA_DeInit(usart->rxDMA, usart->rxDMA_Stream);
|
||||
|
||||
LL_DMA_InitTypeDef dmaInit;
|
||||
@@ -224,7 +226,6 @@ void stm32_usart_init(const stm32_usart_t* usart, const etx_serial_init* params)
|
||||
enable_usart_clock(usart->USARTx);
|
||||
LL_USART_DeInit(usart->USARTx);
|
||||
|
||||
// TODO: enable GPIO clock
|
||||
LL_GPIO_InitTypeDef pinInit;
|
||||
LL_GPIO_StructInit(&pinInit);
|
||||
|
||||
@@ -234,6 +235,8 @@ void stm32_usart_init(const stm32_usart_t* usart, const etx_serial_init* params)
|
||||
pinInit.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||
pinInit.Pull = LL_GPIO_PULL_UP;
|
||||
pinInit.Alternate = _get_usart_af(usart->USARTx);
|
||||
|
||||
stm32_gpio_enable_clock(usart->GPIOx);
|
||||
LL_GPIO_Init(usart->GPIOx, &pinInit);
|
||||
|
||||
LL_USART_InitTypeDef usartInit;
|
||||
@@ -344,6 +347,7 @@ void stm32_usart_send_buffer(const stm32_usart_t* usart, const uint8_t * data, u
|
||||
_half_duplex_output(usart);
|
||||
|
||||
if (usart->txDMA) {
|
||||
stm32_dma_enable_clock(usart->txDMA);
|
||||
LL_DMA_DeInit(usart->txDMA, usart->txDMA_Stream);
|
||||
|
||||
LL_DMA_InitTypeDef dmaInit;
|
||||
|
||||
Reference in New Issue
Block a user