123

Dependencies:   mbed

Fork of LG by igor Apu

Revision:
156:e68ee0bcdcda
Child:
161:efd949e8d536
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DeviceCounters.h	Mon May 09 20:03:26 2016 +0000
@@ -0,0 +1,25 @@
+#ifndef __DEVICE_COUNTERS_H__
+#define __DEVICE_COUNTERS_H__
+
+typedef struct _DeviceCountersSettings {
+} DeviceCountersSettings;
+
+typedef struct _DeviceCountersState {
+  int32_t delta[32];    //Cyclic buffer of QEI counts: with (32 * oscillation frequency)
+  int32_t angle;        //Sum of delta buffer - Angle accumulated for 1 vibro cycle
+  int32_t displacement; //Sum of last 16 deltas minus sum of previous 16 deltas from delta buffer - displacement
+  int32_t amplitude;    //Sum of positive displacements minus negative displacements from last 32 displacements - "dither amplitude"
+  int32_t frequency;    //Sum of positive deltas minus negative deltas from last 32 deltas - dither "frequency"
+  int32_t accumulator;  //Angle accumulated between host requests, or between periodic answers
+} DeviceCountersState;
+
+typedef struct _DeviceCounters {
+  DeviceCountersSettings settings;
+  DeviceCountersState state;
+} DeviceCounters;
+
+void InitCountersWithDefaults(void);
+void InitCounters(void);
+void DeviceCount(void);
+
+#endif  /* __DEVICE_COUNTERS_H__ */
\ No newline at end of file