Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-src by
Diff: targets/hal/TARGET_NXP/TARGET_LPC11U6X/pwmout_api.c
- Revision:
- 516:b3fb5c6901a6
- Parent:
- 285:31249416b6f9
--- a/targets/hal/TARGET_NXP/TARGET_LPC11U6X/pwmout_api.c Fri Apr 17 08:45:07 2015 +0100 +++ b/targets/hal/TARGET_NXP/TARGET_LPC11U6X/pwmout_api.c Mon Apr 20 10:45:07 2015 +0100 @@ -77,9 +77,8 @@ pinmap_pinout(pin, PinMap_PWM); LPC_SCT0_Type* pwm = obj->pwm; - // Two 16-bit counters, autolimit - pwm->CONFIG &= ~(0x1); - pwm->CONFIG |= (1 << 17); + // Unified 32-bit counter, autolimit + pwm->CONFIG |= ((0x3 << 17) | 0x01); // halt and clear the counter pwm->CTRL |= (1 << 2) | (1 << 3); @@ -170,8 +169,8 @@ uint32_t t_off = obj->pwm->MATCHREL0; uint32_t t_on = obj->pwm->MATCHREL1; float v = (float)t_on/(float)t_off; - obj->pwm->MATCHREL0 = (uint64_t)us; - obj->pwm->MATCHREL1 = (uint64_t)((float)us * (float)v); + obj->pwm->MATCHREL0 = (uint32_t)us; + obj->pwm->MATCHREL1 = (uint32_t)((float)us * (float)v); } void pwmout_pulsewidth(pwmout_t* obj, float seconds) { @@ -183,7 +182,7 @@ } void pwmout_pulsewidth_us(pwmout_t* obj, int us) { - obj->pwm->MATCHREL1 = (uint64_t)us; + obj->pwm->MATCHREL1 = (uint32_t)us; } #endif