mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
51 lines
1.1 KiB
C
51 lines
1.1 KiB
C
#pragma once
|
|
|
|
#include <furi_hal.h>
|
|
#include <notification/notification_messages.h>
|
|
#include <xtreme.h>
|
|
|
|
#define UART_CH \
|
|
(xtreme_settings.uart_nmea_channel == UARTDefault ? FuriHalUartIdUSART1 : FuriHalUartIdLPUART1)
|
|
|
|
#define RX_BUF_SIZE 1024
|
|
|
|
static const int gps_baudrates[5] = {9600, 19200, 38400, 57600, 115200};
|
|
static int current_gps_baudrate = 0;
|
|
|
|
typedef struct {
|
|
bool valid;
|
|
float latitude;
|
|
float longitude;
|
|
float speed;
|
|
float course;
|
|
float altitude;
|
|
char altitude_units;
|
|
int fix_quality;
|
|
int satellites_tracked;
|
|
int time_hours;
|
|
int time_minutes;
|
|
int time_seconds;
|
|
} GpsStatus;
|
|
|
|
typedef struct {
|
|
FuriMutex* mutex;
|
|
FuriThread* thread;
|
|
FuriStreamBuffer* rx_stream;
|
|
uint8_t rx_buf[RX_BUF_SIZE];
|
|
|
|
NotificationApp* notifications;
|
|
uint32_t baudrate;
|
|
bool changing_baudrate;
|
|
bool backlight_on;
|
|
bool speed_in_kms;
|
|
|
|
GpsStatus status;
|
|
} GpsUart;
|
|
|
|
void gps_uart_init_thread(GpsUart* gps_uart);
|
|
void gps_uart_deinit_thread(GpsUart* gps_uart);
|
|
|
|
GpsUart* gps_uart_enable();
|
|
|
|
void gps_uart_disable(GpsUart* gps_uart);
|