Skip to content

Commit 064dd47

Browse files
Minor header/directrory cleanup (#802)
1 parent 257db5a commit 064dd47

File tree

32 files changed

+1189
-1079
lines changed

32 files changed

+1189
-1079
lines changed

cores/rp2040/RP2040USB.cpp

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ static int __usb_task_irq;
7171

7272
#define EPNUM_HID 0x83
7373

74-
#define EPNUM_MIDI 0x01
75-
7674

7775
const uint8_t *tud_descriptor_device_cb(void) {
7876
static tusb_desc_device_t usbd_desc_device = {
@@ -91,7 +89,7 @@ const uint8_t *tud_descriptor_device_cb(void) {
9189
.iSerialNumber = USBD_STR_SERIAL,
9290
.bNumConfigurations = 1
9391
};
94-
if (__USBInstallSerial && !__USBInstallKeyboard && !__USBInstallMouse && !__USBInstallJoystick && !__USBInstallMIDI) {
92+
if (__USBInstallSerial && !__USBInstallKeyboard && !__USBInstallMouse && !__USBInstallJoystick) {
9593
// Can use as-is, this is the default USB case
9694
return (const uint8_t *)&usbd_desc_device;
9795
}
@@ -105,9 +103,6 @@ const uint8_t *tud_descriptor_device_cb(void) {
105103
if (__USBInstallJoystick) {
106104
usbd_desc_device.idProduct |= 0x0100;
107105
}
108-
if (__USBInstallMIDI) {
109-
usbd_desc_device.idProduct |= 0x2000;
110-
}
111106
// Set the device class to 0 to indicate multiple device classes
112107
usbd_desc_device.bDeviceClass = 0;
113108
usbd_desc_device.bDeviceSubClass = 0;
@@ -228,7 +223,7 @@ void __SetupUSBDescriptor() {
228223
if (!usbd_desc_cfg) {
229224
bool hasHID = __USBInstallKeyboard || __USBInstallMouse || __USBInstallJoystick;
230225

231-
uint8_t interface_count = (__USBInstallSerial ? 2 : 0) + (hasHID ? 1 : 0) + (__USBInstallMIDI ? 2 : 0);
226+
uint8_t interface_count = (__USBInstallSerial ? 2 : 0) + (hasHID ? 1 : 0);
232227

233228
uint8_t cdc_desc[TUD_CDC_DESC_LEN] = {
234229
// Interface number, string index, protocol, report descriptor len, EP In & Out address, size & polling interval
@@ -243,13 +238,7 @@ void __SetupUSBDescriptor() {
243238
TUD_HID_DESCRIPTOR(hid_itf, 0, HID_ITF_PROTOCOL_NONE, hid_report_len, EPNUM_HID, CFG_TUD_HID_EP_BUFSIZE, 10)
244239
};
245240

246-
uint8_t midi_itf = hid_itf + (hasHID ? 1 : 0);
247-
uint8_t midi_desc[TUD_MIDI_DESC_LEN] = {
248-
// Interface number, string index, EP Out & EP In address, EP size
249-
TUD_MIDI_DESCRIPTOR(midi_itf, 0, EPNUM_MIDI, 0x80 | EPNUM_MIDI, 64)
250-
};
251-
252-
int usbd_desc_len = TUD_CONFIG_DESC_LEN + (__USBInstallSerial ? sizeof(cdc_desc) : 0) + (hasHID ? sizeof(hid_desc) : 0) + (__USBInstallMIDI ? sizeof(midi_desc) : 0);
241+
int usbd_desc_len = TUD_CONFIG_DESC_LEN + (__USBInstallSerial ? sizeof(cdc_desc) : 0) + (hasHID ? sizeof(hid_desc) : 0);
253242

254243
uint8_t tud_cfg_desc[TUD_CONFIG_DESC_LEN] = {
255244
// Config number, interface count, string index, total length, attribute, power in mA
@@ -271,9 +260,6 @@ void __SetupUSBDescriptor() {
271260
memcpy(ptr, hid_desc, sizeof(hid_desc));
272261
ptr += sizeof(hid_desc);
273262
}
274-
if (__USBInstallMIDI) {
275-
memcpy(ptr, midi_desc, sizeof(midi_desc));
276-
}
277263
}
278264
}
279265
}

cores/rp2040/RP2040USB.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ extern void __USBInstallSerial() __attribute__((weak));
2626
extern void __USBInstallKeyboard() __attribute__((weak));
2727
extern void __USBInstallJoystick() __attribute__((weak));
2828
extern void __USBInstallMouse() __attribute__((weak));
29-
extern void __USBInstallMIDI() __attribute__((weak));
3029

3130
// Big, global USB mutex, shared with all USB devices to make sure we don't
3231
// have multiple cores updating the TUSB state in parallel

libraries/ArduinoOTA/src/ArduinoOTA.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
/*
2+
Arduino OTA.cpp - Simple Arduino IDE OTA handler
3+
Modified 2022 Earle F. Philhower, III. All rights reserved.
4+
5+
Taken from the ESP8266 core libraries, (c) various authors.
6+
7+
This library is free software; you can redistribute it and/or
8+
modify it under the terms of the GNU Lesser General Public
9+
License as published by the Free Software Foundation; either
10+
version 2.1 of the License, or (at your option) any later version.
11+
12+
This library is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
Lesser General Public License for more details.
16+
17+
You should have received a copy of the GNU Lesser General Public
18+
License along with this library; if not, write to the Free Software
19+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20+
*/
21+
122
#include <functional>
223
#include <WiFiUdp.h>
324
#include "ArduinoOTA.h"

libraries/ArduinoOTA/src/ArduinoOTA.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
/*
2+
Arduino OTA.h - Simple Arduino IDE OTA handler
3+
Modified 2022 Earle F. Philhower, III. All rights reserved.
4+
5+
Taken from the ESP8266 core libraries, (c) various authors.
6+
7+
This library is free software; you can redistribute it and/or
8+
modify it under the terms of the GNU Lesser General Public
9+
License as published by the Free Software Foundation; either
10+
version 2.1 of the License, or (at your option) any later version.
11+
12+
This library is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
Lesser General Public License for more details.
16+
17+
You should have received a copy of the GNU Lesser General Public
18+
License along with this library; if not, write to the Free Software
19+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20+
*/
21+
122
#pragma once
223

324
#include <WiFi.h>

libraries/DNSServer/examples/CaptivePortalAdvanced/CaptivePortalAdvanced.ino

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,9 @@ void loop() {
133133
WiFi.disconnect();
134134
}
135135
}
136-
if (s == WL_CONNECTED) { MDNS.update(); }
136+
if (s == WL_CONNECTED) {
137+
MDNS.update();
138+
}
137139
}
138140
// Do work:
139141
// DNS

libraries/DNSServer/examples/CaptivePortalAdvanced/handleHttp.ino

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,23 @@ void handleWifi() {
5757
+ String(softAP_ssid) + F("</td></tr>"
5858
"<tr><td>IP ")
5959
+ toStringIp(WiFi.softAPIP()) + F("</td></tr>"
60-
"</table>"
61-
"\r\n<br />"
62-
"<table><tr><th align='left'>WLAN config</th></tr>"
63-
"<tr><td>SSID ")
60+
"</table>"
61+
"\r\n<br />"
62+
"<table><tr><th align='left'>WLAN config</th></tr>"
63+
"<tr><td>SSID ")
6464
+ String(ssid) + F("</td></tr>"
6565
"<tr><td>IP ")
6666
+ toStringIp(WiFi.localIP()) + F("</td></tr>"
67-
"</table>"
68-
"\r\n<br />"
69-
"<table><tr><th align='left'>WLAN list (refresh if any missing)</th></tr>");
67+
"</table>"
68+
"\r\n<br />"
69+
"<table><tr><th align='left'>WLAN list (refresh if any missing)</th></tr>");
7070
Serial.println("scan start");
7171
int n = WiFi.scanNetworks();
7272
Serial.println("scan done");
7373
if (n > 0) {
74-
for (int i = 0; i < n; i++) { Page += String(F("\r\n<tr><td>SSID ")) + WiFi.SSID(i) + ((WiFi.encryptionType(i) == ENC_TYPE_NONE) ? F(" ") : F(" *")) + F(" (") + WiFi.RSSI(i) + F(")</td></tr>"); }
74+
for (int i = 0; i < n; i++) {
75+
Page += String(F("\r\n<tr><td>SSID ")) + WiFi.SSID(i) + ((WiFi.encryptionType(i) == ENC_TYPE_NONE) ? F(" ") : F(" *")) + F(" (") + WiFi.RSSI(i) + F(")</td></tr>");
76+
}
7577
} else {
7678
Page += F("<tr><td>No WLAN found</td></tr>");
7779
}
@@ -114,7 +116,9 @@ void handleNotFound() {
114116
message += server.args();
115117
message += F("\n");
116118

117-
for (uint8_t i = 0; i < server.args(); i++) { message += String(F(" ")) + server.argName(i) + F(": ") + server.arg(i) + F("\n"); }
119+
for (uint8_t i = 0; i < server.args(); i++) {
120+
message += String(F(" ")) + server.argName(i) + F(": ") + server.arg(i) + F("\n");
121+
}
118122
server.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate");
119123
server.sendHeader("Pragma", "no-cache");
120124
server.sendHeader("Expires", "-1");

libraries/DNSServer/examples/CaptivePortalAdvanced/tools.ino

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,19 @@
22
boolean isIp(String str) {
33
for (size_t i = 0; i < str.length(); i++) {
44
int c = str.charAt(i);
5-
if (c != '.' && (c < '0' || c > '9')) { return false; }
5+
if (c != '.' && (c < '0' || c > '9')) {
6+
return false;
7+
}
68
}
79
return true;
810
}
911

1012
/** IP to String? */
1113
String toStringIp(IPAddress ip) {
1214
String res = "";
13-
for (int i = 0; i < 3; i++) { res += String((ip >> (8 * i)) & 0xFF) + "."; }
15+
for (int i = 0; i < 3; i++) {
16+
res += String((ip >> (8 * i)) & 0xFF) + ".";
17+
}
1418
res += String(((ip >> 8 * 3)) & 0xFF);
1519
return res;
1620
}

0 commit comments

Comments
 (0)