It is based on https://developer.mbed.org/users/gregeric/code/Nucleo_Hello_Encoder/
Diff: rotary_encoder.hpp
- Revision:
- 0:caf1d0bc4b90
- Child:
- 2:4580c3869b7b
diff -r 000000000000 -r caf1d0bc4b90 rotary_encoder.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rotary_encoder.hpp Sat Feb 06 14:24:56 2016 +0000 @@ -0,0 +1,23 @@ +#ifndef INCLUDED_ROTARY_ENCODER_H +#define INCLUDED_ROTARY_ENCODER_H + +#include "mbed.h" + +class rotary_encoder { +public: + rotary_encoder(size_t resolution); + virtual ~rotary_encoder() = 0; + + virtual int32_t get_counts() const = 0; + float get_revol_num() const; + + virtual void reset() = 0; + virtual void start() = 0; + virtual void stop() = 0; + +protected: + static const size_t max_counts_; + const size_t resolution_; +}; + +#endif