Skip to content

Commit 3440bca

Browse files
Lab fixes (#1361)
* lab fixes * add the solutions
1 parent 090a2dd commit 3440bca

33 files changed

Lines changed: 36 additions & 11 deletions

website/lab/00.1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,4 +670,4 @@ mod tests {
670670
- Define an enum called Expression with the appropriate variants(hint: use [`Box`](https://doc.rust-lang.org/alloc/boxed/struct.Box.html))
671671
- Create a function that returns an Expression based on a given string. Respect operator precedence rules
672672
- Creates a function that takes an Expression and evaluates it to an i32
673-
- Read an expression from stdin and print out the result
673+
- Read an expression from stdin and print out the result

website/lab/00.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ fn main() {
236236

237237
:::warning
238238

239-
Note that the entire instance must be **editable** ; Rust **doesn't allow us** to mark only certain fields as mutable!
239+
Note that the entire instance must be **mutable** ; Rust **doesn't allow us** to mark only certain fields as mutable!
240240

241241
:::
242242

@@ -835,4 +835,4 @@ Before tackling the exercises, take a look and cover chapters [1](https://tourof
835835

836836
[^c_equivalent]: The data types used here are considered for a 32 bit system, for other architectures the equivalent data types might differ (`short` is at least 2 bytes long).
837837
[^java_unsigned]: Starting with Java 8, the `Number` classes have some helper methods, like `compareUnsigned` and `toUnsigned...` that allow the usage and manipulation of unsigned numbers.
838-
[^move_might_be_optimized]: The compiler might optimize out the shallow copy. https://users.rust-lang.org/t/how-move-works-in-rust/116776/19
838+
[^move_might_be_optimized]: The compiler might optimize out the shallow copy. https://users.rust-lang.org/t/how-move-works-in-rust/116776/19

website/lab/01/index.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1841,3 +1841,7 @@ Make sure you download the `.pacthed` versions of the files.
18411841
to go step by step throughout the running firmware and look at the variables using the **Watches**.
18421842
3. Define a few fuctions throughout the firmware and perform some math. Use the `probe-rs` VS Code extension
18431843
to go step by step through the running firmware and look at the called functions using the **Call Stack**.
1844+
1845+
## Solutions
1846+
1847+
The lab's exercises solutions are available in the [lab-solutions](https://github.com/UPB-PMRust/lab-solutions/tree/main/lab01) repository.

website/lab/02/index.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,3 +1006,7 @@ const CODES: [&str; 26] = [
10061006
];
10071007
```
10081008
:::
1009+
1010+
## Solutions
1011+
1012+
The lab's exercises solutions are available in the [lab-solutions](https://github.com/UPB-PMRust/lab-solutions/tree/main/lab02) repository.

website/lab/03/index.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,4 +838,6 @@ Unlike the photoresistor, which requires an external resistor to form a voltage
838838

839839
5. Write a program using Embassy that moves a servo motor smoothly between 0° and 180°, then back to 0°, in a continuous loop. (**2p**)
840840

841-
841+
## Solutions
842+
843+
The lab's exercises solutions are available in the [lab-solutions](https://github.com/UPB-PMRust/lab-solutions/tree/main/lab03) repository.

website/lab/04/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,3 +507,6 @@ However if the switch **S1** is pressed the state of traffic light changes immed
507507
Use a `PubSubChannel` to transmit the state of the traffic light from the LEDs task to both the buzzer and the servo motor tasks.
508508
:::
509509

510+
## Solutions
511+
512+
The lab's exercises solutions are available in the [lab-solutions](https://github.com/UPB-PMRust/lab-solutions/tree/main/lab04) repository.

website/lab/05/index.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,3 +734,7 @@ In order to increase the framerate, make sure to decrease the delay.
734734

735735
Clearing the whole screen takes time. In order to optimize further, instead, draw a black circle over the old one before computing the new location.
736736
:::
737+
738+
## Solutions
739+
740+
The lab's exercises solutions are available in the [lab-solutions](https://github.com/UPB-PMRust/lab-solutions/tree/main/lab05) repository.

website/lab/06/index.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,3 +712,7 @@ let nvm_par_t1: u16 = ((data[1] as u16) << 8) | (data[0] as u16);
712712
:::tip `i32` to bytes and vice-versa
713713
To quickly convert an `i32` variable into an array of `u8`s, we can use either the `from_be_bytes()` and `to_be_bytes()` or the `from_le_bytes()` and `to_le_bytes()` methods. You can find more details about them in the [`i32` documentation](https://doc.rust-lang.org/core/primitive.i32.html) page.
714714
:::
715+
716+
## Solutions
717+
718+
The lab's exercises solutions are available in the [lab-solutions](https://github.com/UPB-PMRust/lab-solutions/tree/main/lab06) repository.

website/lab/07/index.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,3 +639,7 @@ Transform your board into a PC-controlled I/O expander.
639639
- If it receives `"P"`, read the pressure from the **BMP390** and send it back.
640640
- If it receives `"A"`, read the X, Y, Z acceleration from the **MPU-6000** and send it back. \
641641
**Host**: Create a simple script that asks the user which sensor they want to read, sends the corresponding letter, and prints the response.
642+
643+
## Solutions
644+
645+
The lab's exercises solutions are available in the [usb-examples](https://github.com/UPB-PMRust/usb-examples) repository.

0 commit comments

Comments
 (0)