View Source APDS9960.Gesture (apds9960 v0.4.0)

The gesture detection.

Link to this section Summary

Types

t()

The gesture data accumulator in the gesture processing loop.

Link to this section Types

Specs

gesture_direction() :: :down | :left | :right | :up

Specs

t() :: %APDS9960.Gesture{
  deduced_gesture_direction: gesture_direction() | nil,
  down_count: non_neg_integer(),
  left_count: non_neg_integer(),
  right_count: non_neg_integer(),
  sensor: APDS9960.Sensor.t(),
  started_at_ms: integer() | nil,
  up_count: non_neg_integer(),
  updated_at_ms: integer() | nil
}

The gesture data accumulator in the gesture processing loop.

Link to this section Functions

Link to this function

enable(sensor, value \\ 1)

View Source

Specs

enable(APDS9960.Sensor.t(), 0 | 1) :: :ok
Link to this function

enable_interrupt(sensor, value \\ 1)

View Source

Specs

enable_interrupt(APDS9960.Sensor.t(), 0 | 1) :: :ok

Specs

enabled?(APDS9960.Sensor.t()) :: boolean()

Specs

fifo_level(APDS9960.Sensor.t()) :: byte()

The number of datasets that are currently available in the FIFO for read.

Specs

fifo_overflow?(APDS9960.Sensor.t()) :: boolean()
Link to this function

gesture_fifo(sensor, dataset_count)

View Source

Specs

gesture_fifo(APDS9960.Sensor.t(), non_neg_integer()) :: [dataset()]

Specs

get_dimension(APDS9960.Sensor.t()) :: 0..3
Link to this function

get_exit_persistence(sensor)

View Source

Specs

get_exit_persistence(APDS9960.Sensor.t()) :: 0..3
Link to this function

get_fifo_threshold(sensor)

View Source

Specs

get_fifo_threshold(APDS9960.Sensor.t()) :: 0..3

Specs

get_gain(APDS9960.Sensor.t()) :: 0..3
Link to this function

get_gesture_exit_mask(sensor)

View Source

Specs

get_gesture_exit_mask(APDS9960.Sensor.t()) :: 0..4369

Specs

get_led_boost(APDS9960.Sensor.t()) :: 0..3
Link to this function

get_led_drive_strength(sensor)

View Source

Specs

get_led_drive_strength(APDS9960.Sensor.t()) :: 0..3

Specs

get_mode(APDS9960.Sensor.t()) :: 0 | 1

Specs

get_offset(APDS9960.Sensor.t()) :: %{
  down: -127..127,
  left: -127..127,
  right: -127..127,
  up: -127..127
}

Specs

get_pulse(APDS9960.Sensor.t()) :: %{count: 0..63, length: 0..3}

Specs

get_threshold(APDS9960.Sensor.t()) :: %{enter: byte(), exit: byte()}

Specs

get_wait_time(APDS9960.Sensor.t()) :: 0..7
Link to this function

interrupt_enabled?(sensor)

View Source

Specs

interrupt_enabled?(APDS9960.Sensor.t()) :: boolean()
Link to this function

read_gesture(sensor, opts \\ [])

View Source

Specs

read_gesture(APDS9960.Sensor.t(), Enum.t()) ::
  gesture_direction() | {:error, any()}

Specs

saturation?(APDS9960.Sensor.t()) :: boolean()
Link to this function

set_dimension(sensor, value)

View Source

Specs

set_dimension(APDS9960.Sensor.t(), 0..3) :: :ok
Link to this function

set_exit_persistence(sensor, value)

View Source

Specs

set_exit_persistence(APDS9960.Sensor.t(), 0..3) :: :ok
Link to this function

set_fifo_threshold(sensor, value)

View Source

Specs

set_fifo_threshold(APDS9960.Sensor.t(), 0..3) :: :ok

Specs

set_gain(APDS9960.Sensor.t(), 0..3) :: :ok
Link to this function

set_gesture_exit_mask(sensor, opts)

View Source

Specs

set_gesture_exit_mask(APDS9960.Sensor.t(), Enum.t()) :: :ok
Link to this function

set_led_boost(sensor, value)

View Source

Specs

set_led_boost(APDS9960.Sensor.t(), 0..3) :: :ok
Link to this function

set_led_drive_strength(sensor, value)

View Source

Specs

set_led_drive_strength(APDS9960.Sensor.t(), 0..3) :: :ok
Link to this function

set_offset(sensor, opts)

View Source

Specs

set_offset(APDS9960.Sensor.t(), Enum.t()) :: :ok
Link to this function

set_threshold(sensor, opts)

View Source

Specs

set_threshold(APDS9960.Sensor.t(), Enum.t()) :: :ok
Link to this function

set_wait_time(sensor, value)

View Source

Specs

set_wait_time(APDS9960.Sensor.t(), 0..7) :: :ok

Specs

settings(APDS9960.Sensor.t()) :: %{
  dimension: 0..3,
  enabled: boolean(),
  exit_mask: byte(),
  exit_persistence: 0..3,
  fifo_threshold: 0..3,
  gain: 0..3,
  interrupt_enabled: boolean(),
  led_boost: 0..3,
  led_drive_strength: 0..3,
  offset: %{down: integer(), left: integer(), right: integer(), up: integer()},
  pulse: %{count: byte(), length: 0..3},
  threshold: %{enter: byte(), exit: byte()},
  wait_time: 0..7
}

Specs

status(APDS9960.Sensor.t()) :: %{
  fifo_overflow: boolean(),
  saturation: boolean(),
  valid: boolean()
}

Specs

valid?(APDS9960.Sensor.t()) :: boolean()