Commit Graph

10 Commits (jebbatime)

Author SHA1 Message Date
Damien George 473157eeb9 stm32/usbd_hid_interface: Include extra header to build with threading. 2019-07-26 12:44:14 +10:00
Damien George fa07deda9f stm32/usbd_hid_interface: Rewrite USB HID interface code.
The previous version did not work on MCUs that only had USB device mode
(compared to OTG) because of the handling of NAK.  And this previous
handling of NAK had a race condition where a new packet could come in
before USBD_HID_SetNAK was called (since USBD_HID_ReceivePacket clears NAK
as part of its operation).  Furthermore, the double buffering of incoming
reports was not working, only one buffer could be used at a time.

This commit rewrites the HID interface code to have a single incoming
buffer, and only calls USBD_HID_ReceivePacket after the user has read the
incoming report (similar to how the VCP does its flow control).  As such,
USBD_HID_SetNAK and USBD_HID_ClearNAK are no longer needed.

API functionality from the user's point of view should be unchanged with
this commit.
2019-07-25 17:42:17 +10:00
Damien George f302f784e9 stm32/usb: Add config options to disable USB MSC and/or HID.
The new configurations MICROPY_HW_USB_MSC and MICROPY_HW_USB_HID can be
used by a board to enabled or disable MSC and/or HID.  They are both
enabled by default.
2019-07-16 14:39:21 +10:00
Damien George 2e565cc0d4 stm32/usb: Change HID report funcs to take HID state, not usbdev state. 2018-05-14 17:04:43 +10:00
Damien George ed92d62326 stm32/usb: Combine HID lower-layer and interface state into one struct. 2018-05-14 16:34:31 +10:00
Peter D. Gray ca36645410 stm32/usbd_hid_interface: Address possible race condition vs. interrupt.
The USB IRQ may fire once USBD_HID_ClearNAK() is called and then change the
last_read_len value.
2018-05-14 12:08:34 +10:00
Damien George f8f17f48c5 stm32/usbdev: Put all state for the USB device driver in a struct. 2017-09-21 21:51:04 +10:00
Damien George b3b922f177 stm32/usbdev: Simplify HID tx/rx buffer passing. 2017-09-21 21:50:56 +10:00
Damien George 77e1da40e2 stm32/usbdev: Put all HID state in a struct. 2017-09-21 21:50:37 +10:00
Damien George 01dd7804b8 ports: Make new ports/ sub-directory and move all ports there.
This is to keep the top-level directory clean, to make it clear what is
core and what is a port, and to allow the repository to grow with new ports
in a sustainable way.
2017-09-06 13:40:51 +10:00