-
Notifications
You must be signed in to change notification settings - Fork 32
/
LoRaCom.h
76 lines (69 loc) · 2.16 KB
/
LoRaCom.h
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
/**
* This file is part of Wio LoRaWan Field Tester.
*
* Wio LoRaWan Field Tester is free software created by Paul Pinault aka disk91.
* You can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* Wio LoRaWan Field Tester is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Wio LoRaWan Field Tester. If not, see <https://www.gnu.org/licenses/>.
*
* Author : Paul Pinault (disk91.com)
*/
#ifndef __LORACOM_H__
#define __LORACOM_H__
#define MAX_RETRY 5
typedef struct {
uint8_t deveui[8];
uint8_t appeui[8];
uint8_t appkey[16];
uint8_t zone;
} loraConf_t;
extern loraConf_t loraConf;
void loraSetup(void);
void do_send(uint8_t port, uint8_t * data, uint8_t sz, uint8_t _dr, uint8_t pwr, bool acked, uint8_t retries );
void loraLoop(void);
boolean canLoraSleep(void);
boolean canLoRaSend();
uint32_t nextPossibleSendMs();
bool processLoRaConfig(void);
#if HWTARGET == LORAE5
bool storeOneByte(uint8_t adr, uint8_t v);
bool readOneByte(uint8_t adr, uint8_t * v);
bool loraQuickSetup();
#endif
#define ZONE_UNDEFINED 0
#define ZONE_EU868 1
#define ZONE_US915 2
#define ZONE_AS923_1 3
#define ZONE_AS923_2 4
#define ZONE_AS923_3 5
#define ZONE_AS923_4 6
#define ZONE_KR920 7
#define ZONE_IN865 8
#define ZONE_AU915_2 9
#define ZONE_US915_1 10
#define ZONE_US915_3 11
#define ZONE_US915_4 12
#define ZONE_US915_5 13
#define ZONE_US915_6 14
#define ZONE_US915_7 15
#define ZONE_US915_8 16
#define ZONE_AU915_1 17
#define ZONE_AU915_3 18
#define ZONE_AU915_4 19
#define ZONE_AU915_5 20
#define ZONE_AU915 21
#define ZONE_AU915_7 22
#define ZONE_AU915_8 23
#define ZONE_LATER 99
#define ZONE_MAX ZONE_AU915_8
#define ZONE_MIN ZONE_EU868
#endif