Official reference client implementation for Cumulocity SmartREST on u-blox C027.

Dependencies:   C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed

Fork of MbedSmartRestMain by Vincent Wochnik

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers watchdog.h Source File

watchdog.h

00001 #ifndef WATCHDOG_H
00002 #define WATCHDOG_H
00003 #include "mbed.h"
00004 
00005 class Watchdog {
00006 public:
00007 // Load timeout value in watchdog timer and enable
00008     void kick(float s) {
00009         LPC_WDT->WDCLKSEL = 0x1;                // Set CLK src to PCLK
00010         uint32_t clk = SystemCoreClock / 16;    // WD has a fixed /4 prescaler, PCLK default is /4
00011         LPC_WDT->WDTC = s * (float)clk;
00012         LPC_WDT->WDMOD = 0x3;                   // Enabled and Reset
00013         kick();
00014     }
00015 // "kick" or "feed" the dog - reset the watchdog timer
00016 // by writing this required bit pattern
00017     void kick() {
00018         LPC_WDT->WDFEED = 0xAA;
00019         LPC_WDT->WDFEED = 0x55;
00020     }
00021 };
00022 #endif /* WATCHDOG_H */