Merge pull request #544 from gschorcht/sht3x

Minor changes in SHT3x driver
This commit is contained in:
Ruslan V. Uss 2018-01-20 17:03:09 +05:00 committed by GitHub
commit 42e342e3dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -164,6 +164,8 @@ void user_init(void)
// Create a user task that uses the sensors. // Create a user task that uses the sensors.
xTaskCreate(user_task, "user_task", TASK_STACK_DEPTH, NULL, 2, 0); xTaskCreate(user_task, "user_task", TASK_STACK_DEPTH, NULL, 2, 0);
} }
else
printf("Could not initialize SHT3x sensor\n");
// That's it. // That's it.
} }

View file

@ -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. 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); 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. 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: Thus, in this mode the user task could look like the following: