Skip to content
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

drivers: sensor: Add Vishay VEML6031 Ambient Light Sensor #84563

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

Conversation

it-klinger
Copy link
Contributor

VEML6031 Sensor driver:

  • add driver for Vishay VEML6031 High Accuracy Ambient Light Sensor.
  • add new compatible "vishay,veml6031".
  • support fetch and get.
  • triggered mode and interrupt is not yet supported.

Sample application:

  • Test all attribute combinations of Vishay sensor VEML6031 which is an
    ambient light sensor.
  • Print out saturation case of sensor.
  • Idea is to be able to find a good combination of attributes for an
    optimal working area.

drivers/sensor/vishay/veml6031/veml6031.c Outdated Show resolved Hide resolved
drivers/sensor/vishay/veml6031/veml6031.c Outdated Show resolved Hide resolved
drivers/sensor/vishay/veml6031/veml6031.c Outdated Show resolved Hide resolved
drivers/sensor/vishay/veml6031/veml6031.c Outdated Show resolved Hide resolved
drivers/sensor/vishay/veml6031/veml6031.c Outdated Show resolved Hide resolved
Comment on lines +26 to +27
This sample uses the VEML6031 sensor controlled using the I2C-2 interface at
the Olimex-STM32-E407 board on feather PF0 and PF1.
Copy link
Member

Choose a reason for hiding this comment

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

Is there a feather board available with this sensor or did you hand-wire something up?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I got the sensor on a breakout board from the vendor Vishay and connected it manually to the Olimex board.

@MaureenHelm
Copy link
Member

Add this sensor to tests/drivers/build_all/sensor

@it-klinger it-klinger force-pushed the add-veml6031 branch 3 times, most recently from 65867d2 to cf4fd60 Compare January 28, 2025 15:48
drivers/sensor/vishay/veml6031/veml6031.c Outdated Show resolved Hide resolved
drivers/sensor/vishay/veml6031/veml6031.c Outdated Show resolved Hide resolved
Copy link
Collaborator

@yperess yperess left a comment

Choose a reason for hiding this comment

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

A few final optimizations, then I think this is good to go.

drivers/sensor/vishay/veml6031/veml6031.c Outdated Show resolved Hide resolved
drivers/sensor/vishay/veml6031/veml6031.c Outdated Show resolved Hide resolved
drivers/sensor/vishay/veml6031/veml6031.c Outdated Show resolved Hide resolved
yperess
yperess previously approved these changes Jan 30, 2025
Comment on lines 694 to 697
test_i2c_veml6031: veml6031@29 {
compatible = "vishay,veml6031";
reg = <0x29>;
};
Copy link
Member

Choose a reason for hiding this comment

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

This needs to go at the end of the file with an I2C bus address incremented by one from the previous node. This is a build-only test so the address doesn't need to match the datasheet.

Comment on lines 2 to 7
CONFIG_GPIO=y
CONFIG_SHELL=y
CONFIG_I2C=y
CONFIG_I2C_STM32=y
CONFIG_SENSOR=y
CONFIG_SENSOR_SHELL=y
Copy link
Member

Choose a reason for hiding this comment

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

Most of these Kconfigs aren't needed.

Suggested change
CONFIG_GPIO=y
CONFIG_SHELL=y
CONFIG_I2C=y
CONFIG_I2C_STM32=y
CONFIG_SENSOR=y
CONFIG_SENSOR_SHELL=y
CONFIG_SENSOR=y

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the reviews.

- add driver for Vishay VEML6031 High Accuracy Ambient Light Sensor.
- add new compatible "vishay,veml6031".
- read and write consecutive 8 bit registers as bulk operation.
- add driver to build all test of sensors.
- support fetch and get.
- triggered mode and interrupt is not yet supported.

Signed-off-by: Andreas Klinger <ak@it-klinger.de>
- Test all attribute combinations of Vishay sensor VEML6031 which is an
  ambient light sensor.
- Print out saturation case of sensor.
- Idea is to be able to find a good combination of attributes for an
  optimal working area.

Signed-off-by: Andreas Klinger <ak@it-klinger.de>
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.

4 participants