-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathL3_timer.cpp
More file actions
35 lines (28 loc) · 729 Bytes
/
L3_timer.cpp
File metadata and controls
35 lines (28 loc) · 729 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "mbed.h"
#include "L3_FSMevent.h"
#include "protocol_parameters.h"
//ARQ retransmission timer
static Timeout timer;
static uint8_t timerStatus = 0;
//timer event : ARQ timeout
void L3_timer_timeoutHandler(void)
{
timerStatus = 0;
//L3_event_setEventFlag(L3_event_arqTimeout);
}
//timer related functions ---------------------------
void L3_timer_startTimer()
{
uint8_t waitTime = 1;//L2_ARQ_MINWAITTIME + rand()%(L2_ARQ_MAXWAITTIME-L2_ARQ_MINWAITTIME); //timer length
timer.attach(L3_timer_timeoutHandler, waitTime);
timerStatus = 1;
}
void L3_timer_stopTimer()
{
timer.detach();
timerStatus = 0;
}
uint8_t L3_timer_getTimerStatus()
{
return timerStatus;
}