Skip to content
Snippets Groups Projects
Commit 2a72f2fc authored by anttib-5's avatar anttib-5
Browse files

bare0_4

parent 7d1753a9
No related branches found
No related tags found
No related merge requests found
Pipeline #119 failed
...@@ -40,7 +40,7 @@ optional = true ...@@ -40,7 +40,7 @@ optional = true
[dependencies.stm32f4xx-hal] [dependencies.stm32f4xx-hal]
git = "https://github.com/stm32-rs/stm32f4xx-hal.git" git = "https://github.com/stm32-rs/stm32f4xx-hal.git"
version = "0.2.8" version = "0.3.0"
features = ["stm32f413", "rt"] features = ["stm32f413", "rt"]
optional = true optional = true
......
...@@ -48,25 +48,27 @@ fn main() -> ! { ...@@ -48,25 +48,27 @@ fn main() -> ! {
// 1. Run the program in the debugger, let the program run for a while and // 1. Run the program in the debugger, let the program run for a while and
// then press pause. Look in the (Local -vscode) Variables view what do you find. // then press pause. Look in the (Local -vscode) Variables view what do you find.
// //
// ** your answer here ** // X = 7893536
// Y = 7893536
// //
// In the Expressions (WATCH -vscode) view add X and Y // In the Expressions (WATCH -vscode) view add X and Y
// what do you find // what do you find
// //
// ** your answer here ** // X and Y are less than x
// //
// Step through one complete iteration of the loop // Step through one complete iteration of the loop
// and see how the (Local) Variables are updated // and see how the (Local) Variables are updated
// can you foresee what will eventually happen? // can you foresee what will eventually happen?
// //
// ** place your answer here ** // x will increment then X will increment, then Y will be set as the same as X and then
// // it will assert the changes.
// Commit your answers (bare0_1) // Commit your answers (bare0_1)
// //
// 2. Alter the constant X_INIT so that `x += 1` directly causes `x` to wrap // 2. Alter the constant X_INIT so that `x += 1` directly causes `x` to wrap
// what happens when `x` wraps // what happens when `x` wraps
// //
// ** your answer here ** // Core panic, since the u32 int will overflow
// //
// Commit your answers (bare0_2) // Commit your answers (bare0_2)
// //
...@@ -74,10 +76,12 @@ fn main() -> ! { ...@@ -74,10 +76,12 @@ fn main() -> ! {
// //
// Change (both) += opertions to use wrapping_add // Change (both) += opertions to use wrapping_add
// load and run the progam, what happens // load and run the progam, what happens
// ** your answer here **
// The variables wrapped around back to 0.
// //
// Now continue exectution, what happens // Now continue exectution, what happens
// ** your answer here **
// The variables was incremeted as normal.
// //
// Commit your answers (bare0_3) // Commit your answers (bare0_3)
// //
...@@ -86,7 +90,7 @@ fn main() -> ! { ...@@ -86,7 +90,7 @@ fn main() -> ! {
// //
// 4. Change the asserion to `assert!(x == X && X == Y + 1)`, what happens? // 4. Change the asserion to `assert!(x == X && X == Y + 1)`, what happens?
// //
// ** place your answer here ** // The assert fails and we get core panic.
// //
// Commit your answers (bare0_4) // Commit your answers (bare0_4)
// //
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment