Pinscape fork (KL25Z)

Dependents:   Pinscape_Controller_V2_arnoz Pinscape_Controller_V2

Fork of FastPWM by Erik -

Revision:
35:25e9500598ae
Parent:
29:3c8a0d977bc3
--- a/Device/FastPWM_STM_TIM_PinOut.cpp	Fri Mar 24 05:32:57 2017 +0000
+++ b/Device/FastPWM_STM_TIM_PinOut.cpp	Fri Mar 24 05:39:58 2017 +0000
@@ -1,6 +1,6 @@
 #include "mbed.h"
 
-#ifdef TARGET_NUCLEO_F030R8
+#if defined (TARGET_NUCLEO_F030R8) || (TARGET_DISCO_F051R8)
 __IO uint32_t* getChannel(TIM_TypeDef* pwm, PinName pin) {
     switch (pin) {
         // Channels 1
@@ -23,30 +23,7 @@
 }
 #endif
 
-#if defined TARGET_NUCLEO_F401RE || defined TARGET_NUCLEO_F411RE
-__IO uint32_t* getChannel(TIM_TypeDef* pwm, PinName pin) {
-    switch (pin) {
-        // Channels 1 : PWMx/1
-        case PA_0: case PA_5: case PA_6: case PA_8: case PA_15: case PB_4: case PB_6: case PC_6: case PA_7: case PB_13:
-            return &pwm->CCR1;
-        
-        // Channels 2 : PWMx/2
-        case PA_1: case PA_9: case PB_3: case PB_5: case PB_7: case PC_7: case PB_0: case PB_14:
-            return &pwm->CCR2;
-            
-        // Channels 3 : PWMx/3
-        case PA_2: case PA_10: case PB_8: case PB_10: case PC_8: case PB_1: case PB_15:
-            return &pwm->CCR3;
- 
-        // Channels 4 : PWMx/4
-        case PA_3: case PA_11: case PB_9: case PC_9: 
-            return &pwm->CCR4;
-    }
-    return NULL;
-}
-#endif
-
-#if defined TARGET_NUCLEO_F103RB
+#if defined (TARGET_NUCLEO_F103RB) || (TARGET_DISCO_F100RB)
 __IO uint32_t* getChannel(TIM_TypeDef* pwm, PinName pin) {
     switch (pin) {
         // Channels 1 : PWMx/1
@@ -69,31 +46,6 @@
 }
 #endif
 
-#ifdef TARGET_NUCLEO_F334R8
-__IO uint32_t* getChannel(TIM_TypeDef* pwm, PinName pin) {
-    switch (pin) {
-         // Channels 1
-        case PA_2: case PA_6: case PA_7: case PA_8: case PA_12: case PB_4: case PB_5: case PB_8: case PB_9: case PB_14: case PC_0: case PC_6:
-        case PA_1: case PA_13: case PB_6: case PB_13: case PC_13:
-            return &pwm->CCR1;
- 
-        // Channels 2
-        case PA_3: case PA_4: case PA_9: case PB_15: case PC_1: case PC_7:
-            return &pwm->CCR2;
-            
-        // Channels 3
-        case PA_10: case PB_0: case PC_2: case PC_8:
-        case PF_0:
-            return &pwm->CCR3;
- 
-        // Channels 4
-        case PA_11: case PB_1: case PB_7: case PC_3: case PC_9:
-            return &pwm->CCR4;
-    }
-    return NULL;
-}
-#endif
-
 #if defined TARGET_NUCLEO_F072RB
 __IO uint32_t* getChannel(TIM_TypeDef* pwm, PinName pin) {
     switch (pin) {
@@ -117,4 +69,34 @@
     }
     return NULL;
 }
-#endif
\ No newline at end of file
+#endif
+
+
+
+#if defined (TARGET_NUCLEO_L152RE)
+__IO uint32_t* getChannel(TIM_TypeDef* pwm, PinName pin) {
+    switch (pin) {
+        // Channels 1 : PWMx/1
+        case PA_6:  case PB_4: case PB_12: case PB_13: case PC_6:
+            return &pwm->CCR1;
+        
+        // Channels 2 : PWMx/2
+        case PA_1: case PA_7: case PB_3: case PB_5: case PB_14: case PB_7: case PC_7:
+            return &pwm->CCR2;
+            
+        // Channels 3 : PWMx/3
+        case PA_2: case PB_0: case PB_8: case PB_10: case PC_8:
+            return &pwm->CCR3;
+ 
+        // Channels 4 : PWMx/4
+        case PA_3: case PB_1:case PB_9: case PB_11: case PC_9: 
+            return &pwm->CCR4;
+        default:
+            /* NOP */
+            break;
+    }
+    return NULL;
+}
+#endif
+
+ 
\ No newline at end of file