SGP40 (sgp40 v0.1.3) View Source
Use Sensirion SGP40 air quality sensor in Elixir
Link to this section 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.
Link to this section Types
Specs
bus_address() :: 0..127
Specs
bus_name() :: binary()
Specs
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
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Specs
measure(GenServer.server()) :: {:ok, SGP40.Measurement.t()} | {:error, any()}
Measure the current air quality.
Specs
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.
Specs
update_rht(GenServer.server(), number(), number()) :: :ok
Update relative ambient humidity (RH %) and ambient temperature (degree C) for the humidity compensation.