View Source TSL256X (tsl256x v0.1.0)
Documentation for TSL256x family of Ligh to digital convertors
.
This module supports TSL2560 and 2561 in both T and SC packages.
To start add the module to your mix.exs
Summary
Functions
Disable the sensor
Enable the sensor
Checks to see if the sensor is currently enabled.
Gets the current gain
setting from the sensor
Sets the current gain
setting for the sensor
Gets the current integration time
from the sensors.
Set the integration time
, check integration_time/1
for the possible values.
Calculate the current light strength in lux.
Start the sensor and return a struct for future calls.
Stop the light sensor and closes the I2C bus.
Types
Functions
Disable the sensor
Enable the sensor
Checks to see if the sensor is currently enabled.
@spec gain(t()) :: 0 | 1
Gets the current gain
setting from the sensor:
- 0 - 1X
- 1 - 16X
Sets the current gain
setting for the sensor:
- 0 - 1X
- 1 - 16X
Gets the current integration time
from the sensors.
value | scale | nominal integration time |
---|---|---|
0 | 0.034 | 13.7 ms |
1 | 0.252 | 101 ms |
2 | 1 | 402 ms |
3 | -- | N/A |
When the value is set to 3, manual timing control is used, check the datasheet for more information.
Set the integration time
, check integration_time/1
for the possible values.
Calculate the current light strength in lux.
Example
iex> TSL256X.lux(sensor)
2851
Start the sensor and return a struct for future calls.
Examples
iex> TSL256X.start("i2c-1", 4)
{:ok, %TSL256X{}}
@spec stop(t()) :: :ok
Stop the light sensor and closes the I2C bus.
Examples
iex> TSL256X.stop(sensor)
:ok