aversive_10-03-12/modules/base/time/time.h File Reference

#include <aversive.h>

Go to the source code of this file.

Data Structures

struct  time_h

Typedefs

typedef int32_t seconds
typedef int32_t microseconds

Functions

void time_init (uint8_t priority)
seconds time_get_s (void)
microseconds time_get_us (void)
time_h time_get_time (void)
void time_reset (void)
void time_set (seconds s, microseconds us)
void time_wait_ms (uint16_t ms)
microseconds time_get_us2 (void)


Typedef Documentation

typedef int32_t microseconds

Definition at line 41 of file time.h.

typedef int32_t seconds

This module can be used to get a human readable time. It uses the scheduler module. Its goal is not to be very precise, but just simple to use. provides two timers: one in s and us, and one in us which doesn't overflow on seconds (better to substract two times)

Definition at line 40 of file time.h.


Function Documentation

seconds time_get_s ( void   ) 

get time in second since last init/reset

Definition at line 67 of file time.c.

References IRQ_LOCK, IRQ_UNLOCK, and time_h::s.

Referenced by main().

time_h time_get_time ( void   ) 

get the complete time struct since last init/reset

Definition at line 103 of file time.c.

References IRQ_LOCK, and IRQ_UNLOCK.

microseconds time_get_us ( void   ) 

get time in microsecond since last init/reset

Definition at line 79 of file time.c.

References IRQ_LOCK, IRQ_UNLOCK, and time_h::us.

microseconds time_get_us2 ( void   ) 

get a microsecond timer that overflows naturally

Definition at line 91 of file time.c.

References IRQ_LOCK, and IRQ_UNLOCK.

Referenced by time_wait_ms().

void time_init ( uint8_t  priority  ) 

init time module : schedule the event with the givent priority

Definition at line 58 of file time.c.

References NB_SCHEDULER_UNIT_NOT_NULL, time_increment(), and time_reset().

Referenced by main().

void time_reset ( void   ) 

reset time counter

Definition at line 115 of file time.c.

References IRQ_LOCK, IRQ_UNLOCK, time_h::s, and time_h::us.

Referenced by time_init().

void time_set ( seconds  s,
microseconds  us 
)

set time

Definition at line 126 of file time.c.

References IRQ_LOCK, IRQ_UNLOCK, time_h::s, and time_h::us.

void time_wait_ms ( uint16_t  ms  ) 

This is an equivalent of 'wait_ms(x)', but uses time value, so it is independant of CPU load. Warning, you should not use this function in a irq locked context, or in a scheduled function with higher priority than time module

Definition at line 137 of file time.c.

References time_get_us2().

Referenced by test_sched().


Generated on Fri Mar 12 06:32:05 2010 for AVR by  doxygen 1.5.6