Initialization and usage of device drivers in user code


akrckn
 

Hello everyone,

I'm pretty new to the Zephyr Project as we (our company) are evaluating it to use it as our base for the upcoming projects.

It didn't take long to get our own application running on our hardware, but a
s we are developing battery powered modules we just activate and use devices when they really are needed.

Is there a way to define devices (e.g. BME280 below) in the device tree file and trigger the initialization and start / stop in the application code and how can we do that?

I'm assuming there is a solution and I didn't get or find it, yet - could you please help me?

&i2c1 {
pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>;
status = "okay";
clock-frequency = <I2C_BITRATE_FAST>;
bme280@77 {
compatible = "bosch,bme280";
status = "okay";
reg = <0x77>;
label = "BME280";
};
};

Thank you in advance and best regards!