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.
Dependents: backdrive backdrive_3
Diff: encoder.h
- Revision:
- 2:4bb7c8730d91
- Parent:
- 0:4b99060621fd
- Child:
- 3:6dce9d79da13
--- a/encoder.h Sat Jun 09 02:24:14 2018 +0000
+++ b/encoder.h Sun Jul 22 00:15:08 2018 +0000
@@ -20,7 +20,7 @@
};
enum BEFORE_NUMBER{
- NOW,
+ CURRENT,
ONE_BEFORE,
TWO_BEFORE,
BEFORE_NUMBER,
@@ -29,7 +29,7 @@
class Encoder
{
public:
- Encoder(PinName aPhase , PinName bPhase );
+ Encoder(PinName a_phase , PinName b_phase );
void calState();
float getState(int ch);
@@ -44,7 +44,11 @@
float rpm, distance, omega, velocity, radius, delta_distance,
ppr, dt, dt_square, circle, acceleration;
- float count[TYPE_NUMBER][BEFORE_NUMBER];
+ float count[TYPE_NUMBER][BEFORE_NUMBER];/* = {
+ {[NORMAL][NOW], [NORMAL][ONE_BEFORE], [NORMAL][TWO_BEFORE]},
+ {[DELTA][NOW], [DELTA][ONE_BEFORE], [DELTA][TWO_BEFORE]}
+ }
+ */
InterruptIn aPhase;
DigitalIn bPhase;
};