Horus internal GPS: cmake changes, more CLI options, ability to send commands to the module

This commit is contained in:
Damjan Adamic
2016-08-30 21:23:20 +02:00
parent 1ef91597ca
commit ff37274e64
7 changed files with 75 additions and 13 deletions
+11 -3
View File
@@ -1,7 +1,14 @@
set(PCBREV "13" CACHE STRING "PCB Revision")
set(INTERNAL_GPS_BAUDRATE "9600" CACHE STRING "Baud rate for internal GPS")
option(INTERNAL_GPS_INSTALLED "Internal GPS installed in beta hardware version" NO)
option(DISK_CACHE "Enable SD card disk cache" YES)
if(${PCBREV} GREATER 10)
option(INTERNAL_GPS "Internal GPS installed" YES)
else()
option(INTERNAL_GPS "Internal GPS installed" NO)
if(NOT INTERNAL_GPS)
message("Internal GPS is optional, use INTERNAL_GPS=YES option to enable it")
endif()
endif()
set(CPU_TYPE STM32F4)
set(HSE_VALUE 12000000)
@@ -52,8 +59,9 @@ if(DISK_CACHE)
set(SRC ${SRC} disk_cache.cpp)
add_definitions(-DDISK_CACHE)
endif()
if(INTERNAL_GPS_INSTALLED)
add_definitions(-DINTERNAL_GPS_INSTALLED)
if(INTERNAL_GPS)
add_definitions(-DINTERNAL_GPS)
message("Internal GPS enabled")
endif()
set(SERIAL2_DRIVER serial2_driver.cpp)
set(TARGET_SRC
+4 -5
View File
@@ -389,13 +389,12 @@ void hapticOff(void);
void hapticOn(uint32_t pwmPercent);
// GPS driver
#if PCBREV >= 13 || defined(INTERNAL_GPS_INSTALLED)
#define INTERNAL_GPS 1
#else
#define INTERNAL_GPS 0
#endif
void gpsInit(uint32_t baudrate);
uint8_t gpsGetByte(uint8_t * byte);
#if defined(DEBUG)
extern uint8_t gpsTraceEnabled;
void gpsSendByte(uint8_t byte);
#endif
// Second serial port driver
#define SERIAL2
+22 -2
View File
@@ -60,9 +60,23 @@ void gpsInit(uint32_t baudrate)
NVIC_Init(&NVIC_InitStructure);
}
#if defined(DEBUG)
uint8_t gpsTraceEnabled = false;
Fifo<uint8_t, 64> gpsTxFifo;
void gpsSendByte(uint8_t byte)
{
while (gpsTxFifo.isFull());
gpsTxFifo.push(byte);
USART_ITConfig(GPS_USART, USART_IT_TXE, ENABLE);
}
#endif // #if defined(DEBUG)
extern "C" void GPS_USART_IRQHandler(void)
{
#if 0
#if defined(DEBUG)
// Send
if (USART_GetITStatus(GPS_USART, USART_IT_TXE) != RESET) {
uint8_t txchar;
@@ -89,5 +103,11 @@ extern "C" void GPS_USART_IRQHandler(void)
uint8_t gpsGetByte(uint8_t * byte)
{
return gpsRxFifo.pop(*byte);
uint8_t result = gpsRxFifo.pop(*byte);
#if defined(DEBUG)
if (gpsTraceEnabled) {
serialPutc(*byte);
}
#endif
return result;
}