Skip to content
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

Add missing watchdog prescalers. #218

Merged
merged 1 commit into from
May 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/watchdog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub struct IndependentWatchdog {
}

const LSI_KHZ: u32 = 40;
const MAX_PR: u8 = 4;
const MAX_PR: u8 = 8;
const MAX_RL: u16 = 0xFFF;
const KR_ACCESS: u16 = 0x5555;
const KR_RELOAD: u16 = 0xAAAA;
Expand Down Expand Up @@ -69,6 +69,9 @@ impl IndependentWatchdog {
0b010 => 16,
0b011 => 32,
0b100 => 64,
0b101 => 128,
0b110 => 256,
0b111 => 256,
_ => panic!("Invalid IWDG prescaler divider"),
};
(u32::from(rl) + 1) * divider / LSI_KHZ
Expand Down