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. | |
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.
| #define AG_ALREADY_CREATED 1 |
| #define AG_NOT_FOUND 2 |
| typedef struct AgendaType Agenda |
| 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.
| 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
| 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.
| func | function to test |
| func | function to test |
| 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).
| timer | the timer's number [0-3]. 0 stops all the timers. |
| int e_pause_agenda | ( | void(*)(void) | func | ) |
Pause an agenda.
Pause an agenda but do not reset its information.
| func | function to pause |
| 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.
| func | function to reset |
Reset an agenda's counter with a given callback function
| func | function to reset |
| int e_restart_agenda | ( | void(*)(void) | func | ) |
Restart an agenda previously paused.
Restart an agenda previously paused.
| func | function to restart |
| 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.
| void e_start_timer_processing | ( | int | timer | ) |
Start the timer(s) used.
Activate one or all the timers to be used by the agenda.
| timer | the timer's number to activate (between [0-3] with 0 activating all of them) |
1.5.4