Structure
typedef struct reg814E_s { //
union { // same location of 2 fields of 1 byte
uint8_t reads; // this byte
struct { // field bits of this byte
uint8_t touchPts : 4; // b0 to b3 : number of touch points
uint8_t haveKey : 1; // b4 : HaveKey
uint8_t proxi : 1; // b5 : Proximity Valid
uint8_t largeDet : 1; // b6 : large detect
uint8_t status : 1; // b7 : buffer status
};
};
} __attribute__((packed)) reg814E_t; // minimize memory alignment
or simpler writing
typedef struct {
union { // same location of 2 fields of 1 byte
uint8_t reads; // this byte
struct { // field bits of this byte, starting with low weight
uint8_t
touchPts : 4, // b0 to b3 : number of touch points
haveKey : 1, // b4 : HaveKey
proxi : 1, // b5 : Proximity Valid
largeDet : 1, // b6 : large detect
status : 1; // b7 : buffer status
};
};
} reg814E_t;
Declarations
private:
bool _is_finger_up = false;
uint8_t _num = 0;
uint8_t _rotate = ROTATE_0;
tp_finger_t _fingers[2];
reg814E_t r814E;
uint8_t _iic_addr = 0x14;
uint8_t _pin_int = -1;
bool _sleeping = false;
};