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.
Revision 0:8da3c40a4505, committed 2010-02-17
- Comitter:
- simon
- Date:
- Wed Feb 17 14:32:10 2010 +0000
- Commit message:
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 8da3c40a4505 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Feb 17 14:32:10 2010 +0000
@@ -0,0 +1,39 @@
+#include "mbed.h"
+
+DigitalOut led(LED1);
+
+class Watchdog {
+public:
+ void kick(float s) {
+ LPC_WDT->WDCLKSEL = 0x1; // Set CLK src to PCLK
+ uint32_t clk = SystemCoreClock / 16; // WD has a fixed /4 prescaler, PCLK default is /4
+ LPC_WDT->WDTC = s * (float)clk;
+ LPC_WDT->WDMOD = 0x3; // Enabled and Reset
+ kick();
+ }
+
+ void kick() {
+ LPC_WDT->WDFEED = 0xAA;
+ LPC_WDT->WDFEED = 0x55;
+ }
+};
+
+Watchdog w;
+
+int main() {
+ printf("Hello World!\n");
+ w.kick(2.5);
+
+ int hang = 0;
+ while(1) {
+ printf("loop...\n");
+ wait(0.1);
+
+ if(hang == 10) {
+ while(1);
+ }
+
+ w.kick();
+ hang++;
+ }
+}
diff -r 000000000000 -r 8da3c40a4505 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Feb 17 14:32:10 2010 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/49a220cc26e0