ble nano hid over gatt

Dependencies:   BLE_API mbed-dev nRF51822

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers WatchDog.h Source File

WatchDog.h

00001 
00002 class WatchDog {
00003     static const uint8_t WDT_TIMEOUT = 10; // sec
00004 
00005 public:
00006     static void init() {
00007         // timeout [s] = (CRV + 1) / 32768;
00008         // crv = 32768 * timeout - 1
00009         NRF_WDT->CRV = 32768 * WDT_TIMEOUT - 1;
00010         NRF_WDT->CONFIG = WDT_CONFIG_SLEEP_Pause << WDT_CONFIG_SLEEP_Pos;
00011         NRF_WDT->TASKS_START = 1;
00012         NRF_WDT->RREN = WDT_RREN_RR0_Enabled << WDT_RREN_RR0_Pos;
00013     }
00014 
00015     static void reload() {
00016         NRF_WDT->RR[0] = WDT_RR_RR_Reload;
00017     }
00018 
00019 };