Tetsuya Suzuki / Mbed 2 deprecated fc1114

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
rutles
Date:
Thu Jun 12 09:03:02 2014 +0000
Parent:
0:1913ea9baf30
Commit message:
Frequency counter with i2c slave.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Jun 12 05:34:52 2014 +0000
+++ b/main.cpp	Thu Jun 12 09:03:02 2014 +0000
@@ -1,4 +1,4 @@
-// fc1114 - Frequency counter with i2c slave output
+// fc1114 - Frequency counter with i2c slave.
 // target: LPC1114FN28
 
 #include "mbed.h"
@@ -9,7 +9,7 @@
 I2CSlave slave(dp5, dp27);
 Ticker tick;
 
-uint32_t frq;
+volatile uint32_t frq;
 
 void isr_tick(){
     frq = LPC_TMR32B0->TC;
@@ -25,10 +25,9 @@
     } buf;
     char dummy[4];
 
+    led = 1;
     tick.attach(&isr_tick, 1);
 
-    led = 1;
-
     LPC_SYSCON->SYSAHBCLKCTRL |= (1 << 9);//TMR32B0 wakeup
     LPC_IOCON->PIO1_5 |= (1 << 1);// Set PIN14 as CT32B0_CAP0
     LPC_IOCON->PIO1_5 |= (1 << 5);// Hysteresis enable