gps_uart.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #pragma once
  2. #include <furi_hal.h>
  3. #include <notification/notification_messages.h>
  4. #define RX_BUF_SIZE 1024
  5. static const int gps_baudrates[6] = {4800, 9600, 19200, 38400, 57600, 115200};
  6. static int current_gps_baudrate = 1;
  7. typedef struct {
  8. bool valid;
  9. float latitude;
  10. float longitude;
  11. float speed;
  12. float course;
  13. float altitude;
  14. char altitude_units;
  15. int fix_quality;
  16. int satellites_tracked;
  17. int time_hours;
  18. int time_minutes;
  19. int time_seconds;
  20. } GpsStatus;
  21. typedef enum { KNOTS, KPH, MPH, INVALID } SpeedUnit;
  22. typedef struct {
  23. FuriMutex* mutex;
  24. FuriThread* thread;
  25. FuriStreamBuffer* rx_stream;
  26. uint8_t rx_buf[RX_BUF_SIZE];
  27. NotificationApp* notifications;
  28. uint32_t baudrate;
  29. bool changing_baudrate;
  30. bool backlight_on;
  31. SpeedUnit speed_units;
  32. GpsStatus status;
  33. } GpsUart;
  34. void gps_uart_init_thread(GpsUart* gps_uart);
  35. void gps_uart_deinit_thread(GpsUart* gps_uart);
  36. GpsUart* gps_uart_enable();
  37. void gps_uart_disable(GpsUart* gps_uart);