[wpilib] Add timestamp getters with configurable time base (#7378)

This commit is contained in:
Jonah Bonner
2024-11-16 10:43:38 -05:00
committed by GitHub
parent 91142ba5fe
commit ca51197486
27 changed files with 180 additions and 53 deletions

View File

@@ -46,6 +46,8 @@ void TimedRobot::StartCompetition() {
break;
}
m_loopStartTimeUs = RobotController::GetFPGATime();
callback.func();
// Increment the expiration time by the number of full periods it's behind
@@ -97,6 +99,10 @@ TimedRobot::~TimedRobot() {
}
}
uint64_t TimedRobot::GetLoopStartTime() {
return m_loopStartTimeUs;
}
void TimedRobot::AddPeriodic(std::function<void()> callback,
units::second_t period, units::second_t offset) {
m_callbacks.emplace(