NAME

Device::Chip::SGP4x - chip driver for SGP40 and SGP41

SYNOPSIS

use Device::Chip::SGP4x;
use Future::AsyncAwait;

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

await $chip->execute_conditioning;

while(1) {
   await Future::IO->sleep(1);

   my ( $raw_NOx, $raw_VOC ) = await $chip->measure_raw_signals;
   printf "NOx = %d, VOC = %d\n", $raw_NOx, $raw_VOC;
}

DESCRIPTION

This Device::Chip subclass provides specific communication to a Sensirion SGP40 or SGP41 attached to a computer via 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.

MOUNT PARAMETERS

addr

The I²C address of the device. Can be specified in decimal, octal or hex with leading 0 or 0x prefixes.

METHODS

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

execute_conditioning

await $chip->execute_conditioning;

Performs a conditioning operation.

execute_self_test

await $chip->execute_self_test;

Performs a self-test operation.

measure_raw_signals

( $adc_VOC, $adc_NOx ) = await $chip->measure_raw_signals;

Performs a sampling cycle and returns the raw ADC values from the sensor elements.

AUTHOR

Paul Evans <leonerd@leonerd.org.uk>