Eurobot system lib
system.cpp@0:b35c6c9aad45, 2012-04-26 (annotated)
- Committer:
- narshu
- Date:
- Thu Apr 26 19:40:58 2012 +0000
- Revision:
- 0:b35c6c9aad45
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
narshu | 0:b35c6c9aad45 | 1 | #include "system.h" |
narshu | 0:b35c6c9aad45 | 2 | |
narshu | 0:b35c6c9aad45 | 3 | //Defining the externs |
narshu | 0:b35c6c9aad45 | 4 | DigitalOut OLED1(LED1); |
narshu | 0:b35c6c9aad45 | 5 | DigitalOut OLED2(LED2); |
narshu | 0:b35c6c9aad45 | 6 | DigitalOut OLED3(LED3); |
narshu | 0:b35c6c9aad45 | 7 | DigitalOut OLED4(LED4); |
narshu | 0:b35c6c9aad45 | 8 | |
narshu | 0:b35c6c9aad45 | 9 | float cpupercent; //defining the extern |
narshu | 0:b35c6c9aad45 | 10 | void measureCPUidle (void const* arg) { |
narshu | 0:b35c6c9aad45 | 11 | |
narshu | 0:b35c6c9aad45 | 12 | Timer timer; |
narshu | 0:b35c6c9aad45 | 13 | cpupercent = 0; //defined in system.h |
narshu | 0:b35c6c9aad45 | 14 | |
narshu | 0:b35c6c9aad45 | 15 | while(1) { |
narshu | 0:b35c6c9aad45 | 16 | timer.reset(); |
narshu | 0:b35c6c9aad45 | 17 | timer.start(); |
narshu | 0:b35c6c9aad45 | 18 | wait(1); |
narshu | 0:b35c6c9aad45 | 19 | |
narshu | 0:b35c6c9aad45 | 20 | int thistime = timer.read_us()-1000000; |
narshu | 0:b35c6c9aad45 | 21 | cpupercent = thistime; |
narshu | 0:b35c6c9aad45 | 22 | } |
narshu | 0:b35c6c9aad45 | 23 | } |