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.
QED/qed.h
- Committer:
- Reiko
- Date:
- 2019-11-11
- Revision:
- 4:81cb68f1bcbd
- Parent:
- 0:ef6268629f0b
File content as of revision 4:81cb68f1bcbd:
#ifndef QED_H #define QED_H #include "mbed.h" #define PREV_MASK 0x1 //Mask for the previous state in determining direction of rotation. #define CURR_MASK 0x2 //Mask for the current state in determining direction of rotation. #define INVALID 0x3 //XORing two states where both bits have changed. class QED { public: QED(PinName channelA, PinName channelB); int read(); private: void decode(); InterruptIn interruptA; InterruptIn interruptB; volatile int pulses; int prevState; int currState; }; #endif