[hal] Add systemcore duty cycle (#7682)

This commit is contained in:
Thad House
2025-01-15 11:57:31 -08:00
committed by GitHub
parent 24d6e87447
commit 58cb395d76
17 changed files with 138 additions and 233 deletions

View File

@@ -36,29 +36,11 @@ class DutyCycle : public wpi::Sendable, public wpi::SendableHelper<DutyCycle> {
public:
/**
* Constructs a DutyCycle input from a DigitalSource input.
* Constructs a DutyCycle input from a smartio channel.
*
* <p> This class does not own the inputted source.
*
* @param source The DigitalSource to use.
* @param source The channel to use.
*/
explicit DutyCycle(DigitalSource& source);
/**
* Constructs a DutyCycle input from a DigitalSource input.
*
* <p> This class does not own the inputted source.
*
* @param source The DigitalSource to use.
*/
explicit DutyCycle(DigitalSource* source);
/**
* Constructs a DutyCycle input from a DigitalSource input.
*
* <p> This class does not own the inputted source.
*
* @param source The DigitalSource to use.
*/
explicit DutyCycle(std::shared_ptr<DigitalSource> source);
explicit DutyCycle(int source);
DutyCycle(DutyCycle&&) = default;
DutyCycle& operator=(DutyCycle&&) = default;
@@ -121,7 +103,7 @@ class DutyCycle : public wpi::Sendable, public wpi::SendableHelper<DutyCycle> {
private:
void InitDutyCycle();
std::shared_ptr<DigitalSource> m_source;
int m_channel;
hal::Handle<HAL_DutyCycleHandle, HAL_FreeDutyCycle> m_handle;
};
} // namespace frc

View File

@@ -61,33 +61,6 @@ class DutyCycleEncoder : public wpi::Sendable,
*/
explicit DutyCycleEncoder(std::shared_ptr<DutyCycle> dutyCycle);
/**
* Construct a new DutyCycleEncoder attached to a DigitalSource object.
*
* <p>This has a fullRange of 1 and an expectedZero of 0.
*
* @param digitalSource the digital source to attach to
*/
explicit DutyCycleEncoder(DigitalSource& digitalSource);
/**
* Construct a new DutyCycleEncoder attached to a DigitalSource object.
*
* <p>This has a fullRange of 1 and an expectedZero of 0.
*
* @param digitalSource the digital source to attach to
*/
explicit DutyCycleEncoder(DigitalSource* digitalSource);
/**
* Construct a new DutyCycleEncoder attached to a DigitalSource object.
*
* <p>This has a fullRange of 1 and an expectedZero of 0.
*
* @param digitalSource the digital source to attach to
*/
explicit DutyCycleEncoder(std::shared_ptr<DigitalSource> digitalSource);
/**
* Construct a new DutyCycleEncoder on a specific channel.
*
@@ -125,36 +98,6 @@ class DutyCycleEncoder : public wpi::Sendable,
DutyCycleEncoder(std::shared_ptr<DutyCycle> dutyCycle, double fullRange,
double expectedZero);
/**
* Construct a new DutyCycleEncoder attached to a DigitalSource object.
*
* @param digitalSource the digital source to attach to
* @param fullRange the value to report at maximum travel
* @param expectedZero the reading where you would expect a 0 from get()
*/
DutyCycleEncoder(DigitalSource& digitalSource, double fullRange,
double expectedZero);
/**
* Construct a new DutyCycleEncoder attached to a DigitalSource object.
*
* @param digitalSource the digital source to attach to
* @param fullRange the value to report at maximum travel
* @param expectedZero the reading where you would expect a 0 from get()
*/
DutyCycleEncoder(DigitalSource* digitalSource, double fullRange,
double expectedZero);
/**
* Construct a new DutyCycleEncoder attached to a DigitalSource object.
*
* @param digitalSource the digital source to attach to
* @param fullRange the value to report at maximum travel
* @param expectedZero the reading where you would expect a 0 from get()
*/
DutyCycleEncoder(std::shared_ptr<DigitalSource> digitalSource,
double fullRange, double expectedZero);
~DutyCycleEncoder() override = default;
DutyCycleEncoder(DutyCycleEncoder&&) = default;