ws28128-rpi
ws28128-rpi copied to clipboard
Possible to use other hardware pin? (PWM1, GPIO13)
Hi! I want to run an i2s-DAC and some WS2812B-pixels from a RaspBerryPi Zero (Jessie Lite) Since the i2s-DAC occupies GPIO18, I was wondering if I could use GPIO13 (also PWM?) instead, by changing it in this line
// Set PWM alternate function for GPIO18
SET_GPIO_ALT(18, 5);
Thanks! :)
@jivido Ive got the same use-case. Did you found a solution?
I came across: https://github.com/evopro-ag/ws28128-rpi
But id not tested it yet.
Hi @miathedev Yes, I did! Edit: Sorry, linked to the wrong lib, this is the one I used (and got i2s-audio + leds working): https://github.com/jgarff/rpi_ws281x (For audio I used this Adafruit script) Don't have acces to my full implementation right now, but got it working like this: (I edited the main.c file into my .cpp file (openFrameworks)) In .h file:
#define TARGET_FREQ 800000
#define DMA 8
#define GPIO_PIN 13
#define STRIP_TYPE WS2812_STRIP
ws2811_channel_t channel[RPI_PWM_CHANNELS];
ws2811_t ledstring;
In .cpp file:
channel[1] = {};
channel[1].gpionum = GPIO_PIN;
channel[1].count = numLeds;
channel[1].invert = 0;
channel[1].brightness = 255;
channel[1].strip_type = STRIP_TYPE;
ledstring.channel[1] = channel[1];
ledstring.dmanum = DMA;
ledstring.freq = TARGET_FREQ;
ws2811_return_t ret;
ws2811_init(&ledstring);
if (ws2811_init(&ledstring) != WS2811_SUCCESS){
fprintf(stderr, "ws2811_init failed: %s\n", ws2811_get_return_t_str(ret));
}