sumotoy / RA8875

A library for RAiO RA8875 display driver for Teensy3.x or LC/Arduino's/Energia/Spark
GNU General Public License v3.0
79 stars 55 forks source link

How to use the ISR? #110

Open shockerty opened 8 years ago

shockerty commented 8 years ago

Apologies if this is a ridiculous noob question... I am a bit lost regarding the ISR functionality. As well as including:

tft.useINT(RA8875_INT); tft.touchBegin(); tft.enableISR(true);

I also added the following:

attachInterrupt(digitalPinToInterrupt(RA8875_INT), touchISR, CHANGE);

The action that I want to occur on a touch is put in touchISR(). Is this the best way to do this? Or is there some other way to specify the ISR? If not, then what is the purpose of the tft.touchBegin(); and tft.enableISR(true); lines?

sumotoy commented 8 years ago

I also added the following:

attachInterrupt(digitalPinToInterrupt(RA8875_INT), touchISR, CHANGE);

This is the problem, I'm currently handle interrupts internally and you write your own interrupt routine externally?! Why?! I'm handle internally because, after int has been triggered, some code conditions have to be performed fast, like reading registers, clear flags, write results in variables and rearm registers and interrupt. If you want to handle interrupt separately you have to do externally all this stuff using a right sequence or your RA8875 will be stuck. There's some examples about this in library, maybe I can comment better....

shockerty commented 8 years ago

Thanks for the reply. Apologies, I completely missed the example utilising the internally handled interrupt! Now I have the basics down I will play around with it.