COSA
An Object-Oriented Platform for Arduino Programming
RTT::Clock Class Reference

#include <RTT.hh>

Inheritance diagram for RTT::Clock:
Inheritance graph
Collaboration diagram for RTT::Clock:
Collaboration graph

Public Member Functions

 Clock ()
 
virtual uint32_t time ()
 
void time (uint32_t sec)
 
uint32_t await ()
 
void tick (uint16_t ms)
 
void calibration (int16_t ms)
 
int16_t calibration ()
 
void adjust (int16_t ms)
 
virtual bool start (Job *job)
 
virtual bool stop (Job *job)
 
virtual void dispatch ()
 

Protected Attributes

int16_t m_msec
 Milli-seconds fraction. More...
 
uint32_t m_sec
 Seconds counter. More...
 
int16_t m_cal
 Milli-seconds calibration. More...
 
Head m_queue
 

Detailed Description

RTT Clock for seconds level time base.

Definition at line 186 of file RTT.hh.

Constructor & Destructor Documentation

RTT::Clock::Clock ( )
inline

Construct and register a RTT Clock. Should be a singleton.

Definition at line 191 of file RTT.hh.

Member Function Documentation

void Clock::adjust ( int16_t  ms)
inlineinherited

Adjust clock calibration with given number of milli-seconds.

Parameters
[in]msmilli-seconds.
Note
atomic

Definition at line 136 of file Clock.hh.

uint32_t Clock::await ( )
inlineinherited

Synchronize with clock by waiting for next clock update. Returns clock time in seconds.

Returns
seconds.

Definition at line 77 of file Clock.hh.

void Clock::calibration ( int16_t  ms)
inlineinherited

Set clock calibration to given number of milli-seconds to adjust by per second.

Parameters
[in]msmilli-seconds.
Note
atomic

Definition at line 114 of file Clock.hh.

int16_t Clock::calibration ( )
inlineinherited

Get current clock calibration in milli-seconds.

Returns
calibration.
Note
atomic

Definition at line 124 of file Clock.hh.

void Job::Scheduler::dispatch ( )
virtualinherited

Dispatch expired jobs. This member function is typically called from an interrupt service routine.

Reimplemented in RTT::Scheduler.

Definition at line 53 of file Job_Scheduler.cpp.

bool Job::Scheduler::start ( Job job)
virtualinherited

Start given job. Returns true(1) if successful otherwise false(0).

Parameters
[in]jobto start.
Returns
bool.

Reimplemented in RTT::Scheduler.

Definition at line 24 of file Job_Scheduler.cpp.

bool Job::Scheduler::stop ( Job job)
virtualinherited

Stop given job. Returns true(1) if successful otherwise false(0).

Parameters
[in]jobto stop.
Returns
bool.

Definition at line 44 of file Job_Scheduler.cpp.

void Clock::tick ( uint16_t  ms)
inlineinherited

Increment the clock with the given number of milli-seconds. Dispatch jobs if the clock seconds counter is incremented.

Parameters
[in]msmilli-seconds in a tick.
Note
atomic

Definition at line 94 of file Clock.hh.

virtual uint32_t Clock::time ( )
inlinevirtualinherited

Return clock time in seconds.

Returns
seconds.
Note
atomic

Implements Job::Scheduler.

Definition at line 51 of file Clock.hh.

void Clock::time ( uint32_t  sec)
inlineinherited

Set clock (seconds) to real-time (for instance seconds from a given date; epoch 1900-01-01 00:00 or 1970-01-01 00:00).

Parameters
[in]sec.
Note
atomic

Definition at line 64 of file Clock.hh.

Member Data Documentation

int16_t Clock::m_cal
protectedinherited

Milli-seconds calibration.

Definition at line 144 of file Clock.hh.

int16_t Clock::m_msec
protectedinherited

Milli-seconds fraction.

Definition at line 142 of file Clock.hh.

Head Job::Scheduler::m_queue
protectedinherited

Job queue.

Definition at line 84 of file Job.hh.

uint32_t Clock::m_sec
protectedinherited

Seconds counter.

Definition at line 143 of file Clock.hh.


The documentation for this class was generated from the following file: