How to control neopixel (ws2812b)

I want to add matek 2812 led strip to pixracer r15 and it seems that it is neopixel.

  1. I cannot find implementation of neopixel_write in source code. Where is it?

  2. I cannot find, where is configured output pin? Where does neopixel_write sends its data and how can I configure it?

  3. How can I publish data to neopixel instance? I see that it takes something from led_controller, but I cannot understand where does the data comes from?

This one? PX4-Autopilot/neopixel.cpp at 55563eba49f87624d7b73356ea3d421fee7ec081 · PX4/PX4-Autopilot · GitHub

Ah, it’s a bit hidden, and here:

Good question. Have a look through these files. I’m not sure. Maybe @david_s5 can give you a hint.

It looks like LedController is consuming the uORB led_control topic.

great response! Thanks a lot!! Will try to dig deeper

The driver uses DMA operations on a Timer.

This is how it is chosen:

Timer and channel choices is configured here:

Here is the init

1 Like

In all sources I’ve found S_RGB_LED_TIM_GPIO only on cuav/can-gps-v1
Does it mean that pixracer r15 doesn’t have proper hardware for plugging this led or it means that it is just not configured?

I’m not using any regular frsky telemetry or radio input, only mavlink via TELEM1, so maybe it is possible to reuse some free pin in these connectors for this task? Sorry if this question looks dumb, I’m not aware of details of DMA in STM32.

If there are no proper free pins in pixracer, then my way is to have a separate arduino working as UART peer or i2c slave doing this controlling?