My attempt at using the mbed without the mbed libraries.
Here is a main.cpp, that uses the registers library.
Diff: main.cpp
- Revision:
- 3:88da6c0412b0
- Parent:
- 2:e26c096f1946
- Child:
- 4:6ed8900881e8
--- a/main.cpp Sun Dec 30 04:58:42 2012 +0000 +++ b/main.cpp Thu Jan 03 02:57:29 2013 +0000 @@ -1,17 +1,30 @@ #include "registers.h" -DigitalOut led1(LED1); -DigitalOut led2(LED2); +DigitalOut led1(p20); +DigitalOut led2(p19); DigitalOut led3(LED3); DigitalOut led4(LED4); DigitalIn switch1(p21); -Serial pc; +Serial pc(115200); Timer t(1000); //ms resolution for a serial stopwatch demo -int main() { //Timer demonstration +Ticker tock; +Ticker tock2; + +extern "C" void isr(void) { + led1 = !led1; +} + +extern "C" void isr2(void) { + led2 = !led2; +} + +int main() { //Timer and Ticker demonstration switch1.mode(PULLDOWN); t.start(); - + + tock.attach(&isr, 0.50); + tock2.attach(&isr2, 0.25); while(1) { double time = t;