diff --git a/meson.build b/meson.build index f3fce9ba..2740f161 100644 --- a/meson.build +++ b/meson.build @@ -285,6 +285,8 @@ stm32h743_src = ['platform/mcu/STM32H7xx/boot/startup.cpp', 'platform/drivers/GPIO/gpio_stm32.c', 'platform/drivers/ADC/adc_stm32h7.c', 'platform/drivers/SPI/spi_stm32h7.c', + 'platform/drivers/GPS/gps_stm32.cpp', + 'platform/drivers/GPS/nmea_rbuf.c', 'platform/drivers/audio/stm32_dac.cpp', 'platform/drivers/audio/stm32_adc.cpp', 'platform/mcu/CMSIS/Device/ST/STM32H7xx/Source/system_stm32h7xx.c'] diff --git a/platform/targets/CS7000-PLUS/hwconfig.c b/platform/targets/CS7000-PLUS/hwconfig.c index 60ddb148..7cc37117 100644 --- a/platform/targets/CS7000-PLUS/hwconfig.c +++ b/platform/targets/CS7000-PLUS/hwconfig.c @@ -20,10 +20,12 @@ #include #include #include +#include #include #include #include #include +#include /** * SPI bitbang function for SN74HC595 gpio extender. @@ -111,3 +113,10 @@ const struct sky73210 pll = .cs = { PLL_CS }, .refClk = 16800000 }; + +const struct gpsDevice gps = +{ + .enable = gpsStm32_enable, + .disable = gpsStm32_disable, + .getSentence = gpsStm32_getNmeaSentence +}; diff --git a/platform/targets/CS7000-PLUS/hwconfig.h b/platform/targets/CS7000-PLUS/hwconfig.h index e00ba713..8b2a1399 100644 --- a/platform/targets/CS7000-PLUS/hwconfig.h +++ b/platform/targets/CS7000-PLUS/hwconfig.h @@ -50,6 +50,7 @@ extern const struct spiDevice c6000_spi; extern const struct gpioDev extGpio; extern const struct ak2365a detector; extern const struct sky73210 pll; +extern const struct gpsDevice gps; /* Screen dimensions */ #define CONFIG_SCREEN_WIDTH 160 @@ -69,7 +70,9 @@ extern const struct sky73210 pll; #define CONFIG_M17 /* Device has a GPS chip */ -// #define CONFIG_GPS +#define CONFIG_GPS +#define CONFIG_GPS_STM32_USART6 +#define CONFIG_NMEA_RBUF_SIZE 128 /* Use extended addressing for external flash memory */ #define CONFIG_W25Qx_EXT_ADDR diff --git a/platform/targets/CS7000-PLUS/platform.c b/platform/targets/CS7000-PLUS/platform.c index cf059717..38813b99 100644 --- a/platform/targets/CS7000-PLUS/platform.c +++ b/platform/targets/CS7000-PLUS/platform.c @@ -22,9 +22,11 @@ #include #include #include +#include #include #include #include +#include static const hwInfo_t hwInfo = { @@ -65,6 +67,7 @@ void platform_init() void platform_terminate() { adcStm32_terminate(&adc1); + gpsStm32_terminate(); #ifndef RUNNING_TESTSUITE gpioDev_clear(MAIN_PWR_SW); @@ -206,3 +209,11 @@ const hwInfo_t *platform_getHwInfo() { return &hwInfo; } + +const struct gpsDevice *platform_initGps() +{ + gpio_setMode(GPS_RXD, ALTERNATE | ALTERNATE_FUNC(7)); + gpsStm32_init(9600); + + return &gps; +}