Skip to content

Not possible to detach interrupt #8

Open
@aliphys

Description

@aliphys

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions