Minor changes in BME680 driver (#543)
This commit is contained in:
parent
8325bb87c5
commit
13db675ac6
7 changed files with 142 additions and 74 deletions
|
@ -103,10 +103,7 @@ void user_init(void)
|
|||
|
||||
if (sensor)
|
||||
{
|
||||
// Create a task that uses the sensor
|
||||
xTaskCreate(user_task, "user_task", 256, NULL, 2, NULL);
|
||||
|
||||
/** -- OPTIONAL PART -- */
|
||||
/** -- SENSOR CONFIGURATION PART (optional) --- */
|
||||
|
||||
// Changes the oversampling rates to 4x oversampling for temperature
|
||||
// and 2x oversampling for humidity. Pressure measurement is skipped.
|
||||
|
@ -121,5 +118,15 @@ void user_init(void)
|
|||
bme680_set_heater_profile (sensor, 2, 300, 140);
|
||||
bme680_set_heater_profile (sensor, 3, 350, 160);
|
||||
bme680_set_heater_profile (sensor, 4, 400, 180);
|
||||
|
||||
/** -- TASK CREATION PART --- */
|
||||
|
||||
// must be done last to avoid concurrency situations with the sensor
|
||||
// configuration part
|
||||
|
||||
// Create a task that uses the sensor
|
||||
xTaskCreate(user_task, "user_task", 256, NULL, 2, NULL);
|
||||
}
|
||||
else
|
||||
printf("Could not initialize BME680 sensor\n");
|
||||
}
|
||||
|
|
|
@ -138,10 +138,7 @@ void user_init(void)
|
|||
|
||||
if (sensor)
|
||||
{
|
||||
// Create a task that uses the sensor
|
||||
xTaskCreate(user_task, "user_task", TASK_STACK_DEPTH, NULL, 2, NULL);
|
||||
|
||||
/** -- OPTIONAL PART -- */
|
||||
/** -- SENSOR CONFIGURATION PART (optional) --- */
|
||||
|
||||
// Changes the oversampling rates to 4x oversampling for temperature
|
||||
// and 2x oversampling for humidity. Pressure measurement is skipped.
|
||||
|
@ -156,5 +153,15 @@ void user_init(void)
|
|||
|
||||
// Set ambient temperature to 10 degree Celsius
|
||||
bme680_set_ambient_temperature (sensor, 10);
|
||||
|
||||
/** -- TASK CREATION PART --- */
|
||||
|
||||
// must be done last to avoid concurrency situations with the sensor
|
||||
// configuration part
|
||||
|
||||
// Create a task that uses the sensor
|
||||
xTaskCreate(user_task, "user_task", TASK_STACK_DEPTH, NULL, 2, NULL);
|
||||
}
|
||||
else
|
||||
printf("Could not initialize BME680 sensor\n");
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Simple example with two sensors, one sensor connected to I2C bus 0 and
|
||||
* one sensor connected to SPI. It defines two different user tasks, one for
|
||||
* each sensor. It demonstrate the possible approaches to wait for measurement
|
||||
* each sensor. It demonstrates the possible approaches to wait for measurement
|
||||
* results, active busy waiting using ```bme680_is_measuring``` and passive
|
||||
* waiting using *vTaskDelay*.
|
||||
*
|
||||
|
@ -128,13 +128,7 @@ void user_init(void)
|
|||
|
||||
if (sensor1 && sensor2)
|
||||
{
|
||||
// Create the tasks that use the sensors
|
||||
xTaskCreate(user_task_sensor1, "user_task_sensor1", 256, NULL, 2, 0);
|
||||
xTaskCreate(user_task_sensor2, "user_task_sensor2", 256, NULL, 2, 0);
|
||||
|
||||
// That's it.
|
||||
|
||||
/** -- OPTIONAL PART -- */
|
||||
/** -- SENSOR CONFIGURATION PART (optional) --- */
|
||||
|
||||
// Changes the oversampling rates for both sensor to different values
|
||||
bme680_set_oversampling_rates(sensor1, osr_4x, osr_2x, osr_1x);
|
||||
|
@ -151,5 +145,14 @@ void user_init(void)
|
|||
// Activate the heater profile 0
|
||||
bme680_use_heater_profile (sensor1, 0);
|
||||
bme680_use_heater_profile (sensor2, 0);
|
||||
|
||||
/** -- TASK CREATION PART --- */
|
||||
|
||||
// must be done last to avoid concurrency situations with the sensor
|
||||
// configuration part
|
||||
|
||||
// Create the tasks that use the sensors
|
||||
xTaskCreate(user_task_sensor1, "user_task_sensor1", 256, NULL, 2, 0);
|
||||
xTaskCreate(user_task_sensor2, "user_task_sensor2", 256, NULL, 2, 0);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue