Take VIM1 as an example.
Enable 1-Wire Driver
Edit /boot/env.txt
to add onewire
to overlays
.
e.g.
1 | overlays=uart4 pwm_ao_a pwm_f i2c0 onewire |
For details on overlays, please refer to how to use device tree overlays.
Uasge
Here we attach a 1-Wire device
DS18B20temperature sensor to the
1-Wire` bus.
Goto the driver directory:
1 | khadas@Khadas:~$ cd /sys/bus/w1/devices |
You can see the node of ds18b20
is 28-0119395ebf91
. Goto this directory:
1 | khadas@Khadas:/sys/bus/w1/devices$ cd 28-0119395ebf91 |
Read w1_slave
file will get the temperature value:
1 | khadas@Khadas:/sys/bus/w1/devices/28-0119395ebf91$ cat w1_slave |
Physical pins of onewire bus:
GPIOH5 - PIN37
GPIOH5 - PIN37
GPIOH6 - PIN15
GPIOT19 - PIN37