Michael Fischler / Mbed 2 deprecated Contest_Winner

Dependencies:   mbed

Committer:
mafischl
Date:
Thu Oct 13 18:01:31 2011 +0000
Revision:
1:5a7cce9994a3
Parent:
0:d9266031f832

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mafischl 0:d9266031f832 1 #include "sys_arch.h"
mafischl 0:d9266031f832 2 #include "mbed.h"
mafischl 0:d9266031f832 3 //DG 2010
mafischl 0:d9266031f832 4
mafischl 0:d9266031f832 5 #ifdef __cplusplus
mafischl 0:d9266031f832 6 extern "C" {
mafischl 0:d9266031f832 7 #endif
mafischl 0:d9266031f832 8
mafischl 0:d9266031f832 9 #ifdef __COMPLEX_AND_BUGGUY_HANDLING__
mafischl 0:d9266031f832 10 static Timer* pTmr = NULL;
mafischl 0:d9266031f832 11
mafischl 0:d9266031f832 12 void sys_init(void)
mafischl 0:d9266031f832 13 {
mafischl 0:d9266031f832 14 //Start Timer
mafischl 0:d9266031f832 15 pTmr = new Timer();
mafischl 0:d9266031f832 16 pTmr->start();
mafischl 0:d9266031f832 17 }
mafischl 0:d9266031f832 18
mafischl 0:d9266031f832 19 u32_t sys_jiffies(void) /* since power up. */
mafischl 0:d9266031f832 20 {
mafischl 0:d9266031f832 21 return (u32_t) (pTmr->read_ms()/10); //In /10ms units
mafischl 0:d9266031f832 22 }
mafischl 0:d9266031f832 23
mafischl 0:d9266031f832 24 u32_t sys_now(void)
mafischl 0:d9266031f832 25 {
mafischl 0:d9266031f832 26 return (u32_t) pTmr->read_ms(); //In /ms units
mafischl 0:d9266031f832 27 }
mafischl 0:d9266031f832 28 #elif0
mafischl 0:d9266031f832 29 void sys_init(void)
mafischl 0:d9266031f832 30 {
mafischl 0:d9266031f832 31
mafischl 0:d9266031f832 32 }
mafischl 0:d9266031f832 33
mafischl 0:d9266031f832 34 u32_t sys_jiffies(void) /* since power up. */
mafischl 0:d9266031f832 35 {
mafischl 0:d9266031f832 36 static int count = 0;
mafischl 0:d9266031f832 37 return ++count;
mafischl 0:d9266031f832 38 }
mafischl 0:d9266031f832 39
mafischl 0:d9266031f832 40 u32_t sys_now(void)
mafischl 0:d9266031f832 41 {
mafischl 0:d9266031f832 42 return (u32_t) time(NULL);
mafischl 0:d9266031f832 43 }
mafischl 0:d9266031f832 44 #else
mafischl 0:d9266031f832 45 static Timer* pTmr = NULL;
mafischl 0:d9266031f832 46
mafischl 0:d9266031f832 47 void sys_init(void)
mafischl 0:d9266031f832 48 {
mafischl 0:d9266031f832 49 //Start Timer
mafischl 0:d9266031f832 50 pTmr = new Timer();
mafischl 0:d9266031f832 51 pTmr->start();
mafischl 0:d9266031f832 52 }
mafischl 0:d9266031f832 53
mafischl 0:d9266031f832 54 u32_t sys_jiffies(void) /* since power up. */
mafischl 0:d9266031f832 55 {
mafischl 0:d9266031f832 56 static int count = 0;
mafischl 0:d9266031f832 57 return ++count;
mafischl 0:d9266031f832 58 //return (u32_t) (pTmr->read_us());
mafischl 0:d9266031f832 59 }
mafischl 0:d9266031f832 60
mafischl 0:d9266031f832 61 u32_t sys_now(void)
mafischl 0:d9266031f832 62 {
mafischl 0:d9266031f832 63 return (u32_t) (pTmr->read_ms()); //In /ms units
mafischl 0:d9266031f832 64 }
mafischl 0:d9266031f832 65 #endif
mafischl 0:d9266031f832 66
mafischl 0:d9266031f832 67
mafischl 0:d9266031f832 68 #ifdef __cplusplus
mafischl 0:d9266031f832 69 }
mafischl 0:d9266031f832 70 #endif