fork/GramFirmware
git clone https://git.julia.blue/fork/GramFirmware
818d962
gram
1#include "comms/SnesBackend.hpp" 2 3SnesBackend ::SnesBackend ( 4InputState & inputs , 5InputSource ** input_sources , 6size_t input_source_count , 7uint data_pin , 8uint clock_pin , 9uint latch_pin , 10PIO pio , 11int sm , 12int offset 13) 14 :CommunicationBackend (inputs ,input_sources ,input_source_count ), 15_snes (data_pin ,clock_pin ,latch_pin ,pio ,sm ,offset ) {} 16 17CommunicationBackendId SnesBackend ::BackendId () { 18return COMMS_BACKEND_SNES ; 19} 20 21void SnesBackend ::SendReport () { 22ScanInputs (); 23 24// Run gamemode logic 25UpdateOutputs (); 26 27// Digital outputs 28_report .a = _outputs .a ; 29_report .b = _outputs .b ; 30_report .x = _outputs .x ; 31_report .y = _outputs .y ; 32_report .l = _outputs .buttonL || _outputs .triggerLDigital ; 33_report .r = _outputs .buttonR || _outputs .triggerRDigital ; 34_report .select = _outputs .select ; 35_report .start = _outputs .start ; 36_report .dpad_left = _outputs .dpadLeft || _outputs .leftStickX < 128 ; 37_report .dpad_right = _outputs .dpadRight || _outputs .leftStickX > 128 ; 38_report .dpad_down = _outputs .dpadDown || _outputs .leftStickY < 128 ; 39_report .dpad_up = _outputs .dpadUp || _outputs .leftStickY > 128 ; 40 41_snes .SendReport (_report ); 42} 43 44int SnesBackend ::GetOffset () { 45return _snes .GetOffset (); 46}