Functions

Watchdog (hal_wdog)
[nRF24LE1 HAL]


The on-chip watchdog counter is intended to force a system reset if the software hangs. This module contains functions for initializing and enabling the watchdog, reloading the watchdog ("kicking the dog") and for reading the current watchdog counter value.

Functions

void hal_wdog_init (uint16_t start_value)
void hal_wdog_restart (void)

Function Documentation

void hal_wdog_init ( uint16_t  start_value )

Function to initialize and enable the watchdog.

Remarks:
Remember to enable the low frequency clock before use
Parameters:
start_valueThe value to load into the watchdog counter.

Definition at line 25 of file hal_wdog.c.

{
#ifdef __C51__
  WDSV = LSB(start_value);      // Write the 8 LSB to the WD counter
  WDSV = MSB(start_value);      // Write the 8 MSB to the WD counter
#elif __ICC8051__
  WDSVL = LSB(start_value); 
  WDSVH = MSB(start_value);
#else
#error Please define watchdog registers!
#endif
}
void hal_wdog_restart ( void   )

Function to reload the watchdog. This function reloads the watchdog counter with the parameter given in the hal_wdog_init function.

Definition at line 38 of file hal_wdog.c.

{
  uint8_t wd_msb, wd_lsb;

  #ifdef __C51__  
  wd_lsb = WDSV;
  wd_msb = WDSV;
  WDSV = wd_lsb;           // Write the 8 LSB to the WD counter
  WDSV = wd_msb;           // Write the 8 MSB to the WD counter
#elif __ICC8051__
  wd_lsb = WDSVL;
  wd_msb = WDSVH;
  WDSVL = wd_lsb;           // Write the 8 LSB to the WD counter
  WDSVH = wd_msb;           // Write the 8 MSB to the WD counter
#else
#error Please define watchdog restart
#endif
}