-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create recovery timer mechanism #101
Conversation
boards/recovery/src/main.rs
Outdated
let timerclk: hal::clock::v1::Tc2Tc3Clock = pclk_tc2tc3.into(); | ||
let mut recovery_timer = | ||
hal::timer::TimerCounter2::tc2_(&timerclk, peripherals.TC2, &mut mclk); | ||
recovery_timer.enable_interrupt(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't want to enable interrupts here, just create the timer object.
boards/recovery/src/main.rs
Outdated
data.recovery_counter += 1; | ||
}); | ||
} | ||
// restart timer after interrupt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic should be inside the if statement, not outside of it. This is because the timer interrupt can fire for multiple reasons and right now you are restarting the time for any and all interrupts, not just the case that it is finished.
@@ -8,6 +8,7 @@ use messages::command::{Command, PowerDown, RadioRate, RadioRateChange}; | |||
use messages::sender::Sender::SensorBoard; | |||
use messages::Message; | |||
use rtic::mutex::Mutex; | |||
use atsamd_hal::prelude::_atsamd_hal_timer_traits_InterruptDrivenTimer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know why this was needed? What is the error if you do not include this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments 👍
No description provided.