[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:
Thad House
2025-03-20 19:23:22 -07:00
committed by GitHub
parent 2e21a41f87
commit e2cc9e0059
96 changed files with 1037 additions and 2453 deletions

View File

@@ -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 {