Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
e7020e_2021
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
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tommy Andersson
e7020e_2021
Commits
81965df7
Commit
81965df7
authored
4 years ago
by
Jonas Jacobsson
Committed by
Tommy Andersson
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Update rtic_bare8.rs
parent
c8a9e969
No related branches found
No related tags found
Loading
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/rtic_bare8.rs
+20
-10
20 additions, 10 deletions
examples/rtic_bare8.rs
with
20 additions
and
10 deletions
examples/rtic_bare8.rs
+
20
−
10
View file @
81965df7
...
@@ -11,13 +11,13 @@
...
@@ -11,13 +11,13 @@
use
panic_rtt_target
as
_
;
use
panic_rtt_target
as
_
;
use
nb
::
block
;
use
stm32f4xx_hal
::{
use
stm32f4xx_hal
::{
gpio
::{
gpioa
::
PA
,
Output
,
PushPull
},
gpio
::{
gpioa
::
PA
,
Output
,
PushPull
},
prelude
::
*
,
prelude
::
*
,
serial
::{
config
::
Config
,
Rx
,
Serial
,
Tx
},
serial
::{
config
::
Config
,
Rx
,
Serial
,
Tx
},
stm32
::
USART2
,
stm32
::
USART2
,
nb
::
block
,
};
};
use
rtic
::
app
;
use
rtic
::
app
;
...
@@ -69,17 +69,25 @@ const APP: () = {
...
@@ -69,17 +69,25 @@ const APP: () = {
fn
idle
(
cx
:
idle
::
Context
)
->
!
{
fn
idle
(
cx
:
idle
::
Context
)
->
!
{
let
rx
=
cx
.resources.RX
;
let
rx
=
cx
.resources.RX
;
let
tx
=
cx
.resources.TX
;
let
tx
=
cx
.resources.TX
;
let
mut
received
=
0
;
let
mut
errors
=
0
;
loop
{
loop
{
match
block!
(
rx
.read
())
{
match
block!
(
rx
.read
())
{
Ok
(
byte
)
=>
{
Ok
(
byte
)
=>
{
rprintln!
(
"Ok {:?}"
,
byte
);
rprintln!
(
"Ok {:?}"
,
byte
);
tx
.write
(
byte
)
.unwrap
();
tx
.write
(
byte
)
.unwrap
();
received
+=
1
;
}
}
Err
(
err
)
=>
{
Err
(
err
)
=>
{
rprintln!
(
"Error {:?}"
,
err
);
rprintln!
(
"Error {:?}"
,
err
);
let
test
:
u8
=
13
;
tx
.write
(
test
)
.unwrap
();
errors
+=
1
;
}
}
}
}
rprintln!
(
"Numbers of received: {:?}"
,
received
);
rprintln!
(
"Numbers of errors: {:?}"
,
errors
);
}
}
}
}
};
};
...
@@ -113,31 +121,33 @@ const APP: () = {
...
@@ -113,31 +121,33 @@ const APP: () = {
//
//
// What do you receive in `moserial`?
// What do you receive in `moserial`?
//
//
//
** your answer here **
//
I can't run moserial (Windows). But PuTTY seems to get a.
//
//
// What do you receive in the RTT terminal?
// What do you receive in the RTT terminal?
//
//
//
** your answer here **
//
OK 97
//
//
// 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.
//
//
// What did you receive in `moserial`?
// What did you receive in `moserial`?
//
//
//
** your answer here **
//
ad (Running PuTTY. Not moserial)
//
//
// What do you receive in the RTT terminal?
// What do you receive in the RTT terminal?
//
//
// ** your answer here **
// Ok 97
// Error Overrun
// Ok 100
//
//
// What do you believe to be the problem?
// What do you believe to be the problem?
//
//
// Hint: Look at the code in `idle` what does it do?
// Hint: Look at the code in `idle` what does it do?
//
//
//
** your answer here **
//
The buffer have not been read from and has not been cleared.
//
//
// Experiment a bit, what is the max length sequence you can receive without errors?
// Experiment a bit, what is the max length sequence you can receive without errors?
//
//
//
** your answer here **
//
8 bits or 1 byte.
//
//
// Commit your answers (bare8_1)
// Commit your answers (bare8_1)
//
//
...
@@ -152,11 +162,11 @@ const APP: () = {
...
@@ -152,11 +162,11 @@ const APP: () = {
//
//
// 3. Experiment a bit, what is the max length sequence you can receive without errors?
// 3. Experiment a bit, what is the max length sequence you can receive without errors?
//
//
//
** your answer here **
//
1
//
//
// How did the added tracing/instrumentation affect the behavior?
// How did the added tracing/instrumentation affect the behavior?
//
//
//
** your answer here **
//
I now only receive a back.
//
//
// Commit your answer (bare8_3)
// Commit your answer (bare8_3)
//
//
...
@@ -168,7 +178,7 @@ const APP: () = {
...
@@ -168,7 +178,7 @@ const APP: () = {
//
//
// Experiment a bit, what is the max length sequence you can receive without errors?
// Experiment a bit, what is the max length sequence you can receive without errors?
//
//
//
** your answer here **
//
Now I receive "ad" again
//
//
// Commit your answer (bare8_4)
// Commit your answer (bare8_4)
//
//
...
...
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