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));
32 bool GetInitialized() {
return HALSIM_GetDIOInitialized(m_index); }
33 void SetInitialized(
bool initialized) {
34 HALSIM_SetDIOInitialized(m_index, initialized);
37 std::unique_ptr<CallbackStore> RegisterValueCallback(NotifyCallback callback,
39 auto store = std::make_unique<CallbackStore>(
40 m_index, -1, callback, &HALSIM_CancelDIOValueCallback);
41 store->SetUid(HALSIM_RegisterDIOValueCallback(m_index, &CallbackStoreThunk,
42 store.get(), initialNotify));
45 bool GetValue() {
return HALSIM_GetDIOValue(m_index); }
46 void SetValue(
bool value) { HALSIM_SetDIOValue(m_index, value); }
48 std::unique_ptr<CallbackStore> RegisterPulseLengthCallback(
49 NotifyCallback callback,
bool initialNotify) {
50 auto store = std::make_unique<CallbackStore>(
51 m_index, -1, callback, &HALSIM_CancelDIOPulseLengthCallback);
52 store->SetUid(HALSIM_RegisterDIOPulseLengthCallback(
53 m_index, &CallbackStoreThunk, store.get(), initialNotify));
56 double GetPulseLength() {
return HALSIM_GetDIOPulseLength(m_index); }
57 void SetPulseLength(
double pulseLength) {
58 HALSIM_SetDIOPulseLength(m_index, pulseLength);
61 std::unique_ptr<CallbackStore> RegisterIsInputCallback(
62 NotifyCallback callback,
bool initialNotify) {
63 auto store = std::make_unique<CallbackStore>(
64 m_index, -1, callback, &HALSIM_CancelDIOIsInputCallback);
65 store->SetUid(HALSIM_RegisterDIOIsInputCallback(
66 m_index, &CallbackStoreThunk, store.get(), initialNotify));
69 bool GetIsInput() {
return HALSIM_GetDIOIsInput(m_index); }
70 void SetIsInput(
bool isInput) { HALSIM_SetDIOIsInput(m_index, isInput); }
72 std::unique_ptr<CallbackStore> RegisterFilterIndexCallback(
73 NotifyCallback callback,
bool initialNotify) {
74 auto store = std::make_unique<CallbackStore>(
75 m_index, -1, callback, &HALSIM_CancelDIOFilterIndexCallback);
76 store->SetUid(HALSIM_RegisterDIOFilterIndexCallback(
77 m_index, &CallbackStoreThunk, store.get(), initialNotify));
80 int GetFilterIndex() {
return HALSIM_GetDIOFilterIndex(m_index); }
81 void SetFilterIndex(
int filterIndex) {
82 HALSIM_SetDIOFilterIndex(m_index, filterIndex);
85 void ResetData() { HALSIM_ResetDIOData(m_index); }
92 #endif // __FRC_ROBORIO__
WPILib FRC namespace.
Definition: SPIAccelerometerSim.h:18