Merge pull request #544 from gschorcht/sht3x
Minor changes in SHT3x driver
This commit is contained in:
commit
42e342e3dd
2 changed files with 5 additions and 1 deletions
|
@ -164,6 +164,8 @@ void user_init(void)
|
|||
// Create a user task that uses the sensors.
|
||||
xTaskCreate(user_task, "user_task", TASK_STACK_DEPTH, NULL, 2, 0);
|
||||
}
|
||||
else
|
||||
printf("Could not initialize SHT3x sensor\n");
|
||||
|
||||
// That's it.
|
||||
}
|
||||
|
|
|
@ -102,12 +102,14 @@ if ((sensor = sht3x_init_sensor (I2C_BUS, SHT3x_ADDR_2)))
|
|||
|
||||
Function ```sht3x_init_sensor``` returns a pointer to the sensor device data structure or NULL in case of error.
|
||||
|
||||
Last, the user task that uses the sensor has to be created.
|
||||
Finally, a user task that uses the sensor has to be created.
|
||||
|
||||
```
|
||||
xTaskCreate(user_task, "user_task", 256, NULL, 2, 0);
|
||||
```
|
||||
|
||||
**Please note:** To avoid concurrency situations when driver functions are used to access the sensor, for example to read data, the user task must not be created until the sensor configuration is completed.
|
||||
|
||||
In **periodic mode**, the user task has to start the periodic measurement only once at the beginning of the task. After that, it has only to wait for the results of the first measurement. In the task loop itself, it simply fetches the next measurement results in each cycle.
|
||||
|
||||
Thus, in this mode the user task could look like the following:
|
||||
|
|
Loading…
Reference in a new issue