Button in HID report

This commit is contained in:
whowechina
2025-03-24 22:56:16 +08:00
parent 3ea3d16722
commit aaa081b401
4 changed files with 10 additions and 10 deletions
Binary file not shown.
+1 -1
View File
@@ -22,7 +22,7 @@
#define ADC_KEY_CHN { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, \
27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16 }
#define BUTTON_DEF { 13, 12, 11, 10 }
#define BUTTON_DEF { 13, 12, 10, 11 }
#else
#endif
+7 -5
View File
@@ -31,6 +31,7 @@
#include "light.h"
#include "hammer.h"
#include "button.h"
#define WHITE 0xffffff
@@ -88,10 +89,10 @@ static void hid_update()
}
}
if (nos_cfg->hid.analog) {
for (int i = 0; i < hammer_keynum(); i++) {
hid_report.analog[i] = hammer_analog(i);
}
hid_report.buttons |= button_read() << 28;
for (int i = 0; i < hammer_keynum(); i++) {
hid_report.analog[i] = nos_cfg->hid.analog ? hammer_analog(i) : 127;
}
if (!tud_hid_ready()) {
@@ -143,7 +144,7 @@ static void core0_loop()
savedata_loop();
hammer_update();
proc_midi();
button_update();
hid_update();
cli_fps_count(0);
@@ -189,6 +190,7 @@ void init()
light_init();
hammer_init();
button_init();
cli_init("nos_pico>", "\n << Nos Pico Controller >>\n"
" https://github.com/whowechina\n\n");
+2 -4
View File
@@ -23,12 +23,10 @@ enum {
HID_COLLECTION(HID_COLLECTION_APPLICATION), \
HID_REPORT_ID(REPORT_ID_JOYSTICK) \
HID_USAGE_PAGE(HID_USAGE_PAGE_BUTTON), \
HID_USAGE_MIN(1), HID_USAGE_MAX(28), \
HID_USAGE_MIN(1), HID_USAGE_MAX(32), \
HID_LOGICAL_MIN(0), HID_LOGICAL_MAX(1), \
HID_REPORT_COUNT(28), HID_REPORT_SIZE(1), \
HID_REPORT_COUNT(32), HID_REPORT_SIZE(1), \
HID_INPUT(HID_DATA | HID_VARIABLE | HID_ABSOLUTE), \
HID_REPORT_COUNT(4), HID_REPORT_SIZE(1), \
HID_INPUT(HID_CONSTANT), \
HID_USAGE_PAGE(HID_USAGE_PAGE_DESKTOP), \
HID_LOGICAL_MIN(0x00), HID_LOGICAL_MAX_N(0x00ff, 2), \
HID_USAGE(HID_USAGE_DESKTOP_X), HID_USAGE(HID_USAGE_DESKTOP_Y), \