Eurobot2012_Primary

Dependencies:   mbed Eurobot_2012_Primary

Committer:
narshu
Date:
Thu May 03 14:20:04 2012 +0000
Revision:
22:7ba09c0af0d0
Parent:
9:377560539b74
added 90sec timer and tigger

Who changed what in which revision?

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