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
Jonas Jacobsson
e7020e_2021
Commits
1a4afebb
Commit
1a4afebb
authored
4 years ago
by
Jonas Jacobsson
Browse files
Options
Downloads
Patches
Plain Diff
This will be removed
parent
69114b0d
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main.rs
+12
-1
12 additions, 1 deletion
src/main.rs
with
12 additions
and
1 deletion
src/main.rs
+
12
−
1
View file @
1a4afebb
...
@@ -26,6 +26,8 @@ const APP: () = {
...
@@ -26,6 +26,8 @@ const APP: () = {
struct
Resources
{
struct
Resources
{
// late resources
// late resources
GPIOA
:
stm32
::
GPIOA
,
GPIOA
:
stm32
::
GPIOA
,
GPIOC
:
stm32
::
GPIOC
,
//button: <stm32::GPIOC as int>::PC13,
}
}
#[init(schedule
=
[
toggle]
)]
#[init(schedule
=
[
toggle]
)]
...
@@ -59,9 +61,15 @@ const APP: () = {
...
@@ -59,9 +61,15 @@ const APP: () = {
// configure PA5 as output, RM0368 8.4.1
// configure PA5 as output, RM0368 8.4.1
device
.GPIOA.moder
.modify
(|
_
,
w
|
w
.moder5
()
.bits
(
1
));
device
.GPIOA.moder
.modify
(|
_
,
w
|
w
.moder5
()
.bits
(
1
));
// Test button thingy. Think I put PC13 to input
device
.GPIOC.moder
.modify
(|
_
,
w
|
w
.moder13
()
.bits
(
0
));
// device.GPIOC.pupdr.modify(|_, w| w.pupdr13().bits(0));
// pass on late resources
// pass on late resources
init
::
LateResources
{
init
::
LateResources
{
GPIOA
:
device
.GPIOA
,
GPIOA
:
device
.GPIOA
,
GPIOC
:
device
.GPIOC
,
//button: device.button,
}
}
}
}
...
@@ -76,7 +84,7 @@ const APP: () = {
...
@@ -76,7 +84,7 @@ const APP: () = {
#[task(resources
=
[
GPIOA]
,
schedule
=
[
toggle
])]
#[task(resources
=
[
GPIOA
,GPIOC
]
,
schedule
=
[
toggle
])]
fn
toggle
(
cx
:
toggle
::
Context
)
{
fn
toggle
(
cx
:
toggle
::
Context
)
{
static
mut
TOGGLE
:
bool
=
false
;
static
mut
TOGGLE
:
bool
=
false
;
rprintln!
(
"toggle @ {:?}"
,
Instant
::
now
());
rprintln!
(
"toggle @ {:?}"
,
Instant
::
now
());
...
@@ -87,10 +95,13 @@ const APP: () = {
...
@@ -87,10 +95,13 @@ const APP: () = {
cx
.resources.GPIOA.bsrr
.write
(|
w
|
w
.br5
()
.set_bit
());
cx
.resources.GPIOA.bsrr
.write
(|
w
|
w
.br5
()
.set_bit
());
}
}
//cx.resources.GPIOC.PullDown;
*
TOGGLE
=
!*
TOGGLE
;
*
TOGGLE
=
!*
TOGGLE
;
cx
.schedule
cx
.schedule
.toggle
(
cx
.scheduled
+
16_000_000
.cycles
())
.toggle
(
cx
.scheduled
+
16_000_000
.cycles
())
.unwrap
();
.unwrap
();
}
}
extern
"C"
{
extern
"C"
{
...
...
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