Data Fields

mTouch_AcquisitionData Union Reference
[Acquisition]

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.

Detailed Description

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.


Field Documentation

struct { ... } accumulator

Accumulator array for sensor oversampling.

uint32_t all

Accesses full 32-bit register.

Definition at line 212 of file mTouch.h.

uint16_t invalid

Definition at line 216 of file mTouch.h.

uint8_t invalid

Definition at line 223 of file mTouch.h.

struct { ... } result

Decimate-filtered differential ADC result register.

uint24_t v

Accumulator's value (must have top 4 bits masked off)

Definition at line 222 of file mTouch.h.

uint16_t v

Result's value (must have bottom 4 bits shifted out)

Definition at line 217 of file mTouch.h.


The documentation for this union was generated from the following file: