@@ -58,6 +58,7 @@ BLEAdafruitAddressablePixel blePixel;
58
58
Adafruit_LSM6DS33 lsm6ds33;
59
59
Adafruit_BMP280 bmp280;
60
60
#else
61
+
61
62
#error "Board is not supported"
62
63
#endif
63
64
@@ -72,12 +73,13 @@ uint16_t measure_button(uint8_t* buf, uint16_t bufsize)
72
73
button |= ( CircuitPlayground.leftButton () ? 0x02 : 0x00 );
73
74
button |= ( CircuitPlayground.rightButton () ? 0x04 : 0x00 );
74
75
75
- #else
76
+ #elif defined ARDUINO_NRF52840_CLUE
76
77
// Button is active LOW on most board except CPlay
77
78
78
79
// No slide switch
79
80
button |= ( digitalRead (PIN_BUTTON1) ? 0x00 : 0x02 );
80
81
button |= ( digitalRead (PIN_BUTTON2) ? 0x00 : 0x04 );
82
+
81
83
#endif
82
84
83
85
memcpy (buf, &button, 4 );
@@ -87,10 +89,13 @@ uint16_t measure_button(uint8_t* buf, uint16_t bufsize)
87
89
uint16_t measure_temperature (uint8_t * buf, uint16_t bufsize)
88
90
{
89
91
float temp;
92
+
90
93
#if defined ARDUINO_NRF52840_CIRCUITPLAY
91
94
temp = CircuitPlayground.temperature ();
92
- #else
95
+
96
+ #elif defined ARDUINO_NRF52840_CLUE
93
97
temp = bmp280.readTemperature ();
98
+
94
99
#endif
95
100
96
101
memcpy (buf, &temp, 4 );
@@ -122,7 +127,8 @@ uint16_t measure_accel(uint8_t* buf, uint16_t bufsize)
122
127
accel_buf[0 ] = CircuitPlayground.motionX ();
123
128
accel_buf[1 ] = CircuitPlayground.motionY ();
124
129
accel_buf[2 ] = CircuitPlayground.motionZ ();
125
- #else
130
+
131
+ #elif defined ARDUINO_NRF52840_CLUE
126
132
127
133
sensors_event_t accel, gyro, temp;
128
134
(void ) gyro; (void ) temp;
@@ -132,6 +138,7 @@ uint16_t measure_accel(uint8_t* buf, uint16_t bufsize)
132
138
accel_buf[0 ] = accel.acceleration .x ;
133
139
accel_buf[1 ] = accel.acceleration .y ;
134
140
accel_buf[2 ] = accel.acceleration .z ;
141
+
135
142
#endif
136
143
137
144
return 3 *sizeof (float ); // 12
@@ -147,7 +154,8 @@ void setup()
147
154
148
155
#if defined ARDUINO_NRF52840_CIRCUITPLAY
149
156
CircuitPlayground.begin ();
150
- #else
157
+
158
+ #elif defined ARDUINO_NRF52840_CLUE
151
159
152
160
// Button
153
161
pinMode (PIN_BUTTON1, INPUT_PULLUP);
0 commit comments