e_agenda_fast.h File Reference

Manage the fast agendas (timer1, 2, 3). More...


Data Structures

struct  AgendaType
 srtuct Agenda as chained list More...
struct  AgendaList
 Manage the differents agendas lists. More...

Defines

#define AG_ALREADY_CREATED   1
#define AG_NOT_FOUND   2

Typedefs

typedef struct AgendaType Agenda

Functions

void e_start_agendas_processing (void)
 Start the agendas processing.
void e_start_timer_processing (int timer)
 Start the timer(s) used.
void e_end_agendas_processing (int timer)
 Stop an agenda running.
void e_configure_timer (int timer)
 Configure the timer(s) used.
void e_activate_agenda (void(*func)(void), unsigned cycle)
 Activate a fast agenda.
void e_activate_motors (void(*func1)(void), void(*func2)(void))
int e_set_motor_speed (void(*func)(void), unsigned cycle)
int e_destroy_agenda (void(*func)(void))
 Destroy an agenda.
int e_set_agenda_cycle (void(*func)(void), unsigned cycle)
int e_reset_agenda (void(*func)(void))
 Reset an agenda's counter.
int e_pause_agenda (void(*func)(void))
 Pause an agenda.
int e_restart_agenda (void(*func)(void))
 Restart an agenda previously paused.


Detailed Description

Manage the fast agendas (timer1, 2, 3).

This module manage the fast agendas with the timer1, 2, 3.

An agenda is a structure made to work as chained list. It containts: the function you want to launch, the time setup between two launching events, a counter to measure the current time, a pointer to the next element of the list.

Each times the timer1, 2, 3 has an interrupt, the corresponding agenda chained list is scanned to look if an agenda has to be treated according to the cycle value and current counter value.

If one (or more) agenda has to be treated, his callback function is launch.

Author:
Code: Julien Hubert
Doc: Jonathan Besuchet

Define Documentation

#define AG_ALREADY_CREATED   1

#define AG_NOT_FOUND   2


Typedef Documentation

typedef struct AgendaType Agenda


Function Documentation

void e_activate_agenda ( void(*)(void)  func,
unsigned  cycle 
)

Activate a fast agenda.

Activate an agenda and allocate memory for him if there isn't already an agenda with the same callback function (the agenda is active but isn't processed if he have a null cycle value).
The appropriate timer is automatically selected.

Parameters:
func function called if the cycle value is reached by the counter
cycle cycle value in millisec/10

void e_activate_motors ( void(*)(void)  func1,
void(*)(void)  func2 
)

void e_configure_timer ( int  timer  ) 

Configure the timer(s) used.

Configure one or all the timers to be used by the agenda

Parameters:
timer the timer's number to configure (between [0-3] with 0 configuring all of them)

int e_destroy_agenda ( void(*)(void)  func  ) 

Destroy an agenda.

Destroy the agenda with a given callback function.

Parameters:
func function to test
Returns:
EXIT_OK if the agenda has been destroyed, AG_NOT_FOUND otherwise
Destroy the agenda with a given callback function
Parameters:
func function to test
Returns:
int return the success of the destruction (EXIT_OK for successfull, AG_NOT_FOUND for unsuccessfull).

void e_end_agendas_processing ( int  timer  ) 

Stop an agenda running.

Stop the agendas running on one particular timer (the memory allocated for the agenda isn't freed, use e_destroy_agenda for that).

Parameters:
timer the timer's number [0-3]. 0 stops all the timers.
See also:
e_destroy_agenda

int e_pause_agenda ( void(*)(void)  func  ) 

Pause an agenda.

Pause an agenda but do not reset its information.

Parameters:
func function to pause
Returns:
EXIT_OK the agenda has been paused, AG_NOT_FOUND otherwise
Pause an agenda but do not reset its information.
Parameters:
func function to pause

int e_reset_agenda ( void(*)(void)  func  ) 

Reset an agenda's counter.

Reset an agenda's counter with a given callback function.

Parameters:
func function to reset
Returns:
EXIT_OK if the cycle of the agenda has been reseted, AG_NOT_FOUND otherwise
Warning:
This function RESET the agenda, if you just want a pause tell e_pause_agenda(void (*func)(void))
See also:
e_pause_agenda
Reset an agenda's counter.

Reset an agenda's counter with a given callback function

Parameters:
func function to reset

int e_restart_agenda ( void(*)(void)  func  ) 

Restart an agenda previously paused.

Restart an agenda previously paused.

Parameters:
func function to restart
Returns:
EXIT_OK if he agenda has been restarted, AG_NOT_FOUND otherwise
See also:
e_pause_agenda
Restart an agenda previously paused
Parameters:
func function to restart

int e_set_agenda_cycle ( void(*)(void)  func,
unsigned  cycle 
)

int e_set_motor_speed ( void(*)(void)  func,
unsigned  cycle 
)

void e_start_agendas_processing ( void   ) 

Start the agendas processing.

Start the agendas processing by starting the Timer2.

Start the agendas processing.

Start the agendas processing by initialising the accounting structures.
Don't activate any timer which is done by e_start_timer_processing.

See also:
e_start_timer_processing

void e_start_timer_processing ( int  timer  ) 

Start the timer(s) used.

Activate one or all the timers to be used by the agenda.

Parameters:
timer the timer's number to activate (between [0-3] with 0 activating all of them)


Generated on Fri Feb 29 14:26:55 2008 for e-puck by  doxygen 1.5.4