adafruit / Adafruit_NeoPixel

Arduino library for controlling single-wire LED pixels (NeoPixel, WS2812, etc.)
GNU Lesser General Public License v3.0
3.11k stars 1.27k forks source link

Feature Request: Apollo3 support #204

Open csonsino opened 5 years ago

csonsino commented 5 years ago

Would be nice to have NeoPixel support for SparkFun Artemis based boards that use the Ambiq Apollo3.

csonsino commented 5 years ago

I wrote a quick and dirty proof of concept on the apollo3 branch at https://github.com/csonsino/Adafruit_NeoPixel, but it uses the nasty "noop" timings. Will start looking at improving the timing mechanism with interrupts, DMA, etc, but if anyone out there wants to put something together then I'd be glad to test out code.

ladyada commented 5 years ago

PR's welcome, even if they are inelegant to start :)

dhalbert commented 5 years ago

There is an implementation in https://github.com/adafruit/circuitpython/blob/master/ports/nrf/common-hal/neopixel_write/__init__.c that uses PWM peripherals to do the timing, at the expense of using quite a bit more RAM to generate the waveforms.

csonsino commented 5 years ago

PR posted.

I have a project that I want to port to the Artemis Nano board, but I should be able to continue working on a better timing implementation in a few days.

ladyada commented 5 years ago

nice!

afoxinsocks commented 4 years ago

Hi,

Just wanted to check in on this, did you ever improve the timing implementation? I've been using your nop hack version for a few weeks and it does work, though I'd love to see this work completed and actually brought into the official NeoPixel Arduino Library.

csonsino commented 4 years ago

I implemented a few different timing mechanisms (see my apollo3_flash_delay branch - https://github.com/csonsino/Adafruit_NeoPixel/tree/apollo3_flash_delay). You can switch between the mechanisms by uncommenting the (one) desired #define PIN_METHOD_XXX towards the top of apollo3.cpp. Something to mention is that for the PIN_METHOD_CTIMER_PWM mode, I didn't complete the mapping in apollo3PadToTimer() so only a couple of the pins will actually work.

Now for the bad news- all of my timing mechanisms suffer from the same flaw that the application basically cannot do anything other than service LEDs in the application loop. If I try to do anything else (I really want BLE functionality as well as LED control), then the LED timing gets messed up and stops working.

There is a suggested implementation over in https://github.com/adafruit/Adafruit_NeoPixel/pull/205 to use SPI and MOSI that might resolve the CPU timing problem, but as far as I know nobody has had the time to work on it.