Skip to content
This repository has been archived by the owner on Feb 13, 2019. It is now read-only.

Independent Watchdog peripheral #118

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Independent Watchdog peripheral #118

wants to merge 5 commits into from

Conversation

astro
Copy link

@astro astro commented Oct 31, 2018

Depends on the unproven+unreleased watchdog traits from embedded-hal

Copy link
Collaborator

@TeXitoi TeXitoi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You forgot to implement WatchdogDisable.

src/iwdg.rs Show resolved Hide resolved
src/rcc.rs Outdated Show resolved Hide resolved
@astro
Copy link
Author

astro commented Nov 6, 2018

You forgot to implement WatchdogDisable.

The datasheet doesn't mention anything about stopping the IWDG. Is there an unofficial way?

@TeXitoi
Copy link
Collaborator

TeXitoi commented Nov 25, 2018

Sorry I can't find any way to implement DisableWatchdog. Sorry for the noise.

src/iwdg.rs Show resolved Hide resolved
src/rcc.rs Outdated Show resolved Hide resolved
@astro
Copy link
Author

astro commented Nov 25, 2018

Rebased and addressed your concerns.

Copy link

@eldruin eldruin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some comments about potential improvements.


/// Reason for controller reset
#[derive(Clone, Copy, Debug)]
pub enum ResetReason {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about adding documentation on the variants of this enum? I would say some are not immediately obvious.

pub const MAX_TIMEOUT_MS: u32 = 26214;

const MAX_RELOAD: u16 = 0xFFF;
const MAX_PRESCALE: u8 = 6;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to add some comment on what this prescale value corresponds to, if that makes sense.

impl WatchdogEnable for IndependentWatchdog {
type Time = u32;

fn start<T>(&mut self, period: T) where T: Into<Self::Time> {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be good to add some information about the requirements of period and state what happens when these checks fail. (e.g. max timeout check)

@@ -20,6 +21,10 @@ pub struct KiloHertz(pub u32);
#[derive(Clone, Copy)]
pub struct MegaHertz(pub u32);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make the other structs also PartialOrd and PartialEq?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants