Skip to content

drivers: sensor: add Garmin LIDAR-Lite v4 LED distance sensor driver #93063

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

alexayl
Copy link

@alexayl alexayl commented Jul 13, 2025

This patch adds a driver for the Garmin LIDAR-Lite v4 LED distance sensor.

The sensor communicates over I2C and supports a basic distance measurement mode. The driver implements the Zephyr sensor API and is configurable via devicetree and Kconfig.

Devicetree bindings and a test application are also included for validation.

Signed-off-by: Alexander Aylward [email protected]

Copy link

Hello @alexayl, and thank you very much for your first pull request to the Zephyr project!
Our Continuous Integration pipeline will execute a series of checks on your Pull Request commit messages and code, and you are expected to address any failures by updating the PR. Please take a look at our commit message guidelines to find out how to format your commit messages, and at our contribution workflow to understand how to update your Pull Request. If you haven't already, please make sure to review the project's Contributor Expectations and update (by amending and force-pushing the commits) your pull request if necessary.
If you are stuck or need help please join us on Discord and ask your question there. Additionally, you can escalate the review when applicable. 😊

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for the Garmin LIDAR-Lite v4 LED distance sensor to Zephyr by implementing a new driver, devicetree binding, test DTS entry, and a sample application.

  • Implements the LIDAR-Lite v4 driver (header and C source) with I2C-based distance measurements.
  • Adds devicetree binding YAML, integrates into Kconfig/CMake, and includes a build-all test DTS entry.
  • Provides a sample application with board overlay and project config for ESP32-S3.

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/drivers/build_all/sensor/i2c.dtsi Added test node for the LIDAR-Lite v4 sensor
samples/sensor/lidar_lite_v4/src/main.c New sample app fetching and printing distances
samples/sensor/lidar_lite_v4/prj.conf Enabled I2C, SENSOR, and LIDAR_LITE_V4 configs
samples/sensor/lidar_lite_v4/boards/esp32s3_devkitc.overlay Board overlay: pinctrl, I2C bus, and sensor node
samples/sensor/lidar_lite_v4/CMakeLists.txt Sample app CMake entry
dts/bindings/sensor/grmn,lidar-lite-v4.yaml Devicetree binding for Garmin LIDAR-Lite v4
drivers/sensor/grmn/lidar_lite_v4/lidar_lite_v4.h Driver header definitions and structures
drivers/sensor/grmn/lidar_lite_v4/lidar_lite_v4.c Driver implementation (init, fetch, channel_get)
drivers/sensor/grmn/lidar_lite_v4/Kconfig Driver Kconfig entry
drivers/sensor/grmn/lidar_lite_v4/CMakeLists.txt Driver CMakeLists integration
drivers/sensor/grmn/Kconfig Includes new driver Kconfig
drivers/sensor/grmn/CMakeLists.txt Includes new driver directory in build
drivers/sensor/Kconfig Added grmn group to sensor Kconfig
drivers/sensor/CMakeLists.txt Added grmn folder to sensor CMakeLists
Comments suppressed due to low confidence (6)

samples/sensor/lidar_lite_v4/boards/esp32s3_devkitc.overlay:3

  • Remove the stray "/" on line 3; it will cause a Devicetree parse error.
/

samples/sensor/lidar_lite_v4/boards/esp32s3_devkitc.overlay:19

  • Fix hyphenation to bias-pull-up; for valid Devicetree syntax.
			bias - pull - up;

samples/sensor/lidar_lite_v4/boards/esp32s3_devkitc.overlay:20

  • Fix hyphenation to drive-open-drain; for valid Devicetree syntax.
			drive - open - drain;

samples/sensor/lidar_lite_v4/boards/esp32s3_devkitc.overlay:21

  • Fix hyphenation to output-high; for valid Devicetree syntax.
			output - high;

drivers/sensor/grmn/lidar_lite_v4/lidar_lite_v4.c:52

  • Add #include <zephyr/kernel.h> at the top of this file to ensure k_msleep is declared.
		k_msleep(1);

samples/sensor/lidar_lite_v4/src/main.c:9

  • Add #include <zephyr/sys/printk.h> to properly use printk in the sample application.
#include <zephyr/kernel.h>

Comment on lines 63 to 64
ret = i2c_reg_write_byte_dt(&config->i2c, LIDAR_LITE_V4_REG_MEASURE,
LIDAR_LITE_V4_CMD_MEASURE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems your editor is configured for 4 spaces per tab but 8 are expected.

Copy link
Author

@alexayl alexayl Jul 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this line I know the indentation is wrong. However, would the rest of the code need to be refactored to remove 4-space tabs? To address this comment I was just going to run clang-format

Garmin Lidar Lite V4 driver that enables distance measurements via i2c as described in sensor manual. This includes sample_fetch(), channel_get(), and init().

Signed-off-by: Alex Aylward <[email protected]>
@alexayl alexayl requested a review from faxe1008 July 13, 2025 20:22
faxe1008
faxe1008 previously approved these changes Jul 13, 2025
alexayl added 2 commits July 13, 2025 16:50
Add intermediate Cmake and Kconfig files, sensor dts binding, change "garmin" to "grmn" due to prior convention.

Signed-off-by: Alex Aylward <[email protected]>
Added dts node for driver build test to build all sensors.

Signed-off-by: Alex Aylward <[email protected]>
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants