[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

@@ -39,21 +39,21 @@ void PWMSim::SetInitialized(bool initialized) {
HALSIM_SetPWMInitialized(m_index, initialized);
}
std::unique_ptr<CallbackStore> PWMSim::RegisterRawValueCallback(
std::unique_ptr<CallbackStore> PWMSim::RegisterPulseMicrosecondCallback(
NotifyCallback callback, bool initialNotify) {
auto store = std::make_unique<CallbackStore>(
m_index, -1, callback, &HALSIM_CancelPWMRawValueCallback);
store->SetUid(HALSIM_RegisterPWMRawValueCallback(m_index, &CallbackStoreThunk,
store.get(), initialNotify));
m_index, -1, callback, &HALSIM_CancelPWMPulseMicrosecondCallback);
store->SetUid(HALSIM_RegisterPWMPulseMicrosecondCallback(
m_index, &CallbackStoreThunk, store.get(), initialNotify));
return store;
}
int PWMSim::GetRawValue() const {
return HALSIM_GetPWMRawValue(m_index);
int32_t PWMSim::GetPulseMicrosecond() const {
return HALSIM_GetPWMPulseMicrosecond(m_index);
}
void PWMSim::SetRawValue(int rawValue) {
HALSIM_SetPWMRawValue(m_index, rawValue);
void PWMSim::SetPulseMicrosecond(int32_t microsecondPulseTime) {
HALSIM_SetPWMPulseMicrosecond(m_index, microsecondPulseTime);
}
std::unique_ptr<CallbackStore> PWMSim::RegisterSpeedCallback(