View Source VEML7700 (veml7700 v0.1.0)
Use Vishay ambient light sensor VEML7700 in Elixir.
Link to this section Summary
Types
Ambient light gain setting. See https://learn.sparkfun.com/tutorials/qwiic-ambient-light-sensor-veml6030-hookup-guide
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 settings.
Measure the current light. An error is returned if the I2C transactions fail.
Set the ambient light settings.
Start a new GenServer for interacting with a VEML7700.
Link to this section 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
@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 to0x10
):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
)
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec get_als_config(GenServer.server()) :: {:error, any()} | {:ok, {setting_names :: [atom()], resolution :: float()}}
Get the ambient light settings.
@spec measure(GenServer.server()) :: {:error, any()} | {:ok, VEML7700.Measurement.t()}
Measure the current light. An error is returned if the I2C transactions fail.
@spec set_als_config(GenServer.server(), als_gain() | als_integration_time()) :: {:error, any()} | {:ok, {setting_names :: [atom()], resolution :: float()}}
Set the ambient light settings.
@spec start_link([option()]) :: GenServer.on_start()
Start a new GenServer for interacting with a VEML7700.