Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Eurobot2013 by
system/system.cpp@5:a229f40c1210, 2012-11-14 (annotated)
- Committer:
- madcowswe
- Date:
- Wed Nov 14 16:15:46 2012 +0000
- Revision:
- 5:a229f40c1210
Added "system"
Who changed what in which revision?
| User | Revision | Line number | New 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 | } |
