[wpilibc] Transition C++ classes to units::second_t (#3396)

A lot of these are breaking changes. frc::Timer was replaced with the
contents of frc2::Timer. The others were in-place argument changes or
removing deprecated non-unit overloads.
This commit is contained in:
Tyler Veness
2021-05-28 22:06:59 -07:00
committed by GitHub
parent 827b17a52b
commit e09293a15e
99 changed files with 503 additions and 790 deletions

View File

@@ -15,7 +15,7 @@
#include <wpi/priority_queue.h>
#include "frc/IterativeRobotBase.h"
#include "frc2/Timer.h"
#include "frc/Timer.h"
namespace frc {
@@ -30,7 +30,7 @@ namespace frc {
*/
class TimedRobot : public IterativeRobotBase {
public:
static constexpr units::second_t kDefaultPeriod = 20_ms;
static constexpr auto kDefaultPeriod = 20_ms;
/**
* Provide an alternate "main loop" via StartCompetition().
@@ -99,12 +99,11 @@ class TimedRobot : public IterativeRobotBase {
units::second_t period, units::second_t offset)
: func{std::move(func)},
period{period},
expirationTime{
startTime + offset +
units::math::floor((frc2::Timer::GetFPGATimestamp() - startTime) /
period) *
period +
period} {}
expirationTime{startTime + offset +
units::math::floor(
(Timer::GetFPGATimestamp() - startTime) / period) *
period +
period} {}
bool operator>(const Callback& rhs) const {
return expirationTime > rhs.expirationTime;