[uart] fix uart speed config on linux based AP

This commit is contained in:
Gautier Hattenberger
2014-01-09 22:49:49 +01:00
parent 505ad70de5
commit e863bf9ba4
5 changed files with 19 additions and 2 deletions
@@ -44,6 +44,7 @@
#define B100000 100000
#define B115200 115200
#define B230400 230400
#define UART_SPEED(_def) _def
#define UART_8N1 (uint8_t)(ULCR_CHAR_8 + ULCR_PAR_NO + ULCR_STOP_1)
#define UART_7N1 (uint8_t)(ULCR_CHAR_7 + ULCR_PAR_NO + ULCR_STOP_1)
@@ -31,6 +31,20 @@
// for definition of baud rates
#include <termios.h>
// for conversion between linux baud rate definition and actual speed
#define B1200_SPEED 1200
#define B2400_SPEED 2400
#define B4800_SPEED 4800
#define B9600_SPEED 9600
#define B19200_SPEED 19200
#define B38400_SPEED 38400
#define B57600_SPEED 57600
#define B100000_SPEED 100000
#define B115200_SPEED 115200
#define B230400_SPEED 230400
#define B921600_SPEED 921600
#define UART_SPEED(_def) _def##_SPEED
#define UART1_irq_handler usart1_irq_handler
#define UART2_irq_handler usart2_irq_handler
#define UART3_irq_handler usart3_irq_handler
@@ -38,6 +38,7 @@ extern char stdinout_buffer[STDINOUT_BUFFER_SIZE];
extern uint8_t stdinout_rx_insert_idx;
extern uint8_t stdinout_rx_extract_idx;
#define UART_SPEED(_def) {}
static inline bool StdInOutChAvailable(void) {
struct timeval tv;
@@ -40,5 +40,6 @@
#define B115200 115200
#define B230400 230400
#define B921600 921600
#define UART_SPEED(_def) _def
#endif /* STM32_UART_ARCH_H */
+2 -2
View File
@@ -297,7 +297,7 @@ static inline void gps_ubx_ucenter_config_port(void)
#endif
// UART Interface
#if GPS_PORT_ID == GPS_PORT_UART1 || GPS_PORT_ID == GPS_PORT_UART2
UbxSend_CFG_PRT(GPS_PORT_ID, 0x0, 0x0, 0x000008D0, UBX_GPS_BAUD, UBX_PROTO_MASK, UBX_PROTO_MASK, 0x0, 0x0);
UbxSend_CFG_PRT(GPS_PORT_ID, 0x0, 0x0, 0x000008D0, UART_SPEED(UBX_GPS_BAUD), UBX_PROTO_MASK, UBX_PROTO_MASK, 0x0, 0x0);
#endif
#if GPS_PORT_ID == GPS_PORT_USB
UbxSend_CFG_PRT(GPS_PORT_ID, 0x0, 0x0, 0x0, 0, UBX_PROTO_MASK, UBX_PROTO_MASK, 0x0, 0x0);
@@ -379,7 +379,7 @@ static bool_t gps_ubx_ucenter_configure(uint8_t nr)
case 6:
// Now the GPS baudrate should have changed
GpsUartSetBaudrate(UBX_GPS_BAUD);
gps_ubx_ucenter.baud_run = UBX_GPS_BAUD;
gps_ubx_ucenter.baud_run = UART_SPEED(UBX_GPS_BAUD);
gps_ubx_ucenter_config_nav();
break;
case 7: