Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tudelft-quadrupel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Computer and Embedded Systems Engineering
Embedded Systems Lab
tudelft-quadrupel
Commits
91d9972f
Commit
91d9972f
authored
Mar 7, 2023
by
Vivian Roest
Browse files
Options
Downloads
Patches
Plain Diff
Check if rtc compare event has triggered before waiting for interrupt
parent
a658fff7
No related branches found
No related tags found
1 merge request
!7
Fix loops running quicker than timer
Pipeline
#817279
failed
Mar 7, 2023
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/time.rs
+9
-0
9 additions, 0 deletions
src/time.rs
with
9 additions
and
0 deletions
src/time.rs
+
9
−
0
View file @
91d9972f
...
...
@@ -4,6 +4,7 @@ use core::sync::atomic::{AtomicBool, AtomicU32, Ordering};
use
core
::
time
::
Duration
;
use
nrf51_pac
::
interrupt
;
use
crate
::
led
::
Led
;
use
crate
::
mutex
::
Mutex
;
use
crate
::
once_cell
::
OnceCell
;
/// Delay for a number of CPU cycles. Very inaccurate
...
...
@@ -181,6 +182,14 @@ unsafe fn RTC0() {
/// Wait for the next interrupt configured by `set_interrupt_frequency`.
pub
fn
wait_for_next_tick
()
{
RTC
.modify
(|
rtc
|
{
if
rtc
.is_event_triggered
(
RtcInterrupt
::
Compare0
)
{
// the compare register has already triggered
TIMER_FLAG
.store
(
false
,
Ordering
::
SeqCst
);
return
;
}
});
while
!
TIMER_FLAG
.load
(
Ordering
::
SeqCst
)
{
cortex_m
::
asm
::
wfi
();
}
...
...
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