Timer API for Robolocust's iRobot Create Command Module control program. More...
#include "LoTimer.h"
#include <avr/interrupt.h>
#include <avr/io.h>
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 |
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.
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 | ) |
void lo_setup_timer | ( | unsigned int | ms | ) |
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 | ) |
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().