Publishing for Michael McKinley to calibrate.

Fork of Encoders by Bradley Perry

Revision:
0:1d2644a20b71
Child:
1:2e39be3d2088
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Encoder.h	Mon Nov 24 03:33:29 2014 +0000
@@ -0,0 +1,39 @@
+#ifndef ENCODER_H
+#define ENCODER_H
+
+#include "mbed.h"
+
+// Define BaseClass Encoder
+
+class Encoder
+{
+public:
+    // Constructor
+    Encoder(PinName mosi, PinName miso, PinName sck, PinName ncs);
+    float angle();
+    bool parityFlag();
+    bool encFlag();
+    void init(float zero_ang);
+    void flip();
+    short int readRaw();
+    // Functions
+private:
+    SPI _spi;
+    DigitalOut _cs;
+    bool parity_calc(int x);
+    int sign;
+    int read();
+    bool parity;
+    bool enc_flag;
+    //zero_ang for standing position
+    float zero_ang;
+    short int raw;
+
+
+    // Variables
+    const float enc2deg;
+
+};
+
+#endif
+