NAME

Device::Chip::HTU21D - chip driver for HTU21D

SYNOPSIS

use Device::Chip::HTU21D;
use Future::AsyncAwait;

my $chip = Device::Chip::HTU21D->new;
await $chip->mount( Device::Chip::Adapter::...->new );

printf "Current temperature is is %.2f C\n",
   await $chip->read_temperature;

DESCRIPTION

This Device::Chip subclass provides specific communication to a TE Connectivity HTU21D attached to a computer via an I²C adapter.

The reader is presumed to be familiar with the general operation of this chip; the documentation here will not attempt to explain or define chip-specific concepts or features, only the use of this module to access them.

ACCESSORS

The following methods documented in an await expression return Future instances.

read_config

$config = await $chip->read_config;

Returns a HASH reference of the contents of the user register.

RES        => "12/14" | "11/11" | "10/13" | "8/12"
OTPDISABLE => 0 | 1
HEATER     => 0 | 1
ENDOFBATT  => 0 | 1

change_config

await $chip->change_config( %changes );

Writes updates to the user register.

METHODS

read_temperature

$temperature = await $chip->read_temperature;

Triggers a reading of the temperature sensor, returning a number in degrees C.

read_humidity

$humidity = await $chip->read_humidity;

Triggers a reading of the humidity sensor, returning a number in % RH.

AUTHOR

Paul Evans <leonerd@leonerd.org.uk>