FASTPWM
Diff: Device/FastPWM_LPC_SCT.cpp
- Revision:
- 30:87e38b846651
- Parent:
- 29:3e4d3b900850
--- a/Device/FastPWM_LPC_SCT.cpp Sun Mar 13 11:43:18 2016 +0000 +++ b/Device/FastPWM_LPC_SCT.cpp Mon Mar 14 20:41:49 2016 +0000 @@ -11,6 +11,14 @@ //Mbed uses the timer as a single unified 32-bit timer, who are we to argue with this, and it is easier bits = 32; + #ifdef TARGET_LPC82X + //The mbed lib uses the PWM peripheral slightly different, which is irritating. This sets it bck to the LPC81X + _pwm.pwm->EVENT[_pwm.pwm_ch + 1].CTRL = (1 << 12) | (_pwm.pwm_ch + 1); // Event_n on Match_n + _pwm.pwm->EVENT[_pwm.pwm_ch + 1].STATE = 0xFFFFFFFF; // All states + _pwm.pwm->OUT[_pwm.pwm_ch].SET = (1 << 0); // All PWM channels are SET on Event_0 + _pwm.pwm->OUT[_pwm.pwm_ch].CLR = (1 << (_pwm.pwm_ch + 1)); // PWM ch is CLRed on Event_(ch+1) + #endif + //With 32-bit we fix prescaler to 1 _pwm.pwm->CTRL_U |= (1 << 2) | (1 << 3); _pwm.pwm->CTRL_U &= ~(0x7F << 5);