diff --git a/flight/OpenPilot/System/inc/pios_board.h b/flight/OpenPilot/System/inc/pios_board.h index ddbfdec3d..6dc3c67a4 100644 --- a/flight/OpenPilot/System/inc/pios_board.h +++ b/flight/OpenPilot/System/inc/pios_board.h @@ -99,7 +99,8 @@ //------------------------- // PIOS_USART2 (GPS) //------------------------- -#define PIOS_USART2_ENABLED 1 +#define PIOS_USART1_NAME GPS +#define PIOS_USART2_ENABLED 1 #define PIOS_USART2_USART USART3 #define PIOS_USART2_GPIO_PORT GPIOC #define PIOS_USART2_RX_PIN GPIO_Pin_11 @@ -132,7 +133,7 @@ #define PIOS_USART_NUM 3 #define PIOS_USART_RX_BUFFER_SIZE 1024 #define PIOS_USART_TX_BUFFER_SIZE 256 -#define PIOS_COM_DEBUG_PORT GPS +#define PIOS_COM_DEBUG_PORT USART_1 //------------------------- // SPI diff --git a/flight/PiOS/Common/pios_com.c b/flight/PiOS/Common/pios_com.c index e04f058f3..9e822c843 100644 --- a/flight/PiOS/Common/pios_com.c +++ b/flight/PiOS/Common/pios_com.c @@ -74,12 +74,12 @@ int32_t PIOS_COM_SendBufferNonBlocking(COMPortTypeDef port, uint8_t *buffer, uin switch(port) { case COM_DEBUG_USART: return PIOS_USART_TxBufferPutMoreNonBlocking(PIOS_COM_DEBUG_PORT, buffer, len); - case COM_GPS_USART: - return PIOS_USART_TxBufferPutMoreNonBlocking(GPS, buffer, len); - case COM_TELEM_USART: - return PIOS_USART_TxBufferPutMoreNonBlocking(TELEM, buffer, len); - case COM_AUX_USART: - return PIOS_USART_TxBufferPutMoreNonBlocking(AUX, buffer, len); + case COM_USART1: + return PIOS_USART_TxBufferPutMoreNonBlocking(USART_1, buffer, len); + case COM_USART2: + return PIOS_USART_TxBufferPutMoreNonBlocking(USART_2, buffer, len); + case COM_USART3: + return PIOS_USART_TxBufferPutMoreNonBlocking(USART_3, buffer, len); case COM_USB_HID: return PIOS_USB_HID_TxBufferPutMoreNonBlocking(buffer, len); default: @@ -103,12 +103,12 @@ int32_t PIOS_COM_SendBuffer(COMPortTypeDef port, uint8_t *buffer, uint16_t len) switch(port) { case COM_DEBUG_USART: return PIOS_USART_TxBufferPutMore(PIOS_COM_DEBUG_PORT, buffer, len); - case COM_GPS_USART: - return PIOS_USART_TxBufferPutMore(GPS, buffer, len); - case COM_TELEM_USART: - return PIOS_USART_TxBufferPutMore(TELEM, buffer, len); - case COM_AUX_USART: - return PIOS_USART_TxBufferPutMore(AUX, buffer, len); + case COM_USART1: + return PIOS_USART_TxBufferPutMore(USART_1, buffer, len); + case COM_USART2: + return PIOS_USART_TxBufferPutMore(USART_2, buffer, len); + case COM_USART3: + return PIOS_USART_TxBufferPutMore(USART_3, buffer, len); case COM_USB_HID: return PIOS_USB_HID_TxBufferPutMore(buffer, len); default: @@ -245,17 +245,17 @@ int32_t PIOS_COM_ReceiveHandler(void) status = PIOS_USART_RxBufferGet(PIOS_COM_DEBUG_PORT); port = COM_DEBUG_USART; break; - case COM_GPS_USART: - status = PIOS_USART_RxBufferGet(GPS); - port = COM_GPS_USART; + case COM_USART1: + status = PIOS_USART_RxBufferGet(USART_1); + port = COM_USART1; break; - case COM_TELEM_USART: - status = PIOS_USART_RxBufferGet(TELEM); - port = COM_TELEM_USART; + case COM_USART2: + status = PIOS_USART_RxBufferGet(USART_2); + port = COM_USART2; break; - case COM_AUX_USART: - status = PIOS_USART_RxBufferGet(AUX); - port = COM_AUX_USART; + case COM_USART3: + status = PIOS_USART_RxBufferGet(USART_3); + port = COM_USART3; break; case COM_USB_HID: status = PIOS_USB_HID_RxBufferGet(); diff --git a/flight/PiOS/STM32F10x/pios_sys.c b/flight/PiOS/STM32F10x/pios_sys.c index 5744070a0..e37dd1e40 100644 --- a/flight/PiOS/STM32F10x/pios_sys.c +++ b/flight/PiOS/STM32F10x/pios_sys.c @@ -72,9 +72,11 @@ void PIOS_SYS_Init(void) /* Initialise Basic NVIC */ NVIC_Configuration(); - + +#if !defined(PIOS_DONT_USE_LED) /* Initialise LEDs */ PIOS_LED_Init(); +#endif } /** diff --git a/flight/PiOS/STM32F10x/pios_usart.c b/flight/PiOS/STM32F10x/pios_usart.c index f85fa4ba6..671ea0703 100644 --- a/flight/PiOS/STM32F10x/pios_usart.c +++ b/flight/PiOS/STM32F10x/pios_usart.c @@ -525,15 +525,15 @@ PIOS_USART1_IRQHANDLER_FUNC if(PIOS_USART1_USART->SR & (1 << 5)) { uint8_t b = PIOS_USART1_USART->DR; - if(PIOS_USART_RxBufferPut(GPS, b) < 0) { + if(PIOS_USART_RxBufferPut(USART_1, b) < 0) { /* Here we could add some error handling */ } } /* Check if TXE flag is set */ if(PIOS_USART1_USART->SR & (1 << 7)) { - if(PIOS_USART_TxBufferUsed(GPS) > 0) { - int b = PIOS_USART_TxBufferGet(GPS); + if(PIOS_USART_TxBufferUsed(USART_1) > 0) { + int b = PIOS_USART_TxBufferGet(USART_1); if( b < 0 ) { /* Here we could add some error handling */ PIOS_USART1_USART->DR = 0xff; @@ -554,15 +554,15 @@ PIOS_USART2_IRQHANDLER_FUNC if(PIOS_USART2_USART->SR & (1 << 5)) { uint8_t b = PIOS_USART2_USART->DR; - if(PIOS_USART_RxBufferPut(TELEM, b) < 0) { + if(PIOS_USART_RxBufferPut(USART_2, b) < 0) { /* Here we could add some error handling */ } } /* Check if TXE flag is set */ if(PIOS_USART2_USART->SR & (1 << 7)) { - if(PIOS_USART_TxBufferUsed(TELEM) > 0) { - int b = PIOS_USART_TxBufferGet(TELEM); + if(PIOS_USART_TxBufferUsed(USART_2) > 0) { + int b = PIOS_USART_TxBufferGet(USART_2); if(b < 0) { /* Here we could add some error handling */ PIOS_USART2_USART->DR = 0xff; @@ -583,14 +583,14 @@ PIOS_USART3_IRQHANDLER_FUNC if(PIOS_USART3_USART->SR & (1 << 5)) { uint8_t b = PIOS_USART3_USART->DR; - if(PIOS_USART_RxBufferPut(AUX, b) < 0) { + if(PIOS_USART_RxBufferPut(USART_3, b) < 0) { /* Here we could add some error handling */ } } if(PIOS_USART3_USART->SR & (1 << 7)) { // check if TXE flag is set - if(PIOS_USART_TxBufferUsed(AUX) > 0) { - int b = PIOS_USART_TxBufferGet(AUX); + if(PIOS_USART_TxBufferUsed(USART_3) > 0) { + int b = PIOS_USART_TxBufferGet(USART_3); if(b < 0) { /* Here we could add some error handling */ PIOS_USART3_USART->DR = 0xff; diff --git a/flight/PiOS/STM32F10x/pios_usb_hid.c b/flight/PiOS/STM32F10x/pios_usb_hid.c index b725faa20..16401aa48 100644 --- a/flight/PiOS/STM32F10x/pios_usb_hid.c +++ b/flight/PiOS/STM32F10x/pios_usb_hid.c @@ -120,7 +120,7 @@ int32_t PIOS_USB_HID_ChangeConnectionState(uint32_t Connected) } /** -* This function returns the connection status of the USB COM interface +* This function returns the connection status of the USB HID interface * \return 1: interface available * \return 0: interface not available * \note Applications shouldn't call this function directly, instead please use \ref PIOS_COM layer functions diff --git a/flight/PiOS/inc/pios_com.h b/flight/PiOS/inc/pios_com.h index d5ff89b74..e270e439e 100644 --- a/flight/PiOS/inc/pios_com.h +++ b/flight/PiOS/inc/pios_com.h @@ -30,9 +30,9 @@ /* Global Types */ typedef enum { COM_DEBUG_USART = 0, - COM_GPS_USART = 1, - COM_TELEM_USART = 2, - COM_AUX_USART = 3, + COM_USART1 = 1, + COM_USART2 = 2, + COM_USART3 = 3, COM_USB_HID = 4 } COMPortTypeDef; diff --git a/flight/PiOS/inc/pios_usart.h b/flight/PiOS/inc/pios_usart.h index 1a2c386e5..b963398ff 100644 --- a/flight/PiOS/inc/pios_usart.h +++ b/flight/PiOS/inc/pios_usart.h @@ -29,7 +29,7 @@ /* Global Types */ -typedef enum {GPS = 0, TELEM = 1, AUX = 2} USARTNumTypeDef; //TODO: Make this non-application specific +typedef enum {USART_1 = 0, USART_2 = 1, USART_3 = 2} USARTNumTypeDef; //TODO: Make this non-application specific /* Public Functions */