Hello,

I am trying use ws2812 driver with a samd21 mcu.

I took example from the /boards/arm/rp2040.

added to board.h:
#define BOARD_GPIO_WS2812_PIN    5 /* verifier pin #5 = PA15 */

added to sam_bringup.c:

#ifdef CONFIG_WS2812
/* Configure and initialize the WS2812 LEDs. */
#ifdef CONFIG_WS2812_NON_SPI_DRIVER
#pragma message ("Configure and initialize the WS2812 LEDs with non spi
driver")

if (sam_ws2812_setup("/dev/leds0",
5,
1,
CONFIG_WS2812_LED_COUNT,
HAS_WHITE) == NULL)
{
syslog(LOG_ERR, "Failed to initialize WS2812: %d\n", errno);
return -errno;
}
else
ret = OK;

#else
#pragma message ("Configure and initialize the WS2812 LEDs with spi driver")

ret = board_ws2812_initialize(0, WS2812_SPI, CONFIG_WS2812_LED_COUNT);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: board_ws2812_initialize() failed: %d\n", ret);
}

#endif

#endif



In arch/arm/src/samd2l2 I copied rp2040_ws2812.c and rp2040_ws2812.h and I
replaced 'rp2040_' with 'sam_'.

The problem I have is that I can not convert #include rp2040_pio.h. It
looks like "rp2040_pio.h",  "rp2040_pio.c",  "rp2040_pio_instructions.h"
are specifically designed for rp2040.

Am I on the good path?
Do you have any advice to use ws2812 with samd? I would like to use ws2812
driver without spi driver as all the sercom (com ports) are used. I have 12
leds on the strip and I only need to refresh once per 0.1s.

regards,
Bertrand.

Reply via email to