mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
[wpilib] Add a few unit overloads (#8231)
Co-authored-by: Sam Carlberg <sam@slfc.dev> Co-authored-by: Joseph Eng <91924258+KangarooKoala@users.noreply.github.com> Co-authored-by: Tyler Veness <calcmogul@gmail.com>
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include <hal/Types.h>
|
||||
#include <units/frequency.h>
|
||||
#include <units/time.h>
|
||||
#include <wpi/mutex.h>
|
||||
|
||||
@@ -107,6 +108,17 @@ class Notifier {
|
||||
*/
|
||||
void StartPeriodic(units::second_t period);
|
||||
|
||||
/**
|
||||
* Run the callback periodically with the given frequency.
|
||||
*
|
||||
* The user-provided callback should be written so that it completes before
|
||||
* the next time it's scheduled to run.
|
||||
*
|
||||
* @param frequency Frequency after which to call the callback starting one
|
||||
* period after the call to this method.
|
||||
*/
|
||||
void StartPeriodic(units::hertz_t frequency);
|
||||
|
||||
/**
|
||||
* Stop further callback invocations.
|
||||
*
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include <hal/Notifier.h>
|
||||
#include <hal/Types.h>
|
||||
#include <units/frequency.h>
|
||||
#include <units/math.h>
|
||||
#include <units/time.h>
|
||||
#include <wpi/priority_queue.h>
|
||||
@@ -47,10 +48,17 @@ class TimedRobot : public IterativeRobotBase {
|
||||
/**
|
||||
* Constructor for TimedRobot.
|
||||
*
|
||||
* @param period Period.
|
||||
* @param period The period of the robot loop function.
|
||||
*/
|
||||
explicit TimedRobot(units::second_t period = kDefaultPeriod);
|
||||
|
||||
/**
|
||||
* Constructor for TimedRobot.
|
||||
*
|
||||
* @param frequency The frequency of the robot loop function.
|
||||
*/
|
||||
explicit TimedRobot(units::hertz_t frequency);
|
||||
|
||||
TimedRobot(TimedRobot&&) = default;
|
||||
TimedRobot& operator=(TimedRobot&&) = default;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user