jostlowe / Pico-DMX

A library for inputting and outputting the DMX512-A lighting control protocol from a Raspberry Pi Pico
BSD 3-Clause "New" or "Revised" License
187 stars 21 forks source link

DmxInput: Use DMA_SIZE_8 instead of DMA_SIZE_32 to fix "last channel reading problem" (#16) #18

Closed kripton closed 2 years ago

kripton commented 2 years ago

Fixes #16 , see discussion there. Since DmxInput used DMA_SIZE_32 to read from the PIO, channel 512 was not read. With the start code, the amount of bytes to be read was 513 and 513 is not 4-byte-aligned, hindering the DMA transfer containing the last channel. This PR changes the PIO program to append 24 NULL bits after every byte, so the byte is in the position where the DMA expects it. Also, the "pre-compiled" .pio.h-file is updated and the unused and outdated file src/DmxInput.pio is removed.

I didn't test this with Arduino-on-RP2040, only with the Pico-C/C++-SDK

kripton commented 2 years ago

This PR also includes the one commit from #17, so please merge that first