metro-m0: Add GPS support
authorKeith Packard <keithp@keithp.com>
Thu, 10 Nov 2022 00:29:56 +0000 (16:29 -0800)
committerKeith Packard <keithp@keithp.com>
Thu, 10 Nov 2022 00:29:56 +0000 (16:29 -0800)
Plug a ublox GPS module into D4(tx)/D3(rx)

Signed-off-by: Keith Packard <keithp@keithp.com>
src/metro-m0/ao_pins.h
src/metro-m0/metro-m0.c

index 2d404cadffd922de9a1f2e9c2d11b420415d3c9f..0f276c1f2f343bbf9933a88cfd3495676305e460 100644 (file)
@@ -118,4 +118,18 @@ struct ao_adc {
 
 #define AO_ADC_SQ6             SAMD21_ADC_INPUTCTRL_MUXPOS_TEMP
 
+/* GPS */
+#define HAS_GPS                        1
+
+#define AO_SERIAL_SPEED_UBLOX  AO_SERIAL_SPEED_9600
+
+#define HAS_SERIAL_0           1
+#define USE_SERIAL_0_STDIN     0
+#define SERIAL_0_PA08_PA09     1
+
+#define ao_gps_getchar         ao_serial0_getchar
+#define ao_gps_putchar         ao_serial0_putchar
+#define ao_gps_set_speed       ao_serial0_set_speed
+#define ao_gps_fifo            (ao_samd21_usart0.rx_fifo)
+
 #endif /* _AO_PINS_H_ */
index 65a0e05a0dc3156f12a2e51b0a61198a4c94262b..5fe7723be83c72848f68388193213c6f5f019e12 100644 (file)
@@ -67,6 +67,8 @@ int main(void)
        ao_exti_init();
        ao_spi_init();
        ao_adc_init();
+       ao_serial_init();
+       ao_gps_init();
        ao_beep_init();
        ao_usb_init();
        ao_storage_init();