TMF882X.Device (tmf882x v0.1.1)
Handles communication around device setup and configuration.
Link to this section Summary
Functions
Applies a subset of configuration
Enables the device via I2C when the enable pin is not connected.
Returns firmware information for the device.
Returns the SPAD currently in the custom page.
Read the contents of the configuration page register and returns them as a TMF882X.Config
struct.
Sets the spad in the custom spad page to the provided one.
Returns the status of the device gathered from the 0xE0
register
Waits until the STAT_OK register returns a value less than 0x10
and returns :ok
or returns {:error, :wait_timeout} if it
does not before the given timeout (in ms).
Waits until the status of the device returns as enabled. Ether returns :ok if the device becomes enabled or {:ok, :enable_timeout} if the device is not enabled before the timeout.
Waits until the STAT_OK register returns a value of 0x00
and returns :ok or returns {:error, :wait_timeout} if it
does not before the given timeout (in ms).
Link to this section Functions
apply_config(pid, config)
Applies a subset of configuration
enable(pid)
Enables the device via I2C when the enable pin is not connected.
firmware(pid)
Returns firmware information for the device.
get_custom_spad(pid)
@spec get_custom_spad(reference()) :: TMF882X.SPAD.t()
Returns the SPAD currently in the custom page.
read_config(pid)
Read the contents of the configuration page register and returns them as a TMF882X.Config
struct.
set_custom_spad(pid, spad)
@spec set_custom_spad(reference(), TMF882X.SPAD.t()) :: :ok | :error
Sets the spad in the custom spad page to the provided one.
status(pid)
@spec status(reference()) :: %{ active: boolean(), enabled: boolean(), set_bits: <<_::2>>, status: byte() }
Returns the status of the device gathered from the 0xE0
register
wait(pid, remain)
@spec wait(reference(), non_neg_integer()) :: :ok | {:error, :wait_timeout}
Waits until the STAT_OK register returns a value less than 0x10
and returns :ok
or returns {:error, :wait_timeout} if it
does not before the given timeout (in ms).
wait_for_enabled(i2c, timeout)
@spec wait_for_enabled(reference(), non_neg_integer()) :: :ok | {:error, :enable_timeout}
Waits until the status of the device returns as enabled. Ether returns :ok if the device becomes enabled or {:ok, :enable_timeout} if the device is not enabled before the timeout.
wait_for_stat_ok(pid, remain)
@spec wait_for_stat_ok(reference(), non_neg_integer()) :: :ok | {:error, :wait_timeout}
Waits until the STAT_OK register returns a value of 0x00
and returns :ok or returns {:error, :wait_timeout} if it
does not before the given timeout (in ms).