LoTimer.c File Reference

Timer API for Robolocust's iRobot Create Command Module control program. More...

#include "LoTimer.h"
#include <avr/interrupt.h>
#include <avr/io.h>
Include dependency graph for LoTimer.c:

Go to the source code of this file.

Classes

struct  cb_list

Enumerations

enum  { LOBOT_MAX_TIMER_CALLBACKS = 5 }

Functions

static void timer1_init (void)
static void timer10_init (void)
void lo_init_timer (void)
void lo_add_timer1_cb (TimerCallback t)
void lo_add_timer10_cb (TimerCallback t)
static void trigger_callbacks (volatile cb_list *callbacks)
 ISR (TIMER0_COMPA_vect)
 ISR (TIMER2_COMPA_vect)
unsigned long lo_ticks (void)
void lo_setup_timer (unsigned int ms)
 Setup a stop watch for the specified number of milliseconds.
char lo_timer_is_running ()
 Check if a stop watch is running.
void lo_wait (unsigned int ms)
 Busy wait for the specified number of milliseconds.

Variables

static volatile unsigned long g_total_ticks
static volatile unsigned int g_stop_watch_ticks
static volatile char g_stop_watch_running
static volatile cb_list g_timer1_callbacks
static volatile cb_list g_timer10_callbacks

Detailed Description

Timer API for Robolocust's iRobot Create Command Module control program.

This file defines the functions and variables used to implement the API for "generalized" one and ten millisecond timers for the iRobot Create Command Module control program used by Robolocust. This API provides a means for other parts of the control program to setup "stop clocks" and perform whatever operations they need while this stop clock ticks away. Additionally, these timers are "generalized" in the sense that client modules may register arbitrary callback functions that will be triggered each time the timer ISR kicks in.

Definition in file LoTimer.c.


Function Documentation

void lo_add_timer10_cb ( TimerCallback   ) 

This function adds a timer callback to the 10ms timer's callback list.

NOTE: A maximum of 10 such callbacks are supported.

Definition at line 297 of file LoTimer.c.

Referenced by lo_init_drive().

void lo_add_timer1_cb ( TimerCallback   ) 

This function adds a timer callback to the 1ms timer's callback list.

NOTE: A maximum of 10 such callbacks are supported.

Definition at line 290 of file LoTimer.c.

Referenced by lo_init_sensors().

void lo_init_timer ( void   ) 

This function sets up the ATmega's two 8-bit timers, one to fire every millisecond and the other to fire every ten milliseconds. Client modules can then register their timer callbacks to take advantage of the asynchrony supported by the ATmega128.

Definition at line 283 of file LoTimer.c.

void lo_setup_timer ( unsigned int  ms  ) 

Setup a stop watch for the specified number of milliseconds.

Definition at line 351 of file LoTimer.c.

Referenced by lo_rx().

unsigned long lo_ticks ( void   ) 

Return the current total number of milliseconds that have elapsed since the low-level controller's 1ms timer was setup.

Definition at line 345 of file LoTimer.c.

Referenced by lo_remote().

char lo_timer_is_running ( void   ) 

Check if a stop watch is running.

Definition at line 358 of file LoTimer.c.

Referenced by lo_rx().

void lo_wait ( unsigned int  ms  ) 

Busy wait for the specified number of milliseconds.

Definition at line 364 of file LoTimer.c.

Referenced by lo_backup(), lo_init_beeps(), lo_io_to_usb(), lo_reset_baud(), and lo_spin().

Generated on Sun May 8 08:42:49 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3