Skip to content

Commit 68a7a95

Browse files
committed
Update driver docs and test application to reflect non-fp usage
Adds driver docs related to the sensor data struct fields formatting, and updates the test application to make the sensor data more human-readable.
1 parent b3677a9 commit 68a7a95

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

libs/bme68x/Inc/bme68x_driver.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ typedef struct
6969

7070
/** Structure to store sensor measurement data. */
7171
/** @todo: May modify this to be an array in order to support parallel mode */
72+
/** @note: Since we're not using floating point, the data will be as follows:
73+
* - Temperature in degrees celsius x100
74+
* - Pressure in Pascal
75+
* - Humidity in % relative humidity x1000
76+
* - Gas resistance in Ohms
77+
*/
7278
struct bme68x_data sensor_data;
7379

7480
// /** Array to store multiple sensor data values (for parallel mode). */

tests/test_bme688/test_bme688.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ int main(void)
133133
// bme_read(0xD0, &sensor_id, 4, &hi2c1);
134134
// debug_print("Received sensor ID: 0x%X\r\n", sensor_id);
135135

136-
debug_print("Temperature(deg C), Pressure(Pa), Humidity(%), Gas resistance(ohm), Status\r\n");
137136
/* USER CODE END 2 */
138137

139138
/* Infinite loop */
@@ -148,11 +147,17 @@ int main(void)
148147
int fetch_success = bme_fetch_data(&bme);
149148
if (fetch_success)
150149
{
151-
debug_print("%d, ", bme.sensor_data.temperature);
152-
debug_print("%d, ", bme.sensor_data.pressure);
153-
debug_print("%d, ", bme.sensor_data.humidity);
154-
debug_print("%d, ", bme.sensor_data.gas_resistance);
155-
debug_print("%X, \r\n", bme.sensor_data.status);
150+
debug_print("Temperature: %d.%02d°C, ",
151+
bme.sensor_data.temperature / 100,
152+
(bme.sensor_data.temperature % 100));
153+
debug_print("Pressure: %d Pa, ", bme.sensor_data.pressure);
154+
debug_print("Humidity: %d.%03d%%, ",
155+
bme.sensor_data.humidity / 1000,
156+
(bme.sensor_data.humidity % 1000));
157+
debug_print("Gas Resistance: %d.%03d kΩ, ",
158+
bme.sensor_data.gas_resistance / 1000,
159+
(bme.sensor_data.gas_resistance % 1000));
160+
debug_print("Status: 0x%X\r\n", bme.sensor_data.status);
156161
}
157162

158163
// The "blink" code is a simple verification of program execution,

0 commit comments

Comments
 (0)