Difference between revisions of "MansOS Alarm"

From DiLab
Jump to: navigation, search
(New page: __NOTOC__ NOTE: This feature is not implemented as described currently. Older interface version exists. '''Include file:''' #include "alarm.h" == Data types == '''AlarmId_t''' - alarm ...)
 
Line 7: Line 7:
== Data types ==
== Data types ==


'''AlarmId_t'''
'''AlarmId_t''' - alarm handle for identifying the alarm when calling the alarm procedures.
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 ==
== Functions ==


AlarmId_t '''alarmNew'''();
{| border=0 cellspacing=0 cellpadding=4
Create a new alarm. Returns the ID for the new alarm.
! Prototype !! Description

|-

|
void '''alarmSet'''( AlarmId_t id, AlarmType_t type, uint delayInMs, AlarmCb_t callbackFunction );
AlarmId_t alarmNew();
Set the alarm type and time period.
| Create a new alarm. Returns the ID for the new alarm.
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.
void alarmSet( AlarmId_t id, AlarmType_t, uint delayInMs );
| Set the alarm type and time period. Do not start the alarm. Stop the alarm if it is already running.
Stop the alarm if it is already running.

|-

|

void alarmStart( AlarmId_t id );
void '''alarmStart'''( AlarmId_t id );
| Start the alarm. Resets the alarm if it was already running.
Start the alarm. Resets the alarm if it was already running.
|-

|

void alarmStop( AlarmId_t id );
void '''alarmStop'''( AlarmId_t id );
| Stop the alarm. You may start this alarm later again.
Stop the alarm. You may start this alarm later again.
|-

|}

void '''alarmFree'''( AlarmId_t id );
Stops and releases the alarm with this ID.

Revision as of 21:30, 28 August 2010

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.