ECRobot C++ API for LEGO MINDSTORMS NXT  1.0.10
ecrobot::Clock Class Reference

NXT system clock related class. More...

#include <Clock.h>

List of all members.

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.

Detailed Description

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.


Constructor & Destructor Documentation

Constructor.

System clock is set to 0 when the class object is constructed.

Parameters:
-
Returns:
-

Member Function Documentation

U32 ecrobot::Clock::now ( void  ) const

Get the current system clock in msec.

Parameters:
-
Returns:
Current system clock in msec
void ecrobot::Clock::reset ( void  )

Reset the system clock to 0.

Parameters:
-
Returns:
-
void ecrobot::Clock::sleep ( U32  duration)

Sleep the running Task for duration in msec.

Parameters:
durationSleep duration in msec
Returns:
-
void ecrobot::Clock::wait ( U32  duration)

Wait in a loop for duration in msec.

Parameters:
durationWait duration in msec
Returns:
-

The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Enumerations Enumerator Friends Defines