Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
e7020e_2020
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gustav Hansson
e7020e_2020
Commits
fa6c1232
Commit
fa6c1232
authored
5 years ago
by
Per Lindgren
Browse files
Options
Downloads
Patches
Plain Diff
bare7 even more polish
parent
7362555c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/bare7.rs
+12
-11
12 additions, 11 deletions
examples/bare7.rs
with
12 additions
and
11 deletions
examples/bare7.rs
+
12
−
11
View file @
fa6c1232
//! bare7.rs
//!
//!
//! Serial echo
//!
//! What it covers:
...
...
@@ -40,6 +40,7 @@ fn main() -> ! {
let
tx
=
gpioa
.pa2
.into_alternate_af7
();
let
rx
=
gpioa
.pa3
.into_alternate_af7
();
// try comment out
// let rx = gpioa.pa3.into_alternate_af6(); // try uncomment
let
serial
=
Serial
::
usart2
(
...
...
@@ -58,7 +59,7 @@ fn main() -> ! {
match
block!
(
rx
.read
())
{
Ok
(
byte
)
=>
{
iprintln!
(
stim
,
"Ok {:?}"
,
byte
);
tx
.write
(
byte
)
.unwrap
();
tx
.write
(
byte
)
.unwrap
();
}
Err
(
err
)
=>
{
iprintln!
(
stim
,
"Error {:?}"
,
err
);
...
...
@@ -94,20 +95,20 @@ fn main() -> ! {
// > cargo build --example bare7 --features "stm32fxx-hal"
// (or use the vscode build task)
//
//
//
// Cargo.toml:
//
//
// [dependencies.stm32f4]
// version = "0.5.0"
// features = ["stm32f413", "rt"]
// optional = true
//
//
// [dependencies.stm32f4xx-hal]
// version = "0.6.0"
// features = ["stm32f401", "rt"]
// 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.
//
// The HAL provides a generic abstraction over the whole stm32f4 family.
...
...
@@ -178,14 +179,14 @@ fn main() -> ! {
// Data Bits 8
// Stop Bits 1
// Parity None
//
//
// This setting is typically abbreviated as 115200 8N1.
//
// Run the example, make sure your ITM is set to 84MHz.
//
// 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.
//
//
// 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.
...
...
@@ -204,7 +205,7 @@ fn main() -> ! {
// What did you receive, and what was the output of the ITM trace.
//
// ** your answer here **
//
//
// Explain why the buffer overflows.
//
// ** your answer here **
...
...
@@ -220,8 +221,8 @@ fn main() -> ! {
// The `stm32f4xx-hal` gives you an abstraction for programming,
// setting up clocks, assigning pins, etc.
//
// The hal overs basic functionality like serial communication.
// Still, in order to fully understand what is going on under the hood you need to
// The hal overs basic functionality like serial communication.
// Still, in order to fully understand what is going on under the hood you need to
// check the documentation (data sheets, user manuals etc.)
//
// Your crate can be documented by:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment