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 by
Diff: Watchdog.cpp
- Revision:
- 22:3c7ea2ad3a85
- Parent:
- 21:dc589c475a04
- Child:
- 23:09d59b812661
--- a/Watchdog.cpp Wed Mar 21 16:21:40 2018 +0000
+++ b/Watchdog.cpp Wed Mar 21 16:27:44 2018 +0000
@@ -121,6 +121,7 @@
uint32_t Watchdog::get_wdtclock()
{
+#if 0
uint32_t wdt_osc = 0;
/* Determine clock frequency according to clock register values */
@@ -143,6 +144,29 @@
case 14: wdt_osc = 4400000; break;
case 15: wdt_osc = 4600000; break;
}
+#else
+ const uint32_t osctab[16] =
+ {
+ 0, // 0
+ 600000, // 1
+ 1050000, // 2
+ 1400000, // 3
+ 1750000, // 4
+ 2100000, // 5
+ 2400000, // 6
+ 2700000, // 7
+ 3000000, // 8
+ 3250000, // 9
+ 3500000, // 10
+ 3750000, // 11
+ 4000000, // 12
+ 4200000, // 13
+ 4400000, // 14
+ 4600000 // 15
+ };
+#endif
+ uint32_t wdt_osc = osctab[(LPC_SYSCON->WDTOSCCTRL >> 5) & 0x0F];
+
// wdt_osc /= ((LPC_SYSCON->WDTOSCCTRL & 0x1F) << 1) + 2;
return wdt_osc;
}
