123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #pragma once
- #include <AP_Param/AP_Param.h>
- #include <stdint.h>
- class AP_RTC {
- public:
- AP_RTC();
- static const struct AP_Param::GroupInfo var_info[];
- AP_Int8 allowed_types;
-
-
-
- enum source_type : uint8_t {
- SOURCE_GPS = 0,
- SOURCE_MAVLINK_SYSTEM_TIME = 1,
- SOURCE_HW = 2,
- SOURCE_NONE,
- };
-
- bool get_utc_usec(uint64_t &usec) const;
-
-
-
- void set_utc_usec(uint64_t time_utc_usec, source_type type);
-
- bool get_system_clock_utc(uint8_t &hour, uint8_t &min, uint8_t &sec, uint16_t &ms);
- uint32_t get_time_utc(int32_t hour, int32_t min, int32_t sec, int32_t ms);
-
- static AP_RTC *get_singleton() {
- return _singleton;
- }
- private:
- static AP_RTC *_singleton;
- source_type rtc_source_type = SOURCE_NONE;
- int64_t rtc_shift;
- };
- namespace AP {
- AP_RTC &rtc();
- };
|