core/time/timer.h File Reference

Go to the source code of this file.

Defines

#define TIMER_ZERO   0
#define TIMER_ONE   1
#define SYSTEM_TIMER   TIMER_ONE

Typedefs

typedef void(* timer_10ms_hook_t )(void)

Functions

void timer_wait_ms (uint32_t delay_ms)
void timer_set_10ms_hook (timer_10ms_hook_t f)
bool_t timer_init (uint8_t timer_num, uint32_t interval)
void timer_enable (uint8_t timer_num)
void timer_disable (uint8_t timer_num)
void timer_reset (uint8_t timer_num)
uint32_t timer_get_count (uint8_t timer_num)
void timer_set_count (uint8_t timer_num, uint32_t val)
uint32_t timer_get_system_count (void)
void timer_set_system_count (uint32_t val)
uint32_t timer_get_10ms_counter (void)

Variables

volatile uint32_t timer0_counter
volatile uint32_t timer1_counter

Detailed Description

Definitions for timer0, timer1 and the system timer.

The system timer is supposed to run at 1 kHz.

A 100 Hz counter is available too.

Definition in file timer.h.


Function Documentation

void timer_disable ( uint8_t  timer_num  ) 

Disable a timer.

Parameters:
timer_num Number (0,1) of timer to enable.

Definition at line 109 of file timer.c.

void timer_enable ( uint8_t  timer_num  ) 

Enable a timer.

Parameters:
timer_num Number (0,1) of timer to enable.

Definition at line 91 of file timer.c.

uint32_t timer_get_10ms_counter ( void   )  [inline]

Get the value of the 10 ms tick counter.

Returns:
The value of the 10 ms tick counter.

Definition at line 239 of file timer.c.

uint32_t timer_get_count ( uint8_t  timer_num  ) 

Get the value of a timer counter.

Parameters:
timer_num Number (0,1) of timer to get count of.

Definition at line 184 of file timer.c.

uint32_t timer_get_system_count ( void   )  [inline]

Get the value of the system timer counter.

Returns:
The value of the system timer counter.

Definition at line 209 of file timer.c.

bool_t timer_init ( uint8_t  timer_num,
uint32_t  interval 
)

Initialize a timer.

Parameters:
timer_num Number (0,1) of timer to initialize.
interval Timer interval in clock ticks.
Returns:
true on success, false if the interrupt handler could not be installed.

Definition at line 154 of file timer.c.

void timer_reset ( uint8_t  timer_num  ) 

Reset a timer.

Parameters:
timer_num Number (0,1) of timer to enable.

Definition at line 127 of file timer.c.

void timer_set_10ms_hook ( timer_10ms_hook_t  f  ) 

Set 10 ms hook for system timer.

Parameters:
f Address of the hook function.

Definition at line 250 of file timer.c.

void timer_set_count ( uint8_t  timer_num,
uint32_t  val 
)

Set the value of a timer counter.

Parameters:
timer_num Number (0,1) of timer to set count of.
val New value for the counter.

Definition at line 197 of file timer.c.

void timer_set_system_count ( uint32_t  val  )  [inline]

Set the value of the system timer counter.

Parameters:
val The new value of the system timer counter.

Definition at line 224 of file timer.c.

void timer_wait_ms ( uint32_t  delay_ms  ) 

Wait for a specified number of milliseconds.

Parameters:
delay_ms The time to wait in milliseconds (ms).

Definition at line 261 of file timer.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Defines

Generated by  doxygen 1.6.2