mbed library sources. Supersedes mbed-src.
Fork of mbed-dev by
Diff: targets/TARGET_NXP/TARGET_LPC15XX/pwmout_api.c
- Revision:
- 156:95d6b41a828b
- Parent:
- 149:156823d33999
--- a/targets/TARGET_NXP/TARGET_LPC15XX/pwmout_api.c Thu Jan 05 10:51:54 2017 +0000 +++ b/targets/TARGET_NXP/TARGET_LPC15XX/pwmout_api.c Mon Jan 16 15:03:32 2017 +0000 @@ -91,6 +91,9 @@ pwm->OUT0_SET = (1 << 0); // event 0 pwm->OUT0_CLR = (1 << 1); // event 1 + // Resolve conflicts on output 0 to set output + // This allows duty cycle = 1.0 to work, where the MATCH registers for set and clear are equal + pwm->RES = 0x01; pwm->EV0_CTRL = (1 << 12); pwm->EV0_STATE = 0xFFFFFFFF; @@ -169,7 +172,7 @@ // Halt the timer and force the output low pwm->CTRL |= (1 << 2) | (1 << 3); pwm->OUTPUT = 0x00000000; - + // Ensure the new period will take immediate effect when the timer is un-halted pwm->MATCH0 = pwm->MATCHREL0; }