SGP40 (sgp40 v0.1.7)
View SourceUse Sensirion SGP40 air quality sensor in Elixir
Summary
Functions
Returns a specification to start this module under a supervisor.
Measure the current air quality.
Start a new GenServer for interacting with the SGP40 sensor.
Normally, you'll want to pass the :bus_name
option to specify the I2C
bus going to the SGP40.
Update relative ambient humidity (RH %) and ambient temperature (degree C) for the humidity compensation.
Types
@type bus_address() :: 0..127
@type bus_name() :: binary()
@type options() :: [ name: GenServer.name(), bus_name: bus_name(), bus_address: bus_address(), humidity_rh: number(), temperature_c: number() ]
SGP40 GenServer start_link options
:name
- A name for theGenServer
:bus_name
- Which I2C bus to use (defaults to"i2c-1"
):bus_address
- The address of the SGP40 (defaults to0x59
):humidity_rh
- Relative humidity in percent for compensation:temperature_c
- Temperature in degree Celsius for compensation
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec get_states(GenServer.server()) :: {:ok, SGP40.VocIndex.AlgorithmStates.t()} | {:error, any()}
@spec measure(GenServer.server()) :: {:ok, SGP40.Measurement.t()} | {:error, any()}
Measure the current air quality.
@spec set_states(GenServer.server(), SGP40.VocIndex.AlgorithmStates.t()) :: {:ok, binary()} | {:error, any()}
@spec set_tuning_params(GenServer.server(), SGP40.VocIndex.AlgorithmTuningParams.t()) :: {:ok, binary()} | {:error, any()}
@spec start_link(options()) :: GenServer.on_start()
Start a new GenServer for interacting with the SGP40 sensor.
Normally, you'll want to pass the :bus_name
option to specify the I2C
bus going to the SGP40.
@spec update_rht(GenServer.server(), number(), number()) :: :ok
Update relative ambient humidity (RH %) and ambient temperature (degree C) for the humidity compensation.