Skip to content

Conversation

@fabiobaltieri
Copy link
Member

Add drivers and shields for Arduino Modulino Buttons and Smart LEDs, these are QWIIC modules to provide buttons and LED strip functionalities.

@fabiobaltieri fabiobaltieri force-pushed the modulino branch 7 times, most recently from d96cb8e to 77e8016 Compare May 9, 2025 05:56
@fabiobaltieri fabiobaltieri self-assigned this May 9, 2025
@fabiobaltieri fabiobaltieri marked this pull request as ready for review May 9, 2025 05:56
@github-actions github-actions bot added area: Input Input Subsystem and Drivers area: Shields Shields (add-on boards) area: LED Label to identify LED subsystem area: MFD labels May 9, 2025
facchinm
facchinm previously approved these changes May 9, 2025
pillo79
pillo79 previously approved these changes May 9, 2025
static int modulino_buttons_leds_set_brightness(const struct device *dev,
uint32_t led, uint8_t value)
{
return modulino_buttons_leds_set(dev, led, value > 0);
Copy link
Contributor

@kartben kartben May 9, 2025

Choose a reason for hiding this comment

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

I'd suggest you don't implement it (it's considered optional as per the documentation) in this case

Copy link
Member Author

Choose a reason for hiding this comment

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

interesting, the problem is that one could use the set brightness API and have it working on both pwm and normal LEDs, if I don't implement it that would not work, but then this would be better handled in the set brightness LED implementation

I'll leave it here for now if you don't mind and follow up with an API clean uproposal

Copy link
Contributor

@simonguinot simonguinot May 9, 2025

Choose a reason for hiding this comment

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

It is OK to have ->set_brightness implemented here. To be honest, I never understood why we have ->on and ->off methods in Zephyr. I think drivers should only implement ->set_brightness, as in Linux. And eventually some led_on and led_off macros should be wrapped around.

Copy link
Member Author

@fabiobaltieri fabiobaltieri May 9, 2025

Choose a reason for hiding this comment

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

Not sure either but #89718 is landing in your inbox soon. I'm all for ditching on/off, though I bumped into a driver that was hooking into those differently for enabling just "on" or "pwm on", that it would be particularly hard to handle that...

@kartben kartben requested a review from Copilot May 9, 2025 07:47
Copy link

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 new drivers and device-tree bindings for Arduino Modulino Buttons and Smart LEDs, along with associated Kconfig, CMakeLists, shields, and documentation files.

  • Added LED and input drivers for smart LEDs and buttons
  • Added DT bindings, configuration files, and documentation overlays for the new hardware modules

Reviewed Changes

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

Show a summary per file
File Description
dts/bindings/led/arduino,modulino-buttons-leds.yaml New DT binding for Modulino smart LED driver
dts/bindings/input/arduino,modulino-buttons.yaml New DT binding for Modulino buttons input driver
drivers/led_strip/modulino_smartleds.c New LED strip driver for smart LEDs
drivers/led_strip/Kconfig.arduino Kconfig for smart LEDs (note help text mismatch)
drivers/led/modulino_buttons_leds.c New LED driver for Modulino buttons LEDs
drivers/input/input_modulino_buttons.c New input driver for Modulino buttons
boards/shields/... Added shields overlays and documentation for smart LEDs and buttons
Comments suppressed due to low confidence (1)

drivers/led/modulino_buttons_leds.c:15

  • [nitpick] Consider revising the logging configuration to use a LED-specific log level (e.g. CONFIG_LED_LOG_LEVEL) instead of CONFIG_INPUT_LOG_LEVEL, since this driver is for LED control.
LOG_MODULE_REGISTER(modulino_buttons_leds, CONFIG_INPUT_LOG_LEVEL);

@fabiobaltieri
Copy link
Member Author

OK ! That's how I understood it at first. So I am reinstalling my initial comment: should we say somewhere (commit description, Kconfig) that these drivers are for any MCU connected to the Modulino board, and not the C0 ? Or is it obvious ? I honestly think there is room for confusion here :)

Wouldn't say it's obvious, but I would reckon that users of this would just see them like any other i2c device without thinking too much as to how the protocol is implemented. That said, the firmware is open source and the code was the reference I used for the protocol, so yeah I think you are right that adding a reference in the commit message is a good idea, let me rework those.

@fabiobaltieri
Copy link
Member Author

Okay same code, added some more details in the commit messages and references to the library, firmware and a mention to the fact that they can be updated. That was a good comment @simonguinot, unfortunately GitHub tend to hide commit messages in a tab and for how much I'm preaching about how important they are I realize I'm tending to write poor ones myself.

pillo79
pillo79 previously approved these changes May 13, 2025
simonguinot
simonguinot previously approved these changes May 13, 2025
Copy link
Contributor

@simonguinot simonguinot left a comment

Choose a reason for hiding this comment

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

The LED drivers are looking good to me !

@fabiobaltieri fabiobaltieri requested review from kartben and soburi May 13, 2025 13:32
@simonguinot
Copy link
Contributor

Thanks for updating the commit message. I think it is clearer.

soburi
soburi previously approved these changes May 13, 2025
Add an input driver for the modulino buttons module. This is a pluggable
I2C board implementing three buttons and three LEDs, the I2C protocol is
implemented on a microcontroller on the modulino board itself, the
firmware for that is open source and can be updated using an Arduino
sketch:

Link: https://github.com/arduino/node_modulino_firmware
Link: https://github.com/arduino-libraries/Modulino
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Add an LED driver for the modulino buttons module, this has three LEDs
that are controllable independently of the buttons.

Link: https://github.com/arduino/node_modulino_firmware
Link: https://github.com/arduino-libraries/Modulino
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Add an led_strip driver for the modulino smartleds module. This is a
pluggable I2C board with 8 addressable RGB LEDs

The I2C protocol is implemented on an microcontroller on the modulino
board itself, the firmware for that is open source and can be updated
using an Arduino sketch:

Link: https://github.com/arduino/node_modulino_firmware
Link: https://github.com/arduino-libraries/Modulino
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Add two shield definitions for the the modulino buttons and smartleds
modules.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Add modulino drivers path to the Arduino area.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
@sonarqubecloud
Copy link

@fabiobaltieri
Copy link
Member Author

Issues 0 New issues 0 Accepted issues

Measures 0 Security Hotspots 0.0% Coverage on New Code 0.0% Duplication on New Code

Hey @sonarqubecloud, if you don't have anything to say, could you just not say anything?

Copy link
Contributor

@pillo79 pillo79 left a comment

Choose a reason for hiding this comment

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

Thanks Fabio!

@fabiobaltieri fabiobaltieri merged commit 8355418 into zephyrproject-rtos:main May 14, 2025
26 checks passed
@fabiobaltieri fabiobaltieri deleted the modulino branch May 14, 2025 10:03
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 area: LED Label to identify LED subsystem area: MFD area: Process area: Shields Shields (add-on boards)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants