Changed default PinMode from PullDown to PullDefault for compatibility with KL25Z

Dependents:   ChordJoy idd_hw2_andrewhead_chordjoy idd_hw2_kevinlee_typinglove idd_hw2_kevinlee_typinglove ... more

Fork of PinDetect by Andy K

Revision:
2:cb3afc45028b
Parent:
1:611a8f5ac65c
Child:
3:2cc013fd659d
--- a/PinDetect.h	Thu Jan 13 09:53:26 2011 +0000
+++ b/PinDetect.h	Thu Jan 13 11:09:22 2011 +0000
@@ -166,6 +166,8 @@
     
 public:
 
+    friend class Ticker;
+    
     PinDetect() { error("You must supply a PinName"); }
 
     /** PinDetect constructor
@@ -202,6 +204,7 @@
      */
     void setSampleFrequency(int i = PINDETECT_SAMPLE_PERIOD) { 
         _sampleTime = i; 
+        _prevState  = _in->read();        
         _ticker->attach_us( this, &PinDetect::isr, _sampleTime );
     }
     
@@ -449,7 +452,8 @@
      * Read the value of the pin being sampled.
      */
     operator int() { return _in->read(); }
-    
+
+protected:    
     /** The Ticker periodic callback function
      */
     void isr(void) {