Skip to content

drivers: input: vs1838b: Add support for VS1838B #88661

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

Merged
merged 1 commit into from
Apr 29, 2025

Conversation

bastienjauny
Copy link
Contributor

@bastienjauny bastienjauny commented Apr 15, 2025

The VS1838B is one of the most found infrared receiver in electronic kits and is easy to setup with only a single GPIO used for signal transmission (apart from VCC and GND).
This new driver let applications use the VS1838B as an input with events relayed as 0x0000<address><command>.

Only the NEC protocol is supported in this version but more can be added later.
Link

This has been tested using the input_dump sample.

Copy link

Hello @bastienjauny, 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. 😊

@github-actions github-actions bot added the area: Input Input Subsystem and Drivers label Apr 15, 2025
@github-actions github-actions bot requested a review from fabiobaltieri April 15, 2025 14:04
@kartben kartben requested a review from Copilot April 15, 2025 14:43
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.

Copilot reviewed 2 out of 5 changed files in this pull request and generated 1 comment.

Files not reviewed (3)
  • drivers/input/CMakeLists.txt: Language not supported
  • drivers/input/Kconfig: Language not supported
  • drivers/input/Kconfig.vs1838b: Language not supported

byte += (1 << i);
} else {
LOG_WRN("Failed to identify detected bit at position %u", i);
return false;
Copy link
Preview

Copilot AI Apr 15, 2025

Choose a reason for hiding this comment

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

Returning 'false' in a function that returns a uint8_t is ambiguous because 0 is a valid byte value. Consider refactoring the function to use an out parameter or a dedicated error code to clearly distinguish between a legitimate 0 value and an error condition.

Copilot uses AI. Check for mistakes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All done.

@bastienjauny bastienjauny marked this pull request as draft April 15, 2025 14:56
@bastienjauny
Copy link
Contributor Author

I'm currently reviewing the needed changes (mainly inquiring with my company about the copyright notice). I'll update the PR when the changes are ready.

@bastienjauny bastienjauny force-pushed the add_irreceiver_driver branch from 2d400cd to fadca6f Compare April 15, 2025 15:28
@bastienjauny bastienjauny marked this pull request as ready for review April 15, 2025 15:35
@bastienjauny
Copy link
Contributor Author

Thanks @fabiobaltieri I was just looking at these. I just ran check_compliance.py without any parameters and didn't see those first hand.

@fabiobaltieri
Copy link
Member

fabiobaltieri commented Apr 29, 2025

Thanks @fabiobaltieri I was just looking at these. I just ran check_compliance.py without any parameters and didn't see those first hand.

yeah you need to specify a commit range otherwise it only does the last commit, something like -c upstream/main..HEAD or HEAD~~..HEAD`, depends on your git setup unfortunately there's no way of detecting what "upstream" is automatically

@bastienjauny bastienjauny force-pushed the add_irreceiver_driver branch 2 times, most recently from 4bcba9a to 34b18a7 Compare April 29, 2025 09:20
fabiobaltieri
fabiobaltieri previously approved these changes Apr 29, 2025
return false;
}
if (!detect_last_burst(edges_ticks)) {
LOG_DBG("No command decoded");
Copy link
Collaborator

Choose a reason for hiding this comment

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

copy paste error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, just pushed the fix.

The VS1838B is one of the most found infrared receiver
found in electronic kits and is easy to setup with only
a single GPIO used for signal transmission (apart from
VCC and GND).
This new driver let applications use the VS1838B as an
input with events relayed as 0x0000<address><command>.

Only the NEC protocol is supported in this version but
more can be added later.
Link: https://github-wiki-see.page/m/CoreELEC/remotes/wiki/08.-NEC-IR-Protocol-Datasheet

This has been tested using the input_dump sample.

Signed-off-by: Bastien JAUNY <[email protected]>
@kartben kartben merged commit d5365ba into zephyrproject-rtos:main Apr 29, 2025
24 checks passed
Copy link

Hi @bastienjauny!
Congratulations on getting your very first Zephyr pull request merged 🎉🥳. This is a fantastic achievement, and we're thrilled to have you as part of our community!

To celebrate this milestone and showcase your contribution, we'd love to award you the Zephyr Technical Contributor badge. If you're interested, please claim your badge by filling out this form: Claim Your Zephyr Badge.

Thank you for your valuable input, and we look forward to seeing more of your contributions in the future! 🪁

@bastienjauny
Copy link
Contributor Author

Awesome, many thanks!

@kartben
Copy link
Collaborator

kartben commented Apr 29, 2025

Awesome, many thanks!

No, thank you!

@bastienjauny bastienjauny deleted the add_irreceiver_driver branch April 30, 2025 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Input Input Subsystem and Drivers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants