@@ -58,6 +58,7 @@ BLEAdafruitAddressablePixel blePixel;
5858 Adafruit_LSM6DS33 lsm6ds33;
5959 Adafruit_BMP280 bmp280;
6060#else
61+
6162 #error "Board is not supported"
6263#endif
6364
@@ -72,12 +73,13 @@ uint16_t measure_button(uint8_t* buf, uint16_t bufsize)
7273 button |= ( CircuitPlayground.leftButton () ? 0x02 : 0x00 );
7374 button |= ( CircuitPlayground.rightButton () ? 0x04 : 0x00 );
7475
75- #else
76+ #elif defined ARDUINO_NRF52840_CLUE
7677 // Button is active LOW on most board except CPlay
7778
7879 // No slide switch
7980 button |= ( digitalRead (PIN_BUTTON1) ? 0x00 : 0x02 );
8081 button |= ( digitalRead (PIN_BUTTON2) ? 0x00 : 0x04 );
82+
8183#endif
8284
8385 memcpy (buf, &button, 4 );
@@ -87,10 +89,13 @@ uint16_t measure_button(uint8_t* buf, uint16_t bufsize)
8789uint16_t measure_temperature (uint8_t * buf, uint16_t bufsize)
8890{
8991 float temp;
92+
9093#if defined ARDUINO_NRF52840_CIRCUITPLAY
9194 temp = CircuitPlayground.temperature ();
92- #else
95+
96+ #elif defined ARDUINO_NRF52840_CLUE
9397 temp = bmp280.readTemperature ();
98+
9499#endif
95100
96101 memcpy (buf, &temp, 4 );
@@ -122,7 +127,8 @@ uint16_t measure_accel(uint8_t* buf, uint16_t bufsize)
122127 accel_buf[0 ] = CircuitPlayground.motionX ();
123128 accel_buf[1 ] = CircuitPlayground.motionY ();
124129 accel_buf[2 ] = CircuitPlayground.motionZ ();
125- #else
130+
131+ #elif defined ARDUINO_NRF52840_CLUE
126132
127133 sensors_event_t accel, gyro, temp;
128134 (void ) gyro; (void ) temp;
@@ -132,6 +138,7 @@ uint16_t measure_accel(uint8_t* buf, uint16_t bufsize)
132138 accel_buf[0 ] = accel.acceleration .x ;
133139 accel_buf[1 ] = accel.acceleration .y ;
134140 accel_buf[2 ] = accel.acceleration .z ;
141+
135142#endif
136143
137144 return 3 *sizeof (float ); // 12
@@ -147,7 +154,8 @@ void setup()
147154
148155#if defined ARDUINO_NRF52840_CIRCUITPLAY
149156 CircuitPlayground.begin ();
150- #else
157+
158+ #elif defined ARDUINO_NRF52840_CLUE
151159
152160 // Button
153161 pinMode (PIN_BUTTON1, INPUT_PULLUP);
0 commit comments