Eurobot2012_Secondary

Fork of Eurobot_2012_Secondary by Shuto Naruse

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers system.cpp Source File

system.cpp

00001 #include "system.h"
00002 
00003 //Defining the externs
00004 DigitalOut     OLED1(LED1);
00005 DigitalOut     OLED2(LED2);
00006 DigitalOut     OLED3(LED3);
00007 DigitalOut     OLED4(LED4);
00008 
00009 //nop style wait function
00010 void nopwait(int ms){
00011 while(ms--)
00012     for (volatile int i = 0; i < 24000; i++);
00013 }
00014 
00015 float cpupercent; //defining the extern
00016 void measureCPUidle (void const* arg) {
00017     
00018     Timer timer;
00019     cpupercent = 0; //defined in system.h
00020     
00021     while(1) {
00022         timer.reset();
00023         timer.start();
00024         wait(1);
00025         
00026         int thistime = timer.read_us()-1000000;
00027         cpupercent = thistime;
00028     }
00029 }