123
Fork of LG by
DeviceCounters.h@161:efd949e8d536, 2016-05-15 (annotated)
- Committer:
- Diletant
- Date:
- Sun May 15 19:12:12 2016 +0000
- Revision:
- 161:efd949e8d536
- Parent:
- 156:e68ee0bcdcda
- Child:
- 167:bedc0a9d559a
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 | 161:efd949e8d536 | 8 | int32_t delta[32]; //Cyclic buffer of QEI counts with (32 * oscillation frequency) update frequency |
Diletant | 161:efd949e8d536 | 9 | int32_t angle; //Sum of last 32 deltas from 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 | 161:efd949e8d536 | 12 | int32_t frequency; //Sum of positive deltas minus negative deltas from last 32 deltas - dither "output frequency" |
Diletant | 161:efd949e8d536 | 13 | int32_t accumulator; //Angle accumulated between user read 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__ */ |