Eurobot2012_Primary
Dependencies: mbed Eurobot_2012_Primary
Eurobot_shared/system/system.cpp@9:377560539b74, 2012-04-28 (annotated)
- Committer:
- narshu
- Date:
- Sat Apr 28 17:21:24 2012 +0000
- Revision:
- 9:377560539b74
Restructured project to have a single shared lib; Also raised the RF baud rate
Who changed what in which revision?
User | Revision | Line number | New 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 | } |