diff --git a/conf/modules/gps_ubx_ucenter.xml b/conf/modules/gps_ubx_ucenter.xml new file mode 100644 index 0000000000..063d4bc866 --- /dev/null +++ b/conf/modules/gps_ubx_ucenter.xml @@ -0,0 +1,29 @@ + + + + + +
+ +
+ + + + + +
+ + diff --git a/conf/settings/gps_ubx_ucenter.xml b/conf/settings/gps_ubx_ucenter.xml new file mode 100644 index 0000000000..24811abbf7 --- /dev/null +++ b/conf/settings/gps_ubx_ucenter.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/conf/ubx.xml b/conf/ubx.xml index cb8b5d572b..ddc9f1850e 100644 --- a/conf/ubx.xml +++ b/conf/ubx.xml @@ -205,4 +205,17 @@ + + + + + + + + + + + + + diff --git a/sw/airborne/arch/lpc21/mcu_periph/uart_arch.h b/sw/airborne/arch/lpc21/mcu_periph/uart_arch.h index 40cd39250b..f44264a428 100644 --- a/sw/airborne/arch/lpc21/mcu_periph/uart_arch.h +++ b/sw/airborne/arch/lpc21/mcu_periph/uart_arch.h @@ -33,6 +33,7 @@ #define B1200 UART_BAUD(1200) #define B2400 UART_BAUD(2400) +#define B4800 UART_BAUD(4800) #define B9600 UART_BAUD(9600) #define B19200 UART_BAUD(19200) #define B38400 UART_BAUD(38400) diff --git a/sw/airborne/arch/stm32/mcu_periph/uart_arch.h b/sw/airborne/arch/stm32/mcu_periph/uart_arch.h index 71191f04ba..45ff4afc4c 100644 --- a/sw/airborne/arch/stm32/mcu_periph/uart_arch.h +++ b/sw/airborne/arch/stm32/mcu_periph/uart_arch.h @@ -31,6 +31,7 @@ #include "std.h" +#define B4800 4800 #define B9600 9600 #define B38400 38400 #define B57600 57600 diff --git a/sw/airborne/firmwares/fixedwing/main_ap.c b/sw/airborne/firmwares/fixedwing/main_ap.c index 2b4dca044d..89c1e9c589 100644 --- a/sw/airborne/firmwares/fixedwing/main_ap.c +++ b/sw/airborne/firmwares/fixedwing/main_ap.c @@ -581,12 +581,6 @@ void init_ap( void ) { /** wait 0.5s (historical :-) */ sys_time_usleep(500000); -#ifdef GPS_CONFIGURE -#ifndef SITL - gps_configure_uart(); -#endif -#endif - #if defined DATALINK #if DATALINK == XBEE diff --git a/sw/airborne/mcu_periph/uart.h b/sw/airborne/mcu_periph/uart.h index f7c6e4f788..d9ebf3b32b 100644 --- a/sw/airborne/mcu_periph/uart.h +++ b/sw/airborne/mcu_periph/uart.h @@ -92,7 +92,7 @@ extern void uart0_init(void); #define UART0ChAvailable Uart0ChAvailable #define UART0Getch Uart0Getch #define UART0TxRunning Uart0TxRunning -#define UART0InitParam Uart0InitParam +#define UART0SetBaudrate Uart0SetBaudrate #endif // USE_UART0 @@ -117,7 +117,7 @@ extern void uart1_init(void); #define UART1ChAvailable Uart1ChAvailable #define UART1Getch Uart1Getch #define UART1TxRunning Uart1TxRunning -#define UART1InitParam Uart1InitParam +#define UART1SetBaudrate Uart1SetBaudrate #endif // USE_UART1 @@ -142,7 +142,7 @@ extern void uart2_init(void); #define UART2ChAvailable Uart2ChAvailable #define UART2Getch Uart2Getch #define UART2TxRunning Uart2TxRunning -#define UART2InitParam Uart2InitParam +#define UART2SetBaudrate Uart2SetBaudrate #endif // USE_UART2 @@ -167,7 +167,7 @@ extern void uart3_init(void); #define UART3ChAvailable Uart3ChAvailable #define UART3Getch Uart3Getch #define UART3TxRunning Uart3TxRunning -#define UART3InitParam Uart3InitParam +#define UART3SetBaudrate Uart3SetBaudrate #endif // USE_UART3 @@ -192,7 +192,7 @@ extern void uart5_init(void); #define UART5ChAvailable Uart5ChAvailable #define UART5Getch Uart5Getch #define UART5TxRunning Uart5TxRunning -#define UART5InitParam Uart5InitParam +#define UART5SetBaudrate Uart5SetBaudrate #endif // USE_UART5 diff --git a/sw/airborne/modules/gps/gps_ubx_ucenter.c b/sw/airborne/modules/gps/gps_ubx_ucenter.c new file mode 100644 index 0000000000..7abe6112bb --- /dev/null +++ b/sw/airborne/modules/gps/gps_ubx_ucenter.c @@ -0,0 +1,410 @@ +/* + * Copyright (C) 2008-2011 The Paparazzi Team + * + * This file is part of paparazzi. + * + * paparazzi is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * paparazzi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with paparazzi; see the file COPYING. If not, write to + * the Free Software Foundation, 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Initial author: C. De Wagter + */ + +#include "gps_ubx_ucenter.h" + +////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////// +// +// UCENTER: init, periodic and event + +static bool_t gps_ubx_ucenter_autobaud(uint8_t nr); +static bool_t gps_ubx_ucenter_configure(uint8_t nr); + +#define GPS_UBX_UCENTER_STATUS_STOPPED 0 +#define GPS_UBX_UCENTER_STATUS_AUTOBAUD 1 +#define GPS_UBX_UCENTER_STATUS_CONFIG 2 + +#define GPS_UBX_UCENTER_REPLY_NONE 0 +#define GPS_UBX_UCENTER_REPLY_ACK 1 +#define GPS_UBX_UCENTER_REPLY_NACK 2 +#define GPS_UBX_UCENTER_REPLY_VERSION 3 + +// All U-Center data +struct gps_ubx_ucenter_struct gps_ubx_ucenter; + + +///////////////////////////// +// Init Function + +void gps_ubx_ucenter_init(void) +{ + // Start UCenter + gps_ubx_ucenter.status = GPS_UBX_UCENTER_STATUS_AUTOBAUD; + gps_ubx_ucenter.reply = GPS_UBX_UCENTER_REPLY_NONE; + gps_ubx_ucenter.cnt = 0; + + gps_ubx_ucenter.baud_init = 0; + gps_ubx_ucenter.baud_run = 0; + + gps_ubx_ucenter.sw_ver_h = 0; + gps_ubx_ucenter.sw_ver_l = 0; + gps_ubx_ucenter.hw_ver_h = 0; + gps_ubx_ucenter.hw_ver_l = 0; + + for (int i=0; i