![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
working version with calibration done
Fork of Eurobot2013 by
system/system.cpp@11:5ba926692210, 2013-04-09 (annotated)
- Committer:
- xiaxia686
- Date:
- Tue Apr 09 15:32:47 2013 +0000
- Revision:
- 11:5ba926692210
woking version (calibrated)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
xiaxia686 | 11:5ba926692210 | 1 | #include "system.h" |
xiaxia686 | 11:5ba926692210 | 2 | |
xiaxia686 | 11:5ba926692210 | 3 | //Defining the externs |
xiaxia686 | 11:5ba926692210 | 4 | DigitalOut OLED1(LED1); |
xiaxia686 | 11:5ba926692210 | 5 | DigitalOut OLED2(LED2); |
xiaxia686 | 11:5ba926692210 | 6 | DigitalOut OLED3(LED3); |
xiaxia686 | 11:5ba926692210 | 7 | DigitalOut OLED4(LED4); |
xiaxia686 | 11:5ba926692210 | 8 | |
xiaxia686 | 11:5ba926692210 | 9 | //nop style wait function |
xiaxia686 | 11:5ba926692210 | 10 | void nopwait(int ms){ |
xiaxia686 | 11:5ba926692210 | 11 | while(ms--) |
xiaxia686 | 11:5ba926692210 | 12 | for (volatile int i = 0; i < 24000; i++); |
xiaxia686 | 11:5ba926692210 | 13 | } |
xiaxia686 | 11:5ba926692210 | 14 | |
xiaxia686 | 11:5ba926692210 | 15 | float cpupercent; //defining the extern |
xiaxia686 | 11:5ba926692210 | 16 | void measureCPUidle (void const* arg) { |
xiaxia686 | 11:5ba926692210 | 17 | |
xiaxia686 | 11:5ba926692210 | 18 | Timer timer; |
xiaxia686 | 11:5ba926692210 | 19 | cpupercent = 0; //defined in system.h |
xiaxia686 | 11:5ba926692210 | 20 | |
xiaxia686 | 11:5ba926692210 | 21 | while(1) { |
xiaxia686 | 11:5ba926692210 | 22 | timer.reset(); |
xiaxia686 | 11:5ba926692210 | 23 | timer.start(); |
xiaxia686 | 11:5ba926692210 | 24 | wait(1); |
xiaxia686 | 11:5ba926692210 | 25 | |
xiaxia686 | 11:5ba926692210 | 26 | int thistime = timer.read_us()-1000000; |
xiaxia686 | 11:5ba926692210 | 27 | cpupercent = thistime; |
xiaxia686 | 11:5ba926692210 | 28 | } |
xiaxia686 | 11:5ba926692210 | 29 | } |