-
Notifications
You must be signed in to change notification settings - Fork 2
/
hb_rf.c
45 lines (37 loc) · 1018 Bytes
/
hb_rf.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
#include "hb_rf.h"
///////////////////////////// RF functions /////////////////////////////////
hb_rf_code_t hb_rf_code_from_u8(uint8_t rf_code) {
switch (rf_code) {
#define XX(_code, name, desc) \
case _code: \
return HB_RF_CODE_##name;
HB_RF_CODE_MAP(XX)
#undef XX
default:
return HB_RF_CODE_INVALID;
}
}
const char* hb_rf_code_to_string(hb_rf_code_t rf_code) {
switch (rf_code) {
#define XX(_code, name, desc) \
case HB_RF_CODE_##name: \
return #name;
HB_RF_CODE_MAP(XX)
#undef XX
default:
return "Unkown hb_rf_code_t";
}
}
#if HB_ENABLE_CHINESE
const char* hb_rf_code_to_string_chinese(hb_rf_code_t rf_code) {
switch (rf_code) {
#define XX(_code, name, desc) \
case HB_RF_CODE_##name: \
return desc;
HB_RF_CODE_MAP(XX)
#undef XX
default:
return "未知无线码";
}
}
#endif /* HB_ENABLE_CHINESE */