2022-10-20 18:02:27 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <furi_hal.h>
|
2022-10-28 16:23:02 +00:00
|
|
|
#include <notification/notification_messages.h>
|
2022-10-20 18:02:27 +00:00
|
|
|
|
|
|
|
#define RX_BUF_SIZE 1024
|
|
|
|
|
2023-04-10 23:37:57 +00:00
|
|
|
static const int gps_baudrates[5] = {9600, 19200, 38400, 57600, 115200};
|
|
|
|
static int current_gps_baudrate = 3;
|
|
|
|
|
2022-10-20 18:02:27 +00:00
|
|
|
typedef struct {
|
|
|
|
bool valid;
|
|
|
|
float latitude;
|
|
|
|
float longitude;
|
|
|
|
float speed;
|
|
|
|
float course;
|
|
|
|
float altitude;
|
|
|
|
char altitude_units;
|
|
|
|
int fix_quality;
|
|
|
|
int satellites_tracked;
|
2022-10-28 16:23:02 +00:00
|
|
|
int time_hours;
|
|
|
|
int time_minutes;
|
|
|
|
int time_seconds;
|
2022-10-20 18:02:27 +00:00
|
|
|
} GpsStatus;
|
|
|
|
|
|
|
|
typedef struct {
|
2023-03-07 21:18:23 +00:00
|
|
|
FuriMutex* mutex;
|
2022-10-20 18:02:27 +00:00
|
|
|
FuriThread* thread;
|
|
|
|
FuriStreamBuffer* rx_stream;
|
|
|
|
uint8_t rx_buf[RX_BUF_SIZE];
|
|
|
|
|
2022-10-28 16:23:02 +00:00
|
|
|
NotificationApp* notifications;
|
2023-03-29 23:22:01 +00:00
|
|
|
uint32_t baudrate;
|
|
|
|
bool changing_baudrate;
|
|
|
|
bool backlight_on;
|
2023-03-30 00:58:22 +00:00
|
|
|
bool speed_in_kms;
|
2022-10-28 16:23:02 +00:00
|
|
|
|
2022-10-20 18:02:27 +00:00
|
|
|
GpsStatus status;
|
|
|
|
} GpsUart;
|
|
|
|
|
2023-03-29 23:22:01 +00:00
|
|
|
void gps_uart_init_thread(GpsUart* gps_uart);
|
|
|
|
void gps_uart_deinit_thread(GpsUart* gps_uart);
|
|
|
|
|
2022-10-20 18:02:27 +00:00
|
|
|
GpsUart* gps_uart_enable();
|
|
|
|
|
|
|
|
void gps_uart_disable(GpsUart* gps_uart);
|