Compare commits

3 Commits

Author SHA1 Message Date
kenji 722a9b489b suppress HID messages when device is disconnected 2026-05-08 12:25:54 -04:00
kenji e3620971b1 add schematic 2025-09-11 12:28:02 -04:00
kenji 8082191d4e Add original Pico support 2025-09-06 12:15:42 -04:00
6 changed files with 14826 additions and 14 deletions
+2 -2
View File
@@ -1,2 +1,2 @@
/build/**/*
/external/**/*
/*/**/*
!/html/**/*
+2
View File
@@ -20,6 +20,8 @@ You will need the following hardware to make the device:
- light dependent resistor such as GL5528 (specific part number may vary)
- 10k ohm resistor (resistance value may vary)
![Wiring schematic](schematic.svg)
You will need to cut the USB extension in half and connect the wires from the
female end to the Raspberry Pi Pico (2). The default configuration is to attach
the USB's green wire to pin 1/GP0 and USB's white wire to pin 2/GP1. You will
+5
View File
@@ -376,6 +376,8 @@ void startADC() {
// forward HID report after processing
bool forward_report(uint8_t instance, uint8_t const* report, uint16_t len) {
// forward only if device is connected
if (device_state == DEVICE_ACTIVE) {
// toggle mute button color if mute button is pressed
if ( instance == 0x02 && report[0] == 0x02 && (report[2] & 0x01) ) {
mute = !mute;
@@ -384,6 +386,9 @@ bool forward_report(uint8_t instance, uint8_t const* report, uint16_t len) {
return tud_hid_n_report(instance, 0, report, len);
}
return true;
}
// save RGB configuration to flash
void save_rgb_config(void) {
// set save signature and number of bytes to be written into config
+14802
View File
File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 268 KiB

+10 -7
View File
@@ -79,19 +79,17 @@ void usb_device_main(void) {
while (true) {
switch ( device_state ) {
case DEVICE_ACTIVE:
if (!tud_mounted()) {
device_state = DEVICE_INACTIVE;
}
break;
case DEVICE_INACTIVE:
break;
case DEVICE_RESTART:
if (tud_disconnect()) {
sleep_ms(10);
if (tud_connect()) {
if ( host_state == HOST_INACTIVE ) {
device_state = DEVICE_INACTIVE;
} else {
device_state = DEVICE_ACTIVE;
}
}
sleep_ms(10);
tud_connect();
}
break;
default:
@@ -243,6 +241,11 @@ uint16_t tud_hid_get_report_cb(uint8_t instance, uint8_t report_id, hid_report_t
return 0;
}
// Invoked when device is mounted
void tud_mount_cb(void) {
device_state = DEVICE_ACTIVE;
}
// print message to CDC in raw hex
void cdc_print_hex(uint8_t const* msg, uint16_t msg_len) {
(void) msg;