mirror of
https://github.com/ferrous-systems/embedded-trainings-2020.git
synced 2025-01-24 06:48:11 +00:00
rename USB parser solutions
also put them outside the `src` directory so people don't think they are modules
This commit is contained in:
parent
9cab8bb24e
commit
48e2ef512f
5 changed files with 11 additions and 11 deletions
|
@ -1,5 +1,5 @@
|
|||
//! Some USB 2.0 data types
|
||||
// NOTE this is a solution to exercise `usb-3`
|
||||
// NOTE this is a partial solution to exercise `usb-3`
|
||||
|
||||
#![deny(missing_docs)]
|
||||
#![deny(warnings)]
|
|
@ -1,5 +1,5 @@
|
|||
//! Some USB 2.0 data types
|
||||
// NOTE this is a solution to exercise `usb-2`
|
||||
// NOTE this is a partial solution to exercise `usb-2`
|
||||
|
||||
#![deny(missing_docs)]
|
||||
#![deny(warnings)]
|
|
@ -1,5 +1,5 @@
|
|||
//! Some USB 2.0 data types
|
||||
// NOTE this is a solution to exercise `usb-2`
|
||||
// NOTE this is a partial solution to exercise `usb-4`
|
||||
|
||||
#![deny(missing_docs)]
|
||||
#![deny(warnings)]
|
|
@ -32,7 +32,7 @@ Modify `Request::parse()` in `advanced/common/usb/src/lib.rs` to recognize a GET
|
|||
- 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.
|
||||
See `advanced/common/usb/solution-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.
|
||||
|
@ -54,5 +54,5 @@ INFO:usb_2 -- Goal reached; move to the next section
|
|||
|
||||
`wlength` / `length` can vary depending on the OS, USB port (USB 2.0 vs USB 3.0) or the presence of a USB hub so you may see a different value.
|
||||
|
||||
You can find a solution to step 1. in `advanced/common/usb/get-descriptor-device.rs`.
|
||||
You can find a solution to step 1. in `advanced/common/usb/solution-get-descriptor-device.rs`.
|
||||
You can find a solution to step 2. in `advanced/firmware/src/bin/usb-2-solution.rs`.
|
||||
|
|
|
@ -11,7 +11,7 @@ For each green test, you can extend `usb-4.rs` to handle the new requests your p
|
|||
|
||||
If you need a reference, you can find solutions to parsing `GET_DESCRIPTOR Configuration` and `SET_CONFIGURATION` requests in the following files:
|
||||
|
||||
- `advanced/common/src/get-descriptor-configuration.rs`
|
||||
- `advanced/common/src/set-configuration.rs`
|
||||
- `advanced/common/usb/solution-get-descriptor-configuration.rs`
|
||||
- `advanced/common/usb/solution-set-configuration.rs`
|
||||
|
||||
Each file contains just enough code to parse the request in its name and the `GET_DESCRIPTOR Device` request. So you can refer to `set-configuration.rs` without getting "spoiled" about how to parse the `SET_CONFIGURATION` request.
|
||||
Each file contains just enough code to parse the request in its name and the `GET_DESCRIPTOR Device` and `SET_ADDRESS` requests. So you can refer to `solution-get-descriptor-configuration.rs` without getting "spoiled" about how to parse the `SET_CONFIGURATION` request.
|
||||
|
|
Loading…
Reference in a new issue