Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of PinDetect_KL25Z by
Diff: PinDetect.h
- 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) {