driver for incremental encoder
Diff: decoder.h
- Revision:
- 0:c3a05fe15b84
- Child:
- 1:017efde7ab29
diff -r 000000000000 -r c3a05fe15b84 decoder.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/decoder.h Tue Jan 08 17:10:13 2019 +0000 @@ -0,0 +1,34 @@ +#ifndef DECODER_H +#define DECODER_H +#include "mbed.h" + + + + +class decoder{ + + public: + + decoder(PinName channelA,PinName channelB); + + void isr(); + + int8_t getDirection(); + int16_t getCount(); + + + + private: + + InterruptIn _channelA; + InterruptIn _channelB; + + + int8_t _direction; + int16_t _count; + int16_t _oldCount; + + +}; + +#endif \ No newline at end of file