minor changes

This commit is contained in:
Gunar Schorcht 2018-01-06 15:34:36 +01:00
parent ca0b5da905
commit 7fed013453
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: