12 #include <HAL/Types.h> 14 #include "ErrorBase.h" 15 #include "SmartDashboard/SendableBase.h" 56 explicit PWM(
int channel);
58 virtual void SetRaw(uint16_t value);
59 virtual uint16_t
GetRaw()
const;
68 void SetBounds(
double max,
double deadbandMax,
double center,
69 double deadbandMin,
double min);
70 void SetRawBounds(
int max,
int deadbandMax,
int center,
int deadbandMin,
72 void GetRawBounds(int32_t* max, int32_t* deadbandMax, int32_t* center,
73 int32_t* deadbandMin, int32_t* min);
74 int GetChannel()
const {
return m_channel; }
81 HAL_DigitalHandle m_handle;
Definition: RobotController.cpp:14
void SetBounds(double max, double deadbandMax, double center, double deadbandMin, double min)
Set the bounds on the PWM pulse widths.
Definition: PWM.cpp:103
PeriodMultiplier
Represents the amount to multiply the minimum servo-pulse pwm period by.
Definition: PWM.h:41
Skip every other pulse.
Definition: PWM.h:49
Skip three out of four pulses.
Definition: PWM.h:53
void GetRawBounds(int32_t *max, int32_t *deadbandMax, int32_t *center, int32_t *deadbandMin, int32_t *min)
Get the bounds on the PWM values.
Definition: PWM.cpp:147
virtual void SetSpeed(double speed)
Set the PWM value based on a speed.
Definition: PWM.cpp:203
virtual double GetSpeed() const
Get the PWM value in terms of speed.
Definition: PWM.cpp:222
Don't skip pulses.
Definition: PWM.h:45
PWM(int channel)
Allocate a PWM given a channel number.
Definition: PWM.cpp:31
void SetRawBounds(int max, int deadbandMax, int center, int deadbandMin, int min)
Set the bounds on the PWM values.
Definition: PWM.cpp:125
void EnableDeadbandElimination(bool eliminateDeadband)
Optionally eliminate the deadband from a speed controller.
Definition: PWM.cpp:83
virtual uint16_t GetRaw() const
Get the PWM value directly from the hardware.
Definition: PWM.cpp:252
void SetPeriodMultiplier(PeriodMultiplier mult)
Slow down the PWM signal for old devices.
Definition: PWM.cpp:267
Base class for most objects.
Definition: ErrorBase.h:74
virtual double GetPosition() const
Get the PWM value in terms of a position.
Definition: PWM.cpp:182
virtual void SetRaw(uint16_t value)
Set the PWM value directly to the hardware.
Definition: PWM.cpp:237
Definition: SendableBase.h:19
Definition: SendableBuilder.h:23
virtual void SetPosition(double pos)
Set the PWM value based on a position.
Definition: PWM.cpp:165
Class implements the PWM generation in the FPGA.
Definition: PWM.h:36
void InitSendable(SendableBuilder &builder) override
Initializes this Sendable object.
Definition: PWM.cpp:313
~PWM() override
Free the PWM channel.
Definition: PWM.cpp:65
virtual void SetDisabled()
Temporarily disables the PWM output.
Definition: PWM.cpp:295