[wpilib][hal] PWM Raw using microseconds (#5283)

Co-authored-by: Joe <sciencewhiz@users.noreply.github.com>
This commit is contained in:
Thad House
2023-06-22 19:43:16 -07:00
committed by GitHub
parent 1fca519fb4
commit c1a01569b4
56 changed files with 374 additions and 466 deletions

View File

@@ -17,7 +17,7 @@ void InitializePWMData() {
PWMData* hal::SimPWMData;
void PWMData::ResetData() {
initialized.Reset(false);
rawValue.Reset(0);
pulseMicrosecond.Reset(0);
speed.Reset(0);
position.Reset(0);
periodScale.Reset(0);
@@ -34,7 +34,7 @@ void HALSIM_ResetPWMData(int32_t index) {
LOWERNAME)
DEFINE_CAPI(HAL_Bool, Initialized, initialized)
DEFINE_CAPI(int32_t, RawValue, rawValue)
DEFINE_CAPI(int32_t, PulseMicrosecond, pulseMicrosecond)
DEFINE_CAPI(double, Speed, speed)
DEFINE_CAPI(double, Position, position)
DEFINE_CAPI(int32_t, PeriodScale, periodScale)
@@ -46,7 +46,7 @@ DEFINE_CAPI(HAL_Bool, ZeroLatch, zeroLatch)
void HALSIM_RegisterPWMAllCallbacks(int32_t index, HAL_NotifyCallback callback,
void* param, HAL_Bool initialNotify) {
REGISTER(initialized);
REGISTER(rawValue);
REGISTER(pulseMicrosecond);
REGISTER(speed);
REGISTER(position);
REGISTER(periodScale);

View File

@@ -10,7 +10,7 @@
namespace hal {
class PWMData {
HAL_SIMDATAVALUE_DEFINE_NAME(Initialized)
HAL_SIMDATAVALUE_DEFINE_NAME(RawValue)
HAL_SIMDATAVALUE_DEFINE_NAME(PulseMicrosecond)
HAL_SIMDATAVALUE_DEFINE_NAME(Speed)
HAL_SIMDATAVALUE_DEFINE_NAME(Position)
HAL_SIMDATAVALUE_DEFINE_NAME(PeriodScale)
@@ -19,7 +19,8 @@ class PWMData {
public:
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetInitializedName> initialized{
false};
SimDataValue<int32_t, HAL_MakeInt, GetRawValueName> rawValue{0};
SimDataValue<int32_t, HAL_MakeInt, GetPulseMicrosecondName> pulseMicrosecond{
0};
SimDataValue<double, HAL_MakeDouble, GetSpeedName> speed{0};
SimDataValue<double, HAL_MakeDouble, GetPositionName> position{0};
SimDataValue<int32_t, HAL_MakeInt, GetPeriodScaleName> periodScale{0};