Skip to content

drivers: sensor: Add support for BH1730 ambient light sensor #89908

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 1 commit into
base: main
Choose a base branch
from

Conversation

rtborg
Copy link

@rtborg rtborg commented May 13, 2025

This commit adds support for BH1730 ambient light sensor.

@github-actions github-actions bot added the area: Sensors Sensors label May 13, 2025
Copy link

Hello @rtborg, 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 BH1730 ambient light sensor by introducing a new sensor driver, device tree bindings, and associated build changes.

  • Added a new sensor node in the DTS test file.
  • Introduced DTS binding YAML for the BH1730 sensor.
  • Implemented the sensor driver with configuration (Kconfig, CMakeLists.txt) and driver source code.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/drivers/build_all/sensor/i2c.dtsi Added sensor node for BH1730.
dts/bindings/sensor/rohm,bh1730.yaml New DTS binding file describing sensor properties and defaults.
drivers/sensor/rohm/bh1730/bh1730.c New driver code implementing sensor functionality.
drivers/sensor/rohm/bh1730/Kconfig Added configuration options for the BH1730 sensor.
drivers/sensor/rohm/bh1730/CMakeLists.txt Build file listing new driver source.
drivers/sensor/rohm/Kconfig Updated to include the new sensor driver Kconfig.
drivers/sensor/rohm/CMakeLists.txt Updated to add the BH1730 subdirectory when enabled.
Comments suppressed due to low confidence (1)

drivers/sensor/rohm/bh1730/bh1730.c:29

  • The constant 'BH1730_CONTORL_ADC_EN_POWER_ON_SINGLE_READING' is misspelled; consider renaming it to 'BH1730_CONTROL_ADC_EN_POWER_ON_SINGLE_READING' for clarity.
#define BH1730_CONTORL_ADC_EN_POWER_ON_SINGLE_READING 0x0B

- 0
- 1
- 2
- 3
Copy link
Preview

Copilot AI May 13, 2025

Choose a reason for hiding this comment

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

The gain documentation for value '3 = x64 gain mode' does not match the driver implementation (which returns 128x gain); update the documentation to reflect the correct gain value.

Copilot uses AI. Check for mistakes.


/* Part number in bits 7:4 */
if ((val >> 4) != (BH1730_PART_ID >> 4)) {
LOG_ERR("Part number do not match, received 0x%1X", val >> 4);
Copy link
Preview

Copilot AI May 13, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider correcting the error message to 'Part number does not match' for proper grammar.

Suggested change
LOG_ERR("Part number do not match, received 0x%1X", val >> 4);
LOG_ERR("Part number does not match, received 0x%1X", val >> 4);

Copilot uses AI. Check for mistakes.

properties:
gain:
type: int
default: 0
Copy link
Collaborator

Choose a reason for hiding this comment

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

This commit adds support for BH1730 ambient light sensor.

Signed-off-by: Borislav Kereziev <[email protected]>
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.

3 participants