fork/GramFirmware
git clone https://git.julia.blue/fork/GramFirmware
38b67d3
codespace-scaling-space-guide-56rpxqvxpg2v57v
1#ifndef _COMMS_NINTENDOSWITCHBACKEND_HPP 2#define _COMMS_NINTENDOSWITCHBACKEND_HPP 3 4#include "core/CommunicationBackend.hpp" 5 6typedef enum { 7SWITCH_HAT_UP , 8SWITCH_HAT_UP_RIGHT , 9SWITCH_HAT_RIGHT , 10SWITCH_HAT_DOWN_RIGHT , 11SWITCH_HAT_DOWN , 12SWITCH_HAT_DOWN_LEFT , 13SWITCH_HAT_LEFT , 14SWITCH_HAT_UP_LEFT , 15SWITCH_HAT_CENTERED , 16}switch_gamepad_hat_t ; 17 18typedef struct __attribute__((packed ,aligned (1 ))) { 19bool y :1 ; 20bool b :1 ; 21bool a :1 ; 22bool x :1 ; 23bool l :1 ; 24bool r :1 ; 25bool zl :1 ; 26bool zr :1 ; 27bool minus :1 ; 28bool plus :1 ; 29bool l3 :1 ; 30bool r3 :1 ; 31bool home :1 ; 32bool capture :1 ; 33uint8_t reserved0 :2 ; 34switch_gamepad_hat_t hat ; 35uint8_t lx ; 36uint8_t ly ; 37uint8_t rx ; 38uint8_t ry ; 39uint8_t reserved1 ; 40}switch_gamepad_report_t ; 41 42class NintendoSwitchBackend :public CommunicationBackend { 43public : 44NintendoSwitchBackend (InputSource ** input_sources ,size_t input_source_count ); 45 ~NintendoSwitchBackend (); 46 47static void RegisterDescriptor (); 48 49void SendReport (); 50 51protected : 52static const uint8_t _report_id = 0 ; 53static uint8_t _descriptor []; 54 55switch_gamepad_report_t _report ; 56 57static switch_gamepad_hat_t GetHatPosition (bool left ,bool right ,bool down ,bool up ); 58}; 59 60#endif