At a lower level MIOS would alternate pages by presumably setting a pointer prior to each DMA transfer.
In the above example any attached LED could be run at 100%, 50% (or 0%) brightness. When setting the brightness level for a particular LED, the same bit is set and/or cleared in different pages.
Taking the concept further
#define DOUT_NUM_BUFPAGES 10
would produce 10 level, 100Hz, brightness control. Actually its does not have to be Pulse Width Modulation exactly. It is more like Pulse Density Modulation (if such a term exists). This is because the on and off bits can be randomly distributed in the pages, for any given LED.
When set, the background processing is achieved with almost zero extra overhead. Just updating the page pointer each SRIO cycle?
A nice idea - I haven’t considered such possibilities yet since MIOS8 was always restricted on RAM limitations.
Note that the same concept can be used to drive a LED matrix - e.g. set DOUT_NUM_BUFPAGES to 8 and output (1 << counter) to an additional DOUT register.
If you are working on an extension on MIOS32, you could consider this usecase as well.
Note that the same concept can be used to drive a LED matrix - e.g. set DOUT_NUM_BUFPAGES to 8 and output (1 << counter) to an additional DOUT register.
If you are working on an extension on MIOS32, you could consider this usecase as well.
Sure, but I’m not quite sure how the additional DOUT register is wired to the matrix, and why 8 pages?
Edit:
Having thought a some more about this, if there is a page each for the number of matrix columns,then row/column matrix’s can be driven this way.
A family of helper functions to set the page data for RGB, TriLED, single variable brightness LED, row/col matrix wired LED, etc.
defineMIOS32_SRIO_ScanStart_DoutPaged()which has a rotating index when providing a dout array pointer toMIOS32_SPI_TransferBlock(..)
Put a #ifdef switch invoid vApplicationTickHook(void)so thatMIOS32_SRIO_ScanStart_DoutPaged()is called instead ofMIOS32_SRIO_ScanStart()
Question:
Is there a way of achieving (4.) without modifying MIOS32 source code?
If I’m correct then the rest can be achieved as a pure add on module i.e not modifying MIOS32 source. I’m very happy to commit to the repo, but I dont want to “bloat” anything!