View Source VEML7700 (veml7700 v0.1.3)

Use Vishay ambient light sensor VEML7700 in Elixir.

Summary

Types

Ambient light integration time setting. Longer time has higher sensitivity. See https://learn.sparkfun.com/tutorials/qwiic-ambient-light-sensor-veml6030-hookup-guide

VEML7700 GenServer start_link options

Functions

Returns a specification to start this module under a supervisor.

Get the ambient light sensor settings.

Get the interrupt status.

Get the power saving mode.

Measure the current light. An error is returned if the I2C transactions fail.

Set the ambient light sensor settings.

Start a new GenServer for interacting with a VEML7700.

Types

@type als_gain() :: :als_gain_1 | :als_gain_2 | :als_gain_1_4 | :als_gain_1_8

Ambient light gain setting. See https://learn.sparkfun.com/tutorials/qwiic-ambient-light-sensor-veml6030-hookup-guide

Link to this type

als_integration_time()

View Source
@type als_integration_time() ::
  :als_25ms | :als_50ms | :als_100ms | :als_200ms | :als_400ms | :als_800ms

Ambient light integration time setting. Longer time has higher sensitivity. See https://learn.sparkfun.com/tutorials/qwiic-ambient-light-sensor-veml6030-hookup-guide

@type option() ::
  {:name, atom()}
  | {:bus_name, String.t()}
  | {:bus_address, 16 | 72}
  | {:retries, pos_integer()}
  | {:als_gain, als_gain()}
  | {:als_integration_time, als_integration_time()}

VEML7700 GenServer start_link options

  • :name - a name for the GenServer
  • :bus_name - which I2C bus to use (e.g., "i2c-1")
  • :bus_address - the address of the VEML7700 (defaults to 0x10)
  • :retries - the number of retries before failing (defaults to no retries)
  • :als_gain - ambient light gain setting (defaults to :als_gain_1_4)
  • :als_integration_time - ambient light integration time setting (defaults to :als_100ms)

Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

get_als_config(server \\ __MODULE__)

View Source
@spec get_als_config(GenServer.server()) ::
  {:error, any()} | {:ok, {setting_names :: [atom()], resolution :: float()}}

Get the ambient light sensor settings.

Link to this function

get_high_threshold(server \\ __MODULE__)

View Source
@spec get_high_threshold(GenServer.server()) :: {:error, any()} | {:ok, 0..65535}

Get the high threshold.

Link to this function

get_interrupt_status(server \\ __MODULE__)

View Source
@spec get_interrupt_status(GenServer.server()) :: {:error, any()} | {:ok, 0..65535}

Get the interrupt status.

Link to this function

get_low_threshold(server \\ __MODULE__)

View Source
@spec get_low_threshold(GenServer.server()) :: {:error, any()} | {:ok, 0..65535}

Get the low threshold.

Link to this function

get_power_saving(server \\ __MODULE__)

View Source
@spec get_power_saving(GenServer.server()) ::
  {:error, any()} | {:ok, {mode :: 0..3, enabled :: boolean()}}

Get the power saving mode.

Link to this function

measure(server \\ __MODULE__)

View Source
@spec measure(GenServer.server()) :: {:error, any()} | {:ok, VEML7700.Measurement.t()}

Measure the current light. An error is returned if the I2C transactions fail.

Link to this function

set_als_config(server \\ __MODULE__, als_setting_names)

View Source
@spec set_als_config(GenServer.server(), als_gain() | als_integration_time()) ::
  {:error, any()} | {:ok, {setting_names :: [atom()], resolution :: float()}}

Set the ambient light sensor settings.

Link to this function

set_high_threshold(server \\ __MODULE__, value)

View Source
@spec set_high_threshold(GenServer.server(), 0..65535) :: {:error, any()} | :ok

Set the high threshold.

Link to this function

set_low_threshold(server \\ __MODULE__, value)

View Source
@spec set_low_threshold(GenServer.server(), 0..65535) :: {:error, any()} | :ok

Set the low threshold.

Link to this function

set_power_saving(server \\ __MODULE__, mode, enabled)

View Source
@spec set_power_saving(GenServer.server(), mode :: 0..3, enabled :: boolean()) ::
  {:error, any()} | :ok

Set the power saving mode.

Link to this function

start_link(options \\ [])

View Source
@spec start_link([option()]) :: GenServer.on_start()

Start a new GenServer for interacting with a VEML7700.