ioLibrary for Cortex M series
Functions
Collaboration diagram for Alarm:

Functions

int8_t alarm_set (uint32_t time, alarm_cbfunc cb, int8_t arg)
 
int8_t alarm_del (alarm_cbfunc cb, int8_t arg)
 
int8_t alarm_chk (alarm_cbfunc cb, int8_t arg)
 
void alarm_run (void)
 

Detailed Description

Event Alarm Module. You can register delayed action through Alarm Module.

Function Documentation

int8_t alarm_set ( uint32_t  time,
alarm_cbfunc  cb,
int8_t  arg 
)

Add Alarm event to the waiting queue.

Parameters
timeDelay time in tick.
Max time is defined in common.h
Zero time param is possible
cbCallback function in alarm_cbfunc form
argThe value which will be returned through callback function
This is for separation in same callback function
Returns
RET_OK: Success
RET_NOK: Error

Definition at line 78 of file util.c.

References alarm_node_t::arg, alarm_node_t::cb, ERRA, MAX_TICK_ELAPSE, alarm_node_t::next, RET_NOK, RET_OK, alarm_node_t::time, and wizpf_get_systick().

int8_t alarm_del ( alarm_cbfunc  cb,
int8_t  arg 
)

Delete Alarm event from the waiting queue. This function delete every alarm event which have same condition with param

  • alarm_del(NULL, -1) : Delete all event registered in the queue.
Parameters
cbCallback function in alarm_cbfunc form
NULL value will be ignored
argThe value which was set when alarm event added as arg
-1 value will be ignored
Returns
RET_OK: Success
RET_NOK: Error

Definition at line 119 of file util.c.

References alarm_node_t::arg, alarm_node_t::cb, DBGA, and alarm_node_t::next.

int8_t alarm_chk ( alarm_cbfunc  cb,
int8_t  arg 
)

Count Alarm event which have same condition with param from the waiting queue. If there is not alarm event same with param, 0 value will be returned.

  • alarm_chk(NULL, -1) : Count all event registered in the queue.
Parameters
cbCallback function in alarm_cbfunc form
NULL value will be ignored
argThe value which was set when alarm event added as arg
-1 value will be ignored
Returns
RET_OK: Success
RET_NOK: Error

Definition at line 151 of file util.c.

References DBGA, and alarm_node_t::next.

void alarm_run ( void  )

Alarm Module Handler. If you use alarm, this function should run in the main loop

Definition at line 173 of file util.c.

References alarm_node_t::arg, alarm_node_t::cb, alarm_node_t::next, alarm_node_t::time, and wizpf_tick_elapse().