Class WatchdogTimer

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

Derived Type

Class Documentation

class WatchdogTimer : public Peripheral

Generic I/O controller that implements a watchdog timer.

It combines a classic period feature with a window option such as on Mega0 series.

The actual effect of the timeout is left to sub-classes by overriding timeout()

The configuration via fuses is not supported at the moment.

Subclassed by ArchXT_WDT

Public Functions

WatchdogTimer()
virtual ~WatchdogTimer()
virtual void reset() override

Virtual method called when the device is reset. Note that resetting I/O registers is only necessary here if their reset value is not zero.

virtual bool ctlreq(ctlreq_id_t req, ctlreq_data_t *data) override

Override to handle the core request AVR_CTLREQ_WATCHDOG_RESET.

Protected Functions

void set_timer(uint32_t wdr_win_start, uint32_t wdr_win_end, uint32_t clk_factor)

Configuration of the timer.

the timer is enabled for wdr_win_end > 0. If wdr_win_start > 0, the window feature is enabled.

clk_factor is the ratio WDT_clock_freq / MCU_clock_freq.

virtual void timeout() = 0

Callback to be reimplemented by sub-classes for handling the effects of a timeout.

class WDR_Sync_Timer : public CycleTimer

Public Functions

inline explicit WDR_Sync_Timer(WatchdogTimer &ctl)
inline virtual cycle_count_t next(cycle_count_t when) override

Callback from the cycle loop.

Note

there’s no guarantee the method will be called exactly on the required ‘when’ cycle. The only guarantee is “called ‘when’ <= ‘current cycle’”, the implementations must account for this.

Note

The next ‘when’ can be in the ‘past’ (i.e. <= ‘current cycle’). In this case, the timer will be called again within the same cycle with the given next ‘when’. The only constraint is that it must be greater than the previous ‘when’. If it’s negative or zero, the timer is removed from the queue.

Parameters:

when – current ‘when’ cycle, at which the timer was scheduled

Returns:

the next ‘when’ the timer requires to be called at.

class WDT_Timer : public CycleTimer

Public Functions

inline explicit WDT_Timer(WatchdogTimer &ctl)
inline virtual cycle_count_t next(cycle_count_t when) override

Callback from the cycle loop.

Note

there’s no guarantee the method will be called exactly on the required ‘when’ cycle. The only guarantee is “called ‘when’ <= ‘current cycle’”, the implementations must account for this.

Note

The next ‘when’ can be in the ‘past’ (i.e. <= ‘current cycle’). In this case, the timer will be called again within the same cycle with the given next ‘when’. The only constraint is that it must be greater than the previous ‘when’. If it’s negative or zero, the timer is removed from the queue.

Parameters:

when – current ‘when’ cycle, at which the timer was scheduled

Returns:

the next ‘when’ the timer requires to be called at.