[newCommands] Trigger: Allow override of debounce type (#3845)

Previously Trigger could only be debounced on rising edges.
This change preserves the default behavior but adds the capability to override it.
This commit is contained in:
Oblarg
2021-12-29 19:10:43 -05:00
committed by GitHub
parent aa9dfabde2
commit eee29daaf9
3 changed files with 28 additions and 10 deletions

View File

@@ -9,6 +9,7 @@
#include <memory>
#include <utility>
#include <frc/filter/Debouncer.h>
#include <units/time.h>
#include <wpi/span.h>
@@ -350,10 +351,13 @@ class Trigger {
* Creates a new debounced trigger from this trigger - it will become active
* when this trigger has been active for longer than the specified period.
*
* @param debounceTime the debounce period
* @return the debounced trigger
* @param debounceTime The debounce period.
* @param type The debounce type.
* @return The debounced trigger.
*/
Trigger Debounce(units::second_t debounceTime);
Trigger Debounce(units::second_t debounceTime,
frc::Debouncer::DebounceType type =
frc::Debouncer::DebounceType::kRising);
private:
std::function<bool()> m_isActive;