Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Watchdog_sample_nocoverage by
wdt.cpp
00001 #include "mbed.h" 00002 #include "wdt.h" 00003 00004 00005 // Simple Library for Watchdog 00006 // --------------------------- 00007 00008 // Initialise watchdog using 1KHz clock 00009 // To prevent overwriting, only a single write to the COPC register possible 00010 // 00011 void wdt_1sec() { 00012 // 1024ms, not windowed - this is the default 00013 /* SIM_COPC: COPT=11,COPCLKS=0,COPW=0 */ 00014 SIM->COPC = (uint32_t)0x0Cu; 00015 } 00016 00017 void wdt_256ms() { 00018 // 256ms, not windowed 00019 /* SIM_COPC: COPT=10,COPCLKS=0,COPW=0 */ 00020 SIM->COPC = (uint32_t)0x08u; 00021 } 00022 00023 void wdt_32ms() { 00024 // 32ms, not windowed 00025 /* SIM_COPC: COPT=01,COPCLKS=0,COPW=0 */ 00026 SIM->COPC = (uint32_t)0x04u; 00027 } 00028 00029 // Kick (feed, reload) our watchdog timer 00030 void wdt_kick_all(){ 00031 SIM->SRVCOP = (uint32_t)0x55u; 00032 SIM->SRVCOP = (uint32_t)0xAAu; 00033 } 00034 00035 void wdt_kickA(){ 00036 SIM->SRVCOP = (uint32_t)0x55u; 00037 } 00038 00039 void wdt_kickB(){ 00040 SIM->SRVCOP = (uint32_t)0xAAu; 00041 } 00042 00043
Generated on Tue Jul 19 2022 14:15:39 by
