AHT20.Sensor (aht20 v0.1.0) View Source

Abstracts the basic operations of the temperature and humidity sensor AHT20. For the ADT20 specifications, please refer to the AHT20 data sheet.

Link to this section Summary

Types

The configuration options.

t()

Represents the connection to the sensor.

Functions

Triggers the sensor to read temperature and humidity.

Obtains the sensor status byte. For more info. please refer to the data sheet (section 5.3).

Restarts the sensor system without having to turn off and turn on the power again. For more info. please refer to the data sheet (section 5.5).

Connects to the sensor. For more info. please refer to the data sheet (section 5.4).

Link to this section Types

Specs

config() :: %{
  optional(:i2c_bus) => i2c_bus(),
  optional(:i2c_address) => i2c_address()
}

The configuration options.

Specs

i2c_address() :: Circuit.I2C.address()

Specs

i2c_bus() :: Circuit.I2C.bus()

Specs

t() :: %AHT20.Sensor{
  i2c_address: i2c_address(),
  i2c_bus: i2c_bus(),
  i2c_ref: reference()
}

Represents the connection to the sensor.

Link to this section Functions

Specs

read_data(t()) :: {:ok, <<_::56>>} | {:error, any()}

Triggers the sensor to read temperature and humidity.

Specs

read_state(t()) :: {:ok, <<_::8>>} | {:error, any()}

Obtains the sensor status byte. For more info. please refer to the data sheet (section 5.3).

Specs

reset(t()) :: :ok | {:error, any()}

Restarts the sensor system without having to turn off and turn on the power again. For more info. please refer to the data sheet (section 5.5).

Specs

start(config()) :: {:ok, t()} | {:error, any()}

Connects to the sensor. For more info. please refer to the data sheet (section 5.4).