Merge pull request #29 from ferrous-systems/skade-patch-4

usb-2: make clearer which file is to be edited
This commit is contained in:
Jorge Aparicio 2020-07-13 09:29:18 +00:00 committed by GitHub
commit b7a922746b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -270,11 +270,13 @@ The definition of `Descriptor::Configuration` as well as the associated test has
Now, proceed as follows:
1. **Parse GET_DESCRIPTOR requests:**
Modify `Request::parse()` in `advanced/common/usb` to recognize a GET_DESCRIPTOR request so that the `get_descriptor_device` test passes. Note that the parser already handles SET_ADDRESS requests.
Modify `Request::parse()` in `advanced/common/usb/src/lib.rs` to recognize a GET_DESCRIPTOR request so that the `get_descriptor_device` test passes. Note that the parser already handles SET_ADDRESS requests.
- check table 9-4 in the USB specification for Request Codes
- remember that you can define binary literals by prefixing them with `0b`
- you can use bit shifts (`>>`) and casts (`as u8`) to get the high/low bytes of a `u16`
See `advanced/common/usb/src/get-descriptor-device.rs` for a solution.
2. **Read incoming request information and pass it to the parser:**
modify `usb-2.rs` to read `USBD` registers and parse the SETUP data when an EPSETUP event is received.
- for a mapping of register names to the `USBD` API, check the entry for `nrf52840_hal::target::usbd` in the documentation you've created using `cargo doc`