The HiPi::Interface::DS18X20 module provides simple read access for 18S20 and 18B20 temperature sensors connected to the W1 kernel device driver for the 1 Wire bus.
It uses HiPi::Device::OneWire as a backend.
Filters a call to HiPi::Device::OneWire->list_slaves() to return only devices in the families 10 and 28 ( temperature sensors of the types 18S20 and 18B20 )
Returns a new instance of the HiPi::Interface::DS18X20 class for the temperature device with the unique 1 Wire ID $uniqueid. You can optionally provide additional key => value pairs specifying correction - to be added to the temperature value returned from the device. default = 0 divider - applied as a divider to the value returned by the device This is useful if you want to convert the raw value from your device to an actual temperature within this module. default = 1 my $tmp = HiPi::Interface::DS18X20->new( id => $uniqueid, correction => 775, divider => 1000, );
returns the value passed as 'correction' to the constructor. if $newval is specified, the correction value is set.
returns the value passed as 'divider' to the constructor. if $newval is specified, the divider value is set.
returns the value read from the sensor added to the correction value, divided by the divider value: return ( $sensorval + $correction ) / $divider; With default values this is simply return ( $sensorval + 0 ) / 1;