aboutsummaryrefslogtreecommitdiff
path: root/examples/nrf52840
diff options
context:
space:
mode:
authormatteo <email>2025-09-23 20:20:43 +0200
committermatteo <email>2025-09-23 20:20:43 +0200
commit2e303c995c53a97a1c2eaecf77827f02567b8417 (patch)
tree77ab31d8cf91590a384007936dd09f69e58a475d /examples/nrf52840
parentd72e8d9af921bfd5ddc25a17933e16b2132386b8 (diff)
update hid examples
Diffstat (limited to 'examples/nrf52840')
-rw-r--r--examples/nrf52840/src/bin/usb_hid_keyboard.rs6
-rw-r--r--examples/nrf52840/src/bin/usb_hid_mouse.rs6
2 files changed, 10 insertions, 2 deletions
diff --git a/examples/nrf52840/src/bin/usb_hid_keyboard.rs b/examples/nrf52840/src/bin/usb_hid_keyboard.rs
index 5a9dc90a2..0f0d830c6 100644
--- a/examples/nrf52840/src/bin/usb_hid_keyboard.rs
+++ b/examples/nrf52840/src/bin/usb_hid_keyboard.rs
@@ -45,6 +45,10 @@ async fn main(_spawner: Spawner) {
45 config.max_power = 100; 45 config.max_power = 100;
46 config.max_packet_size_0 = 64; 46 config.max_packet_size_0 = 64;
47 config.supports_remote_wakeup = true; 47 config.supports_remote_wakeup = true;
48 config.composite_with_iads = false;
49 config.device_class = 0;
50 config.device_sub_class = 0;
51 config.device_protocol = 0;
48 52
49 // Create embassy-usb DeviceBuilder using the driver and config. 53 // Create embassy-usb DeviceBuilder using the driver and config.
50 // It needs some buffers for building the descriptors. 54 // It needs some buffers for building the descriptors.
@@ -75,7 +79,7 @@ async fn main(_spawner: Spawner) {
75 poll_ms: 60, 79 poll_ms: 60,
76 max_packet_size: 64, 80 max_packet_size: 64,
77 }; 81 };
78 let hid = HidReaderWriter::<_, 1, 8>::new(&mut builder, &mut state, config); 82 let hid = HidReaderWriter::<_, 1, 8>::new_keyboard(&mut builder, &mut state, config);
79 83
80 // Build the builder. 84 // Build the builder.
81 let mut usb = builder.build(); 85 let mut usb = builder.build();
diff --git a/examples/nrf52840/src/bin/usb_hid_mouse.rs b/examples/nrf52840/src/bin/usb_hid_mouse.rs
index 80cda70e3..b3d90354b 100644
--- a/examples/nrf52840/src/bin/usb_hid_mouse.rs
+++ b/examples/nrf52840/src/bin/usb_hid_mouse.rs
@@ -37,6 +37,10 @@ async fn main(_spawner: Spawner) {
37 config.serial_number = Some("12345678"); 37 config.serial_number = Some("12345678");
38 config.max_power = 100; 38 config.max_power = 100;
39 config.max_packet_size_0 = 64; 39 config.max_packet_size_0 = 64;
40 config.composite_with_iads = false;
41 config.device_class = 0;
42 config.device_sub_class = 0;
43 config.device_protocol = 0;
40 44
41 // Create embassy-usb DeviceBuilder using the driver and config. 45 // Create embassy-usb DeviceBuilder using the driver and config.
42 // It needs some buffers for building the descriptors. 46 // It needs some buffers for building the descriptors.
@@ -65,7 +69,7 @@ async fn main(_spawner: Spawner) {
65 max_packet_size: 8, 69 max_packet_size: 8,
66 }; 70 };
67 71
68 let mut writer = HidWriter::<_, 5>::new(&mut builder, &mut state, config); 72 let mut writer = HidWriter::<_, 5>::new_mouse(&mut builder, &mut state, config);
69 73
70 // Build the builder. 74 // Build the builder.
71 let mut usb = builder.build(); 75 let mut usb = builder.build();