My attempt at using the mbed without the mbed libraries.
Here is a main.cpp, that uses the registers library.
Diff: main.cpp
- Revision:
- 6:d40cd917854d
- Parent:
- 4:6ed8900881e8
- Child:
- 7:411ae6b21c9b
--- a/main.cpp Thu Jan 03 04:26:13 2013 +0000 +++ b/main.cpp Thu Jan 03 05:10:49 2013 +0000 @@ -1,6 +1,6 @@ #include "registers.h" DigitalOut led1(p20); -DigitalOut led2(p19); +DigitalOut led2(LED2); DigitalOut led3(LED3); DigitalOut led4(LED4); DigitalIn switch1(p21); @@ -11,20 +11,19 @@ Timeout tock; Ticker tock2; -extern "C" void isr(void) { - led1 = !led1; +extern "C" void turnOff(void) { + led1 = 0; } -extern "C" void isr2(void) { - led2 = !led2; +extern "C" void turnOn(void) { + led1 = 1; + tock.attach(&turnOff, 0.05); } int main() { //Timer and Ticker demonstration switch1.mode(PULLDOWN); t.start(); - - tock.attach(&isr, 2); - tock2.attach(&isr2, 0.5); + tock2.attach(&turnOn, 0.5); while(1) { double time = t;