Contents Up Previous Next

HiPi::Device::OneWire

This module currently provides a front end to the w1 Kernel device driver. Currently only a simple read function is implemented. Enough to support reading the output of temperature devices.

See : W1 Device Driver

Loading and configuring the kernel 1 Wire driver is controlled by configuring the device tree in your /boot/config.txt file.

See : Using the Device Tree

The connected devices on your One Wire bus can be seen in the HiPi Control GUI if you are using the kernel driver.

The following interface module uses HiPi::Device::OneWire as a backend and may contain code that helps with your own usage.

HiPi::Interface::DS18X20

Class Methods

HiPi::Device::OneWire->list_slaves();
    Returns an array of hash references providing details
    of the connected 1 wire devices.

    the four hash keys are

    id           e.g. 28-00000400bed1
    family       e.g. 28
    name         e.g. 18B20
    description  e.g. programmable resolution digital thermometer

    my @devices = HiPi::Device::OneWire->list_slaves();
    for my $w1 ( @devices ) {
        for ( qw( id family name description ) ) {
	    print qq($_ = $w1->{$_}n); 
        }
    }
HiPi::Device::OneWire->id_exists( $id );
    Returns true or false according to whether the specified
    $id is connected to the kernel device.
HiPi::Device::OneWire->read_data( $id );
    Returns the content of the file
    /sys/bus/w1/devices/$id/w1_slave

    It is up to the caller to parse the content 




Contents Up Previous Next


HiPi Modules Copyright © 2013 - 2016 Mark Dootson