Structure used to implement both a 12-bit and a 20-bit variable inside a single 32-bit array. More...
#include <mTouch.h>
Data Fields | |
| uint32_t | all |
| Accesses full 32-bit register. | |
| struct { | |
| uint16_t invalid | |
| uint16_t v | |
| Result's value (must have bottom 4 bits shifted out) | |
| } | result |
| Decimate-filtered differential ADC result register. | |
| struct { | |
| uint24_t v | |
| Accumulator's value (must have top 4 bits masked off) | |
| uint8_t invalid | |
| } | accumulator |
| Accumulator array for sensor oversampling. | |
Structure used to implement both a 12-bit and a 20-bit variable inside a single 32-bit array.
The 12-bit result value is stored in the MSBs of the 32-bit array. When processing the 'result' variable, we will need to always right shift by 4. See the ASCII drawing, below, for a clearer picture of what's happening.
// ._____._____._____._____. // |xx xx xx|--| // result
The 20-bit accumulation register is stored in the LSBs of the 32-bit array. When processing this variable, we will need to always mask off the 4 MSbs since those are part of the result variable.
// ._____._____._____._____. // |--|xx xx xx xx xx| // accumulator
Together, the variables are able to fit into a single 32-bit register, as shown:
// ._____._____._____._____. // |xx xx xx|xx xx xx xx xx| // result accumulator
Definition at line 210 of file mTouch.h.
| struct { ... } accumulator |
Accumulator array for sensor oversampling.
| struct { ... } result |
Decimate-filtered differential ADC result register.
| uint24_t v |
| uint16_t v |