10 #ifndef __FRC_ROBORIO__
15 #include "CallbackStore.h"
16 #include "mockdata/PWMData.h"
22 explicit PWMSim(
int index) { m_index = index; }
24 std::unique_ptr<CallbackStore> RegisterInitializedCallback(
25 NotifyCallback callback,
bool initialNotify) {
26 auto store = std::make_unique<CallbackStore>(
27 m_index, -1, callback, &HALSIM_CancelPWMInitializedCallback);
28 store->SetUid(HALSIM_RegisterPWMInitializedCallback(
29 m_index, &CallbackStoreThunk, store.get(), initialNotify));
32 bool GetInitialized() {
return HALSIM_GetPWMInitialized(m_index); }
33 void SetInitialized(
bool initialized) {
34 HALSIM_SetPWMInitialized(m_index, initialized);
37 std::unique_ptr<CallbackStore> RegisterRawValueCallback(
38 NotifyCallback callback,
bool initialNotify) {
39 auto store = std::make_unique<CallbackStore>(
40 m_index, -1, callback, &HALSIM_CancelPWMRawValueCallback);
41 store->SetUid(HALSIM_RegisterPWMRawValueCallback(
42 m_index, &CallbackStoreThunk, store.get(), initialNotify));
45 int GetRawValue() {
return HALSIM_GetPWMRawValue(m_index); }
46 void SetRawValue(
int rawValue) { HALSIM_SetPWMRawValue(m_index, rawValue); }
48 std::unique_ptr<CallbackStore> RegisterSpeedCallback(NotifyCallback callback,
50 auto store = std::make_unique<CallbackStore>(
51 m_index, -1, callback, &HALSIM_CancelPWMSpeedCallback);
52 store->SetUid(HALSIM_RegisterPWMSpeedCallback(m_index, &CallbackStoreThunk,
53 store.get(), initialNotify));
56 double GetSpeed() {
return HALSIM_GetPWMSpeed(m_index); }
57 void SetSpeed(
double speed) { HALSIM_SetPWMSpeed(m_index, speed); }
59 std::unique_ptr<CallbackStore> RegisterPositionCallback(
60 NotifyCallback callback,
bool initialNotify) {
61 auto store = std::make_unique<CallbackStore>(
62 m_index, -1, callback, &HALSIM_CancelPWMPositionCallback);
63 store->SetUid(HALSIM_RegisterPWMPositionCallback(
64 m_index, &CallbackStoreThunk, store.get(), initialNotify));
67 double GetPosition() {
return HALSIM_GetPWMPosition(m_index); }
68 void SetPosition(
double position) {
69 HALSIM_SetPWMPosition(m_index, position);
72 std::unique_ptr<CallbackStore> RegisterPeriodScaleCallback(
73 NotifyCallback callback,
bool initialNotify) {
74 auto store = std::make_unique<CallbackStore>(
75 m_index, -1, callback, &HALSIM_CancelPWMPeriodScaleCallback);
76 store->SetUid(HALSIM_RegisterPWMPeriodScaleCallback(
77 m_index, &CallbackStoreThunk, store.get(), initialNotify));
80 int GetPeriodScale() {
return HALSIM_GetPWMPeriodScale(m_index); }
81 void SetPeriodScale(
int periodScale) {
82 HALSIM_SetPWMPeriodScale(m_index, periodScale);
85 std::unique_ptr<CallbackStore> RegisterZeroLatchCallback(
86 NotifyCallback callback,
bool initialNotify) {
87 auto store = std::make_unique<CallbackStore>(
88 m_index, -1, callback, &HALSIM_CancelPWMZeroLatchCallback);
89 store->SetUid(HALSIM_RegisterPWMZeroLatchCallback(
90 m_index, &CallbackStoreThunk, store.get(), initialNotify));
93 bool GetZeroLatch() {
return HALSIM_GetPWMZeroLatch(m_index); }
94 void SetZeroLatch(
bool zeroLatch) {
95 HALSIM_SetPWMZeroLatch(m_index, zeroLatch);
98 void ResetData() { HALSIM_ResetPWMData(m_index); }
105 #endif // __FRC_ROBORIO__
Definition: SPIAccelerometerSim.h:18