0.3.1
Watchdog Timer (WDT)

Macros

#define CPU_WDT_WTCNT(x)   (0x5A00U | ((x) & 0x00FF))
 Value to write to the CPU-WDT WTCNTW register.
 
#define CPU_WDT_WTCSR(x)   (0xA500U | ((x) & 0x00FF))
 Value to write to the CPU-WDT WTCSRW register.
 
#define CPU_WDT_CLEAR_WOVF_RSTCSR   (0xA500U)
 Value to write to the CPU-WDT RSTCSRW register.
 
#define CPU_WDT_CLEAR_RSTCSR(x)   (0x5A3FU | ((x) & 0x00FF))
 Value to write to the CPU-WDT RSTCSRW register.
 

Typedefs

typedef enum cpu_wdt_clock cpu_wdt_clock_t
 CPU-WDT clock divisors.
 
typedef enum cpu_wdt_mode cpu_wdt_mode_t
 CPU-WDT modes.
 
typedef void(* cpu_wdt_ihr_t) (void)
 Callback type.
 

Enumerations

enum  cpu_wdt_clock
 CPU-WDT clock divisors. More...
 
enum  cpu_wdt_mode
 CPU-WDT modes. More...
 

Functions

static void cpu_wdt_count_set (uint8_t count)
 Set the 1-byte WDT tick count.
 
static uint8_t cpu_wdt_count_get (void)
 Obtain the current 1-byte WDT tick count.
 
static void cpu_wdt_enable (void)
 Enable the CPU-WDT.
 
static void cpu_wdt_disable (void)
 Disable the CPU-WDT.
 
static uint8_t cpu_wdt_interrupt_priority_get (void)
 Obtain the interrupt priority level for CPU-WDT.
 
static void cpu_wdt_interrupt_priority_set (uint8_t priority)
 Set the interrupt priority level for CPU-WDT.
 
void cpu_wdt_init (cpu_wdt_clock_t clock_div)
 Fully initialize the CPU-WDT depending with a specific clock divisor.
 

Detailed Description

Description goes here.

Macro Definition Documentation

◆ CPU_WDT_WTCNT

#define CPU_WDT_WTCNT (   x)    (0x5A00U | ((x) & 0x00FF))

Value to write to the CPU-WDT WTCNTW register.

Parameters
xThe 2-byte value.

◆ CPU_WDT_WTCSR

#define CPU_WDT_WTCSR (   x)    (0xA500U | ((x) & 0x00FF))

Value to write to the CPU-WDT WTCSRW register.

When clearing the WOVF bit:

*(volatile uint16_t *)RSTCSRW = 0xA500 | 0x00;
#define RSTCSRW
CPU I/O register.
Definition: map.h:402
unsigned short uint16_t
Not yet documented.
Definition: libc.dox:26
Parameters
xThe 2-byte value.

◆ CPU_WDT_CLEAR_WOVF_RSTCSR

#define CPU_WDT_CLEAR_WOVF_RSTCSR   (0xA500U)

Value to write to the CPU-WDT RSTCSRW register.

For writing to WTCSRW and WTCNTW, use 16-bit writes only:

*(volatile uint16_t *)WTCSRW = 0xA518 | (value & 0xFF);
*(volatile uint16_t *)WTCNTW = 0x5A00 | (value & 0xFF);
#define WTCNTW
CPU I/O register.
Definition: map.h:391
#define WTCSRW
CPU I/O register.
Definition: map.h:380

◆ CPU_WDT_CLEAR_RSTCSR

#define CPU_WDT_CLEAR_RSTCSR (   x)    (0x5A3FU | ((x) & 0x00FF))

Value to write to the CPU-WDT RSTCSRW register.

Parameters
xThe 2-byte value.

Typedef Documentation

◆ cpu_wdt_clock_t

CPU-WDT clock divisors.

See also
cpu_wdt_init

◆ cpu_wdt_mode_t

CPU-WDT modes.

See also
cpu_wdt_timer_mode_set

◆ cpu_wdt_ihr_t

typedef void(* cpu_wdt_ihr_t) (void)

Callback type.

See also
cpu_wdt_timer_mode_set

Enumeration Type Documentation

◆ cpu_wdt_clock

CPU-WDT clock divisors.

See also
cpu_wdt_init
Enumerator
CPU_WDT_CLOCK_DIV_2 

WDT clock divisor of \(\frac{\phi}{2}\).

CPU_WDT_CLOCK_DIV_64 

WDT clock divisor of \(\frac{\phi}{64}\).

CPU_WDT_CLOCK_DIV_128 

WDT clock divisor of \(\frac{\phi}{128}\).

CPU_WDT_CLOCK_DIV_256 

WDT clock divisor of \(\frac{\phi}{256}\).

CPU_WDT_CLOCK_DIV_512 

WDT clock divisor of \(\frac{\phi}{512}\).

CPU_WDT_CLOCK_DIV_1024 

WDT clock divisor of \(\frac{\phi}{1024}\).

CPU_WDT_CLOCK_DIV_4096 

WDT clock divisor of \(\frac{\phi}{4096}\).

CPU_WDT_CLOCK_DIV_8192 

WDT clock divisor of \(\frac{\phi}{8192}\).

◆ cpu_wdt_mode

CPU-WDT modes.

See also
cpu_wdt_timer_mode_set
Enumerator
CPU_WDT_MODE_INTERVAL 

Interval mode.

CPU_WDT_MODE_WATCHDOG 

Watchdog mode.

Function Documentation

◆ cpu_wdt_count_set()

static void cpu_wdt_count_set ( uint8_t  count)
inlinestatic

Set the 1-byte WDT tick count.

Parameters
countThe 1-byte tick value to set.

◆ cpu_wdt_count_get()

static uint8_t cpu_wdt_count_get ( void  )
inlinestatic

Obtain the current 1-byte WDT tick count.

Returns
Return the 1-byte WDT tick count.

◆ cpu_wdt_interrupt_priority_get()

static uint8_t cpu_wdt_interrupt_priority_get ( void  )
inlinestatic

Obtain the interrupt priority level for CPU-WDT.

Returns
The interrupt priority level ranging from 0 to 15.

◆ cpu_wdt_interrupt_priority_set()

static void cpu_wdt_interrupt_priority_set ( uint8_t  priority)
inlinestatic

Set the interrupt priority level for CPU-WDT.

Parameters
priorityThe priority ranging from 0 to 15.

◆ cpu_wdt_init()

void cpu_wdt_init ( cpu_wdt_clock_t  clock_div)

Fully initialize the CPU-WDT depending with a specific clock divisor.

Parameters
clock_divThe clock divisor.