-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiot_board.h
66 lines (51 loc) · 1.89 KB
/
iot_board.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
#pragma once
#include <Arduino.h>
#include <SPI.h>
#include "pins.h"
#include "./buttons/buttons.h"
#include "./display/display.h"
#include "./zigbee/zigbee.h"
#include "./lora/lora_dev.h"
#include "./lorawan/lorawan.h"
#include "./lorawan/packet/LoRaWanPacket.h"
extern Buttons *buttons;
extern SPIClass *radios_spi;
extern Display *display;
extern Zigbee *zigbee;
extern LoRaClass *lora;
extern LoRaWANClass *lorawan;
class IoTBoardClass{
public:
IoTBoardClass(){};
void init_serial(uint baudrate=115200);
void init_leds();
void init_buttons();
bool init_display();
void init_spi(uint8_t spiInterface=HSPI);
bool init_zigbee();
bool init_lora();
bool init_lorawan();
static IoTBoardClass* get_instance(){
if(_instance == nullptr){
_instance = new IoTBoardClass();
}
return _instance;
};
protected:
private:
static IoTBoardClass* _instance;
bool isSPIActivated = false;
bool isZigbeeActivated = false;
bool isLoRaActivated = false;
bool isLoRaWANActivated = false;
};
namespace IoTBoard{
inline void init_serial(uint baudrate=115200){ IoTBoardClass::get_instance()->init_serial(baudrate);};
inline void init_leds(){ IoTBoardClass::get_instance()->init_leds();};
inline void init_buttons(){ IoTBoardClass::get_instance()->init_buttons();};
inline bool init_display(){ return IoTBoardClass::get_instance()->init_display();};
inline void init_spi(uint8_t spiInterface=HSPI){ IoTBoardClass::get_instance()->init_spi(spiInterface);};
inline bool init_zigbee(){ return IoTBoardClass::get_instance()->init_zigbee();};
inline bool init_lora(){ return IoTBoardClass::get_instance()->init_lora();};
inline bool init_lorawan(){ return IoTBoardClass::get_instance()->init_lorawan();};
}