InterruptIn speed check

Dependencies:   FastPWM mbed

Fork of InterruptIn_speed by Erik -

Revision:
4:f871f375cd99
Parent:
3:7745ac0591aa
Child:
5:d49b6c1a35e3
--- a/main.cpp	Wed Sep 11 08:33:22 2013 +0000
+++ b/main.cpp	Mon Dec 15 11:55:08 2014 +0000
@@ -1,43 +1,43 @@
-#include "mbed.h"
-#include "FastPWM.h"
-
-FastPWM pwm(p21);
-InterruptIn interrupt(p22);
-
-volatile int count;
-
-void interrupt_handler(void)
-{
-    count++;
-}
-
-
-int main (void)
-{
-    //Start_frequency is 60kHz
-    double frequency = 65e3;
-    pwm = 0;
-    interrupt.rise(&interrupt_handler);
-
-    while(1) {
-        //Set PWM period, reset count
-        pwm.period(1/frequency);
-        count = 0;
-
-        //Enable PWM at 50% dutycycle for 1 second
-        pwm = 0.5;
-        wait(1);
-        pwm = 0;
-
-        printf("Expected %.0f edges, measured %d edges.\n", frequency, count);
-        if (count < frequency * 0.9) {
-            printf("Test failed at %.0fkHz!\n\n", frequency / 1000);
-            break;
-        }
-        printf("Test succeeded at %.0fkHz!\n\n", frequency / 1000);
-        frequency += 10e3;
-
-    }
-    while(1);
-}
+#include "mbed.h"
+#include "FastPWM.h"
+
+FastPWM pwm(PTA13);
+InterruptIn interrupt(PTD5);
+
+volatile int count;
+
+void interrupt_handler(void)
+{
+    count++;
+}
+
+
+int main (void)
+{
+    //Start_frequency is 60kHz
+    double frequency = 65e3;
+    pwm = 0;
+    interrupt.rise(&interrupt_handler);
 
+    while(1) {
+        //Set PWM period, reset count
+        pwm.period(1/frequency);
+        count = 0;
+
+        //Enable PWM at 50% dutycycle for 1 second
+        pwm = 0.5;
+        wait(1);
+        pwm = 0;
+
+        printf("Expected %.0f edges, measured %d edges.\n", frequency, count);
+        if (count < frequency * 0.9) {
+            printf("Test failed at %.0fkHz!\n\n", frequency / 1000);
+            break;
+        }
+        printf("Test succeeded at %.0fkHz!\n\n", frequency / 1000);
+        frequency += 10e3;
+
+    }
+    while(1);
+}
+