Ley de Ohm
Fork of FastPWM by
Revision 7:1b5df740bcd7, committed 2014-05-01
- Comitter:
- Sissors
- Date:
- Thu May 01 16:54:00 2014 +0000
- Parent:
- 6:0f57969697b6
- Child:
- 8:a7745c791b0c
- Commit message:
- Fixed https://mbed.org/forum/bugs-suggestions/topic/4886/?page=1#comment-24302 and improved in general LPC11u24 code
Changed in this revision
Device/FastPWM_LPC11U24.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/Device/FastPWM_LPC11U24.cpp Mon Mar 17 22:12:58 2014 +0000 +++ b/Device/FastPWM_LPC11U24.cpp Thu May 01 16:54:00 2014 +0000 @@ -36,16 +36,14 @@ bits = 16; else //32-bit timer - bits = 32; - - printf("Bits = %d, PWM = %d, MR = %d\n\r", bits, tid.timer, tid.mr); - + bits = 32; } void FastPWM::pulsewidth_ticks( uint32_t ticks ) { - pwm_obj->TCR = 0x02; - *PWM_MR = pwm_obj->MR3 - ticks; //They inverted PWM on the 11u24 - pwm_obj->TCR = 0x01; + if (ticks) + *PWM_MR = pwm_obj->MR3 - ticks; //They inverted PWM on the 11u24 + else + *PWM_MR = 0xFFFFFFFF; //If MR3 = ticks 1 clock cycle wide errors appear, this prevents that (unless MR3 = max). } void FastPWM::period_ticks( uint32_t ticks ) {