VMX-pi C++ HAL Library for Raspberry Pi
VMX-pi Robotics Controller & Vision/Motion Processor
|
The VMXTime class provides time management functions, including system timestamps, VMX Real-time Clock access, timer notifications and current thread time-delay. More...
#include <VMXTime.h>
Public Types | |
enum | DaylightSavingsAdjustment { DSAdjustmentNone = 0, DSAdjustmentAddOneHour = 1, DSAdjustmentSubtractOneHour = 2 } |
Real-Time Clock Daylight Savings Adjustment Setting. More... | |
Public Member Functions | |
uint64_t | GetCurrentOSTimeMicroseconds () |
Returns the current linux operating system (OS) time in microseconds Note that this value is similar to but not exactly synchronized with the CurrentMicroseconds value. More... | |
uint32_t | GetCurrentMicroseconds () |
Returns the low 32 bit portion of the current system Hardware Timer value in microseconds. More... | |
uint64_t | GetCurrentTotalMicroseconds () |
Returns the full 64 bit current system Hardware Timer value in microseconds. More... | |
uint32_t | GetCurrentMicrosecondsHighPortion () |
Returns the high 32 bit portion of the current system Hardware Timer value in microseconds. More... | |
uint32_t | DelayMicroseconds (uint32_t delay_us) |
Blocks the current thread for the specified amount of time in microseconds. More... | |
uint32_t | DelayMilliseconds (uint32_t delay_ms) |
Blocks the current thread for the specified amount of time in milliseconds. More... | |
uint32_t | DelaySeconds (uint32_t delay_sec) |
Blocks the current thread for the specified amount of time in seconds. More... | |
bool | RegisterTimerNotificationAbsolute (VMXNotifyHandler timer_notify_handler, uint64_t trigger_timestamp_us, void *param) |
Register a VMXNotifyHandler which is invoked when the system timestamp reaches the specified trigger_timestamp. More... | |
bool | RegisterTimerNotificationRelative (VMXNotifyHandler timer_notify_handler, uint64_t time_from_now_us, void *param, bool repeat) |
Register a VMXNotifyHandler which is invoked within a time period relative to now, which option to create a repeating notification. More... | |
bool | DeregisterTimerNotification (VMXNotifyHandler timer_notify_handler) |
Deregisters a previously-registered VMXNotifyHandler. More... | |
bool | IsTimerNotificationExpired (VMXNotifyHandler timer_notify_handler, bool &expired) |
Indicates whether the provided previously-registered timer_notify_handler has expired. More... | |
bool | GetRTCTime (uint8_t &hours, uint8_t &minutes, uint8_t &seconds, uint32_t &milliseconds, VMXErrorCode *errcode=0) |
Retrieves the current VMX Real-time clock value. More... | |
bool | GetRTCDate (uint8_t &weekday, uint8_t &day, uint8_t &month, uint8_t &years, VMXErrorCode *errcode=0) |
Retrieves the current VMX Real-time date value. More... | |
bool | GetRTCDaylightSavingsAdjustment (DaylightSavingsAdjustment &dsa, VMXErrorCode *errcode=0) |
Retrieves the current VMX Real-time clock daylight savings adjustment setting. More... | |
bool | SetRTCTime (uint8_t hours, uint8_t minutes, uint8_t seconds, VMXErrorCode *errcode=0) |
Sets the current VMX Real-time clock value. More... | |
bool | SetRTCDate (uint8_t weekday, uint8_t day, uint8_t month, uint8_t years, VMXErrorCode *errcode=0) |
Sets the current VMX Real-time date value. More... | |
bool | SetRTCDaylightSavingsAdjustment (DaylightSavingsAdjustment dsa, VMXErrorCode *errcode=0) |
Sets the current VMX Real-time clock daylight savings adjustment setting. More... | |
Friends | |
class | VMXPi |
class | VMXIO |
The VMXTime class provides time management functions, including system timestamps, VMX Real-time Clock access, timer notifications and current thread time-delay.
Real-Time Clock Daylight Savings Adjustment Setting.
uint32_t VMXTime::DelayMicroseconds | ( | uint32_t | delay_us | ) |
Blocks the current thread for the specified amount of time in microseconds.
NOTE: Busy-waiting is used when the requested delay is less than 100 microseconds; otherwise, the delay occurs by suspending the current thread.
delay_us | The amount of time to delay the current thread, in microseconds |
uint32_t VMXTime::DelayMilliseconds | ( | uint32_t | delay_ms | ) |
Blocks the current thread for the specified amount of time in milliseconds.
The delay occurs by suspending the current thread.
delay_ms | The amount of time to delay the current thread, in milliseconds |
uint32_t VMXTime::DelaySeconds | ( | uint32_t | delay_sec | ) |
Blocks the current thread for the specified amount of time in seconds.
The delay occurs by suspending the current thread.
delay_sec | The amount of time to delay the current thread, in seconds |
bool VMXTime::DeregisterTimerNotification | ( | VMXNotifyHandler | timer_notify_handler | ) |
Deregisters a previously-registered VMXNotifyHandler.
timer_notify_handler | The VMXNotifyHandler to be cancelled |
uint32_t VMXTime::GetCurrentMicroseconds | ( | ) |
Returns the low 32 bit portion of the current system Hardware Timer value in microseconds.
This value is clock-monotonic, meaning that it is reset to each time the host is powered on.
uint32_t VMXTime::GetCurrentMicrosecondsHighPortion | ( | ) |
Returns the high 32 bit portion of the current system Hardware Timer value in microseconds.
This value is clock-monotonic, meaning that it is reset to each time the host is powered on.
uint64_t VMXTime::GetCurrentOSTimeMicroseconds | ( | ) |
Returns the current linux operating system (OS) time in microseconds Note that this value is similar to but not exactly synchronized with the CurrentMicroseconds value.
This value is clock-monotonic, meaning that it is reset to 0 each time the host is powered on.
uint64_t VMXTime::GetCurrentTotalMicroseconds | ( | ) |
Returns the full 64 bit current system Hardware Timer value in microseconds.
This value is clock-monotonic, meaning that it is reset to each time the host is powered on.
bool VMXTime::GetRTCDate | ( | uint8_t & | weekday, |
uint8_t & | day, | ||
uint8_t & | month, | ||
uint8_t & | years, | ||
VMXErrorCode * | errcode = 0 |
||
) |
Retrieves the current VMX Real-time date value.
weekday | Current weekday (1-7; 1 = Monday) | |
day | Current day (0-31) | |
month | Current month (1-12; 1 = January) | |
years | Current year (0-99; 0 = 2000) | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXTime::GetRTCDaylightSavingsAdjustment | ( | DaylightSavingsAdjustment & | dsa, |
VMXErrorCode * | errcode = 0 |
||
) |
Retrieves the current VMX Real-time clock daylight savings adjustment setting.
dsa | Current DaylightSavingsAdjustment value | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXTime::GetRTCTime | ( | uint8_t & | hours, |
uint8_t & | minutes, | ||
uint8_t & | seconds, | ||
uint32_t & | milliseconds, | ||
VMXErrorCode * | errcode = 0 |
||
) |
Retrieves the current VMX Real-time clock value.
hours | Current hours (0-23; 0 = midnight) | |
minutes | Current minutes (0-59) | |
seconds | Current seconds (0-59) | |
milliseconds | current milliseconds (0-999) | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXTime::IsTimerNotificationExpired | ( | VMXNotifyHandler | timer_notify_handler, |
bool & | expired | ||
) |
Indicates whether the provided previously-registered timer_notify_handler has expired.
timer_notify_handler | The VMXNotifyHandler to check | |
[out] | expired | Set to true if the requested timer_notify_handler is expired |
bool VMXTime::RegisterTimerNotificationAbsolute | ( | VMXNotifyHandler | timer_notify_handler, |
uint64_t | trigger_timestamp_us, | ||
void * | p_param | ||
) |
Register a VMXNotifyHandler which is invoked when the system timestamp reaches the specified trigger_timestamp.
timer_notify_handler | The VMXNotifyHandler to be invoked upon timer expiry |
trigger_timestamp_us | The absolute 64-bit system timestamp value in microseconds at which the notification should be triggered |
p_param | The parameter to pass to the timer_notify_handler; may be null |
bool VMXTime::RegisterTimerNotificationRelative | ( | VMXNotifyHandler | timer_notify_handler, |
uint64_t | time_from_now_us, | ||
void * | p_param, | ||
bool | repeat | ||
) |
Register a VMXNotifyHandler which is invoked within a time period relative to now, which option to create a repeating notification.
timer_notify_handler | The VMXNotifyHandler to be invoked upon timer expiry |
time_from_now_us | The relative amount of time (from now) when the notification should be triggered |
p_param | The parameter to pass to the timer_notify_handler; may be null |
repeat | If true, the VMXNotifyHandler will be repeatedly invoked every time_from_now_use period |
bool VMXTime::SetRTCDate | ( | uint8_t | weekday, |
uint8_t | day, | ||
uint8_t | month, | ||
uint8_t | years, | ||
VMXErrorCode * | errcode = 0 |
||
) |
Sets the current VMX Real-time date value.
weekday | Current weekday (1-7; 1 = Monday) | |
day | Current day (0-31) | |
month | Current month (1-12; 1 = January) | |
years | current years (0-99; 0 = 2000) | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXTime::SetRTCDaylightSavingsAdjustment | ( | DaylightSavingsAdjustment | dsa, |
VMXErrorCode * | errcode = 0 |
||
) |
Sets the current VMX Real-time clock daylight savings adjustment setting.
dsa | Current DaylightSavingsAdjustment value | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXTime::SetRTCTime | ( | uint8_t | hours, |
uint8_t | minutes, | ||
uint8_t | seconds, | ||
VMXErrorCode * | errcode = 0 |
||
) |
Sets the current VMX Real-time clock value.
hours | Current hours (0-23; 0 = midnight) | |
minutes | Current minutes (0-59) | |
seconds | Current seconds (0-59) | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |