based on advices found on dallas documentation :
http://www.maximintegrated.com/app-note ... mvp/id/214
this library use an usart to avoid to consume cpu cycle in bit banging
the library is synchronous, but when waiting it yield the processor to chibios.
the usart is configured in half duplex mode, so there is only TX to wire,
RX is connected internally for data reception when the bus is in reception mode.
i have made a bundle with the library and a demo for discovery, demo compile with
2.5.x version of chibios. The demo get temperature from any number of maxim 18b20 connected,
and can get rom address from ibutton.
https://www.dropbox.com/s/hvb1uy955ns15ci/1wire.zip
** TARGET **
The demo runs on an ST STM32F4-Discovery board with one or several one wire
sensors connected :
a one wire componant need vdd, vss and data, in this demo data (DQ) of all
sensors should be connected on GPIOD PIN 8.
a 4,7Kohms pullup resistor should be connected between vdd (3.3V) and data bus
(GPIOD PIN 8).
output is done on a tty console on serial over usb : wire micro usb port of
discovery on your computer, then open hyperterminal to connect to it.
under linux, screen /dev/ttyACM0 does the job
** The Demo **
The demo show how to use a simple library for accessing one wire devices.
The demo lanch a basic shell and wait for commands :
mem : memory info
info : chibios info
ow (for one wire) =>
ow search : print the unique address of all the device connected on the bus
ow rom : print address of one device *ONLY* if there is only one device on the bus
ow t : get value of all the temperature sensors maxim 18b20 on the bus one
each after other.
ow dt : ask all the 18b20 sensors to initiate acquisition, wait for the acquisition
to be done, then get all the values, better way whan there is more than 1 sensors
Alexandre