View Source VEML7700 (veml7700 v0.1.3)
Use Vishay ambient light sensor VEML7700 in Elixir.
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 sensor settings.
Get the high threshold.
Get the interrupt status.
Get the low threshold.
Get the power saving mode.
Measure the current light. An error is returned if the I2C transactions fail.
Set the ambient light sensor settings.
Set the high threshold.
Set the low threshold.
Set the power saving mode.
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
@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
)
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 sensor settings.
@spec get_high_threshold(GenServer.server()) :: {:error, any()} | {:ok, 0..65535}
Get the high threshold.
@spec get_interrupt_status(GenServer.server()) :: {:error, any()} | {:ok, 0..65535}
Get the interrupt status.
@spec get_low_threshold(GenServer.server()) :: {:error, any()} | {:ok, 0..65535}
Get the low threshold.
@spec get_power_saving(GenServer.server()) :: {:error, any()} | {:ok, {mode :: 0..3, enabled :: boolean()}}
Get the power saving mode.
@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 sensor settings.
@spec set_high_threshold(GenServer.server(), 0..65535) :: {:error, any()} | :ok
Set the high threshold.
@spec set_low_threshold(GenServer.server(), 0..65535) :: {:error, any()} | :ok
Set the low threshold.
@spec set_power_saving(GenServer.server(), mode :: 0..3, enabled :: boolean()) :: {:error, any()} | :ok
Set the power saving mode.
@spec start_link([option()]) :: GenServer.on_start()
Start a new GenServer for interacting with a VEML7700.