10 #ifndef __FRC_ROBORIO__
15 #include "CallbackStore.h"
16 #include "mockdata/DIOData.h"
22 explicit DIOSim(
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_CancelDIOInitializedCallback);
28 store->SetUid(HALSIM_RegisterDIOInitializedCallback(
29 m_index, &CallbackStoreThunk, store.get(), initialNotify));
33 bool GetInitialized()
const {
return HALSIM_GetDIOInitialized(m_index); }
35 void SetInitialized(
bool initialized) {
36 HALSIM_SetDIOInitialized(m_index, initialized);
39 std::unique_ptr<CallbackStore> RegisterValueCallback(NotifyCallback callback,
41 auto store = std::make_unique<CallbackStore>(
42 m_index, -1, callback, &HALSIM_CancelDIOValueCallback);
43 store->SetUid(HALSIM_RegisterDIOValueCallback(m_index, &CallbackStoreThunk,
44 store.get(), initialNotify));
48 bool GetValue()
const {
return HALSIM_GetDIOValue(m_index); }
50 void SetValue(
bool value) { HALSIM_SetDIOValue(m_index, value); }
52 std::unique_ptr<CallbackStore> RegisterPulseLengthCallback(
53 NotifyCallback callback,
bool initialNotify) {
54 auto store = std::make_unique<CallbackStore>(
55 m_index, -1, callback, &HALSIM_CancelDIOPulseLengthCallback);
56 store->SetUid(HALSIM_RegisterDIOPulseLengthCallback(
57 m_index, &CallbackStoreThunk, store.get(), initialNotify));
61 double GetPulseLength()
const {
return HALSIM_GetDIOPulseLength(m_index); }
63 void SetPulseLength(
double pulseLength) {
64 HALSIM_SetDIOPulseLength(m_index, pulseLength);
67 std::unique_ptr<CallbackStore> RegisterIsInputCallback(
68 NotifyCallback callback,
bool initialNotify) {
69 auto store = std::make_unique<CallbackStore>(
70 m_index, -1, callback, &HALSIM_CancelDIOIsInputCallback);
71 store->SetUid(HALSIM_RegisterDIOIsInputCallback(
72 m_index, &CallbackStoreThunk, store.get(), initialNotify));
76 bool GetIsInput()
const {
return HALSIM_GetDIOIsInput(m_index); }
78 void SetIsInput(
bool isInput) { HALSIM_SetDIOIsInput(m_index, isInput); }
80 std::unique_ptr<CallbackStore> RegisterFilterIndexCallback(
81 NotifyCallback callback,
bool initialNotify) {
82 auto store = std::make_unique<CallbackStore>(
83 m_index, -1, callback, &HALSIM_CancelDIOFilterIndexCallback);
84 store->SetUid(HALSIM_RegisterDIOFilterIndexCallback(
85 m_index, &CallbackStoreThunk, store.get(), initialNotify));
89 int GetFilterIndex()
const {
return HALSIM_GetDIOFilterIndex(m_index); }
91 void SetFilterIndex(
int filterIndex) {
92 HALSIM_SetDIOFilterIndex(m_index, filterIndex);
95 void ResetData() { HALSIM_ResetDIOData(m_index); }
102 #endif // __FRC_ROBORIO__
WPILib FRC namespace.
Definition: SPIAccelerometerSim.h:18