mirror of
https://github.com/whowechina/popn_pico.git
synced 2025-01-18 23:54:04 +01:00
HID light works
This commit is contained in:
parent
34a902b997
commit
b8503df02b
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
*backups*
|
||||
Production/PCB/*/*
|
||||
*.bak
|
||||
|
BIN
Production/Firmware/popn_pico2.uf2
Normal file
BIN
Production/Firmware/popn_pico2.uf2
Normal file
Binary file not shown.
@ -34,6 +34,9 @@ void light_set_cab_all(uint32_t color, bool hid);
|
||||
#define HUE_YELLOW 42
|
||||
#define HUE_CYAN 127
|
||||
#define HUE_MAGENTA 212
|
||||
|
||||
#define HUE_ORANGE 21
|
||||
#define HUE_PINK 234
|
||||
#define HUE_PURPLE 191
|
||||
#define HUE_LIME 64
|
||||
|
||||
#endif
|
||||
|
@ -192,22 +192,6 @@ static void update_check()
|
||||
}
|
||||
}
|
||||
|
||||
static void theme_check()
|
||||
{
|
||||
uint16_t button = button_read();
|
||||
if (button & 0x01) {
|
||||
popn_cfg->theme = 0;
|
||||
} else if (button & 0x04) {
|
||||
popn_cfg->theme = 1;
|
||||
} else if (popn_cfg->theme > 1) {
|
||||
popn_cfg->theme = 0;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
config_changed();
|
||||
}
|
||||
|
||||
void init()
|
||||
{
|
||||
sleep_ms(50);
|
||||
@ -230,7 +214,6 @@ void init()
|
||||
cli_init("popn_pico>", "\n << Popn Pico 2 Controller >>\n"
|
||||
" https://github.com/whowechina\n\n");
|
||||
|
||||
theme_check();
|
||||
commands_init();
|
||||
}
|
||||
|
||||
@ -260,5 +243,17 @@ void tud_hid_set_report_cb(uint8_t itf, uint8_t report_id,
|
||||
uint16_t bufsize)
|
||||
{
|
||||
if (report_id == REPORT_ID_LIGHTS) {
|
||||
if (bufsize < 12) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < 9; i++) {
|
||||
if (buffer[i]) {
|
||||
light_set_button(i, hsv2rgb(main_theme.on[i]), true);
|
||||
} else {
|
||||
light_set_button(i, hsv2rgb(main_theme.off[i]), true);
|
||||
}
|
||||
}
|
||||
uint32_t color = rgb32(buffer[9], buffer[10], buffer[11], false);
|
||||
light_set_cab_all(color, true);
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ uint8_t const desc_configuration_joy[] = {
|
||||
sizeof(desc_hid_report_joy), EPNUM_JOY,
|
||||
CFG_TUD_HID_EP_BUFSIZE, 1),
|
||||
|
||||
TUD_CDC_DESCRIPTOR(ITF_NUM_CLI, 5, EPNUM_CLI_NOTIF,
|
||||
TUD_CDC_DESCRIPTOR(ITF_NUM_CLI, 4, EPNUM_CLI_NOTIF,
|
||||
8, EPNUM_CLI_OUT, EPNUM_CLI_IN, 64)
|
||||
|
||||
};
|
||||
@ -127,7 +127,7 @@ char const* string_desc_arr[] = {
|
||||
"WHowe", // 1: Manufacturer
|
||||
"Popn Pico", // 2: Product
|
||||
"123456", // 3: Serials, should use chip ID
|
||||
"Popn Pico CLI"
|
||||
"Popn Pico CLI",
|
||||
"Button 1",
|
||||
"Button 2",
|
||||
"Button 3",
|
||||
|
@ -38,9 +38,9 @@ enum {
|
||||
HID_COLLECTION(HID_COLLECTION_APPLICATION), \
|
||||
HID_REPORT_ID(REPORT_ID_LIGHTS) \
|
||||
HID_LOGICAL_MIN(0x00), HID_LOGICAL_MAX_N(0x00ff, 2), \
|
||||
HID_REPORT_SIZE(8), HID_REPORT_COUNT(11 + 3), \
|
||||
HID_REPORT_SIZE(8), HID_REPORT_COUNT(9 + 3), \
|
||||
HID_USAGE_PAGE(HID_USAGE_PAGE_ORDINAL), \
|
||||
HID_STRING_MINIMUM(4), HID_STRING_MAXIMUM(16), \
|
||||
HID_STRING_MINIMUM(5), HID_STRING_MAXIMUM(16), \
|
||||
HID_USAGE_MIN(1), HID_USAGE_MAX(17), \
|
||||
HID_OUTPUT(HID_DATA | HID_VARIABLE | HID_ABSOLUTE), \
|
||||
HID_REPORT_COUNT(1), HID_REPORT_SIZE(8), /* Padding */ \
|
||||
|
Loading…
x
Reference in New Issue
Block a user