From e0fe43357d1f2f986e7969a3d6efe723e6828fcf Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Sun, 30 Oct 2011 20:19:29 +1300 Subject: usb_f107: Fixed lost 4 bytes on control OUT transaction. --- examples/stm32/f1/stm32-h107/usb_simple/usbtest.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 examples/stm32/f1/stm32-h107/usb_simple/usbtest.py (limited to 'examples') diff --git a/examples/stm32/f1/stm32-h107/usb_simple/usbtest.py b/examples/stm32/f1/stm32-h107/usb_simple/usbtest.py new file mode 100644 index 0000000..85b0ade --- /dev/null +++ b/examples/stm32/f1/stm32-h107/usb_simple/usbtest.py @@ -0,0 +1,20 @@ +import usb.core + +if __name__ == "__main__": + dev = usb.core.find(idVendor=0xcafe, idProduct=0xcafe) + if dev is None: + raise ValueError('Device not found') + + dev.set_configuration() + + import gtk + w = gtk.Window() + w.connect("destroy", gtk.main_quit) + toggle = gtk.ToggleButton("Toggle LED") + def toggled(button): + dev.ctrl_transfer(0x40, 0, button.get_active(), 0, 'Hello World!') + toggle.connect("toggled", toggled) + w.add(toggle) + w.show_all() + gtk.main() + -- cgit v1.2.3