I would like to send some simple read and write commands to the Pis 1wire port. For example to be able to configure the resolution of the ds1820 Temperature sensor. The kernal modules used to access the 1wire devices (w1-gpio and w1-therm) worke fine, but the access via the file system gives only a very very limited functionality. Does anybody know of a possibillity to access 1wire without recreating the whole driver? The functionality should be already in the modules, i just found no way to access it. I would be greatful for any hints
If you want modular then what about the functions described in DS18B20 Temperature Sensor. They are not complete finished routines but the explanations are good enough for you to modify the code to do what you want. I used it to implement an array of 8 DS18B20s and trigger auto alerts.
Have a look at this bit bang method. It allows the resolution to be set.
Bit banging DS18B20
Methods to access the DS18B20 sensor using Rapsberry Pi GPIO
- configDS18B20.c: Application to set bit resolution of the DS18B20.
- DS18B20Scan.c: Application to connect multiple DS18B20 on one GPIO.
- DS18B20V2.c: Application to Connect one DS18B20 per GPIO but read them together.
gcc -lrt -o configDS18B20 configDS18B20.c gcc -lrt -o DS18B20Scan DS18B20Scan.c gcc -lrt -o DS18B20V2 DS18B20V2.c