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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Per Lindgren
e7020e_2021
Commits
dfd79ce0
Commit
dfd79ce0
authored
4 years ago
by
Per Lindgren
Browse files
Options
Downloads
Patches
Plain Diff
exercises updated
parent
12117010
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
examples/rtic_bare2.rs
+3
-8
3 additions, 8 deletions
examples/rtic_bare2.rs
examples/rtic_bare3.rs
+1
-1
1 addition, 1 deletion
examples/rtic_bare3.rs
examples/rtic_bare4.rs
+1
-1
1 addition, 1 deletion
examples/rtic_bare4.rs
examples/rtic_bare5.rs
+7
-11
7 additions, 11 deletions
examples/rtic_bare5.rs
with
12 additions
and
21 deletions
examples/rtic_bare2.rs
+
3
−
8
View file @
dfd79ce0
//! bare2.rs
//!
rtic_
bare2.rs
//!
//! Measuring execution time
//!
...
...
@@ -10,11 +10,6 @@
#![no_main]
#![no_std]
// use panic_halt as _;
// use cortex_m::{iprintln, peripheral::DWT, Peripherals};
// use cortex_m_rt::entry;
use
cortex_m
::
peripheral
::
DWT
;
use
cortex_m_semihosting
::
hprintln
;
use
panic_semihosting
as
_
;
...
...
@@ -124,7 +119,7 @@ fn wait(i: u32) {
//
// Commit your answers (bare2_2)
//
// 3. Now add a second call to `wait` (line 4
7
).
// 3. Now add a second call to `wait` (line 4
2
).
//
// Recompile and run until the breakpoint.
//
...
...
@@ -136,4 +131,4 @@ fn wait(i: u32) {
//
// ** your answer here **
//
//
//
Commit your answers (bare2_3)
This diff is collapsed.
Click to expand it.
examples/rtic_bare3.rs
+
1
−
1
View file @
dfd79ce0
//! bare3.rs
//!
rtic_
bare3.rs
//!
//! Measuring execution time
//!
...
...
This diff is collapsed.
Click to expand it.
examples/rtic_bare4.rs
+
1
−
1
View file @
dfd79ce0
//! bare4.rs
//!
rtic_
bare4.rs
//!
//! Access to Peripherals
//!
...
...
This diff is collapsed.
Click to expand it.
examples/rtic_bare5.rs
+
7
−
11
View file @
dfd79ce0
//! bare5.rs
//!
rtic_
bare5.rs
//!
//! C Like Peripheral API
//!
...
...
@@ -177,6 +177,8 @@ const APP: () = {
let
r
=
gpioa
.MODER
.read
()
&
!
(
0b11
<<
(
5
*
2
));
// read and mask
gpioa
.MODER
.write
(
r
|
0b01
<<
(
5
*
2
));
// set output mode
// test_modify();
loop
{
// set PA5 high
gpioa
.BSRRH
.write
(
1
<<
5
);
// set bit, output hight (turn on led)
...
...
@@ -198,11 +200,6 @@ const APP: () = {
}
};
// 0. Build and run the application.
//
// > cargo build --example bare5
// (or use the vscode)
//
// 1. C like API.
// Using C the .h files are used for defining interfaces, like function signatures (prototypes),
// structs and macros (but usually not the functions themselves).
...
...
@@ -211,9 +208,8 @@ const APP: () = {
// provided by ST (and other companies). Actually, the file presented here is mostly a
// cut/paste/replace of the stm32f40x.h, just Rustified.
//
//
// In the loop we access PA5 through bit set/clear operations.
// Comment out those operations and uncomment the
the ODR
accesses.
// Comment out those operations and uncomment the
ODR based
accesses.
// (They should have the same behavior, but is a bit less efficient.)
//
// Run and see that the program behaves the same.
...
...
@@ -228,12 +224,10 @@ const APP: () = {
//
// Implement and check that running `test` gives you expected behavior.
//
// Change the code into using your new API.
// Change the code into using your new
`modify`
API.
//
// Run and see that the program behaves the same.
//
// Commit your answers (bare5_2)
//
// Discussion:
// As with arithmetic operations, default semantics differ in between
// debug/dev and release builds.
...
...
@@ -248,3 +242,5 @@ const APP: () = {
// Wouldn't that be great?
//
// ** your answer here **
//
// Commit your answers (bare5_2)
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