forked from haraldwolff/avr-fw-modules
33 lines
497 B
C
33 lines
497 B
C
|
#include <hwo/events.h>
|
||
|
#include <sys/atomic.h>
|
||
|
#include <hwo/systick.h>
|
||
|
#include <hwo/threads.h>
|
||
|
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
#include <sys/errno.h>
|
||
|
|
||
|
LIST(_ev_head);
|
||
|
|
||
|
EVENT *_ev_cleanup;
|
||
|
|
||
|
THREAD *eventWaiter;
|
||
|
|
||
|
/*! \brief Trägt einen Event in Eventliste ein und weckt einen wartenden Thread auf.
|
||
|
*
|
||
|
*/
|
||
|
int event_append(EVENT *event)
|
||
|
{
|
||
|
ATOMIC
|
||
|
|
||
|
event->time = systick_ticks();
|
||
|
|
||
|
list_append( &(event->list), &_ev_head );
|
||
|
if (eventWaiter) {
|
||
|
thread_wake(eventWaiter);
|
||
|
};
|
||
|
return ESUCCESS;
|
||
|
};
|
||
|
|
||
|
|