ble nano hid over gatt
Dependencies: BLE_API mbed-dev nRF51822
Diff: WatchDog.h
- Revision:
- 69:9d6ecd584a0c
- Parent:
- 68:13e2343452d5
- Child:
- 78:9184d237cb92
--- a/WatchDog.h Fri Sep 02 07:41:33 2016 +0900 +++ b/WatchDog.h Fri Sep 02 07:54:55 2016 +0900 @@ -1,26 +1,19 @@ class WatchDog { - static const uint8_t WDT_TIMEOUT = 3; // sec + static const uint8_t WDT_TIMEOUT = 3; // sec + public: - static void init() { - // timeout [s] = (CRV + 1) / 32768; - // crv = 32768 * timeout - 1 - NRF_WDT->CRV = 32768 * WDT_TIMEOUT - 1; - // NRF_WDT->CONFIG = WDT_CONFIG_SLEEP_Pause << WDT_CONFIG_SLEEP_Pos; - NRF_WDT->TASKS_START = 1; - enable(); - } - - static void enable() { - NRF_WDT->RREN = WDT_RREN_RR0_Enabled << WDT_RREN_RR0_Pos; - } - - static void disable() { - NRF_WDT->RREN = WDT_RREN_RR0_Disabled << WDT_RREN_RR0_Pos; - } - - static void reload() { - NRF_WDT->RR[0] = WDT_RR_RR_Reload; - } - + static void init() { + // timeout [s] = (CRV + 1) / 32768; + // crv = 32768 * timeout - 1 + NRF_WDT->CRV = 32768 * WDT_TIMEOUT - 1; + NRF_WDT->CONFIG = WDT_CONFIG_SLEEP_Pause << WDT_CONFIG_SLEEP_Pos; + NRF_WDT->TASKS_START = 1; + NRF_WDT->RREN = WDT_RREN_RR0_Enabled << WDT_RREN_RR0_Pos; + } + + static void reload() { + NRF_WDT->RR[0] = WDT_RR_RR_Reload; + } + };