.

Dependencies:   mbed EthernetInterface mbed-rtos

Fork of Bootloader_K64F by Erik -

Revision:
1:782a3ddc329e
Parent:
0:9396d3376435
Child:
2:8c44f28c122c
--- a/main.cpp	Fri Aug 22 15:14:52 2014 +0000
+++ b/main.cpp	Wed Mar 11 21:00:29 2015 +0000
@@ -1,58 +1,15 @@
 #include "mbed.h"
-#include "FastPWM.h"
-#include "FastIO.h"
-
-#define TIME_REG    LPC_TIM2->TC
-FastPWM output(p21);
-FastIn<p22> input;
-void initTimer2();
 
- 
-int main()
-{
-    //Ticks to be measured
-    unsigned int tick_width = 100;
-    
-    unsigned int measured_timed[3];
-    
-    initTimer2(); 
- 
-    while (true) {
-        //Setup PWM
-        output.period_ticks(tick_width);
-        output.pulsewidth_ticks(tick_width/2);
-        wait_us(10);
-        
-        //Start measuring at first rising edge
-        while(!input);
-        while(input);
-        measured_timed[0] = TIME_REG;
-        while(!input);
-        measured_timed[1] = TIME_REG;
-        while(input);
-        measured_timed[2] = TIME_REG;
-        
-        printf("\r\nPulsewidth = %d ticks, which is %2.1fMHz\r\n", tick_width, (float)SystemCoreClock / (float)tick_width / 1000000.0f);
-        printf("Measured period = %d ticks, pulsewidth = %d ticks\r\n", measured_timed[2]-measured_timed[0], measured_timed[1]-measured_timed[0]);
-        
-        //If more than 20% too large, consider it a fail
-        if ((measured_timed[2] - measured_timed[0]) > 1.2 * tick_width) {
-            printf("Period setting failed\r\n");
-            while(1);
-        }
-        
-        //Setup next tick
-        tick_width--;
- 
-    }
+DigitalOut led1(LED1);
+extern void bootloader(void);
+
+void func1(void) {
+    led1 = !led1;
 }
 
-//Semi copy-pasted from: https://mbed.org/users/garyr/code/Counter/file/e619b6823668/Timer2.cpp
-//We init timer at full clock speed, don't do anything else
-void initTimer2() {
-    LPC_SC->PCONP |= (1<<22);           // Power on the Timer2
-    LPC_SC->PCLKSEL1 &= ~(3<<12);
-    LPC_SC->PCLKSEL1 |= (1<<12);        // Select  CCLK for Timer2
-    LPC_TIM2->TCR = 2;
-    LPC_TIM2->TCR = 1;                  // Enable Timer2
-}
\ No newline at end of file
+int main() 
+{   
+    bootloader();
+    while(1);
+}
+ 
\ No newline at end of file