| 7 | #define SWITCH_PRO_KEEPALIVE_TIMER 5 |
| 8 | |
| 9 | void SwitchProDriver::initialize() { |
| 10 | //stdio_init_all(); |
| 11 | |
| 12 | playerID = 0; |
| 13 | last_report_counter = 0; |
| 14 | handshakeCounter = 0; |
| 15 | isReady = false; |
| 16 | |
| 17 | deviceInfo = { |
| 18 | .majorVersion = 0x04, |
| 19 | .minorVersion = 0x91, |
| 20 | .controllerType = SwitchControllerType::SWITCH_TYPE_PRO_CONTROLLER, |
| 21 | .unknown00 = 0x02, |
| 22 | // MAC address in reverse |
| 23 | .macAddress = {0x7c, 0xbb, 0x8a, (uint8_t)(get_rand_32() % 0xff), (uint8_t)(get_rand_32() % 0xff), (uint8_t)(get_rand_32() % 0xff)}, |
| 24 | .unknown01 = 0x01, |
| 25 | .storedColors = 0x02, |
| 26 | }; |
| 27 | |
| 28 | switchReport = { |
| 29 | .reportID = 0x30, |
| 30 | .timestamp = 0, |
| 31 | |
| 32 | .inputs { |
| 33 | .connectionInfo = 0, |
| 34 | .batteryLevel = 0x08, |
| 35 | |
| 36 | // byte 00 |
| 37 | .buttonY = 0, |
| 38 | .buttonX = 0, |
| 39 | .buttonB = 0, |
| 40 | .buttonA = 0, |
| 41 | .buttonRightSR = 0, |
| 42 | .buttonRightSL = 0, |
| 43 | .buttonR = 0, |
| 44 | .buttonZR = 0, |
| 45 | |
| 46 | // byte 01 |
| 47 | .buttonMinus = 0, |
| 48 | .buttonPlus = 0, |
| 49 | .buttonThumbR = 0, |
| 50 | .buttonThumbL = 0, |
| 51 | .buttonHome = 0, |
| 52 | .buttonCapture = 0, |
| 53 | .dummy = 0, |
| 54 | .chargingGrip = 0, |
| 55 | |
| 56 | // byte 02 |
| 57 | .dpadDown = 0, |
| 58 | .dpadUp = 0, |
| 59 | .dpadRight = 0, |
| 60 | .dpadLeft = 0, |
| 61 | .buttonLeftSL = 0, |
| 62 | .buttonLeftSR = 0, |
| 63 | .buttonL = 0, |
| 64 | .buttonZL = 0, |
| 65 | .leftStick = {0xFF, 0xF7, 0x7F}, |
| 66 | .rightStick = {0xFF, 0xF7, 0x7F}, |
nothing calls this directly
no outgoing calls
no test coverage detected