Friedrich-Alexander-Universität UnivisSuche FAU-Logo
Techn. Fakultät Willkommen am Department Informatik FAU-Logo
Logo I4
Lehrstuhl für Informatik 4
SPiC
 
  Übungen
  Dokumentation
  Evaluation
  Prüfungsinformationen
  protected area Intern
Übungen
  Anmeldung
  Folien
  Aufgaben
Department Informatik  >  Informatik 4  >  Lehre  >  WS 2009/10  >  SPiC  >  Übung  >  Doku  >  libspicboard: timer.h File Reference

libspicboard (Revision 149) API documentation

Found a bug or something ambiguous? Mail us to get it fixed!

timer.h File Reference

The timer module provides an event interface to the hardware timers. More...

#include <stdint.h>

Go to the source code of this file.

Typedefs

typedef struct ALARM ALARM
 ALARM type.
typedef void(* alarmcallback_t )(void)
 Type for alarm callback functions.

Functions

int8_t sb_timer_cancelAlarm (ALARM *alrm)
 Cancel an alarm.
ALARMsb_timer_setAlarm (alarmcallback_t callback, uint16_t alarmtime, uint16_t cycle)
 Create a new alarm.
int8_t sb_timer_delay (uint16_t waittime)
 waits for a specific number of ms
void sb_timer_delay_abort ()
 Aborts an active sb_timer_delay.


Detailed Description

The timer module provides an event interface to the hardware timers.

Version:
$Rev: 149 $
The module uses the 16-bit timer 1 of the ATmega32. The timer is dynamically configured as needed by the registered alarms and should always be clocked as slow as possible to keep the interrupt load low. When no alarms are registered, the timer clock is disabled.

The timer module uses dynamic memory management (malloc/free) for the allocation of the ALARM types.


Typedef Documentation

typedef void(* alarmcallback_t)(void)

Type for alarm callback functions.

Alarm callback functions are invoked on the interrupt level whenever the associated alarm expires. The programming model for callback functions is similar to that of interrupt service routines.


Function Documentation

int8_t sb_timer_cancelAlarm ( ALARM alrm  ) 

Cancel an alarm.

Parameters:
alrm identifier of the alarm that should be canceled
Returns:
0 on success, -1 if an error occurred.

int8_t sb_timer_delay ( uint16_t  waittime  ) 

waits for a specific number of ms

This function must not be invoked with interrupts disabled, i.e. from an interrupt handler (or generally, from the ISR level) or a critical section of the application.

Parameters:
waittime wait time in ms
Returns:
0 on success, negative value if a error occurred.
Return values:
0 success
-1 alarm could not be activated
-2 sb_timer_delay invoked while interrupts disabled

void sb_timer_delay_abort (  ) 

Aborts an active sb_timer_delay.

This function must be invoked on the ISR level.

ALARM* sb_timer_setAlarm ( alarmcallback_t  callback,
uint16_t  alarmtime,
uint16_t  cycle 
)

Create a new alarm.

Parameters:
callback callback function that will be invoked whenever the alarm expires
alarmtime time in ms relative to the current time when the alarm shall expire the first time
cycle cycle time in ms for alarms that periodically expire after the first regular expiry
Returns:
the identifier of the alarm, or NULL if creating the alarm failed.

  Impressum   Datenschutz Stand: 2009-05-18 11:24   MS