@mjs513, @defragster, @manitou - Sorry I am late to the game
Not sure if makes sense for another person to jump in as I already probably have enough diversions
Will be interested when we get to PulsePosition Input as I will be at some point wanting to adapt a robot to using a RC setup, and I have one that outputs a single PPM output...
One of the issues with multiple writes, I think is that all of them are being driven by by one or more global variables, where instead maybe the need to be instance variables? and/or per channel variables?
Example:
Code:
static void isrTimer1()
{
IMXRT_TMR1.CH[timer_channel].CSCTRL &= ~(TMR_CSCTRL_TCF1); // clear compare interrupt
ticks++;
if (state == 0) {
// pin was just set high, schedule it to go low
I marked a couple that I think may have issue with multiple things active, there may be others, or they may be fine?
But I am guessing, that the ISRS need to maybe do something like either look at some Timer status register to see which timer(s) are triggered (which I did not see) or look through the channel registers (SCTRL?), see which ones are triggered, and compare it to which ones you have active objects on, and maybe figure out which object this corresponds to, and then maybe call off to a member ISR method, which does the work and have all of the state information , like lists of pulses... as member variables? But again I am just guessing as I have not done much at all with the timer code.