Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
e7020e_2019
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
August Svensson
e7020e_2019
Commits
eb8a2f8b
Commit
eb8a2f8b
authored
6 years ago
by
August Svensson
Browse files
Options
Downloads
Patches
Plain Diff
bare6_4
parent
27bd5234
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
examples/bare6.rs
+6
-6
6 additions, 6 deletions
examples/bare6.rs
with
6 additions
and
6 deletions
examples/bare6.rs
+
6
−
6
View file @
eb8a2f8b
...
...
@@ -43,10 +43,10 @@ fn idle(stim: &mut Stim, rcc: RCC, gpioa: GPIOA) {
iprintln!
(
stim
,
"idle"
);
// power on GPIOA, RM0368 6.3.11
rcc
.ahb1enr
.modify
(|
_
,
w
|
w
.gpioaen
()
.set_bit
()
);
rcc
.ahb1enr
.modify
(|
_
,
w
|
w
.gpioaen
()
.enabled
());
//
.set_bit()
// configure PA5 as output, RM0368 8.4.1
gpioa
.moder
.modify
(|
_
,
w
|
w
.moder5
()
.bits
(
1
)
);
gpioa
.moder
.modify
(|
_
,
w
|
w
.moder5
()
.output
()
);
//
.bits(1)
// at 16 Mhz, 8_000_000 cycles = period 0.5s
// at 64 Mhz, 4*8_000_000 cycles = period 0.5s
...
...
@@ -83,22 +83,22 @@ fn clock_out(rcc: &RCC, gpioc: &GPIOC) {
// mco2 : SYSCLK = 0b00
// mcopre : divide by 4 = 0b110
rcc
.cfgr
.modify
(|
_
,
w
|
unsafe
{
w
.mco2
()
.bits
(
0b00
)
.mco2pre
()
.bits
(
0b110
)
});
.modify
(|
_
,
w
|
unsafe
{
w
.mco2
()
.sysclk
()
.mco2pre
()
.div4
()
});
//
w.mco2().bits(0b00).mco2pre().bits(0b110)
// power on GPIOC, RM0368 6.3.11
rcc
.ahb1enr
.modify
(|
_
,
w
|
w
.gpiocen
()
.
set_bit
());
rcc
.ahb1enr
.modify
(|
_
,
w
|
w
.gpiocen
()
.
enabled
()
);
//
// MCO_2 alternate function AF0, STM32F401xD STM32F401xE data sheet
// table 9
// AF0, gpioc reset value = AF0
// configure PC9 as alternate function 0b10, RM0368 6.2.10
gpioc
.moder
.modify
(|
_
,
w
|
w
.moder9
()
.bits
(
0b10
)
);
gpioc
.moder
.modify
(|
_
,
w
|
w
.moder9
()
.
alternate
());
//.
bits(0b10)
// otyper reset state push/pull, in reset state (don't need to change)
// ospeedr 0b11 = very high speed
gpioc
.ospeedr
.modify
(|
_
,
w
|
w
.ospeedr9
()
.bits
(
0b11
)
);
gpioc
.ospeedr
.modify
(|
_
,
w
|
w
.ospeedr9
()
.
very_high_speed
());
//.
bits(0b11)
}
// 0. Compile and run the example, in 16Mhz
...
...
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