fork/GramFirmware
git clone https://git.julia.blue/fork/GramFirmware
3ab6a9b
WASD_NeutralSOCD
1#include "input/GamecubeControllerInput.hpp" 2 3#include "core/InputSource.hpp" 4 5#include <GamecubeController.hpp> 6 7GamecubeControllerInput ::GamecubeControllerInput ( 8uint pin , 9uint polling_rate , 10PIO pio , 11int sm , 12int offset 13) { 14_controller = new GamecubeController (pin ,polling_rate ,pio ,sm ,offset ); 15} 16 17GamecubeControllerInput ::~GamecubeControllerInput () { 18delete _controller ; 19} 20 21InputScanSpeed GamecubeControllerInput ::ScanSpeed () { 22return InputScanSpeed ::SLOW ; 23} 24 25void GamecubeControllerInput ::UpdateInputs (InputState & inputs ) { 26// Only update inputs if poll response is received. 27if (_controller -> Poll (& _report , false)) { 28inputs .nunchuk_connected = true; 29inputs .nunchuk_x = _report .stick_x ; 30inputs .nunchuk_y = _report .stick_y ; 31inputs .nunchuk_z = _report .l ; 32 } 33} 34 35int GamecubeControllerInput ::GetOffset () { 36return _controller -> GetOffset (); 37}