diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common/includes/GPIO/usart.h | 3 | ||||
-rw-r--r-- | src/common/src/GPS/gps.c | 5 | ||||
-rw-r--r-- | src/glutt-o-logique/usart.c | 16 |
3 files changed, 23 insertions, 1 deletions
diff --git a/src/common/includes/GPIO/usart.h b/src/common/includes/GPIO/usart.h index ed7d441..681d86f 100644 --- a/src/common/includes/GPIO/usart.h +++ b/src/common/includes/GPIO/usart.h @@ -48,6 +48,9 @@ void usart_init(void); // Needs running scheduler void usart_gps_init(void); +// Take GPS out of RESET +void usart_gps_remove_reset(void); + // Send the str to the GPS receiver void usart_gps_puts(const char* str); diff --git a/src/common/src/GPS/gps.c b/src/common/src/GPS/gps.c index 3ac2c52..cfc9782 100644 --- a/src/common/src/GPS/gps.c +++ b/src/common/src/GPS/gps.c @@ -66,7 +66,10 @@ int gps_utctime(struct tm *timeutc) { static char rxbuf[RXBUF_LEN]; static void gps_task(void __attribute__ ((unused))*pvParameters) { - // Periodically reinit the GPS + + // The initialisation placed the GPS into reset + usart_gps_remove_reset(); + while (1) { taskYIELD(); diff --git a/src/glutt-o-logique/usart.c b/src/glutt-o-logique/usart.c index 29943e9..806505b 100644 --- a/src/glutt-o-logique/usart.c +++ b/src/glutt-o-logique/usart.c @@ -31,6 +31,7 @@ * See pio.txt for PIO allocation details */ const uint16_t GPIOD_PIN_USART3_TX = GPIO_Pin_8; const uint16_t GPIOD_PIN_USART3_RX = GPIO_Pin_9; +const uint16_t GPIOD_PIN_GPS_RESET_N = GPIO_Pin_10; /* USART 2 on PA2 and PA3 */ const uint16_t GPIOA_PIN_USART2_RX = GPIO_Pin_3; @@ -103,6 +104,16 @@ void usart_gps_specific_init() { GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_UP; GPIO_Init(GPIOD, &GPIO_InitStruct); + GPIO_InitStruct.GPIO_Pin = GPIOD_PIN_GPS_RESET_N; + GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT; + GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; + GPIO_InitStruct.GPIO_OType = GPIO_OType_PP; + GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL; + GPIO_Init(GPIOD, &GPIO_InitStruct); + + // The GPS is put in RESET here, the GPS task will enable it + GPIO_ResetBits(GPIOD, GPIOD_PIN_GPS_RESET_N); + GPIO_PinAFConfig(GPIOD, GPIO_PinSource8, GPIO_AF_USART3); GPIO_PinAFConfig(GPIOD, GPIO_PinSource9, GPIO_AF_USART3); @@ -133,6 +144,11 @@ void usart_gps_specific_init() { USART_Cmd(USART3, ENABLE); } +void usart_gps_remove_reset(void) +{ + GPIO_SetBits(GPIOD, GPIOD_PIN_GPS_RESET_N); +} + // Make sure Tasks are suspended when this is called! void usart_puts(USART_TypeDef* USART, const char* str) { while(*str) { |