AllWize Library
main.cpp
Go to the documentation of this file.
1 /*
2 
3 AllWize - LoRaWAN Packet Forwarder
4 
5 Listens to messages on the same channel, data rate and CF and
6 forwards them to a LoRaWAN 1.X server using
7 Semtech legacy packet format
8 
9 Copyright (C) 2018-2020 by AllWize <github@allwize.io>
10 
11 This program is free software: you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
15 
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU Lesser General Public License for more details.
20 
21 You should have received a copy of the GNU Lesser General Public License
22 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 
24 */
25 
26 #if not defined(ARDUINO_ARCH_ESP8266)
27  #error "This example is meant to run on an ESP8266 board!"
28 #endif
29 
30 #include "configuration.h"
31 #include "debug.h"
32 #include "wifi.h"
33 #include "wize.h"
34 #include "ntp.h"
35 #include "forwarder.h"
36 
37 // -----------------------------------------------------------------------------
38 // Main
39 // -----------------------------------------------------------------------------
40 
41 void setup() {
42 
43  // Setup debug
44  debugSetup();
45 
46  // Init radio
47  wizeSetup();
48 
49  // Setup NTP client
50  ntpSetup();
51 
52  // Init Packet Forwarder
54 
55  // Connect to wifi
56  wifiSetup();
57  wifiConnect();
58 
59 }
60 
61 void loop() {
62 
63  // Listen to messages
64  wizeLoop();
65 
66  // Keep NTP time up to date
67  ntpLoop();
68 
69  yield();
70 
71 }
void ntpLoop()
Definition: ntp.cpp:60
void wizeLoop()
Definition: wize.cpp:66
void forwarderSetup()
Definition: forwarder.cpp:118
void loop()
Definition: main.cpp:61
void setup()
Definition: main.cpp:41
void debugSetup()
Definition: debug.cpp:11
void ntpSetup()
Definition: ntp.cpp:43
void wifiConnect()
Definition: wifi.cpp:23
void wifiSetup()
Definition: wifi.cpp:40
void wizeSetup()
Definition: wize.cpp:24