platform_specific_components/stm32/libuavcan/driver/include/uavcan_stm32/clock.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
3  */
4 
5 #pragma once
6 
9 
10 namespace uavcan_stm32
11 {
12 
13 namespace clock
14 {
19 void init();
20 
26 
33 void setUtc(uavcan::UtcTime time);
34 
40 
46 void adjustUtc(uavcan::UtcDuration adjustment);
47 
52 {
53  float offset_p;
54  float rate_i;
60 
62  : offset_p(0.01F)
63  , rate_i(0.02F)
64  , rate_error_corner_freq(0.01F)
65  , max_rate_correction_ppm(300.0F)
66  , lock_thres_rate_ppm(2.0F)
67  , lock_thres_offset(uavcan::UtcDuration::fromMSec(4))
68  , min_jump(uavcan::UtcDuration::fromMSec(10))
69  { }
70 };
71 
78 
85 
90 bool isUtcLocked();
91 
96 UtcSyncParams getUtcSyncParams();
97 void setUtcSyncParams(const UtcSyncParams& params);
98 
99 }
100 
105 {
107 
108  virtual void adjustUtc(uavcan::UtcDuration adjustment) { clock::adjustUtc(adjustment); }
109 
110 public:
112  virtual uavcan::UtcTime getUtc() const { return clock::getUtc(); }
113 
118  static SystemClock& instance();
119 };
120 
121 }
uavcan_stm32::clock::getUtcJumpCount
uavcan::uint32_t getUtcJumpCount()
uavcan_stm32::SystemClock::adjustUtc
virtual void adjustUtc(uavcan::UtcDuration adjustment)
Definition: platform_specific_components/stm32/libuavcan/driver/include/uavcan_stm32/clock.hpp:108
uavcan_stm32::clock::setUtc
void setUtc(uavcan::UtcTime time)
uavcan_stm32::SystemClock::getUtc
virtual uavcan::UtcTime getUtc() const
Definition: platform_specific_components/stm32/libuavcan/driver/include/uavcan_stm32/clock.hpp:112
uavcan::Noncopyable
Definition: templates.hpp:46
uavcan::uint32_t
std::uint32_t uint32_t
Definition: std.hpp:26
uavcan::UtcTime
Implicitly convertible to/from uavcan.Timestamp.
Definition: time.hpp:191
uavcan::UtcDuration
Definition: time.hpp:189
build_config.hpp
uavcan_stm32
Definition: bxcan.hpp:22
system_clock.hpp
uavcan_stm32::clock::UtcSyncParams::UtcSyncParams
UtcSyncParams()
Definition: platform_specific_components/stm32/libuavcan/driver/include/uavcan_stm32/clock.hpp:61
uavcan_stm32::clock::isUtcLocked
bool isUtcLocked()
uavcan_stm32::clock::UtcSyncParams::offset_p
float offset_p
PPM per one usec error.
Definition: platform_specific_components/stm32/libuavcan/driver/include/uavcan_stm32/clock.hpp:53
uavcan_stm32::clock::getUtcSyncParams
UtcSyncParams getUtcSyncParams()
uavcan_stm32::clock::UtcSyncParams::rate_i
float rate_i
PPM per one PPM error for second.
Definition: platform_specific_components/stm32/libuavcan/driver/include/uavcan_stm32/clock.hpp:54
uavcan_stm32::clock::setUtcSyncParams
void setUtcSyncParams(const UtcSyncParams &params)
uavcan_stm32::clock::getUtc
uavcan::UtcTime getUtc()
Definition: clock.cpp:97
uavcan_stm32::SystemClock
Definition: platform_specific_components/stm32/libuavcan/driver/include/uavcan_stm32/clock.hpp:104
uavcan_stm32::clock::init
void init()
Definition: clock.cpp:43
uavcan_stm32::clock::getUtcRateCorrectionPPM
float getUtcRateCorrectionPPM()
uavcan_stm32::clock::UtcSyncParams
Definition: platform_specific_components/stm32/libuavcan/driver/include/uavcan_stm32/clock.hpp:51
uavcan_stm32::clock::UtcSyncParams::min_jump
uavcan::UtcDuration min_jump
Min error to jump rather than change rate.
Definition: platform_specific_components/stm32/libuavcan/driver/include/uavcan_stm32/clock.hpp:59
uavcan_stm32::clock::getMonotonic
uavcan::MonotonicTime getMonotonic()
Definition: clock.cpp:83
uavcan_stm32::SystemClock::getMonotonic
virtual uavcan::MonotonicTime getMonotonic() const
Definition: platform_specific_components/stm32/libuavcan/driver/include/uavcan_stm32/clock.hpp:111
uavcan_stm32::clock::UtcSyncParams::lock_thres_rate_ppm
float lock_thres_rate_ppm
Definition: platform_specific_components/stm32/libuavcan/driver/include/uavcan_stm32/clock.hpp:57
uavcan_stm32::clock::UtcSyncParams::rate_error_corner_freq
float rate_error_corner_freq
Definition: platform_specific_components/stm32/libuavcan/driver/include/uavcan_stm32/clock.hpp:55
uavcan_stm32::SystemClock::SystemClock
SystemClock()
Definition: platform_specific_components/stm32/libuavcan/driver/include/uavcan_stm32/clock.hpp:106
uavcan_stm32::clock::UtcSyncParams::max_rate_correction_ppm
float max_rate_correction_ppm
Definition: platform_specific_components/stm32/libuavcan/driver/include/uavcan_stm32/clock.hpp:56
uavcan_stm32::SystemClock::instance
static SystemClock & instance()
uavcan::MonotonicTime
Definition: time.hpp:184
uavcan
Definition: libuavcan/libuavcan/include/uavcan/build_config.hpp:204
uavcan::ISystemClock
Definition: system_clock.hpp:19
uavcan_stm32::clock::UtcSyncParams::lock_thres_offset
uavcan::UtcDuration lock_thres_offset
Definition: platform_specific_components/stm32/libuavcan/driver/include/uavcan_stm32/clock.hpp:58
uavcan_stm32::clock::adjustUtc
void adjustUtc(uavcan::UtcDuration adjustment)
Definition: clock.cpp:117


uavcan_communicator
Author(s):
autogenerated on Fri Dec 13 2024 03:10:02