123

Dependencies:   mbed

Fork of LG by igor Apu

Revision:
174:0f86eedd511c
Parent:
173:7f938afb0447
Child:
177:672ef279c8e0
--- a/DeviceCounters.h	Sun Jun 19 03:54:35 2016 +0000
+++ b/DeviceCounters.h	Sun Jun 26 10:16:39 2016 +0000
@@ -1,14 +1,68 @@
 #ifndef __DEVICE_COUNTERS_H__
 #define __DEVICE_COUNTERS_H__
 
+//Dither latched counters typedefs
+typedef struct _DeviceCountersDitherLatchedSettings {
+} DeviceCountersDitherLatchedSettings;
+
+typedef struct _DeviceCountersDitherLatchedState {
+  int32_t delta[32];    //Cyclic buffer of QEI counts with (32 * oscillation frequency) update frequency
+  int32_t angle;        //Sum of last 32 deltas from delta buffer - angle accumulated for 1 vibro cycle till now
+  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 "output frequency"
+  int32_t accumulator;  //Angle accumulated between user read requests, or between periodic answers
+} DeviceCountersDitherLatchedState;
+
+typedef struct _DeviceCountersDitherLatched {
+  DeviceCountersDitherLatchedSettings settings;
+  DeviceCountersDitherLatchedState state;
+} DeviceCountersDitherLatched;
+
+//Reconstructed meander latched counters typedefs
+typedef struct _DeviceCountersMeanderLatchedSettings {
+} DeviceCountersMeanderLatchedSettings;
+
+typedef struct _DeviceCountersMeanderLatchedState {
+  int32_t a;            //Positive counts
+  int32_t b;            //Negative counts
+} DeviceCountersMeanderLatchedState;
+
+typedef struct _DeviceCountersMeanderLatched {
+  DeviceCountersMeanderLatchedSettings settings;
+  DeviceCountersMeanderLatchedState state;
+} DeviceCountersMeanderLatched;
+
+//Virtual zero sensor latched counters typedefs
+typedef struct _DeviceCountersZeroLatchedSettings {
+} DeviceCountersZeroLatchedSettings;
+
+typedef struct _DeviceCountersZeroLatchedState {
+  int32_t a;            //Positive counts
+  int32_t b;            //Negative counts
+} DeviceCountersZeroLatchedState;
+
+typedef struct _DeviceCountersZeroLatched {
+  DeviceCountersZeroLatchedSettings settings;
+  DeviceCountersZeroLatchedState state;
+} DeviceCountersZeroLatched;
+
+//Counters typedefs
+typedef struct _DeviceCounters {
+  DeviceCountersDitherLatched dither; //Counters latched by dither (measurement) cycle
+  DeviceCountersMeanderLatched meander;      //Counters latched by restored meander (angular velocity reverse latched)
+  DeviceCountersZeroLatched zero;            //Counters latched by virtual zero position sensor
+} DeviceCounters;
+
+/*
 typedef struct _DeviceCountersSettings {
 } DeviceCountersSettings;
 
 typedef struct _DeviceCountersState {
   int32_t delta[32];    //Cyclic buffer of QEI counts with (32 * oscillation frequency) update frequency
-  int32_t angle;        //Sum of last 32 deltas from delta buffer - angle accumulated for 1 vibro cycle
+  int32_t angle;        //Sum of last 32 deltas from delta buffer - angle accumulated for 1 vibro cycle till now
   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 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 "output frequency"
   int32_t accumulator;  //Angle accumulated between user read requests, or between periodic answers
 } DeviceCountersState;
@@ -17,6 +71,7 @@
   DeviceCountersSettings settings;
   DeviceCountersState state;
 } DeviceCounters;
+*/
 
 void InitCountersDefaultSettings(void);
 void InitCountersState(void);