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 FastPWM by
Diff: Device/FastPWM_KLXX.cpp
- Revision:
- 8:a7745c791b0c
- Parent:
- 6:0f57969697b6
- Child:
- 9:c50f688cad07
diff -r 1b5df740bcd7 -r a7745c791b0c Device/FastPWM_KLXX.cpp
--- 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
