ECRobot C++ API for LEGO MINDSTORMS NXT
1.0.10
|
NXT system clock related class. More...
#include <Clock.h>
Public Member Functions | |
Clock (void) | |
Constructor. | |
void | reset (void) |
Reset the system clock to 0. | |
U32 | now (void) const |
Get the current system clock in msec. | |
void | wait (U32 duration) |
Wait in a loop for duration in msec. | |
void | sleep (U32 duration) |
Sleep the running Task for duration in msec. |
NXT system clock related class.
[ How to use with TOPPERS/ATK1(OSEK) ]
I2C (derived/compositted) class and Clock class internally use RTOS features. Thus, user needs to implement a C function and RTOS provided events.
+ Invoke SleeperMonitor function in user_1msec_isr_type2 hook.
void user_1ms_isr_type2(void)
{
SleeperMonitor(); // needed for I2C devices and Clock class
}
+ Define EventSleepI2C and EventSleep Events in user oil file.
EVENT EventSleepI2C
{
MASK = AUTO;
};
EVENT EventSleep
{
MASK = AUTO;
};
TASK TaskMain
{
AUTOSTART = TRUE
{
APPMODE = appmode1;
};
PRIORITY = 1;
ACTIVATION = 1;
SCHEDULE = FULL;
STACKSIZE = 512;
EVENT = EventSleepI2C; <- Here it is
EVENT = EventSleep; <- Here it is
};
[ How to use with TOPPERS/JSP(ITRON) ]
In case of using this class with TOPPERS/JSP(ITRON), RTOS specific definitions for the class are not needed.
ecrobot::Clock::Clock | ( | void | ) |
Constructor.
System clock is set to 0 when the class object is constructed.
- |
U32 ecrobot::Clock::now | ( | void | ) | const |
Get the current system clock in msec.
- |
void ecrobot::Clock::reset | ( | void | ) |
Reset the system clock to 0.
- |
void ecrobot::Clock::sleep | ( | U32 | duration | ) |
Sleep the running Task for duration in msec.
duration | Sleep duration in msec |
void ecrobot::Clock::wait | ( | U32 | duration | ) |
Wait in a loop for duration in msec.
duration | Wait duration in msec |