Skip to content

Commit 843934b

Browse files
committed
temp service use begin(sensor)
1 parent 136a3c0 commit 843934b

File tree

1 file changed

+34
-39
lines changed

1 file changed

+34
-39
lines changed

libraries/Bluefruit52Lib/examples/Peripheral/bluefruit_playground/bluefruit_playground.ino

Lines changed: 34 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,6 @@ Adafruit_SHT31 sht30; // Humid
110110
//Adafruit_Madgwick filter; // faster than NXP
111111
Adafruit_Mahony filter; // fastest/smalleset
112112

113-
uint16_t measure_temperature(uint8_t* buf, uint16_t bufsize)
114-
{
115-
float temp = bmp280.readTemperature();
116-
memcpy(buf, &temp, 4);
117-
return 4;
118-
}
119-
120113
uint16_t measure_light(uint8_t* buf, uint16_t bufsize)
121114
{
122115
float lux;
@@ -130,35 +123,35 @@ uint16_t measure_light(uint8_t* buf, uint16_t bufsize)
130123
return 4;
131124
}
132125

133-
uint16_t measure_gyro(uint8_t* buf, uint16_t bufsize)
134-
{
135-
float* float_buf = (float*) buf;
136-
137-
sensors_event_t accel, gyro, temp;
138-
(void) accel; (void) temp;
139-
140-
lsm6ds33.getEvent(&accel, &gyro, &temp);
141-
142-
float_buf[0] = gyro.gyro.x;
143-
float_buf[1] = gyro.gyro.y;
144-
float_buf[2] = gyro.gyro.z;
145-
146-
return 12;
147-
}
148-
149-
uint16_t measure_magnetic(uint8_t* buf, uint16_t bufsize)
150-
{
151-
float* float_buf = (float*) buf;
152-
153-
sensors_event_t mag;
154-
lis3mdl.getEvent(&mag);
155-
156-
float_buf[0] = mag.magnetic.x;
157-
float_buf[1] = mag.magnetic.y;
158-
float_buf[2] = mag.magnetic.z;
159-
160-
return 12;
161-
}
126+
//uint16_t measure_gyro(uint8_t* buf, uint16_t bufsize)
127+
//{
128+
// float* float_buf = (float*) buf;
129+
//
130+
// sensors_event_t accel, gyro, temp;
131+
// (void) accel; (void) temp;
132+
//
133+
// lsm6ds33.getEvent(&accel, &gyro, &temp);
134+
//
135+
// float_buf[0] = gyro.gyro.x;
136+
// float_buf[1] = gyro.gyro.y;
137+
// float_buf[2] = gyro.gyro.z;
138+
//
139+
// return 12;
140+
//}
141+
//
142+
//uint16_t measure_magnetic(uint8_t* buf, uint16_t bufsize)
143+
//{
144+
// float* float_buf = (float*) buf;
145+
//
146+
// sensors_event_t mag;
147+
// lis3mdl.getEvent(&mag);
148+
//
149+
// float_buf[0] = mag.magnetic.x;
150+
// float_buf[1] = mag.magnetic.y;
151+
// float_buf[2] = mag.magnetic.z;
152+
//
153+
// return 12;
154+
//}
162155

163156
uint16_t measure_button(uint8_t* buf, uint16_t bufsize)
164157
{
@@ -267,12 +260,14 @@ void setup()
267260
blebas.begin();
268261
blebas.write(100);
269262

270-
// Adafruit Service
263+
//------------- Adafruit Service -------------//
264+
#ifdef ARDUINO_NRF52840_CIRCUITPLAY
271265
bleTemp.begin(measure_temperature);
266+
#else
267+
bleTemp.begin(bmp280.getTemperatureSensor());
268+
#endif
272269

273-
274270
bleAccel.begin(accel_sensor);
275-
276271
bleLight.begin(measure_light);
277272

278273
bleButton.begin(measure_button, 100);

0 commit comments

Comments
 (0)