MCPcopy Create free account
hub / github.com/OpenStickCommunity/GP2040-CE / checkProcessedState

Method checkProcessedState

src/gp2040.cpp:535–564  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

533}
534
535void GP2040::checkProcessedState(GamepadState prevState, GamepadState currState) {
536 // buttons pressed
537 if (
538 ((currState.aux & ~prevState.aux) != 0) ||
539 ((currState.dpad & ~prevState.dpad) != 0) ||
540 ((currState.buttons & ~prevState.buttons) != 0)
541 ) {
542 EventManager::getInstance().triggerEvent(new GPButtonProcessedDownEvent((currState.dpad & ~prevState.dpad), (currState.buttons & ~prevState.buttons), (currState.aux & ~prevState.aux)));
543 }
544
545 // buttons released
546 if (
547 ((prevState.aux & ~currState.aux) != 0) ||
548 ((prevState.dpad & ~currState.dpad) != 0) ||
549 ((prevState.buttons & ~currState.buttons) != 0)
550 ) {
551 EventManager::getInstance().triggerEvent(new GPButtonProcessedUpEvent((prevState.dpad & ~currState.dpad), (prevState.buttons & ~currState.buttons), (prevState.aux & ~currState.aux)));
552 }
553
554 if (
555 (currState.lx != prevState.lx) ||
556 (currState.ly != prevState.ly) ||
557 (currState.rx != prevState.rx) ||
558 (currState.ry != prevState.ry) ||
559 (currState.lt != prevState.lt) ||
560 (currState.rt != prevState.rt)
561 ) {
562 EventManager::getInstance().triggerEvent(new GPAnalogProcessedMoveEvent(currState.lx, currState.ly, currState.rx, currState.ry, currState.lt, currState.rt));
563 }
564}
565
566void GP2040::checkSaveRebootState() {
567 if (saveRequested) {

Callers

nothing calls this directly

Calls 1

triggerEventMethod · 0.80

Tested by

no test coverage detected