Skip to content
Snippets Groups Projects
Commit fa6c1232 authored by Per Lindgren's avatar Per Lindgren
Browse files

bare7 even more polish

parent 7362555c
No related branches found
No related tags found
No related merge requests found
//! bare7.rs //! bare7.rs
//! //!
//! Serial echo //! Serial echo
//! //!
//! What it covers: //! What it covers:
...@@ -40,6 +40,7 @@ fn main() -> ! { ...@@ -40,6 +40,7 @@ fn main() -> ! {
let tx = gpioa.pa2.into_alternate_af7(); let tx = gpioa.pa2.into_alternate_af7();
let rx = gpioa.pa3.into_alternate_af7(); // try comment out let rx = gpioa.pa3.into_alternate_af7(); // try comment out
// let rx = gpioa.pa3.into_alternate_af6(); // try uncomment // let rx = gpioa.pa3.into_alternate_af6(); // try uncomment
let serial = Serial::usart2( let serial = Serial::usart2(
...@@ -58,7 +59,7 @@ fn main() -> ! { ...@@ -58,7 +59,7 @@ fn main() -> ! {
match block!(rx.read()) { match block!(rx.read()) {
Ok(byte) => { Ok(byte) => {
iprintln!(stim, "Ok {:?}", byte); iprintln!(stim, "Ok {:?}", byte);
tx.write(byte).unwrap(); tx.write(byte).unwrap();
} }
Err(err) => { Err(err) => {
iprintln!(stim, "Error {:?}", err); iprintln!(stim, "Error {:?}", err);
...@@ -94,20 +95,20 @@ fn main() -> ! { ...@@ -94,20 +95,20 @@ fn main() -> ! {
// > cargo build --example bare7 --features "stm32fxx-hal" // > cargo build --example bare7 --features "stm32fxx-hal"
// (or use the vscode build task) // (or use the vscode build task)
// //
// //
// Cargo.toml: // Cargo.toml:
// //
// [dependencies.stm32f4] // [dependencies.stm32f4]
// version = "0.5.0" // version = "0.5.0"
// features = ["stm32f413", "rt"] // features = ["stm32f413", "rt"]
// optional = true // optional = true
// //
// [dependencies.stm32f4xx-hal] // [dependencies.stm32f4xx-hal]
// version = "0.6.0" // version = "0.6.0"
// features = ["stm32f401", "rt"] // features = ["stm32f401", "rt"]
// optional = true // optional = true
// //
// Notice, stm32f4xx-hal internally enables the dependency to stm32f4, // Notice, stm32f4xx-hal internally enables the dependency to stm32f4,
// so we don't need to explicitly enable it. // so we don't need to explicitly enable it.
// //
// The HAL provides a generic abstraction over the whole stm32f4 family. // The HAL provides a generic abstraction over the whole stm32f4 family.
...@@ -178,14 +179,14 @@ fn main() -> ! { ...@@ -178,14 +179,14 @@ fn main() -> ! {
// Data Bits 8 // Data Bits 8
// Stop Bits 1 // Stop Bits 1
// Parity None // Parity None
// //
// This setting is typically abbreviated as 115200 8N1. // This setting is typically abbreviated as 115200 8N1.
// //
// Run the example, make sure your ITM is set to 84MHz. // Run the example, make sure your ITM is set to 84MHz.
// //
// Send a single character (byte), (set the option No end in moserial). // Send a single character (byte), (set the option No end in moserial).
// Verify that sent bytes are echoed back, and that ITM tracing is working. // Verify that sent bytes are echoed back, and that ITM tracing is working.
// //
// If not go back check your ITM setting, clocks etc. // If not go back check your ITM setting, clocks etc.
// //
// Try sending: "abcd" as a single sequence, don't send the quotation marks, just abcd. // Try sending: "abcd" as a single sequence, don't send the quotation marks, just abcd.
...@@ -204,7 +205,7 @@ fn main() -> ! { ...@@ -204,7 +205,7 @@ fn main() -> ! {
// What did you receive, and what was the output of the ITM trace. // What did you receive, and what was the output of the ITM trace.
// //
// ** your answer here ** // ** your answer here **
// //
// Explain why the buffer overflows. // Explain why the buffer overflows.
// //
// ** your answer here ** // ** your answer here **
...@@ -220,8 +221,8 @@ fn main() -> ! { ...@@ -220,8 +221,8 @@ fn main() -> ! {
// The `stm32f4xx-hal` gives you an abstraction for programming, // The `stm32f4xx-hal` gives you an abstraction for programming,
// setting up clocks, assigning pins, etc. // setting up clocks, assigning pins, etc.
// //
// The hal overs basic functionality like serial communication. // The hal overs basic functionality like serial communication.
// Still, in order to fully understand what is going on under the hood you need to // Still, in order to fully understand what is going on under the hood you need to
// check the documentation (data sheets, user manuals etc.) // check the documentation (data sheets, user manuals etc.)
// //
// Your crate can be documented by: // Your crate can be documented by:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment