gps_uart.h 967 B

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[5] = {9600, 19200, 38400, 57600, 115200};
  6. static int current_gps_baudrate = 0;
  7. typedef struct
  8. {
  9. bool valid;
  10. float latitude;
  11. float longitude;
  12. float speed;
  13. float course;
  14. float altitude;
  15. char altitude_units;
  16. int fix_quality;
  17. int satellites_tracked;
  18. int time_hours;
  19. int time_minutes;
  20. int time_seconds;
  21. } GpsStatus;
  22. typedef struct
  23. {
  24. FuriMutex *mutex;
  25. FuriThread *thread;
  26. FuriStreamBuffer *rx_stream;
  27. uint8_t rx_buf[RX_BUF_SIZE];
  28. NotificationApp *notifications;
  29. uint32_t baudrate;
  30. bool changing_baudrate;
  31. bool backlight_on;
  32. bool speed_in_kms;
  33. GpsStatus status;
  34. } GpsUart;
  35. void gps_uart_init_thread(GpsUart *gps_uart);
  36. void gps_uart_deinit_thread(GpsUart *gps_uart);
  37. GpsUart *gps_uart_enable();
  38. void gps_uart_disable(GpsUart *gps_uart);