Skip to content

Commit 9bfdc0e

Browse files
committed
Merge branch 'imxrt-rs-test-class-builder'
2 parents 49890d9 + 3380712 commit 9bfdc0e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/test_class.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,23 @@ impl<B: UsbBus> TestClass<'_, B> {
8383

8484
/// Convenience method to create a UsbDevice that is configured correctly for TestClass.
8585
pub fn make_device<'a, 'b>(&'a self, usb_bus: &'b UsbBusAllocator<B>) -> UsbDevice<'b, B> {
86+
self.make_device_builder(usb_bus).build()
87+
}
88+
89+
/// Convenience method to create a UsbDeviceBuilder that is configured correctly for TestClass.
90+
///
91+
/// The methods sets
92+
///
93+
/// - manufacturer
94+
/// - product
95+
/// - serial number
96+
///
97+
/// on the returned builder. You should not change these values.
98+
pub fn make_device_builder<'a, 'b> (&'a self, usb_bus: &'b UsbBusAllocator<B>) -> UsbDeviceBuilder<'b, B> {
8699
UsbDeviceBuilder::new(&usb_bus, UsbVidPid(VID, PID))
87100
.manufacturer(MANUFACTURER)
88101
.product(PRODUCT)
89102
.serial_number(SERIAL_NUMBER)
90-
.build()
91103
}
92104

93105
/// Must be called after polling the UsbDevice.

0 commit comments

Comments
 (0)