10 #ifndef __FRC_ROBORIO__
15 #include "CallbackStore.h"
16 #include "mockdata/AnalogInData.h"
22 explicit AnalogInSim(
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_CancelAnalogInInitializedCallback);
28 store->SetUid(HALSIM_RegisterAnalogInInitializedCallback(
29 m_index, &CallbackStoreThunk, store.get(), initialNotify));
33 bool GetInitialized()
const {
return HALSIM_GetAnalogInInitialized(m_index); }
35 void SetInitialized(
bool initialized) {
36 HALSIM_SetAnalogInInitialized(m_index, initialized);
39 std::unique_ptr<CallbackStore> RegisterAverageBitsCallback(
40 NotifyCallback callback,
bool initialNotify) {
41 auto store = std::make_unique<CallbackStore>(
42 m_index, -1, callback, &HALSIM_CancelAnalogInAverageBitsCallback);
43 store->SetUid(HALSIM_RegisterAnalogInAverageBitsCallback(
44 m_index, &CallbackStoreThunk, store.get(), initialNotify));
48 int GetAverageBits()
const {
return HALSIM_GetAnalogInAverageBits(m_index); }
50 void SetAverageBits(
int averageBits) {
51 HALSIM_SetAnalogInAverageBits(m_index, averageBits);
54 std::unique_ptr<CallbackStore> RegisterOversampleBitsCallback(
55 NotifyCallback callback,
bool initialNotify) {
56 auto store = std::make_unique<CallbackStore>(
57 m_index, -1, callback, &HALSIM_CancelAnalogInOversampleBitsCallback);
58 store->SetUid(HALSIM_RegisterAnalogInOversampleBitsCallback(
59 m_index, &CallbackStoreThunk, store.get(), initialNotify));
63 int GetOversampleBits()
const {
64 return HALSIM_GetAnalogInOversampleBits(m_index);
67 void SetOversampleBits(
int oversampleBits) {
68 HALSIM_SetAnalogInOversampleBits(m_index, oversampleBits);
71 std::unique_ptr<CallbackStore> RegisterVoltageCallback(
72 NotifyCallback callback,
bool initialNotify) {
73 auto store = std::make_unique<CallbackStore>(
74 m_index, -1, callback, &HALSIM_CancelAnalogInVoltageCallback);
75 store->SetUid(HALSIM_RegisterAnalogInVoltageCallback(
76 m_index, &CallbackStoreThunk, store.get(), initialNotify));
80 double GetVoltage()
const {
return HALSIM_GetAnalogInVoltage(m_index); }
82 void SetVoltage(
double voltage) {
83 HALSIM_SetAnalogInVoltage(m_index, voltage);
86 std::unique_ptr<CallbackStore> RegisterAccumulatorInitializedCallback(
87 NotifyCallback callback,
bool initialNotify) {
88 auto store = std::make_unique<CallbackStore>(
89 m_index, -1, callback,
90 &HALSIM_CancelAnalogInAccumulatorInitializedCallback);
91 store->SetUid(HALSIM_RegisterAnalogInAccumulatorInitializedCallback(
92 m_index, &CallbackStoreThunk, store.get(), initialNotify));
96 bool GetAccumulatorInitialized()
const {
97 return HALSIM_GetAnalogInAccumulatorInitialized(m_index);
100 void SetAccumulatorInitialized(
bool accumulatorInitialized) {
101 HALSIM_SetAnalogInAccumulatorInitialized(m_index, accumulatorInitialized);
104 std::unique_ptr<CallbackStore> RegisterAccumulatorValueCallback(
105 NotifyCallback callback,
bool initialNotify) {
106 auto store = std::make_unique<CallbackStore>(
107 m_index, -1, callback, &HALSIM_CancelAnalogInAccumulatorValueCallback);
108 store->SetUid(HALSIM_RegisterAnalogInAccumulatorValueCallback(
109 m_index, &CallbackStoreThunk, store.get(), initialNotify));
113 int64_t GetAccumulatorValue()
const {
114 return HALSIM_GetAnalogInAccumulatorValue(m_index);
117 void SetAccumulatorValue(int64_t accumulatorValue) {
118 HALSIM_SetAnalogInAccumulatorValue(m_index, accumulatorValue);
121 std::unique_ptr<CallbackStore> RegisterAccumulatorCountCallback(
122 NotifyCallback callback,
bool initialNotify) {
123 auto store = std::make_unique<CallbackStore>(
124 m_index, -1, callback, &HALSIM_CancelAnalogInAccumulatorCountCallback);
125 store->SetUid(HALSIM_RegisterAnalogInAccumulatorCountCallback(
126 m_index, &CallbackStoreThunk, store.get(), initialNotify));
130 int64_t GetAccumulatorCount()
const {
131 return HALSIM_GetAnalogInAccumulatorCount(m_index);
134 void SetAccumulatorCount(int64_t accumulatorCount) {
135 HALSIM_SetAnalogInAccumulatorCount(m_index, accumulatorCount);
138 std::unique_ptr<CallbackStore> RegisterAccumulatorCenterCallback(
139 NotifyCallback callback,
bool initialNotify) {
140 auto store = std::make_unique<CallbackStore>(
141 m_index, -1, callback, &HALSIM_CancelAnalogInAccumulatorCenterCallback);
142 store->SetUid(HALSIM_RegisterAnalogInAccumulatorCenterCallback(
143 m_index, &CallbackStoreThunk, store.get(), initialNotify));
147 int GetAccumulatorCenter()
const {
148 return HALSIM_GetAnalogInAccumulatorCenter(m_index);
151 void SetAccumulatorCenter(
int accumulatorCenter) {
152 HALSIM_SetAnalogInAccumulatorCenter(m_index, accumulatorCenter);
155 std::unique_ptr<CallbackStore> RegisterAccumulatorDeadbandCallback(
156 NotifyCallback callback,
bool initialNotify) {
157 auto store = std::make_unique<CallbackStore>(
158 m_index, -1, callback,
159 &HALSIM_CancelAnalogInAccumulatorDeadbandCallback);
160 store->SetUid(HALSIM_RegisterAnalogInAccumulatorDeadbandCallback(
161 m_index, &CallbackStoreThunk, store.get(), initialNotify));
165 int GetAccumulatorDeadband()
const {
166 return HALSIM_GetAnalogInAccumulatorDeadband(m_index);
169 void SetAccumulatorDeadband(
int accumulatorDeadband) {
170 HALSIM_SetAnalogInAccumulatorDeadband(m_index, accumulatorDeadband);
173 void ResetData() { HALSIM_ResetAnalogInData(m_index); }
180 #endif // __FRC_ROBORIO__
WPILib FRC namespace.
Definition: SPIAccelerometerSim.h:18
Definition: AnalogInSim.h:20