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.
Dependents: qonly_controller foc-ed_in_the_bot_compact foc-ed_in_the_bot_compact CurrentModeSine ... more
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
