Hello,
it's a nice concept to include sensors via the device tree and simply enable them in the project file. But I feel like I'm losing control of the sensor a bit. I don't have access to the direct sensor functions of the library. The sensor is initialized directly when booting. For example, what happens if I have a separate battery-powered sensor and I need to replace the battery? After that I have to restart the SoC (Zypher) as well, otherwise the sensor no longer works in many cases because it has to be reinitialized. I can't seem to invoke the initialization manually.
The same if I want to plug a sensor on and off? With I2C communication I can do this directly, but with the device tree the sensor apparently only works via the driver if it is active at system start.
Do I understand something wrong? Or is there a more convenient solution for this? Switching the power mode didn't work on the SHT31 and I don't want to have to patch drivers either. Then I prefer to program the sensors directly via I2C.
And how do I integrate the header file of a sensor? For the CCS811, for example, this works with
#include <drivers/sensor/ccs811.h>
Why doesn't that work with the mcp9808 or sht3xd header file?
#include <drivers/sensor/mcp9808.h> or #include <zephyr/drivers/sensor/mcp9808/mcp9808.h> didnt work.
Also what is with error handling? If i unplug a sensor i get error code -5 with calling the function rc = sensor_sample_fetch(mcp9808_dev); Is there an explanation what this code means?
Regards
Markus