From aed3e47d937ea6d723214c715831d7a364faca86 Mon Sep 17 00:00:00 2001 From: Luke Arntson Date: Mon, 23 Sep 2024 22:25:16 -0400 Subject: [PATCH] Formatting, getting ready for merge --- headers/drivers/xinput/XInputDescriptors.h | 245 ++++++++++----------- headers/gp2040.h | 4 +- src/drivers/shared/xinput_host.cpp | 5 +- src/drivers/xbone/XBOneAuthUSBListener.cpp | 31 --- src/drivers/xbone/XBOneDriver.cpp | 3 - src/drivers/xinput/XInputDriver.cpp | 31 --- src/gp2040.cpp | 6 - src/gp2040aux.cpp | 4 +- src/main.cpp | 10 +- 9 files changed, 131 insertions(+), 208 deletions(-) diff --git a/headers/drivers/xinput/XInputDescriptors.h b/headers/drivers/xinput/XInputDescriptors.h index f841d77ce..c99ae0a20 100644 --- a/headers/drivers/xinput/XInputDescriptors.h +++ b/headers/drivers/xinput/XInputDescriptors.h @@ -33,54 +33,51 @@ typedef struct __attribute((packed, aligned(1))) { - uint8_t report_id; - uint8_t report_size; - uint8_t buttons1; - uint8_t buttons2; - uint8_t lt; - uint8_t rt; - int16_t lx; - int16_t ly; - int16_t rx; - int16_t ry; - uint8_t _reserved[6]; + uint8_t report_id; + uint8_t report_size; + uint8_t buttons1; + uint8_t buttons2; + uint8_t lt; + uint8_t rt; + int16_t lx; + int16_t ly; + int16_t rx; + int16_t ry; + uint8_t _reserved[6]; } XInputReport; static const uint8_t xinput_string_language[] = { 0x09, 0x04 }; static const uint8_t xinput_string_serial[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -//static const uint8_t xinput_string_manfacturer[] = "Microsoft"; -//static const uint8_t xinput_string_product[] = "XInput STANDARD GAMEPAD"; -//static const uint8_t xinput_string_version[] = "1.0"; static const uint8_t xinput_string_manfacturer[] = "\xa9Microsoft Corporation"; static const uint8_t xinput_string_product[] = "Controller"; -static const uint8_t xinput_string_version[] = "08FEC93"; // serial? +static const uint8_t xinput_string_version[] = "08FEC93"; // Fake a random serial, doesn't matter static const uint8_t xinput_string_xsm3[] = "Xbox Security Method 3, Version 1.00, \xa9 2005 Microsoft Corporation. All rights reserved."; static const uint8_t *xinput_string_descriptors[] __attribute__((unused)) = { - xinput_string_serial, - xinput_string_manfacturer, - xinput_string_product, - xinput_string_version, + xinput_string_serial, + xinput_string_manfacturer, + xinput_string_product, + xinput_string_version, xinput_string_xsm3 }; static const uint8_t xinput_device_descriptor[] = { - 0x12, // bLength - 0x01, // bDescriptorType (Device) - 0x00, 0x02, // bcdUSB 2.00 - 0xFF, // bDeviceClass - 0xFF, // bDeviceSubClass - 0xFF, // bDeviceProtocol - 0x40, // bMaxPacketSize0 64 - 0x5E, 0x04, // idVendor 0x045E - 0x8E, 0x02, // idProduct 0x028E - 0x14, 0x01, // bcdDevice 2.14 - 0x01, // iManufacturer (String Index) - 0x02, // iProduct (String Index) - 0x03, // iSerialNumber (String Index) - 0x01, // bNumConfigurations 1 + 0x12, // bLength + 0x01, // bDescriptorType (Device) + 0x00, 0x02, // bcdUSB 2.00 + 0xFF, // bDeviceClass + 0xFF, // bDeviceSubClass + 0xFF, // bDeviceProtocol + 0x40, // bMaxPacketSize0 64 + 0x5E, 0x04, // idVendor 0x045E + 0x8E, 0x02, // idProduct 0x028E + 0x14, 0x01, // bcdDevice 2.14 + 0x01, // iManufacturer (String Index) + 0x02, // iProduct (String Index) + 0x03, // iSerialNumber (String Index) + 0x01, // bNumConfigurations 1 }; // This needs to be: @@ -88,65 +85,65 @@ static const uint8_t xinput_device_descriptor[] = // remote wakeup enabled static const uint8_t xinput_configuration_descriptor[] = { - 0x09, // bLength - 0x02, // bDescriptorType (Configuration) - 0x99, 0x00, // wTotalLength 0x99 - 0x04, // bNumInterfaces 4 - 0x01, // bConfigurationValue - 0x00, // iConfiguration (String Index) - 0xA0, // bmAttributes (remote wakeup) - 0xFA, // bMaxPower 500mA + 0x09, // bLength + 0x02, // bDescriptorType (Configuration) + 0x99, 0x00, // wTotalLength 0x99 + 0x04, // bNumInterfaces 4 + 0x01, // bConfigurationValue + 0x00, // iConfiguration (String Index) + 0xA0, // bmAttributes (remote wakeup) + 0xFA, // bMaxPower 500mA // Control Interface (0x5D 0xFF) - 0x09, // bLength - 0x04, // bDescriptorType (Interface) - 0x00, // bInterfaceNumber 0 - 0x00, // bAlternateSetting - 0x02, // bNumEndpoints 2 - 0xFF, // bInterfaceClass - 0x5D, // bInterfaceSubClass - 0x01, // bInterfaceProtocol - 0x00, // iInterface (String Index) + 0x09, // bLength + 0x04, // bDescriptorType (Interface) + 0x00, // bInterfaceNumber 0 + 0x00, // bAlternateSetting + 0x02, // bNumEndpoints 2 + 0xFF, // bInterfaceClass + 0x5D, // bInterfaceSubClass + 0x01, // bInterfaceProtocol + 0x00, // iInterface (String Index) // Gamepad Descriptor - 0x11, // bLength - 0x21, // bDescriptorType (HID) - 0x00, 0x01, // bcdHID 1.10 - 0x01, // SUB_TYPE - 0x25, // reserved2 - 0x81, // DEVICE_EPADDR_IN + 0x11, // bLength + 0x21, // bDescriptorType (HID) + 0x00, 0x01, // bcdHID 1.10 + 0x01, // SUB_TYPE + 0x25, // reserved2 + 0x81, // DEVICE_EPADDR_IN 0x14, // bMaxDataSizeIn 0x00, 0x00, 0x00, 0x00, 0x13, // reserved3 - 0x02, // DEVICE_EPADDR_OUT is this right? - 0x08, // bMaxDataSizeOut + 0x02, // DEVICE_EPADDR_OUT is this right? + 0x08, // bMaxDataSizeOut 0x00, 0x00, // reserved4 // Report IN Endpoint 1.1 - 0x07, // bLength - 0x05, // bDescriptorType (Endpoint) - 0x81, // bEndpointAddress (IN/D2H) - 0x03, // bmAttributes (Interrupt) - 0x20, 0x00, // wMaxPacketSize 32 - 0x01, // bInterval 1 (unit depends on device speed) + 0x07, // bLength + 0x05, // bDescriptorType (Endpoint) + 0x81, // bEndpointAddress (IN/D2H) + 0x03, // bmAttributes (Interrupt) + 0x20, 0x00, // wMaxPacketSize 32 + 0x01, // bInterval 1 (unit depends on device speed) // Report OUT Endpoint 1.2 - 0x07, // bLength - 0x05, // bDescriptorType (Endpoint) - 0x02, // bEndpointAddress (OUT/H2D) - 0x03, // bmAttributes (Interrupt) - 0x20, 0x00, // wMaxPacketSize 32 - 0x08, // bInterval 8 (unit depends on device speed) + 0x07, // bLength + 0x05, // bDescriptorType (Endpoint) + 0x02, // bEndpointAddress (OUT/H2D) + 0x03, // bmAttributes (Interrupt) + 0x20, 0x00, // wMaxPacketSize 32 + 0x08, // bInterval 8 (unit depends on device speed) // Interface Audio - 0x09, // bLength - 0x04, // bDescriptorType (Interface) - 0x01, // bInterfaceNumber 1 - 0x00, // bAlternateSetting - 0x04, // bNumEndpoints 4 - 0xFF, // bInterfaceClass - 0x5D, // bInterfaceSubClass - 0x03, // bInterfaceProtocol - 0x00, // iInterface (String Index) + 0x09, // bLength + 0x04, // bDescriptorType (Interface) + 0x01, // bInterfaceNumber 1 + 0x00, // bAlternateSetting + 0x04, // bNumEndpoints 4 + 0xFF, // bInterfaceClass + 0x5D, // bInterfaceSubClass + 0x03, // bInterfaceProtocol + 0x00, // iInterface (String Index) // Audio Descriptor 0x1B, // bLength @@ -178,47 +175,47 @@ static const uint8_t xinput_configuration_descriptor[] = 0x00, // Report IN Endpoint 2.1 - 0x07, // bLength - 0x05, // bDescriptorType (Endpoint) - 0x83, // bEndpointAddress (XINPUT_MIC_IN) - 0x03, // bmAttributes (Interrupt) - 0x20, 0x00, // wMaxPacketSize 32 - 0x02, // bInterval 2 (unit depends on device speed) + 0x07, // bLength + 0x05, // bDescriptorType (Endpoint) + 0x83, // bEndpointAddress (XINPUT_MIC_IN) + 0x03, // bmAttributes (Interrupt) + 0x20, 0x00, // wMaxPacketSize 32 + 0x02, // bInterval 2 (unit depends on device speed) // Report OUT Endpoint 2.2 - 0x07, // bLength - 0x05, // bDescriptorType (Endpoint) - 0x04, // bEndpointAddress (XINPUT_AUDIO_OUT) - 0x03, // bmAttributes (Interrupt) - 0x20, 0x00, // wMaxPacketSize 32 - 0x04, // bInterval 4 (unit depends on device speed) + 0x07, // bLength + 0x05, // bDescriptorType (Endpoint) + 0x04, // bEndpointAddress (XINPUT_AUDIO_OUT) + 0x03, // bmAttributes (Interrupt) + 0x20, 0x00, // wMaxPacketSize 32 + 0x04, // bInterval 4 (unit depends on device speed) // Report IN Endpoint 2.3 - 0x07, // bLength - 0x05, // bDescriptorType (Endpoint) - 0x85, // bEndpointAddress (XINPUT_UNK_IN) - 0x03, // bmAttributes (Interrupt) - 0x20, 0x00, // wMaxPacketSize 32 - 0x40, // bInterval 128 + 0x07, // bLength + 0x05, // bDescriptorType (Endpoint) + 0x85, // bEndpointAddress (XINPUT_UNK_IN) + 0x03, // bmAttributes (Interrupt) + 0x20, 0x00, // wMaxPacketSize 32 + 0x40, // bInterval 128 // Report OUT Endpoint 2.4 0x07, // bLength - 0x05, // bDescriptorType (Endpoint) - 0x06, // bEndpointAddress (XINPUT_UNK_OUT) - 0x03, // bmAttributes (Interrupt) - 0x20, 0x00, // wMaxPacketSize 32 - 0x10, // bInterval 16 + 0x05, // bDescriptorType (Endpoint) + 0x06, // bEndpointAddress (XINPUT_UNK_OUT) + 0x03, // bmAttributes (Interrupt) + 0x20, 0x00, // wMaxPacketSize 32 + 0x10, // bInterval 16 // Interface Plugin Module - 0x09, // bLength - 0x04, // bDescriptorType (Interface) - 0x02, // bInterfaceNumber 2 - 0x00, // bAlternateSetting - 0x01, // bNumEndpoints 1 - 0xFF, // bInterfaceClass - 0x5D, // bInterfaceSubClass - 0x02, // bInterfaceProtocol - 0x00, // iInterface (String Index) + 0x09, // bLength + 0x04, // bDescriptorType (Interface) + 0x02, // bInterfaceNumber 2 + 0x00, // bAlternateSetting + 0x01, // bNumEndpoints 1 + 0xFF, // bInterfaceClass + 0x5D, // bInterfaceSubClass + 0x02, // bInterfaceProtocol + 0x00, // iInterface (String Index) //PluginModuleDescriptor : { 0x09, // bLength @@ -232,22 +229,22 @@ static const uint8_t xinput_configuration_descriptor[] = // Report IN Endpoint 3.1 0x07, // bLength - 0x05, // bDescriptorType (Endpoint) - 0x86, // bEndpointAddress (XINPUT_PLUGIN_MODULE_IN) - 0x03, // bmAttributes (Interrupt) - 0x20, 0x00, // wMaxPacketSize 32 - 0x10, // bInterval 8 (unit depends on device speed) + 0x05, // bDescriptorType (Endpoint) + 0x86, // bEndpointAddress (XINPUT_PLUGIN_MODULE_IN) + 0x03, // bmAttributes (Interrupt) + 0x20, 0x00, // wMaxPacketSize 32 + 0x10, // bInterval 8 (unit depends on device speed) // Interface Security 0x09, // bLength - 0x04, // bDescriptorType (Interface) - 0x03, // bInterfaceNumber 3 - 0x00, // bAlternateSetting - 0x00, // bNumEndpoints 0 - 0xFF, // bInterfaceClass - 0xFD, // bInterfaceSubClass - 0x13, // bInterfaceProtocol - 0x04, // iInterface (String Index) + 0x04, // bDescriptorType (Interface) + 0x03, // bInterfaceNumber 3 + 0x00, // bAlternateSetting + 0x00, // bNumEndpoints 0 + 0xFF, // bInterfaceClass + 0xFD, // bInterfaceSubClass + 0x13, // bInterfaceProtocol + 0x04, // iInterface (String Index) // SecurityDescriptor (XSM3) 0x06, // bLength diff --git a/headers/gp2040.h b/headers/gp2040.h index 8914d56a3..c252ef773 100644 --- a/headers/gp2040.h +++ b/headers/gp2040.h @@ -17,8 +17,8 @@ class GP2040 { public: - GP2040(); - ~GP2040(); + GP2040(){} + ~GP2040(){} void setup(); // setup core0 void run(); // loop core0 private: diff --git a/src/drivers/shared/xinput_host.cpp b/src/drivers/shared/xinput_host.cpp index 7703c44c3..def9c2ca7 100644 --- a/src/drivers/shared/xinput_host.cpp +++ b/src/drivers/shared/xinput_host.cpp @@ -117,7 +117,6 @@ bool tuh_xinput_receive_report(uint8_t dev_addr, uint8_t instance) { } bool tuh_xinput_receive_vendor_report(uint8_t dev_addr, uint8_t instance, uint8_t request, uint16_t value, uint8_t index, uint16_t length, uint8_t * recvBuf) { - //xinputh_interface_t *xid_itf = get_instance(dev_addr, instance); const tusb_control_request_t xfer_ctrl_req = { .bmRequestType_bit { .recipient = TUSB_REQ_RCPT_INTERFACE, @@ -313,9 +312,7 @@ bool xinputh_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t const // Set Configure //--------------------------------------------------------------------+ static void config_driver_mount_complete(uint8_t dev_addr, uint8_t instance); -static void process_set_config(tuh_xfer_t *xfer) { - -} +static void process_set_config(tuh_xfer_t *xfer); bool xinputh_set_config(uint8_t dev_addr, uint8_t itf_num) { uint8_t instance = get_instance_id_by_itfnum(dev_addr, itf_num); diff --git a/src/drivers/xbone/XBOneAuthUSBListener.cpp b/src/drivers/xbone/XBOneAuthUSBListener.cpp index 9e0b917aa..43cb0fabc 100644 --- a/src/drivers/xbone/XBOneAuthUSBListener.cpp +++ b/src/drivers/xbone/XBOneAuthUSBListener.cpp @@ -45,7 +45,6 @@ void XBOneAuthUSBListener::process() { // Received a packet from the console (or Windows) to dongle if ( xboxOneAuthData->xboneState == XboxOneState::send_auth_console_to_dongle ) { - printf("[Xbox One Auth USB] Sending Console to Dongle\n"); uint8_t isChunked = ( xboxOneAuthData->consoleBuffer.length > GIP_MAX_CHUNK_SIZE ); uint8_t needsAck = ( xboxOneAuthData->consoleBuffer.length > 2 ); outgoingXGIP.reset(); @@ -58,7 +57,6 @@ void XBOneAuthUSBListener::process() { // Process waiting (always on first frame) if ( xboxOneAuthData->xboneState == XboxOneState::wait_auth_console_to_dongle) { - printf("[Xbox One Auth USB] Waiting console to dongle\n"); queue_host_report(outgoingXGIP.generatePacket(), outgoingXGIP.getPacketLength()); if ( outgoingXGIP.getChunked() == false || outgoingXGIP.endOfChunk() == true) { xboxOneAuthData->xboneState = XboxOneState::auth_idle_state; @@ -77,29 +75,6 @@ void XBOneAuthUSBListener::xmount(uint8_t dev_addr, uint8_t instance, uint8_t co incomingXGIP.reset(); outgoingXGIP.reset(); mounted = true; -/* - // Get Xbox Security Method 3 (XSM3) - uint8_t recvBuf[0xB2]; - const tusb_control_request_t xfer_ctrl_req = { - .bmRequestType_bit { - .recipient = TUSB_REQ_RCPT_DEVICE, - .type = TUSB_REQ_TYPE_STANDARD, - .direction = TUSB_DIR_IN, - }, - .bRequest = TUSB_REQ_GET_DESCRIPTOR, - .wValue = TU_U16(0x03,0x04), - .wIndex = TU_U16(0x04,0x09), - .wLength = 0xB2 - }; - tuh_xfer_t xfer = { - .daddr = dev_addr, - .ep_addr = 0,//xid_itf->ep_in, - .setup = &xfer_ctrl_req, - .buffer = recvBuf, - .complete_cb = NULL, - //.user_data = user_data - }; - tuh_control_xfer(&xfer);*/ } } @@ -121,7 +96,6 @@ void XBOneAuthUSBListener::report_received(uint8_t dev_addr, uint8_t instance, u incomingXGIP.parse(report, len); if ( incomingXGIP.validate() == false ) { - printf("[Xbox One Dongle] Bad Packet\n"); sleep_ms(50); // First packet is invalid, drop and wait for dongle to boot incomingXGIP.reset(); return; @@ -139,9 +113,7 @@ void XBOneAuthUSBListener::report_received(uint8_t dev_addr, uint8_t instance, u queue_host_report((uint8_t*)outgoingXGIP.generatePacket(), outgoingXGIP.getPacketLength()); break; case GIP_DEVICE_DESCRIPTOR: - printf("[Xbox One Dongle] Got device descriptor sequence : %02x\n", incomingXGIP.getSequence()); if ( incomingXGIP.endOfChunk() == true && xboxOneAuthData->dongle_ready != true) { - printf("[Xbox One Dongle] Got device descriptor\n"); outgoingXGIP.reset(); // Power-on full string outgoingXGIP.setAttributes(GIP_POWER_MODE_DEVICE_CONFIG, 2, 1, false, 0); outgoingXGIP.setData(xb1_power_on, sizeof(xb1_power_on)); @@ -163,16 +135,13 @@ void XBOneAuthUSBListener::report_received(uint8_t dev_addr, uint8_t instance, u break; case GIP_AUTH: case GIP_FINAL_AUTH: - printf("[Xbox One] Got auth .."); if ( incomingXGIP.getChunked() == false || (incomingXGIP.getChunked() == true && incomingXGIP.endOfChunk() == true )) { - printf("final auth"); xboxOneAuthData->dongleBuffer.setBuffer(incomingXGIP.getData(), incomingXGIP.getDataLength(), incomingXGIP.getSequence(), incomingXGIP.getCommand()); xboxOneAuthData->xboneState = XboxOneState::send_auth_dongle_to_console; incomingXGIP.reset(); } - printf("\n"); break; case GIP_ACK_RESPONSE: default: diff --git a/src/drivers/xbone/XBOneDriver.cpp b/src/drivers/xbone/XBOneDriver.cpp index 493c46d1a..41dff9cc8 100644 --- a/src/drivers/xbone/XBOneDriver.cpp +++ b/src/drivers/xbone/XBOneDriver.cpp @@ -280,7 +280,6 @@ bool xbone_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, } if ( (incomingXGIP->getChunked() == true && incomingXGIP->endOfChunk() == true) || (incomingXGIP->getChunked() == false )) { - printf("[Xbox One] Creating sending Console to Dongle\n"); xboxOneAuthData->consoleBuffer.setBuffer(incomingXGIP->getData(), incomingXGIP->getDataLength(), incomingXGIP->getSequence(), incomingXGIP->getCommand()); xboxOneAuthData->xboneState = XboxOneState::send_auth_console_to_dongle; @@ -625,7 +624,6 @@ void XBOneDriver::update() { case SETUP_AUTH: // Received packet from dongle to console / PC if ( xboxOneAuthData->xboneState == XboxOneState::send_auth_dongle_to_console ) { - printf("[Xbox One] Dongle to Console happening\n"); uint16_t len = xboxOneAuthData->dongleBuffer.length; uint8_t type = xboxOneAuthData->dongleBuffer.type; uint8_t sequence = xboxOneAuthData->dongleBuffer.sequence; @@ -640,7 +638,6 @@ void XBOneDriver::update() { // Process auth dongle to console if ( xboxOneAuthData->xboneState == XboxOneState::wait_auth_dongle_to_console ) { - printf("[Xbox One] Dongle to Console WAIT happening\n"); queue_xbone_report(outgoingXGIP->generatePacket(), outgoingXGIP->getPacketLength()); if ( outgoingXGIP->getChunked() == false || outgoingXGIP->endOfChunk() == true ) { xboxOneAuthData->xboneState = XboxOneState::auth_idle_state; diff --git a/src/drivers/xinput/XInputDriver.cpp b/src/drivers/xinput/XInputDriver.cpp index 66a4874dd..fe466a9f6 100644 --- a/src/drivers/xinput/XInputDriver.cpp +++ b/src/drivers/xinput/XInputDriver.cpp @@ -114,43 +114,12 @@ static uint16_t xinput_open(uint8_t rhport, tusb_desc_interface_t const *itf_des TU_ASSERT(usbd_open_edpt_pair(rhport, (const uint8_t*)p_desc, itf_descriptor->bNumEndpoints, TUSB_XFER_INTERRUPT, &p_xinput->ep_out, &p_xinput->ep_in), 0); p_xinput->itf_num = itf_descriptor->bInterfaceNumber; - //if (p_xinput->ep_out) { - // if (!usbd_edpt_xfer(rhport, p_xinput->ep_out, p_xinput->epout_buf, sizeof(p_xinput->epout_buf))) { - // TU_LOG_FAILED(); - // TU_BREAKPOINT(); - // } - //} // Control Endpoints are used for gamepad input/output if ( itf_descriptor->bInterfaceProtocol == 0x01 ) { endpoint_in = p_xinput->ep_in; endpoint_out = p_xinput->ep_out; } -/* - // Xbox 360 CONTROL ONLY: ignore audio and plug-in for our purposes - if ( itf_descriptor->bInterfaceProtocol == 0x01 ) { - printf("[xinput_open] Found xbox 360 control interface, setup the endpoints\n"); - uint8_t const *current_descriptor = tu_desc_next(itf_descriptor); - uint8_t found_endpoints = 0; - while ((found_endpoints < itf_descriptor->bNumEndpoints) && (driver_length <= max_length)) - { - tusb_desc_endpoint_t const *endpoint_descriptor = (tusb_desc_endpoint_t const *)current_descriptor; - if (TUSB_DESC_ENDPOINT == tu_desc_type(endpoint_descriptor)) - { - TU_ASSERT(usbd_edpt_open(rhport, endpoint_descriptor)); - - if (tu_edpt_dir(endpoint_descriptor->bEndpointAddress) == TUSB_DIR_IN) - endpoint_in = endpoint_descriptor->bEndpointAddress; - else - endpoint_out = endpoint_descriptor->bEndpointAddress; - - ++found_endpoints; - } - - current_descriptor = tu_desc_next(current_descriptor); - } - } -*/ // Xbox 360 Security Interface } else if (itf_descriptor->bInterfaceSubClass == 0xFD && itf_descriptor->bInterfaceProtocol == 0x13) { diff --git a/src/gp2040.cpp b/src/gp2040.cpp index 4699a6ba9..d1e03bc15 100644 --- a/src/gp2040.cpp +++ b/src/gp2040.cpp @@ -46,12 +46,6 @@ static const uint32_t REBOOT_HOTKEY_ACTIVATION_TIME_MS = 50; static const uint32_t REBOOT_HOTKEY_HOLD_TIME_MS = 4000; -GP2040::GP2040() { -} - -GP2040::~GP2040() { -} - void GP2040::setup() { Storage::getInstance().init(); diff --git a/src/gp2040aux.cpp b/src/gp2040aux.cpp index dafbdeeb4..ebd016ce5 100644 --- a/src/gp2040aux.cpp +++ b/src/gp2040aux.cpp @@ -51,8 +51,8 @@ void GP2040Aux::setup() { addons.LoadAddon(new BoardLedAddon(), CORE1_LOOP); addons.LoadAddon(new BuzzerSpeakerAddon(), CORE1_LOOP); - // Ready to sync Core0 and Core1 - isReady = true; + // Ready to sync Core0 and Core1 + isReady = true; } void GP2040Aux::run() { diff --git a/src/main.cpp b/src/main.cpp index 5651e9455..66c694060 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -35,18 +35,18 @@ void core1() { int main() { // Create GP2040 Main Core (core0), Core1 is dependent on Core0 gp2040Core0 = new GP2040(); - gp2040Core1 = new GP2040Aux(); + gp2040Core1 = new GP2040Aux(); - // Create GP2040 Main Core - Setup Core0 + // Create GP2040 Main Core - Setup Core0 gp2040Core0->setup(); // Create GP2040 Thread for Core1 multicore_launch_core1(core1); // Sync Core0 and Core1 - while(gp2040Core1->ready() == false ) { - __asm volatile ("nop\n"); - } + while(gp2040Core1->ready() == false ) { + __asm volatile ("nop\n"); + } gp2040Core0->run(); return 0;