From 7fed013453e7cde3b29f92dafc50e77a32508295 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Sat, 6 Jan 2018 15:34:36 +0100 Subject: [PATCH] minor changes --- examples/sht3x/sht3x.c | 2 ++ extras/sht3x/README.md | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/sht3x/sht3x.c b/examples/sht3x/sht3x.c index ee304ea..1bf3ed4 100644 --- a/examples/sht3x/sht3x.c +++ b/examples/sht3x/sht3x.c @@ -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. } diff --git a/extras/sht3x/README.md b/extras/sht3x/README.md index ca236b4..21b25c9 100644 --- a/extras/sht3x/README.md +++ b/extras/sht3x/README.md @@ -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: