Page 1 of 1

[SOLVED] Changing PWM from an interrupt.

Posted: Tue Oct 13, 2015 5:23 pm
by rew
Hi,

I have an interrupt where I suddenly "know" the new value for a PWM module.
I tried:

Code: Select all

 pwmEnableChannel(&PWMD3, chan, data);
but that ends up in an assert that there is a syslock problem.
I now use:

Code: Select all

    PWMD3.tim->CCR[chan] = data;
Saves a few subroutine calls as well I guess. :-)

Is there anything I can do to cleanup the code? Do I need to twist myself to pass the new value to the main program and then call pwmEnableChannel?

Solved:

Code: Select all

    pwmEnableChannelI (&PWMD3, baddr&3, d);