Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
cortex-m-fork
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
Per Lindgren
cortex-m-fork
Commits
bc315114
Commit
bc315114
authored
7 years ago
by
homunkulus
Browse files
Options
Downloads
Plain Diff
Auto merge of #75 - japaric:syst, r=japaric
better document the SYST API closes #59
parents
ca3d4ef2
f0919f2b
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/peripheral/syst.rs
+14
-2
14 additions, 2 deletions
src/peripheral/syst.rs
with
14 additions
and
2 deletions
src/peripheral/syst.rs
+
14
−
2
View file @
bc315114
...
...
@@ -39,8 +39,7 @@ const SYST_CALIB_NOREF: u32 = 1 << 31;
impl
SYST
{
/// Clears current value to 0
///
/// After calling `clear_current()`, the next call to `has_wrapped()`
/// will return `false`.
/// After calling `clear_current()`, the next call to `has_wrapped()` will return `false`.
pub
fn
clear_current
(
&
mut
self
)
{
unsafe
{
self
.cvr
.write
(
0
)
}
}
...
...
@@ -56,6 +55,17 @@ impl SYST {
}
/// Enables counter
///
/// *NOTE* The reference manual indicates that:
///
/// "The SysTick counter reload and current value are undefined at reset, the correct
/// initialization sequence for the SysTick counter is:
///
/// - Program reload value
/// - Clear current value
/// - Program Control and Status register"
///
/// The sequence translates to `self.set_reload(x); self.clear_current(); self.enable_counter()`
pub
fn
enable_counter
(
&
mut
self
)
{
unsafe
{
self
.csr
.modify
(|
v
|
v
|
SYST_CSR_ENABLE
)
}
}
...
...
@@ -153,6 +163,8 @@ impl SYST {
/// Sets reload value
///
/// Valid values are between `1` and `0x00ffffff`.
///
/// *NOTE* To make the timer wrap every `N` ticks set the reload value to `N - 1`
pub
fn
set_reload
(
&
mut
self
,
value
:
u32
)
{
unsafe
{
self
.rvr
.write
(
value
)
}
}
...
...
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