Friedrich-Alexander-Universität UnivisSuche FAU-Logo
Techn. Fakultšt Willkommen am Department Informatik FAU-Logo
Logo I4
Lehrstuhl für Informatik 4
    - UnivIS-Infos
    - Inhalt
    - Folien
    - UnivIS-Infos
    - Inhalt
    - Ergänzendes Material
    - Aufgaben
    - libspicboard-Doku
    - FSI-Forum für Fragen
Department Informatik  >  Informatik 4  >  Lehre  >  SS 2010  >  GSPiC  >  Übungen  >  Doku  >  libspicboard: Timer module

SPiCboard library (libspicboard, revision 3032) API documentation

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

Timer module


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


typedef struct ALARM ALARM
 ALARM type.
typedef void(* alarmcallback_t )(void)
 Type for alarm callback 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.

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.

alrm identifier of the alarm that should be canceled
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.

The CPU is set in sleep mode while waiting.

waittime wait time in ms
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
See also:

void sb_timer_delay_abort (  ) 

Aborts an active sb_timer_delay.

This function must be invoked on the ISR level.

See also:

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

Create a new alarm.

This function can be used to set single shot, as well as repeating timers. The function uses the malloc-function. Therefore setting too many alarms in parallel may cause unexpected behavior.

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. If set to 0 cycle time will be used.
cycle time in ms for alarms that periodically expire after the first regular expiry. Set to 0 for single shot timers.
the identifier of the alarm, or NULL if creating the alarm failed.
Canceling a timer twice or canceling a single shot timer after its expiry may cause unexpected results.
See also:

  Impressum   Datenschutz Stand: 2010-07-02 13:45   MS