PPM library based on teensy 3 PulsePostion library. uses k64f FTM0 PWM pins.

Dependents:   k64f_ppmtst

PPM library based on teensy 3 PulsePostion library. uses k64f FTM0 PWM pins.

https://www.pjrc.com/teensy/td_libs_PulsePosition.html

Revision:
1:cb791d277230
Parent:
0:3b67d4bc53ca
--- a/PulsePosition.cpp	Thu Apr 21 16:31:18 2016 +0000
+++ b/PulsePosition.cpp	Thu Apr 21 17:04:15 2016 +0000
@@ -28,7 +28,7 @@
 
 
 #include "mbed.h"
-
+#include "PeripheralPins.h"
 #include "PulsePosition.h"
 
 #define F_BUS 60000000
@@ -163,8 +163,7 @@
     SIM_SCGC5 |= (1 << SIM_SCGC5_PORTC_SHIFT);  // power PORTC
     uint32_t port = txPin >> GPIO_PORT_SHIFT;
     uint32_t pin = (txPin & 0x1F) ;
-    uint32_t alt=3;  // PTA
-    if (port>1) alt =4;  // PTC
+    uint32_t alt= pinmap_function(txPin, PinMap_PWM);
     ((PORT_Type *)(PORTA_BASE + 0x1000 * port))->PCR[pin] = PORT_PCR_MUX(alt) | PORT_PCR_DSE_MASK | PORT_PCR_SRE_MASK;
     NVIC_SetPriority(FTM0_IRQn, 32);
     NVIC_EnableIRQ(FTM0_IRQn);
@@ -336,8 +335,7 @@
     SIM_SCGC5 |= (1 << SIM_SCGC5_PORTC_SHIFT);  // power PORTC
     uint32_t port = pin >> GPIO_PORT_SHIFT;
     uint32_t ppin = (pin & 0x1F) ;
-    uint32_t alt=3;  // PTA
-    if (port>1) alt =4;  // PTC
+    uint32_t alt= pinmap_function(pin, PinMap_PWM);
     ((PORT_Type *)(PORTA_BASE + 0x1000 * port))->PCR[ppin] = PORT_PCR_MUX(alt);
     CSC_CHANGE(ftm, cscEdge); // input capture & interrupt on rising edge
     NVIC_SetPriority(FTM0_IRQn, 32);