My forked repository. DISCO_F407VG, DISCO_F303VC, DISCO_F051R8 and DISCO_F100RB maybe added.
Dependents: FastPWM-DISCO-test
Fork of FastPWM by
Revision 8:a7745c791b0c, committed 2014-06-27
- Comitter:
- Sissors
- Date:
- Fri Jun 27 05:48:25 2014 +0000
- Parent:
- 7:1b5df740bcd7
- Child:
- 9:c50f688cad07
- Commit message:
- KLxx bugfix when using multiple FastPwm
Changed in this revision
Device/FastPWM_KLXX.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/Device/FastPWM_KLXX.cpp Thu May 01 16:54:00 2014 +0000 +++ b/Device/FastPWM_KLXX.cpp Fri Jun 27 05:48:25 2014 +0000 @@ -2,13 +2,8 @@ #include "FastPWM.h" -volatile uint32_t *TPM_SC; - void FastPWM::initFastPWM( void ) { bits = 16; - - //Yes this is ugly, yes I should feel bad about it - TPM_SC = _pwm.MOD - 2; } void FastPWM::pulsewidth_ticks( uint32_t ticks ) { @@ -24,6 +19,10 @@ } uint32_t FastPWM::setPrescaler(uint32_t reqScale) { + + //Yes this is ugly, yes I should feel bad about it + volatile uint32_t *TPM_SC = _pwm.MOD - 2; + const char prescalers[] = {1, 2, 4, 8, 16, 32, 64, 128}; //If prescaler is 0, return current one