mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[hal, wpilib] PWM Rewrite (#7845)
The HAL will only contain the output period and the raw microseconds. Higher level things such as SimDevice can handle everything else.
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
using namespace halsimgui;
|
||||
|
||||
namespace {
|
||||
HALSIMGUI_DATASOURCE_DOUBLE_INDEXED(PWMSpeed, "PWM");
|
||||
HALSIMGUI_DATASOURCE_DOUBLE_INDEXED(PWMPulseMicrosecond, "PWM");
|
||||
|
||||
class PWMSimModel : public glass::PWMModel {
|
||||
public:
|
||||
@@ -33,12 +33,14 @@ class PWMSimModel : public glass::PWMModel {
|
||||
|
||||
glass::DoubleSource* GetSpeedData() override { return &m_speed; }
|
||||
|
||||
void SetSpeed(double val) override { HALSIM_SetPWMSpeed(m_index, val); }
|
||||
void SetSpeed(double val) override {
|
||||
HALSIM_SetPWMPulseMicrosecond(m_index, val);
|
||||
}
|
||||
|
||||
private:
|
||||
int32_t m_index;
|
||||
int m_led = -1;
|
||||
PWMSpeedSource m_speed;
|
||||
PWMPulseMicrosecondSource m_speed;
|
||||
};
|
||||
|
||||
class PWMsSimModel : public glass::PWMsModel {
|
||||
|
||||
Reference in New Issue
Block a user