STM32F407VET6 uses RT-Thread to add DS18B20 temperature sensor software package online

STM32F407VET6 uses RT-Thread to add DS18B20 temperature sensor software package online

Add packages online

Use the env tool in the relevant directory
insert image description here
to open the sensor framework
insert image description here
. Find the corresponding software package and open it.
insert image description here
insert image description here
Open the keil project, and you will find the corresponding software package and sensor framework
insert image description here
. Modify the pins and refer to the example to use.
insert image description here
It should be noted here that if you are using the following DS18B20 modules without external resistors, you should change the pins to pull-up input mode, otherwise the device cannot be found. Can't find device: temp_ds18b20.
insert image description here
Modify as follows:
insert image description here

Steps to add packages manually

Open the sensor framework
insert image description here
and add the driver code. Here is a general idea without going into each step carefully.
insert image description here
The driver code includes: hardware driver function part, ops function, data acquisition function, instruction control function, initialization (including sensor structure assignment).
ops function, data acquisition function, instruction control function, and
insert image description here
initialization
insert image description here
driver related functions are written, basically for the acquisition of temperature sensor data: hardware initialization, raw data acquisition (ds18b20 should be written according to the timing, I did it lazily), data processing, Control transfer instructions, etc.
insert image description here
If you use it, you can use the frame method according to the conventional equipment.
insert image description here

Guess you like

Origin blog.csdn.net/weixin_43058521/article/details/106044232