4 // Copyright 2009 by Takashi Chikamasa, Jon C. Martin and Robert W. Kramer
\r
12 #include "ecrobot_interface.h"
\r
13 #include "rtoscalls.h"
\r
19 * NXT system clock related class
\r
21 * [ How to use with TOPPERS/ATK1(OSEK) ]<BR>
\r
22 * I2C (derived/compositted) class and Clock class internally use RTOS features.
\r
23 * Thus, user needs to implement a C function and RTOS provided events.<BR><BR>
\r
24 * + Invoke SleeperMonitor function in user_1msec_isr_type2 hook.<BR>
\r
25 * void user_1ms_isr_type2(void)<BR>
\r
27 * SleeperMonitor(); // needed for I2C devices and Clock class<BR>
\r
30 * + Define EventSleepI2C and EventSleep Events in user oil file.<BR>
\r
31 * EVENT EventSleepI2C<BR>
\r
33 * MASK = AUTO;<BR>
\r
34 * };<BR><BR>
\r
35 * EVENT EventSleep<BR>
\r
37 * MASK = AUTO;<BR>
\r
38 * };<BR><BR>
\r
39 * TASK TaskMain<BR>
\r
41 * AUTOSTART = TRUE<BR>
\r
42 * {<BR>
\r
43 * APPMODE = appmode1;<BR>
\r
44 * };<BR>
\r
45 * PRIORITY = 1;<BR>
\r
46 * ACTIVATION = 1;<BR>
\r
47 * SCHEDULE = FULL;<BR>
\r
48 * STACKSIZE = 512;<BR>
\r
49 * EVENT = EventSleepI2C; <- Here it is<BR>
\r
50 * EVENT = EventSleep; <- Here it is<BR>
\r
51 * };<BR>
\r
53 * [ How to use with TOPPERS/JSP(ITRON) ]<BR>
\r
54 * In case of using this class with TOPPERS/JSP(ITRON), RTOS specific definitions for the class are not needed.
\r
61 * System clock is set to 0 when the class object is constructed.
\r
68 * Reset the system clock to 0.
\r
75 * Get the current system clock in msec.
\r
77 * @return Current system clock in msec
\r
79 U32 now(void) const;
\r
82 * Wait in a loop for duration in msec.
\r
83 * @param duration Wait duration in msec
\r
86 void wait(U32 duration);
\r
89 * Sleep the running Task for duration in msec.
\r
90 * @param duration Sleep duration in msec
\r
93 void sleep(U32 duration);
\r