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));
33 bool GetInitialized()
const {
return HALSIM_GetPWMInitialized(m_index); }
35 void SetInitialized(
bool initialized) {
36 HALSIM_SetPWMInitialized(m_index, initialized);
39 std::unique_ptr<CallbackStore> RegisterRawValueCallback(
40 NotifyCallback callback,
bool initialNotify) {
41 auto store = std::make_unique<CallbackStore>(
42 m_index, -1, callback, &HALSIM_CancelPWMRawValueCallback);
43 store->SetUid(HALSIM_RegisterPWMRawValueCallback(
44 m_index, &CallbackStoreThunk, store.get(), initialNotify));
48 int GetRawValue()
const {
return HALSIM_GetPWMRawValue(m_index); }
50 void SetRawValue(
int rawValue) { HALSIM_SetPWMRawValue(m_index, rawValue); }
52 std::unique_ptr<CallbackStore> RegisterSpeedCallback(NotifyCallback callback,
54 auto store = std::make_unique<CallbackStore>(
55 m_index, -1, callback, &HALSIM_CancelPWMSpeedCallback);
56 store->SetUid(HALSIM_RegisterPWMSpeedCallback(m_index, &CallbackStoreThunk,
57 store.get(), initialNotify));
61 double GetSpeed()
const {
return HALSIM_GetPWMSpeed(m_index); }
63 void SetSpeed(
double speed) { HALSIM_SetPWMSpeed(m_index, speed); }
65 std::unique_ptr<CallbackStore> RegisterPositionCallback(
66 NotifyCallback callback,
bool initialNotify) {
67 auto store = std::make_unique<CallbackStore>(
68 m_index, -1, callback, &HALSIM_CancelPWMPositionCallback);
69 store->SetUid(HALSIM_RegisterPWMPositionCallback(
70 m_index, &CallbackStoreThunk, store.get(), initialNotify));
74 double GetPosition()
const {
return HALSIM_GetPWMPosition(m_index); }
76 void SetPosition(
double position) {
77 HALSIM_SetPWMPosition(m_index, position);
80 std::unique_ptr<CallbackStore> RegisterPeriodScaleCallback(
81 NotifyCallback callback,
bool initialNotify) {
82 auto store = std::make_unique<CallbackStore>(
83 m_index, -1, callback, &HALSIM_CancelPWMPeriodScaleCallback);
84 store->SetUid(HALSIM_RegisterPWMPeriodScaleCallback(
85 m_index, &CallbackStoreThunk, store.get(), initialNotify));
89 int GetPeriodScale()
const {
return HALSIM_GetPWMPeriodScale(m_index); }
91 void SetPeriodScale(
int periodScale) {
92 HALSIM_SetPWMPeriodScale(m_index, periodScale);
95 std::unique_ptr<CallbackStore> RegisterZeroLatchCallback(
96 NotifyCallback callback,
bool initialNotify) {
97 auto store = std::make_unique<CallbackStore>(
98 m_index, -1, callback, &HALSIM_CancelPWMZeroLatchCallback);
99 store->SetUid(HALSIM_RegisterPWMZeroLatchCallback(
100 m_index, &CallbackStoreThunk, store.get(), initialNotify));
104 bool GetZeroLatch()
const {
return HALSIM_GetPWMZeroLatch(m_index); }
106 void SetZeroLatch(
bool zeroLatch) {
107 HALSIM_SetPWMZeroLatch(m_index, zeroLatch);
110 void ResetData() { HALSIM_ResetPWMData(m_index); }
117 #endif // __FRC_ROBORIO__
WPILib FRC namespace.
Definition: SPIAccelerometerSim.h:18