drivers: led: is31fl3197 Arduino GIGA#96821
drivers: led: is31fl3197 Arduino GIGA#96821KurtE wants to merge 6 commits intozephyrproject-rtos:mainfrom
Conversation
fd309e3 to
b69ff55
Compare
|
@pillo79 @facchinm and all - As far as I can tell, the basic parts of this PR are working. That is I can set the RGB led on the I am going to mark this as ready to review, however I know there are issues with twister, as it appears like the GIGA board Currently I have the sample setup to work with just specifying board as arduino_giga_r1//m7, as the shield currently Also should mention: that the code is hard coded similarly to the is31fl3194 code in that it assumes RED/GREEN/BLUE But before I go much further, it would help to know if this is a direction that Arduino wishes to go. |
simonguinot
left a comment
There was a problem hiding this comment.
Hi @KurtE,
Thanks for this PR !
Can it be merged with the driver is31fl3194 ? into a is31fl319x driver ?
I didn't check but I am asking because in Linux the leds-is31fl319x driver supports the IS31FL319{0,1,3,6,9} models...
Good question, both of them have stuff in common, and I started off that way, but then found many of the registers @pillo79 As the one who originally did the 94 version, What do you think? |
|
Thanks Kurt! I also think this is worth merging with the existing driver, there's a lot of common code, and the few exceptions look like they can be specifically handled. Take a look at the end of Oh, and re/ Arduino attitude, upstream is the way to go so 👍 on that! By all means make it part of the Giga Display shield, that way it will be automatically available everywhere you use that and not only in the test code 🙂 |
Can do. At least the basics, that the display shield uses. Don't have any other things to try more advanced stuff on. My first thoughts were to hack it and drive everything off of Product ID. I believe the 94 has a fixed ID of 0xce
I agree, that in the Zephyr world, having it all here under the shield is the way to go and not have to put the DT info in the Some questions on this, should I then remove the GIGA from the integration section of the sample.yaml? As I don't believe Include Portenta H7? I have a overlay I experimented with yesterday, that had the LEDS working on an H7 plugged into a MID Main Secondary Question: Currently with ArduinoCore-zephyr if I wish to build for a GIGA, it includes all of the Giga Shield stuff, regardless if I actually have a shield. With the MBED version, only the basics for the display are included with a board release in the library Arduino_H7_video, The I decided to try first with the LEDS as it is pretty self contained and not very large. Our zephyr version of Arduino library for this: Longer term question: how much of the stuff in the ArduinoCore-zephyr overlays/config files maybe should be |
|
Sorry, another quick question: Is there any Boards other than the Nicla Sense ME that uses is31fl3194? |
8e0f5b9 to
f2c2e67
Compare
drivers/led/is31fl319x.c
Outdated
| &is31fl319##id##_config_##n, POST_KERNEL, \ | ||
| CONFIG_LED_INIT_PRIORITY, &is31fl319x_led_api); | ||
|
|
||
| #ifdef CONFIG_DT_HAS_ISSI_IS31FL3194_ENABLED |
There was a problem hiding this comment.
If you want to support multiple "compatible" values,
this is a cleaner way to write it than using #undef.
Just for your reference.
zephyr/drivers/display/ssd1306.c
Lines 614 to 643 in a989118
drivers/led/is31fl319x.c
Outdated
| &is31fl319##id##_config_##n, POST_KERNEL, \ | ||
| CONFIG_LED_INIT_PRIORITY, &is31fl319x_led_api); | ||
|
|
||
| #ifdef CONFIG_DT_HAS_ISSI_IS31FL3194_ENABLED |
There was a problem hiding this comment.
If you want to support multiple "compatible" values,
this is a cleaner way to write it than using #undef.
Just for your reference.
zephyr/drivers/display/ssd1306.c
Lines 614 to 643 in a989118
| }; | ||
|
|
||
| #ifdef CONFIG_DT_HAS_ISSI_IS31FL3194_ENABLED | ||
| /* IS31FL3194 model registers and values */ |
There was a problem hiding this comment.
There is no need to put it in #ifdef because the model name is designed to be unique. It is also better to put it at the beginning.
|
|
||
| #ifdef CONFIG_DT_HAS_ISSI_IS31FL3197_ENABLED | ||
| /* IS31FL3197 model registers and values */ | ||
| #define IS31FL3197_PROD_ID_REG 0x00 |
|
|
||
| #define IS31FL3197_CHANNEL_COUNT 4 | ||
|
|
||
| static const struct is31f1319x_model is31f13197_model = { |
There was a problem hiding this comment.
Here too, there will be no name duplication, so I think it's okay to add __maybe_unused and remove the #ifdef.
f2c2e67 to
63d8c85
Compare
|
@ALL I removed the #if/endif pairs to enumerate the devices as to mimic It builds and I programmed both a Arduino GIGA R1 as well as an Arduino Nicla Sense ME |
drivers/led/is31fl319x.c
Outdated
| const struct is31f1319x_model *regs = config->regs; | ||
| int i, ret; | ||
| uint8_t prod_id, band; | ||
| int i, j, ret; |
There was a problem hiding this comment.
not fixed in the right commit and other lines are not fixed at all, it needs to be fixed
Not sure what are saying? I understand the don't add the third variable to a line that already had two... Which I did that way, as usually find you try However not sure what the "other lines are not fixed" means. The other comments about changing how to handle |
63d8c85 to
ae2fe12
Compare
|
@thedjnK - Hopefully I got the variables changed you were concerned about in the right commit. |
| /* | ||
| * output LED RGB color table | ||
| */ | ||
| void display_RGB_color_table(const struct device *dev, uint32_t led) |
There was a problem hiding this comment.
camel case for functions and variables
| } | ||
|
|
||
| /* | ||
| * output LED RGB color table |
There was a problem hiding this comment.
Start comments with a capital letter
| /* | ||
| * Main | ||
| */ |
There was a problem hiding this comment.
| /* | |
| * Main | |
| */ |
ae2fe12 to
c9a8b31
Compare
Removed the driver knowing anything about what color each channel is. When you output to an LED with a buffer it simply writes the channels out with buffer. Also removed the assumptions that the leds are either a) RGB or b) 3 channels and instead use them the way they are defined. That is for example if we have 4 channels, we could define an LED with just one color in it and we could define another with three. The user can define 4 leds each with color yellow. For each LED it counts how many buffers were used by previous LEDs and starts there and outputs N channels. Decided it looked cleaner to use helper function write channels, so implemented it and added it to the call table. Updated sample: It manually computes which channel maps to red, green and blue and then uses those indexes to map the table of colors to the right channels. Signed-off-by: Kurt Eckhardt <kurte@rockisland.com>
c9a8b31 to
62a0869
Compare
simonguinot
left a comment
There was a problem hiding this comment.
Hi @KurtE
The driver itself is in a pretty good shape now. Well done.
I only have minor comments. The main thing is the sample. It seems really complicated to me and I suggest we drop the RGB mixing color test.
See my comments below.
| help | ||
| Enable LED driver for Lumissil Microsystems (a division of ISSI) | ||
| IS31FL3194. This chip supports one RGB LED or 3 independent LEDs. | ||
| IS31FL3197. This chip supports 4 LEDs. |
There was a problem hiding this comment.
Please, rephrase. It is quite confusing.
| #define DT_DRV_COMPAT issi_is31fl3194 | ||
|
|
||
| /** | ||
| * @file |
There was a problem hiding this comment.
You should replace
IS31FL3194withIS31FL319xin the line below.
Still valid. It is now the IS31FL319x LED driver.
| * @file | ||
| * @brief IS31FL3194 LED driver | ||
| * | ||
| * The IS31FL3194 is a 3-channel LED driver that communicates over I2C. |
There was a problem hiding this comment.
And you can transform this description into a list of controller models supported by this driver.
| @@ -1,3 +1,3 @@ | |||
| /* | |||
| * Copyright (c) 2024 Arduino SA | |||
| * | |||
There was a problem hiding this comment.
You may want to add your copyright here.
| /* | ||
| * Set one color (R or G or B) to all on and then fade it down to off | ||
| */ | ||
| void fade_one_color(const struct device *dev, uint8_t led, uint8_t led_count, |
There was a problem hiding this comment.
Maybe led_count would be better named color_count or num_colors,
The third parameter of led_set_color is named num_colors, So it is quite confusing to read that a led_count parameter is passed.
| fade_all_channels(led_dev, device_channel_count); | ||
|
|
||
| /* Check for RGB LED */ | ||
| rgb_led = generate_rgb_color_mapping(led_dev); |
There was a problem hiding this comment.
All the RGB handling seems complicated to me.
IMO, it is enough to iterate the LEDs, display their name, the number of colors, and for each color display the ID or name and perform an action (e.g. off, on, fade).
It would be nice to make it simple :)
Add the registers and the like to the .c file plus add a Kconf file plus bindings. Updated sample: to also check for is31fl3197 boards Signed-off-by: Kurt Eckhardt <kurte@rockisland.com>
Added is31fl3197@50 to overlay Also updated GIGA board yaml file to say that it supports i2c And updated sample to mention it Signed-off-by: Kurt Eckhardt <kurte@rockisland.com>
62a0869 to
52bdedd
Compare
Removed all of the color mixing example code, which looped at the end of the example. This included code, that on LED setups which have RGB colors, would show mixing of the LEDs for different colors like yellow. It also striped out the fading of single colros at the end for those LED setups that do not have a RGB configured. Note: not sure if the code now exercises every API. Signed-off-by: Kurt Eckhardt <kurte@rockisland.com> Update main.c
8b20e35 to
12488e4
Compare
|




Start of support for the is31fl3197 LED controller used by Arduino in the Arduino Giga Display shield.
So far there is just enough implemented that allows me to control the LEDS, to the same extent as our version of the library we implemented that runs on ArduinoCore-zephyr
@pillo79 @facchinm - I am not sure what direction Arduino is heading with functionality such as this.
Add support to zephyr? Or do it external as libraries within ArduinoCore-zephyr (either integrated within the zephyr builds or external libraries), This is also true, about for some of the other
features of the display, like the display itself. Should there be samples setup to actually
display something on the display, preferably without the need for LVGL.
So far this only has the minimal support for setting up to 4 LEDS (the GIGA only uses 3).
Added sample sketch that runs on the GIGA. Currently it works with just
west build -p -b arduino_giga_r1//m7
I put the device tree into sample/boards. Potentially it should be defined as part of the
overlay in the arduino_giga_display_shield, in which case the west build should
define the shield as part of the command.
Let me know know what you think.
Thanks