gps_uart.h 967 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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[5] = {9600, 19200, 38400, 57600, 115200};
  6. static int current_gps_baudrate = 0;
  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 struct {
  22. FuriMutex* mutex;
  23. FuriThread* thread;
  24. FuriStreamBuffer* rx_stream;
  25. uint8_t rx_buf[RX_BUF_SIZE];
  26. NotificationApp* notifications;
  27. uint32_t baudrate;
  28. bool changing_baudrate;
  29. bool backlight_on;
  30. bool speed_in_kms;
  31. GpsStatus status;
  32. } GpsUart;
  33. void gps_uart_init_thread(GpsUart* gps_uart);
  34. void gps_uart_deinit_thread(GpsUart* gps_uart);
  35. GpsUart* gps_uart_enable();
  36. void gps_uart_disable(GpsUart* gps_uart);