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

NeoPixelBus on a EPS32 board with esp-idf framework #684

Open
roykrikke opened this issue Apr 10, 2023 · 12 comments
Open

NeoPixelBus on a EPS32 board with esp-idf framework #684

roykrikke opened this issue Apr 10, 2023 · 12 comments
Labels
enhancement future consideration This issue is tracking a feature for consideration in any future major work.

Comments

@roykrikke
Copy link

Is your feature request related to a problem? Please describe.
This feature request is not based on a problem, but missing support for esp-idf framework.

Describe the solution you'd like
I'd like it if NeoPixelBus could support a EPS32 board with the end goal to have an integration possibly inside ESPHome via the esp-idf framework
Board example e.g. like Atom Lite

Additional context
There are several ESP32 based boards designed which could be used with NeoPixelBus for controlling e.g. SK6812 or WS2812 led strips, it would be great if they could be run inside ESPHome via NeoPixelBus.

@Makuna
Copy link
Owner

Makuna commented Apr 10, 2023

Have you tried it? I would imagine with little effort on your side you should be able to just include NeoPixelBus.h and it should work. A simple Arduino.h file containing the very few specific arduino calls made and I would think it would work.

It is unlikely that I would make the effort without an incitive, but I will mark it and leave it active. I have tons of features to work as is.

@Makuna Makuna added enhancement future consideration This issue is tracking a feature for consideration in any future major work. labels Apr 10, 2023
@roykrikke
Copy link
Author

Have you tried it? I would imagine with little effort on your side you should be able to just include NeoPixelBus.h and it should work. A simple Arduino.h file containing the very few specific arduino calls made and I would think it would work.

It is unlikely that I would make the effort without an incitive, but I will mark it and leave it active. I have tons of features to work as is.

I know C and C++ but I don't quite understand what you mean with your explanation. Can you help me on my way so that I can make the effort myself?

@Makuna
Copy link
Owner

Makuna commented Apr 10, 2023

My library includes "Arduino.h", the idf will not have this, so create an empty one in your project. As you compile and find errors about missing arduino specific calls/defines, add wrappers in your Arduino.h as needed. I suspect there is just going to be a few. digitalWrite(), pinMode() are examples. Heck, you might be able to just copy them from the ardunio esp32 source code. Most of the lower level stuff I use is IDF calls.

@Surgikill
Copy link

Just chiming in, I am also running into this issue. I'm not sure how I can go about adding "Arduino.h" into esphome.

@Makuna
Copy link
Owner

Makuna commented Jun 9, 2023

I also don't know esphome. Have you asked there if there is a way to include Arduino libraries?

@Surgikill In the compiler output, what errors are you getting? Also include the make line that runs the compiler so I can view the defines (-Dblahblah).

@Surgikill
Copy link

@Makuna This is the output when I try to compile.

`INFO ESPHome 2023.5.5
INFO Reading configuration /config/esphome/office-presencebox.yaml...
Failed config

light.neopixelbus: [source /config/esphome/office-presencebox.yaml:260]

This feature is only available with frameworks ['arduino'].
platform: neopixelbus
type: GRB
variant: WS2811
pin: GPIO23
num_leds: 60
name: NeoPixel Light
`

I don't even know what the make line is. ESPhome just uses yaml configurations to then flash devices.

@Makuna
Copy link
Owner

Makuna commented Jun 9, 2023

ESPHome requires the framework Arduino for their use of my Library it looks like. Again, not a ESPHome person, so talking with them first is the way to go.

@trombik
Copy link

trombik commented Jul 12, 2023

A simple Arduino.h file containing the very few specific arduino calls made and I would think it would work.

it turned out you are right. Some examples are running fine on my board. one needs to copy some files, including many HAL files for different chips, with some modifications. Modifications to NeoPixelBus is minimal; skipping SerialDumpTables() and SPI-based driver (they are tied with hardware). It might possible to implement a simple wrapper of esp-idf SPI Master Driver as an alternative of arduino SPI library.

It is unlikely that I would make the effort without an incitive, but I will mark it and leave it active.

do you mean, if someone maintains esp-idf part in the tree, you would merge the changes?

@edwardtfn
Copy link

edwardtfn commented Jun 12, 2024

I can also help with esp-idf if you are willing to merge it.
And as soon you merge, I can also submit a pr to change ESPHome for supporting esp-idf with this library.

@Makuna
Copy link
Owner

Makuna commented Jun 14, 2024

If they don't affect the Arduino building, then yes, I will merge.

@edwardtfn
Copy link

To which branch should I submit the PRs?

@Makuna
Copy link
Owner

Makuna commented Jun 18, 2024

To which branch should I submit the PRs?

Master. Master is always the next upcoming release. Each release gets a tag into master when it was stable. Other branches are usually prototype changes or changes so dramatic they require some time to "bake" with concerned users before they get rolled into master.
If the changes are dramatic, they may require a branch. But work in your clone of this repo to get things working. Test to make sure that it compiles for Arduino.

edwardtfn added a commit to edwardtfn/esphome that referenced this issue Dec 18, 2024
This changes the library in use from v2.7.3 to the current latest NeoPixelBus version (v2.8.3).
No additional changes on this PR to avoid breaking changes, but I wanna use this to enable playing with an IDF version of this library (Makuna/NeoPixelBus#684).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement future consideration This issue is tracking a feature for consideration in any future major work.
Projects
None yet
Development

No branches or pull requests

5 participants