Diff: counter.h
- Revision:
- 2:fa04a99dcdab
- Parent:
- 1:8c1bace3af7b
- Child:
- 3:bd08a59ee473
--- a/counter.h Fri Nov 25 14:03:51 2011 +0000 +++ b/counter.h Fri Nov 25 14:09:37 2011 +0000 @@ -1,57 +1,57 @@ -#ifndef counter_H -#define counter_H - -/** - * Includes - */ -#include "mbed.h" - -/** - * Simple counter - */ -class counter { - -public: - - - /** - * Constructor. - * - * Attaches the encode function to the rise/fall edge of - * channels A. - * - * @param channelA mbed pin for counter input. - */ - counter(PinName channelA); - - /** - * Reset the encoder. - * - * Sets the pulses and revolutions count to zero. - */ - void reset(void); - - /** - * Read the number of pulses recorded by the encoder. - * - * @return Number of pulses which have occured. - */ - int getPulses(void); - -private: - - /** - * Update the pulse count. - * - * Called on every rising edge of channels A. - * - */ - void encode(void); - - InterruptIn channelA_; - - volatile int pulses_; - -}; - -#endif /* counter_H */ +#ifndef counter_H +#define counter_H + +/** + * Includes + */ +#include "mbed.h" + +/** + * Simple counter + */ +class counter { + +public: + + + /** + * Constructor. + * + * Attaches the encode function to the rise/fall edge of + * channels A. + * + * @param channelA mbed pin for counter input. + */ + counter(PinName channelA); + + /** + * Reset the encoder. + * + * Sets the pulses and revolutions count to zero. + */ + void reset(void); + + /** + * Read the number of pulses recorded by the encoder. + * + * @return Number of pulses which have occured. + */ + int getPulses(void); + +private: + + /** + * Update the pulse count. + * + * Called on every rising edge of channels A. + * + */ + void encode(void); + + InterruptIn channelA_; + + volatile int pulses_; + +}; + +#endif /* counter_H */