1
1
#include " Arduino_BHY2Host.h"
2
2
3
3
#include " EslovHandler.h"
4
- #include " BLEHandler.h"
5
4
#include " sensors/SensorManager.h"
6
5
7
6
Arduino_BHY2Host::Arduino_BHY2Host () :
@@ -20,10 +19,17 @@ bool Arduino_BHY2Host::begin(bool passthrough, NiclaWiring niclaConnection)
20
19
_passthrough = passthrough;
21
20
_wiring = niclaConnection;
22
21
if (niclaConnection == NICLA_VIA_BLE) {
22
+ #ifdef __BHY2_HOST_BLE_SUPPORTED__
23
23
if (_debug) {
24
24
_debug->println (" NICLA_VIA_BLE selected" );
25
25
}
26
26
return bleHandler.begin ();
27
+ #else
28
+ if (_debug) {
29
+ _debug->println (" Unsupported board!" );
30
+ }
31
+ return false ;
32
+ #endif
27
33
}
28
34
if (niclaConnection == NICLA_AS_SHIELD) {
29
35
eslovHandler.niclaAsShield ();
@@ -34,7 +40,9 @@ bool Arduino_BHY2Host::begin(bool passthrough, NiclaWiring niclaConnection)
34
40
void Arduino_BHY2Host::update ()
35
41
{
36
42
if (_wiring == NICLA_VIA_BLE) {
43
+ #ifdef __BHY2_HOST_BLE_SUPPORTED__
37
44
bleHandler.update ();
45
+ #endif
38
46
} else {
39
47
if (_passthrough){
40
48
eslovHandler.update ();
@@ -57,7 +65,9 @@ void Arduino_BHY2Host::update(unsigned long ms)
57
65
void Arduino_BHY2Host::configureSensor (SensorConfigurationPacket& config)
58
66
{
59
67
if (_wiring == NICLA_VIA_BLE) {
68
+ #ifdef __BHY2_HOST_BLE_SUPPORTED__
60
69
bleHandler.writeConfigPacket (config);
70
+ #endif
61
71
} else {
62
72
eslovHandler.writeConfigPacket (config);
63
73
}
@@ -70,7 +80,9 @@ void Arduino_BHY2Host::configureSensor(uint8_t sensorId, float sampleRate, uint3
70
80
config.sampleRate = sampleRate;
71
81
config.latency = latency;
72
82
if (_wiring == NICLA_VIA_BLE) {
83
+ #ifdef __BHY2_HOST_BLE_SUPPORTED__
73
84
bleHandler.writeConfigPacket (config);
85
+ #endif
74
86
} else {
75
87
eslovHandler.writeConfigPacket (config);
76
88
}
@@ -115,7 +127,9 @@ void Arduino_BHY2Host::debug(Stream &stream)
115
127
{
116
128
_debug = &stream;
117
129
eslovHandler.debug (stream);
130
+ #ifdef __BHY2_HOST_BLE_SUPPORTED__
118
131
bleHandler.debug (stream);
132
+ #endif
119
133
}
120
134
121
135
Arduino_BHY2Host BHY2Host;
0 commit comments