wpilibc: Add overloads for units (#1815)

Add unit-taking overloads to the following classes:
- IterativeRobotBase
- LinearFilter
- Notifier
- TimedRobot
- Timer (HasPeriodPassed only)
- frc2::PIDController

The corresponding non-units-taking functions have been deprecated.

The return value of TimedRobot::GetPeriod() was updated.
This is a breaking change, users should use to<double> to get the value in seconds.

Other return values, e.g. Timer::Get(), have NOT been updated due to much wider use.
This commit is contained in:
Prateek Machiraju
2019-08-17 00:56:48 -04:00
committed by Peter Johnson
parent f1d71da8a9
commit c07ac23532
15 changed files with 136 additions and 35 deletions

View File

@@ -7,6 +7,7 @@
#pragma once
#include <units/units.h>
#include <wpi/deprecated.h>
#include <wpi/mutex.h>
@@ -101,8 +102,19 @@ class Timer {
* @param period The period to check for (in seconds).
* @return True if the period has passed.
*/
WPI_DEPRECATED("Use unit-safe HasPeriodPassed method instead.")
bool HasPeriodPassed(double period);
/**
* Check if the period specified has passed and if it has, advance the start
* time by that period. This is useful to decide if it's time to do periodic
* work without drifting later by the time it took to get around to checking.
*
* @param period The period to check for.
* @return True if the period has passed.
*/
bool HasPeriodPassed(units::second_t period);
/**
* Return the FPGA system clock time in seconds.
*