We are going to win! wohoo

Dependencies:   mbed mbed-rtos

Committer:
madcowswe
Date:
Wed Nov 14 17:15:53 2012 +0000
Revision:
9:08552997b544
Parent:
5:a229f40c1210
Added an important comment

Who changed what in which revision?

UserRevisionLine numberNew contents of line
madcowswe 5:a229f40c1210 1 #include "system.h"
madcowswe 5:a229f40c1210 2
madcowswe 5:a229f40c1210 3 //Defining the externs
madcowswe 5:a229f40c1210 4 DigitalOut OLED1(LED1);
madcowswe 5:a229f40c1210 5 DigitalOut OLED2(LED2);
madcowswe 5:a229f40c1210 6 DigitalOut OLED3(LED3);
madcowswe 5:a229f40c1210 7 DigitalOut OLED4(LED4);
madcowswe 5:a229f40c1210 8
madcowswe 5:a229f40c1210 9 //nop style wait function
madcowswe 5:a229f40c1210 10 void nopwait(int ms){
madcowswe 5:a229f40c1210 11 while(ms--)
madcowswe 5:a229f40c1210 12 for (volatile int i = 0; i < 24000; i++);
madcowswe 5:a229f40c1210 13 }
madcowswe 5:a229f40c1210 14
madcowswe 5:a229f40c1210 15 float cpupercent; //defining the extern
madcowswe 5:a229f40c1210 16 void measureCPUidle (void const* arg) {
madcowswe 5:a229f40c1210 17
madcowswe 5:a229f40c1210 18 Timer timer;
madcowswe 5:a229f40c1210 19 cpupercent = 0; //defined in system.h
madcowswe 5:a229f40c1210 20
madcowswe 5:a229f40c1210 21 while(1) {
madcowswe 5:a229f40c1210 22 timer.reset();
madcowswe 5:a229f40c1210 23 timer.start();
madcowswe 5:a229f40c1210 24 wait(1);
madcowswe 5:a229f40c1210 25
madcowswe 5:a229f40c1210 26 int thistime = timer.read_us()-1000000;
madcowswe 5:a229f40c1210 27 cpupercent = thistime;
madcowswe 5:a229f40c1210 28 }
madcowswe 5:a229f40c1210 29 }