MansOS Alarm

From DiLab
Revision as of 21:30, 28 August 2010 by Leo (talk | contribs)
Jump to: navigation, search

NOTE: This feature is not implemented as described currently. Older interface version exists.

Include file:

#include "alarm.h"

Data types

AlarmId_t

Handle (ID) for identifying the alarm when calling the alarm procedures.

AlarmCb_t

Alarm callback function pointer. Points to a function that will be called when the alarm event occurs.


Constants

typedef enum {
  ALARM_TYPE_ONESHOOT = 0x01,   // fires the alarm once
  ALARM_TYPE_REPEAT   = 0x02,   // fires the alarm repeatedly until stopped
  ALARM_TYPE_STARTNOW = 0x04,   // Starts the timer now.
} AlarmType_t;

Functions

AlarmId_t alarmNew();

Create a new alarm. Returns the ID for the new alarm.


void alarmSet( AlarmId_t id, AlarmType_t type, uint delayInMs, AlarmCb_t callbackFunction );

Set the alarm type and time period. Set the callback function, unless NULL. When NULL, leave the old callback function.

Do not start the alarm unless ALARM_TYPE_STARTNOW is added to the type. Stop the alarm if it is already running.


void alarmStart( AlarmId_t id );

Start the alarm. Resets the alarm if it was already running.


void alarmStop( AlarmId_t id );

Stop the alarm. You may start this alarm later again.


void alarmFree( AlarmId_t id );

Stops and releases the alarm with this ID.