hctl 2032 encoder for stm32
Diff: EncoderCounter.h
- Revision:
- 0:b1faec368b5d
- Child:
- 1:6cab31aea0b8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/EncoderCounter.h Fri Sep 05 04:51:48 2014 +0000 @@ -0,0 +1,40 @@ +/* porting stm32 http://www.robogaia.com/two-axis-encoder-counter-mega-shield-version-2.html +/* by Paolo Della Vedova +/* ther is more problem to convert 5v to 3v + +#ifndef HCTL_2032_DRIVER +#define HCTL_2032_DRIVER + +#include "mbed.h" + + +//*** arduino compatibility +#define HIGH 1 +#define LOW 0 + +#define digitalWrite(x,y) x=y + + + + +class ENCODER +{ + public: + ENCODER( unsigned char countMode=4 ); + + void XAxisReset( ); + int XAxisGetCount( ); + void YAxisReset( ); + int YAxisGetCount( ); + + void switchCountMode( unsigned char countMode ); + + private: + signed int countEnc; + unsigned char busByte; + signed char busByteMSB; +}; + + +#endif +