12 #include <hal/Types.h>
13 #include <wpi/raw_ostream.h>
15 #include "frc/MotorSafety.h"
16 #include "frc/smartdashboard/SendableBase.h"
67 explicit PWM(
int channel);
80 void StopMotor()
override;
90 virtual void SetRaw(uint16_t value);
99 virtual uint16_t
GetRaw()
const;
138 virtual void SetSpeed(
double speed);
192 void SetBounds(
double max,
double deadbandMax,
double center,
193 double deadbandMin,
double min);
208 void SetRawBounds(
int max,
int deadbandMax,
int center,
int deadbandMin,
224 void GetRawBounds(int32_t* max, int32_t* deadbandMax, int32_t* center,
225 int32_t* deadbandMin, int32_t* min);
227 int GetChannel()
const;
234 HAL_DigitalHandle m_handle = HAL_kInvalidHandle;
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:45
WPILib FRC namespace.
Definition: SPIAccelerometerSim.h:18
void SetBounds(double max, double deadbandMax, double center, double deadbandMin, double min)
Set the bounds on the PWM pulse widths.
virtual void SetPosition(double pos)
Set the PWM value based on a position.
PeriodMultiplier
Represents the amount to multiply the minimum servo-pulse pwm period by.
Definition: PWM.h:42
Skip every other pulse.
Definition: PWM.h:50
Skip three out of four pulses.
Definition: PWM.h:54
void EnableDeadbandElimination(bool eliminateDeadband)
Optionally eliminate the deadband from a speed controller.
virtual void SetSpeed(double speed)
Set the PWM value based on a speed.
Don't skip pulses.
Definition: PWM.h:46
void InitSendable(SendableBuilder &builder) override
Initializes this Sendable object.
This base class runs a watchdog timer and calls the subclass's StopMotor() function if the timeout ex...
Definition: MotorSafety.h:26
void GetRawBounds(int32_t *max, int32_t *deadbandMax, int32_t *center, int32_t *deadbandMin, int32_t *min)
Get the bounds on the PWM values.
void SetRawBounds(int max, int deadbandMax, int center, int deadbandMin, int min)
Set the bounds on the PWM values.
PWM(int channel)
Allocate a PWM given a channel number.
void SetPeriodMultiplier(PeriodMultiplier mult)
Slow down the PWM signal for old devices.
virtual void SetDisabled()
Temporarily disables the PWM output.
virtual void SetRaw(uint16_t value)
Set the PWM value directly to the hardware.
Definition: SendableBase.h:19
virtual double GetSpeed() const
Get the PWM value in terms of speed.
virtual uint16_t GetRaw() const
Get the PWM value directly from the hardware.
virtual double GetPosition() const
Get the PWM value in terms of a position.
Definition: SendableBuilder.h:23
~PWM() override
Free the PWM channel.
Class implements the PWM generation in the FPGA.
Definition: PWM.h:37