Compare commits
1 Commits
main
..
f72f505026
| Author | SHA1 | Date | |
|---|---|---|---|
|
f72f505026
|
+2
-2
@@ -1,2 +1,2 @@
|
|||||||
/*/**/*
|
/build/**/*
|
||||||
!/html/**/*
|
/external/**/*
|
||||||
|
|||||||
+1
-1
@@ -70,7 +70,7 @@ target_link_libraries(${PROJECT} PRIVATE
|
|||||||
hardware_adc
|
hardware_adc
|
||||||
)
|
)
|
||||||
|
|
||||||
set_target_properties(${PROJECT} PROPERTIES OUTPUT_NAME "${PROJECT}-${PICO_BOARD}")
|
set_target_properties(${PROJECT} PROPERTIES OUTPUT_NAME "${PROJECT}- ${PICO_BOARD}")
|
||||||
|
|
||||||
pico_add_extra_outputs(${PROJECT})
|
pico_add_extra_outputs(${PROJECT})
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ You will need the following hardware to make the device:
|
|||||||
- light dependent resistor such as GL5528 (specific part number may vary)
|
- light dependent resistor such as GL5528 (specific part number may vary)
|
||||||
- 10k ohm resistor (resistance value may vary)
|
- 10k ohm resistor (resistance value may vary)
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
You will need to cut the USB extension in half and connect the wires from the
|
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
|
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
|
the USB's green wire to pin 1/GP0 and USB's white wire to pin 2/GP1. You will
|
||||||
|
|||||||
@@ -376,17 +376,12 @@ void startADC() {
|
|||||||
|
|
||||||
// forward HID report after processing
|
// forward HID report after processing
|
||||||
bool forward_report(uint8_t instance, uint8_t const* report, uint16_t len) {
|
bool forward_report(uint8_t instance, uint8_t const* report, uint16_t len) {
|
||||||
// forward only if device is connected
|
// toggle mute button color if mute button is pressed
|
||||||
if (device_state == DEVICE_ACTIVE) {
|
if ( instance == 0x02 && report[0] == 0x02 && (report[2] & 0x01) ) {
|
||||||
// toggle mute button color if mute button is pressed
|
mute = !mute;
|
||||||
if ( instance == 0x02 && report[0] == 0x02 && (report[2] & 0x01) ) {
|
|
||||||
mute = !mute;
|
|
||||||
}
|
|
||||||
|
|
||||||
return tud_hid_n_report(instance, 0, report, len);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return tud_hid_n_report(instance, 0, report, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
// save RGB configuration to flash
|
// save RGB configuration to flash
|
||||||
|
|||||||
-14802
File diff suppressed because it is too large
Load Diff
|
Before Width: | Height: | Size: 268 KiB |
+7
-10
@@ -79,17 +79,19 @@ void usb_device_main(void) {
|
|||||||
while (true) {
|
while (true) {
|
||||||
switch ( device_state ) {
|
switch ( device_state ) {
|
||||||
case DEVICE_ACTIVE:
|
case DEVICE_ACTIVE:
|
||||||
if (!tud_mounted()) {
|
|
||||||
device_state = DEVICE_INACTIVE;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case DEVICE_INACTIVE:
|
case DEVICE_INACTIVE:
|
||||||
break;
|
break;
|
||||||
case DEVICE_RESTART:
|
case DEVICE_RESTART:
|
||||||
if (tud_disconnect()) {
|
if (tud_disconnect()) {
|
||||||
device_state = DEVICE_INACTIVE;
|
|
||||||
sleep_ms(10);
|
sleep_ms(10);
|
||||||
tud_connect();
|
if (tud_connect()) {
|
||||||
|
if ( host_state == HOST_INACTIVE ) {
|
||||||
|
device_state = DEVICE_INACTIVE;
|
||||||
|
} else {
|
||||||
|
device_state = DEVICE_ACTIVE;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -241,11 +243,6 @@ uint16_t tud_hid_get_report_cb(uint8_t instance, uint8_t report_id, hid_report_t
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Invoked when device is mounted
|
|
||||||
void tud_mount_cb(void) {
|
|
||||||
device_state = DEVICE_ACTIVE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// print message to CDC in raw hex
|
// print message to CDC in raw hex
|
||||||
void cdc_print_hex(uint8_t const* msg, uint16_t msg_len) {
|
void cdc_print_hex(uint8_t const* msg, uint16_t msg_len) {
|
||||||
(void) msg;
|
(void) msg;
|
||||||
|
|||||||
Reference in New Issue
Block a user