mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
[hal, wpilib] Fix up DIO pulse API (#4387)
The FPGA API takes microseconds directly, instead of a scaled value. Also add a new HAL level API to trigger multiple DIOs with the same pulse at once.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <hal/Types.h>
|
||||
#include <units/time.h>
|
||||
#include <wpi/sendable/Sendable.h>
|
||||
#include <wpi/sendable/SendableHelper.h>
|
||||
|
||||
@@ -79,11 +80,11 @@ class DigitalOutput : public DigitalSource,
|
||||
* Output a single pulse on the digital output line.
|
||||
*
|
||||
* Send a single pulse on the digital output line where the pulse duration is
|
||||
* specified in seconds. Maximum pulse length is 0.0016 seconds.
|
||||
* specified in seconds. Maximum of 65535 microseconds.
|
||||
*
|
||||
* @param length The pulse length in seconds
|
||||
* @param pulseLength The pulse length in seconds
|
||||
*/
|
||||
void Pulse(double length);
|
||||
void Pulse(units::second_t pulseLength);
|
||||
|
||||
/**
|
||||
* Determine if the pulse is still going.
|
||||
|
||||
@@ -164,8 +164,8 @@ class Ultrasonic : public wpi::Sendable,
|
||||
*/
|
||||
static void UltrasonicChecker();
|
||||
|
||||
// Time (sec) for the ping trigger pulse.
|
||||
static constexpr double kPingTime = 10 * 1e-6;
|
||||
// Time (usec) for the ping trigger pulse.
|
||||
static constexpr auto kPingTime = 10_us;
|
||||
|
||||
// Max time (ms) between readings.
|
||||
static constexpr auto kMaxUltrasonicTime = 0.1_s;
|
||||
|
||||
Reference in New Issue
Block a user