summaryrefslogtreecommitdiff
path: root/examples/host/hid_controller
diff options
context:
space:
mode:
authorhathach <[email protected]>2025-09-15 16:45:41 +0700
committerhathach <[email protected]>2025-09-15 16:45:41 +0700
commit8e34ba9cf6bdcabe2c9eb73ae1aafec38d0ec46d (patch)
tree58c2426146aa5d413706a62521ab6e2cb740b170 /examples/host/hid_controller
parent802819d271314298ea5a786a37ec6a1e65ef31d6 (diff)
parentfeef534921446e1a3ded54a0c46191fe1709bdb4 (diff)
Merge branch 'master' into fork/ennebi/mtp
Diffstat (limited to 'examples/host/hid_controller')
-rw-r--r--examples/host/hid_controller/only.txt5
-rw-r--r--examples/host/hid_controller/src/hid_app.c17
2 files changed, 11 insertions, 11 deletions
diff --git a/examples/host/hid_controller/only.txt b/examples/host/hid_controller/only.txt
index 95f9f1d82..cba58f8e8 100644
--- a/examples/host/hid_controller/only.txt
+++ b/examples/host/hid_controller/only.txt
@@ -1,3 +1,4 @@
+mcu:CH32V20X
mcu:KINETIS_KL
mcu:LPC175X_6X
mcu:LPC177X_8X
@@ -15,3 +16,7 @@ mcu:MAX3421
mcu:STM32F4
mcu:STM32F7
mcu:STM32H7
+mcu:STM32H7RS
+mcu:STM32N6
+family:samd21
+family:samd5x_e5x
diff --git a/examples/host/hid_controller/src/hid_app.c b/examples/host/hid_controller/src/hid_app.c
index 6ffe0b6d4..1d6ca8b07 100644
--- a/examples/host/hid_controller/src/hid_app.c
+++ b/examples/host/hid_controller/src/hid_app.c
@@ -231,14 +231,12 @@ void tuh_hid_umount_cb(uint8_t dev_addr, uint8_t instance)
}
// check if different than 2
-bool diff_than_2(uint8_t x, uint8_t y)
-{
+static inline bool diff_than_2(uint8_t x, uint8_t y) {
return (x - y > 2) || (y - x > 2);
}
// check if 2 reports are different enough
-bool diff_report(sony_ds4_report_t const* rpt1, sony_ds4_report_t const* rpt2)
-{
+static bool diff_report(sony_ds4_report_t const* rpt1, sony_ds4_report_t const* rpt2) {
bool result;
// x, y, z, rz must different than 2 to be counted
@@ -251,7 +249,7 @@ bool diff_report(sony_ds4_report_t const* rpt1, sony_ds4_report_t const* rpt2)
return result;
}
-void process_sony_ds4(uint8_t const* report, uint16_t len)
+static void process_sony_ds4(uint8_t const* report, uint16_t len)
{
(void)len;
const char* dpad_str[] = { "N", "NE", "E", "SE", "S", "SW", "W", "NW", "none" };
@@ -310,16 +308,13 @@ void process_sony_ds4(uint8_t const* report, uint16_t len)
}
// Invoked when received report from device via interrupt endpoint
-void tuh_hid_report_received_cb(uint8_t dev_addr, uint8_t instance, uint8_t const* report, uint16_t len)
-{
- if ( is_sony_ds4(dev_addr) )
- {
+void tuh_hid_report_received_cb(uint8_t dev_addr, uint8_t instance, uint8_t const *report, uint16_t len) {
+ if (is_sony_ds4(dev_addr)) {
process_sony_ds4(report, len);
}
// continue to request to receive report
- if ( !tuh_hid_receive_report(dev_addr, instance) )
- {
+ if (!tuh_hid_receive_report(dev_addr, instance)) {
printf("Error: cannot request to receive report\r\n");
}
}