Skip to content

Commit

Permalink
Add missing watchdog prescalers.
Browse files Browse the repository at this point in the history
  • Loading branch information
khrs authored and TheZoq2 committed May 23, 2020
1 parent df0f47f commit 964b3e4
Showing 1 changed file with 4 additions and 1 deletion.
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

0 comments on commit 964b3e4

Please sign in to comment.