# Copyright (c) 2020 Richard Osterloh
# SPDX-License-Identifier: Apache-2.0

description: |
    VCNL4040 proximity and ambient light sensor.  See datasheet at
    https://www.vishay.com/docs/84274/vcnl4040.pdf

compatible: "vishay,vcnl4040"

include: [sensor-device.yaml, i2c-device.yaml]

properties:
  int-gpios:
    type: phandle-array
    description: |
      The INT pin signals that a programmable interrupt function
      for ALS and PS with upper and lower thresholds has been
      triggered. The sensor generates an active-low level signal
      which remains asserted until the data is read.

  led-current:
    type: int
    default: 50
    # default of 50 mA is POR (0b000) for PS_MS[LED_I] register
    description: LED current in mA
    enum:
      - 50
      - 75
      - 100
      - 120
      - 140
      - 160
      - 180
      - 200

  led-duty-cycle:
    type: int
    default: 40
    # default of 40 Hz is POR (0b00) for PS_CONF1[PS_Duty] register
    description: LED duty cycle in Hz
    enum:
      - 40
      - 80
      - 160
      - 320

  proximity-it:
    type: string
    default: "1"
    # default of 1 is POR (0b000) for PS_CONF2[PS_IT] register
    description: Proximity integration time in T
    enum:
      - "1"
      - "1.5"
      - "2"
      - "2.5"
      - "3"
      - "3.5"
      - "4"
      - "8"

  proximity-trigger:
    type: string
    default: "disabled"
    # default of "disabled" is POR (0b00) for PS_CONF2[PS_INT] register
    description: Proximity trigger type
    enum:
      - "disabled"
      - "close"
      - "away"
      - "close-away"

  als-it:
    type: int
    default: 80
    # default of 80 is POR (0b00) for ALS_CONF[ALS_IT] register
    description: ALS integration time in ms
    enum:
      - 80
      - 160
      - 320
      - 640
