This repository has been archived by the owner on Nov 28, 2022. It is now read-only.
Adding low level buffer operations ro RPIO.PWM #20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change adds functionality that allows the assignment of individual GPIO channel commands to the DMA ring buffer. This allows pulses length to be changed with minimal cost.
Below is an example python usage, it demonstrates a single dma channel being used to control 9 channels of PWM output [three banks of RGB leds]. The LED color can be faded with no flickers or glitches, and there is a minimal cost to change the pulse width. The on and off commands are pre-setup to allow each of the channels to start at a different phase of the cycle to reduce the current surge.
The on instructions are at fixed positions so that we do no attempt to reassign them to off instructions.
from RPIO import PWM
class LightController:
dmachannel = 0
channels = [24,23,25,15,18,14,9,11,10]
starts = [0,333,666,999,1332,1665,1998,2331,2664]
lastPos = [0,333,666,999,1332,1665,1998,2331,2664]