Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not possible to detach interrupt #8

Open
aliphys opened this issue Jun 12, 2024 · 0 comments · May be fixed by #9
Open

Not possible to detach interrupt #8

aliphys opened this issue Jun 12, 2024 · 0 comments · May be fixed by #9

Comments

@aliphys
Copy link
Contributor

aliphys commented Jun 12, 2024

The onDetect() method can be used to attached interrupts so that when a touch event is detected by the GT911, the specified sub routine is ran specified by handler in the function below.

void Arduino_GigaDisplayTouch::onDetect(void (*handler)(uint8_t, GDTpoint_t*)) {
_gt911TouchHandler = handler;
t.start(callback(&queue, &events::EventQueue::dispatch_forever));
_irqInt.rise(queue.event(mbed::callback(this, &Arduino_GigaDisplayTouch::_gt911onIrq)));
}

An example of how to use the interrupt is given in Touch_IRQ.ino example.

touchDetector.onDetect(gigaTouchHandler);

void gigaTouchHandler(uint8_t contacts, GDTpoint_t* points) {
Serial.print("Contacts: ");
Serial.println(contacts);
if (contacts > 0) {
/* First touch point */
Serial.print(points[0].x);
Serial.print(" ");
Serial.println(points[0].y);
}
}

It is not possible to detach the interrupt, using the current public methods. Detaching interrupts is useful for:

  • Using delay()
  • Sending data over serial, without competing with the interrupt pin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant