ESPHome  2024.11.1
gps_time.h
Go to the documentation of this file.
1 #pragma once
2 
3 #ifdef USE_ARDUINO
4 
8 
9 namespace esphome {
10 namespace gps {
11 
12 class GPSTime : public time::RealTimeClock, public GPSListener {
13  public:
14  void update() override { this->from_tiny_gps_(this->get_tiny_gps()); };
15  void on_update(TinyGPSPlus &tiny_gps) override {
16  if (!this->has_time_)
17  this->from_tiny_gps_(tiny_gps);
18  }
19 
20  protected:
21  void from_tiny_gps_(TinyGPSPlus &tiny_gps);
22  bool has_time_{false};
23 };
24 
25 } // namespace gps
26 } // namespace esphome
27 
28 #endif // USE_ARDUINO
TinyGPSPlus & get_tiny_gps()
Definition: gps.cpp:11
void from_tiny_gps_(TinyGPSPlus &tiny_gps)
Definition: gps_time.cpp:11
The RealTimeClock class exposes common timekeeping functions via the device's local real-time clock...
void on_update(TinyGPSPlus &tiny_gps) override
Definition: gps_time.h:15
void update() override
Definition: gps_time.h:14
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7