35 #define NUM_AREAS 50 //Number of Touch Areas we can manage
108 if (areas[z] != NULL && touchX >= areas[z]->x1 && touchX <= areas[z]->x2 && touchY >= areas[z]->y1 && touchY <= areas[z]->y2) {
111 if (areas[z]->hookedActions &
PEN_DOWN) {
112 areas[z]->
callback(areas[z], PEN_DOWN);
118 if (areas[z] != NULL) {
120 if (touchX >= areas[z]->x1 && touchX <= areas[z]->x2 && touchY >= areas[z]->y1 && touchY <= areas[z]->y2) {
121 if (areas[z]->flags == 0) {
124 if (areas[z]->hookedActions &
PEN_ENTER) {
125 areas[z]->
callback(areas[z], PEN_ENTER);
128 }
else if (areas[z]->flags) {
131 if (areas[z]->hookedActions &
PEN_LEAVE) {
132 areas[z]->
callback(areas[z], PEN_LEAVE);
140 if (areas[z] != NULL && (areas[z]->hookedActions &
PEN_MOVE)) {
142 if (touchX >= areas[z]->x1 && touchX <= areas[z]->x2 && touchY >= areas[z]->y1 && touchY <= areas[z]->y2) {
143 areas[z]->
callback(areas[z], PEN_MOVE);
151 if (areas[z] != NULL && touchX >= areas[z]->x1 && touchX <= areas[z]->x2 && touchY >= areas[z]->y1 && touchY <= areas[z]->y2) {
154 if (areas[z]->hookedActions &
PEN_UP) {
155 areas[z]->
callback(areas[z], PEN_UP);
168 for (
unsigned char i = 0; i <
NUM_AREAS; i++) {
169 if (areas[i] == NULL) {
184 for (
unsigned char i = 0; i <
NUM_AREAS; i++) {
185 if (areas[i] == NULL) {
202 for (
unsigned char i = 0; i <
NUM_AREAS; i++) {
203 if (areas[i] == area) {
bool touch_register_area(TOUCH_AREA_STRUCT *area)
Receive an event when the pen moves inside the region (pen is down)
Receive an event when the pen goes down inside the region.
Receive an event when the pen goes up inside the region.
uint16_t y
The Y-Coordinate of the point.
uint8_t flags
For internal use, don't change, don't initialize.
uint16_t x
The X-Coordinate of the point.
void touch_unregister_area(TOUCH_AREA_STRUCT *area)
bool touch_add_raw_event(uint16_t touchX, uint16_t touchY, TOUCH_STATE state)
The display is currently not touched.
The display is currently touched at some point.
volatile POINT_STRUCT pos
volatile TOUCH_STATE oldState
TOUCH_CALLBACK callback
Callback which is executed when an event occurred in this Area.
void touch_set_value_convert_mode(bool uc)
Receive an event when the pen enters the region (pen was down before)
POINT_STRUCT touch_get_last_point()
volatile bool calibration
TOUCH_AREA_STRUCT * areas[NUM_AREAS]
bool touch_have_empty(unsigned char num)
void touch_set_calibration_values(int xs, int dx, int ys, int dy)
Receive an event when the pen leaves the region (pen was inside region before)