-
Notifications
You must be signed in to change notification settings - Fork 0
/
MultiRadio_Callback.c
150 lines (104 loc) · 3 KB
/
MultiRadio_Callback.c
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/*
* MultiRadio_Callback.c
*
* Created on: 13 Apr 2018
* Author: TP
*/
#include <string.h>
#include <stdio.h>
#include "MultiRadio_library.h"
/******************************************************
* Macros
******************************************************/
#define BYTE_TO_INT(HMSB, MSB , HLSB , LSB) (LSB)|((HLSB)<<8)|((MSB)<<16)|((MSB)<<24)
/******************************************************
* Type Definitions
******************************************************/
/******************************************************
* Constants
******************************************************/
/******************************************************
* Enumerations
******************************************************/
/******************************************************
* Structures
******************************************************/
/******************************************************
* Static Function Declarations
******************************************************/
/******************************************************
* Variable Definitions
******************************************************/
extern uint8_t ackok_flag;
extern uint8_t ackno_flag;
extern uint8_t wtnup_flag;
extern uint8_t bleup_flag;
extern uint8_t loraup_flag;
/******************************************************
* Function Definitions
******************************************************/
/**
* @brief ACKOK Command Callback
* @param Data received
* @retval None
*/
void clbk_ACKOK (uint8_t * buff) {
printd("ACKOK\n\r");
ackok_flag = TRUE;
};
/**
* @brief ACKOK Command Callback
* @param Data received
* @retval None
*/
void clbk_ACKNO (uint8_t * buff) {
printd("ACKNO\n\r");
ackno_flag = TRUE;
};
/**
* @brief WNTUP Command Callback
* @param Data received
* @retval None
*/
void clbk_WNTUP (uint8_t * buff) {
printd("WNTUP\n\r");
wtnup_flag = TRUE;
};
/**
* @brief WNTDW Command Callback
* @param Data received
* @retval None
*/
void clbk_WNTDW (uint8_t * buff) {
printd("WNTDW\n\r");
wtnup_flag = FALSE;
};
/**
* @brief WTXOK Command Callback
* @param Data received
* @retval None
*/
void clbk_WTXOK (uint8_t * buff) {
};
/**
* @brief WTXNO Command Callback
* @param Data received
* @retval None
*/
void clbk_WTXNO (uint8_t * buff) {
};
/**
* @brief WRXCM Command Callback
* @param Data received
* @retval None
*/
void clbk_WRXCM (uint8_t * buff) {
uint32_t len;
/* packet len*/
len = BYTE_TO_INT(buff[WRXCM_DTS_POS], buff[WRXCM_DTS_POS + 1] ,
buff[WRXCM_DTS_POS + 2 ] , buff[WRXCM_DTS_POS + 3]);
if (WTXCM_DTS_ASSERT(len)){
//HAL_GPIO_TogglePin(LD2_GPIO_Port, LD2_Pin);
}
printd("PACKET RX - LEN : %d \n\r", (int)len);
}