Shop OBEX P1 Docs P2 Docs Learn Events
USB Host controller code ported to C++ — Parallax Forums

USB Host controller code ported to C++

Hi,

I have finally managed to successfully porting the USB Host controller code by M. Elizabeth Scott from Spin to C++.
Took me a while to make it working due to a very nasty issue with the received bytes count calculation that was very hard to debug.

The attached zip file contains the USBHost class and two demo applications: enumerate.elf shows the informations about the attached device, and hid.elf that polls a keyboard or mouse and shows the data from it.
Can be compiled with propeller-gcc using the included Makefile and uploaded and run on the Propeller with propeller-load:

propeller-load -p /dev/ttyUSB0 -t -r enumerate.elf

or

propeller-load -p /dev/ttyUSB0 -t -r hid.elf

The code is not fully tested and I'm sure it needs some more revisions so use with cautions.

Hope you enjoy!

Best regards,
Marco

Comments

  • @macca said:
    Hi,

    I have finally managed to successfully porting the USB Host controller code by M. Elizabeth Scott from Spin to C++.
    Took me a while to make it working due to a very nasty issue with the received bytes count calculation that was very hard to debug.

    The attached zip file contains the USBHost class and two demo applications: enumerate.elf shows the informations about the attached device, and hid.elf that polls a keyboard or mouse and shows the data from it.
    Can be compiled with propeller-gcc using the included Makefile and uploaded and run on the Propeller with propeller-load:

    propeller-load -p /dev/ttyUSB0 -t -r enumerate.elf

    or

    propeller-load -p /dev/ttyUSB0 -t -r hid.elf

    The code is not fully tested and I'm sure it needs some more revisions so use with cautions.

    Hope you enjoy!

    Best regards,
    Marco

    Thanks for sharing it. I am interested in C/C++ and will look at it.

Sign In or Register to comment.