MCPcopy Create free account
hub / github.com/Santroller/Santroller / processData

Method processData

lib/psx_controller/psx_controller.cpp:166–348  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164 return ret;
165}
166void PSXController::processData(bool ack, bool timeout)
167{
168 // if the controller sends an ack after we are done, ignore it!
169 if (done && ack)
170 {
171 return;
172 }
173 cancel_alarm(timeout_alarm_id);
174 if (done)
175 {
176 switch (status)
177 {
178 case DISCONNECTED:
179 if (valid)
180 {
181 status = CONNECTION_DELAY;
182 timeout_alarm_id = add_alarm_in_ms(100, restart_handler, this, true);
183 return;
184 }
185 break;
186 case CONNECTION_DELAY:
187 status = FIRST_INPUTS;
188 autoShiftData(commandPollInput, sizeof(commandPollInput));
189 return;
190 case FIRST_INPUTS:
191 if (isConfigReply(ps2Data))
192 {
193 status = ENABLE_ANALOG_MODE;
194 autoShiftData(commandSetMode, sizeof(commandSetMode));
195 }
196 else
197 {
198 status = ENTER_CONFIG;
199 autoShiftData(commandEnterConfig, sizeof(commandEnterConfig));
200 }
201 return;
202 case ENTER_CONFIG:
203 if (valid)
204 {
205 // poll the controller so we know it has entered config mode before we send config commands
206 status = FIRST_INPUTS;
207 }
208 else
209 {
210 // config mode not supported
211 status = SECOND_INPUTS;
212 }
213 autoShiftData(commandPollInput, sizeof(commandPollInput));
214 return;
215 case ENABLE_ANALOG_MODE:
216 status = ENABLE_PRESSURES;
217 autoShiftData(commandSetPressures, sizeof(commandSetPressures));
218 return;
219 case ENABLE_PRESSURES:
220 status = ENABLE_PRESSURES_2;
221 autoShiftData(commandSetPressures, sizeof(commandSetPressures));
222 return;
223 case ENABLE_PRESSURES_2:

Callers 3

attentionInterruptFunction · 0.45
restart_handlerFunction · 0.45
process_dmaFunction · 0.45

Calls 12

isConfigReplyFunction · 0.85
isValidReplyFunction · 0.85
isDualShock2ReplyFunction · 0.85
isDualShockReplyFunction · 0.85
isFlightStickReplyFunction · 0.85
isNegconReplyFunction · 0.85
isJogconReplyFunction · 0.85
isGunconReplyFunction · 0.85
isMouseReplyFunction · 0.85
isDigitalReplyFunction · 0.85
memcpyFunction · 0.85
transferMethod · 0.45

Tested by

no test coverage detected