NNP STM Generic Remote Module git-main
Loading...
Searching...
No Matches
timer.h
Go to the documentation of this file.
1
8#ifndef INC_TIMER_H_
9#define INC_TIMER_H_
10
11
12#include "timerscfg.h"
13#include "applicfg.h"
14
15#define TIMER_HANDLE INTEGER16
16#define TASK_HANDLE INTEGER16
17
18#include <can_stm.h>
19
20/* --------- types and constants definitions --------- */
21#define TIMER_FREE 0 // timer is available for use
22#define TIMER_ARMED 1 // row is active
23#define TIMER_TRIG 2 // timer has been triggered
24#define TIMER_TRIG_PERIOD 3
25
26#define TIMER_NONE -1
27
28typedef void (*TimerCallback_t)(CO_Data* d, UNS32 id);
29
34 UNS8 state;
35 CO_Data* d;
36 TimerCallback_t callback;
38 TIMEVAL val;
39 TIMEVAL interval;
40};
41
43
44/****************Variables****************************/
45extern unsigned char osc_value;
46
47/* --------- prototypes --------- */
48TIMER_HANDLE SetAlarm(CO_Data* d, UNS32 id, TimerCallback_t callback, TIMEVAL value, TIMEVAL period);
49TIMER_HANDLE DelAlarm(TIMER_HANDLE handle);
50void TimeDispatch(void);
51
52//for timer_stm.c
53void setTimer(TIMEVAL value);
54TIMEVAL getElapsedTime(void);
55
56UNS8 isTimedOut( UNS32 *tRef, UNS32 tAlarm );
57void resetTimeOut( UNS32 *tRef );
58
59#endif /* INC_TIMER_H_ */
#define UNS8
Unsigned int8 representation in CANFest.
Definition applicfg.h:25
#define UNS32
Unsigned int32 representation in CANFest.
Definition applicfg.h:27
TIMER_HANDLE SetAlarm(CO_Data *d, UNS32 id, TimerCallback_t callback, TIMEVAL value, TIMEVAL period)
Set an alarm to execute a callback function when expired.
Definition timer.c:37
TIMER_HANDLE DelAlarm(TIMER_HANDLE handle)
Delete an alarm before expiring.
Definition timer.c:83
void TimeDispatch(void)
TimeDispatch is called on each timer expiration -—.
Definition timer.c:102
This structure contains all necessary informations to define a CANOpen node.
Definition data.h:44
timer struct
Definition timer.h:33
TimerCallback_t callback
Definition timer.h:36
TIMEVAL interval
Definition timer.h:39
UNS32 id
Definition timer.h:37
TIMEVAL val
Definition timer.h:38
UNS8 isTimedOut(UNS32 *tRef, UNS32 tAlarm)
Checks if a timer has timed out.
Definition timer_stm.c:41
TIMEVAL getElapsedTime(void)
Return the elapsed time to tell the Stack how much time is spent since last call.
Definition timer_stm.c:65
void resetTimeOut(UNS32 *tRef)
Resets a timed out timer.
Definition timer_stm.c:56
void setTimer(TIMEVAL value)
Set the timer peripheral for the next interrupt.
Definition timer_stm.c:23