diff --git a/flight/OpenPilot/System/inc/pios_board.h b/flight/OpenPilot/System/inc/pios_board.h index 9725b0ea4..51ae98872 100644 --- a/flight/OpenPilot/System/inc/pios_board.h +++ b/flight/OpenPilot/System/inc/pios_board.h @@ -103,20 +103,25 @@ TIM8 | Servo 5 | Servo 6 | Servo 7 | Servo 8 // // See also pios_board.c //------------------------- -#define PIOS_USART_RX_BUFFER_SIZE 1024 -#define PIOS_USART_TX_BUFFER_SIZE 256 +#define PIOS_USART_RX_BUFFER_SIZE 1024 +#define PIOS_USART_TX_BUFFER_SIZE 256 -#define PIOS_COM_TELEM_RF 0 -#define PIOS_COM_GPS 1 -#define PIOS_COM_TELEM_USB 2 +#define PIOS_COM_TELEM_BAUDRATE 57600 +#define PIOS_COM_GPS_BAUDRATE 57600 + +#define PIOS_COM_TELEM_RF 0 +#define PIOS_COM_GPS 1 +#define PIOS_COM_TELEM_USB 2 #ifdef PIOS_ENABLE_AUX_UART -#define PIOS_COM_AUX 3 -#define PIOS_COM_DEBUG PIOS_COM_AUX + #define PIOS_COM_AUX_BAUDRATE 57600 + #define PIOS_COM_AUX 3 + #define PIOS_COM_DEBUG PIOS_COM_AUX #endif #ifdef PIOS_INCLUDE_SPEKTRUM -#define PIOS_COM_SPEKTRUM 3 + #define PIOS_COM_SPEKTRUM_BAUDRATE 115200 + #define PIOS_COM_SPEKTRUM 3 #endif //------------------------- diff --git a/flight/OpenPilot/System/pios_board.c b/flight/OpenPilot/System/pios_board.c index 17dda5dac..e2007aa38 100644 --- a/flight/OpenPilot/System/pios_board.c +++ b/flight/OpenPilot/System/pios_board.c @@ -313,7 +313,11 @@ void USART2_IRQHandler() __attribute__ ((alias ("PIOS_USART_telem_irq_handler")) const struct pios_usart_cfg pios_usart_telem_cfg = { .regs = USART2, .init = { - .USART_BaudRate = 57600, + #if defined (PIOS_COM_TELEM_BAUDRATE) + .USART_BaudRate = PIOS_COM_TELEM_BAUDRATE, + #else + .USART_BaudRate = 57600, + #endif .USART_WordLength = USART_WordLength_8b, .USART_Parity = USART_Parity_No, .USART_StopBits = USART_StopBits_1, @@ -356,7 +360,11 @@ const struct pios_usart_cfg pios_usart_gps_cfg = { .regs = USART3, .remap = GPIO_PartialRemap_USART3, .init = { - .USART_BaudRate = 57600, + #if defined (PIOS_COM_GPS_BAUDRATE) + .USART_BaudRate = PIOS_COM_GPS_BAUDRATE, + #else + .USART_BaudRate = 57600, + #endif .USART_WordLength = USART_WordLength_8b, .USART_Parity = USART_Parity_No, .USART_StopBits = USART_StopBits_1, @@ -399,6 +407,11 @@ void USART1_IRQHandler() __attribute__ ((alias ("PIOS_USART_aux_irq_handler"))); const struct pios_usart_cfg pios_usart_aux_cfg = { .regs = USART1, .init = { + #if defined (PIOS_COM_AUX_BAUDRATE) + .USART_BaudRate = PIOS_COM_AUX_BAUDRATE, + #else + .USART_BaudRate = 57600, + #endif .USART_BaudRate = 57600, .USART_WordLength = USART_WordLength_8b, .USART_Parity = USART_Parity_No, @@ -444,7 +457,11 @@ void USART1_IRQHandler() __attribute__ ((alias ("PIOS_USART_spektrum_irq_handler const struct pios_usart_cfg pios_usart_spektrum_cfg = { .regs = USART1, .init = { - .USART_BaudRate = 115200, + #if defined (PIOS_COM_SPEKTRUM_BAUDRATE) + .USART_BaudRate = PIOS_COM_SPEKTRUM_BAUDRATE, + #else + .USART_BaudRate = 115200, + #endif .USART_WordLength = USART_WordLength_8b, .USART_Parity = USART_Parity_No, .USART_StopBits = USART_StopBits_1,