123
Fork of LG by
DeviceCounters.h@156:e68ee0bcdcda, 2016-05-09 (annotated)
- Committer:
- Diletant
- Date:
- Mon May 09 20:03:26 2016 +0000
- Revision:
- 156:e68ee0bcdcda
- Child:
- 161:efd949e8d536
Device & ... update. Not final!!!
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Diletant | 156:e68ee0bcdcda | 1 | #ifndef __DEVICE_COUNTERS_H__ |
Diletant | 156:e68ee0bcdcda | 2 | #define __DEVICE_COUNTERS_H__ |
Diletant | 156:e68ee0bcdcda | 3 | |
Diletant | 156:e68ee0bcdcda | 4 | typedef struct _DeviceCountersSettings { |
Diletant | 156:e68ee0bcdcda | 5 | } DeviceCountersSettings; |
Diletant | 156:e68ee0bcdcda | 6 | |
Diletant | 156:e68ee0bcdcda | 7 | typedef struct _DeviceCountersState { |
Diletant | 156:e68ee0bcdcda | 8 | int32_t delta[32]; //Cyclic buffer of QEI counts: with (32 * oscillation frequency) |
Diletant | 156:e68ee0bcdcda | 9 | int32_t angle; //Sum of delta buffer - Angle accumulated for 1 vibro cycle |
Diletant | 156:e68ee0bcdcda | 10 | int32_t displacement; //Sum of last 16 deltas minus sum of previous 16 deltas from delta buffer - displacement |
Diletant | 156:e68ee0bcdcda | 11 | int32_t amplitude; //Sum of positive displacements minus negative displacements from last 32 displacements - "dither amplitude" |
Diletant | 156:e68ee0bcdcda | 12 | int32_t frequency; //Sum of positive deltas minus negative deltas from last 32 deltas - dither "frequency" |
Diletant | 156:e68ee0bcdcda | 13 | int32_t accumulator; //Angle accumulated between host requests, or between periodic answers |
Diletant | 156:e68ee0bcdcda | 14 | } DeviceCountersState; |
Diletant | 156:e68ee0bcdcda | 15 | |
Diletant | 156:e68ee0bcdcda | 16 | typedef struct _DeviceCounters { |
Diletant | 156:e68ee0bcdcda | 17 | DeviceCountersSettings settings; |
Diletant | 156:e68ee0bcdcda | 18 | DeviceCountersState state; |
Diletant | 156:e68ee0bcdcda | 19 | } DeviceCounters; |
Diletant | 156:e68ee0bcdcda | 20 | |
Diletant | 156:e68ee0bcdcda | 21 | void InitCountersWithDefaults(void); |
Diletant | 156:e68ee0bcdcda | 22 | void InitCounters(void); |
Diletant | 156:e68ee0bcdcda | 23 | void DeviceCount(void); |
Diletant | 156:e68ee0bcdcda | 24 | |
Diletant | 156:e68ee0bcdcda | 25 | #endif /* __DEVICE_COUNTERS_H__ */ |