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

Please review these changes for inclusion #2

Merged
merged 4 commits into from
Nov 26, 2015

Conversation

Defragster
Copy link
Contributor

Small change of 20 lines uses interrupt pin to gate the actual touch reading.

I tried to fit it into the PJRC code model - there is one exposed value that would allow user code to disable touch reading (until next interrupt if enabled)

Putting the CPP class code as an ISR was done based on FrankB's personal usage.

On interrupt only a BOOLEAN flag is set.

Doing anything more complex enters the realm of race condition cascading interrupts.

The boolean goes false AFTER the prior SPI read is detects NO_TOUCH, which will have triggered the interrupt in the process. DIsabling it then will set it false, preventing added SPI reads of touch until the interrupt falls again.

I have tested this to work with T_3.1 and T_LC. LC works on TouchTest, I also tested on a complex graphics button example with LC and AdaFruit driver.

Defragster added 4 commits November 14, 2015 15:12
When only called to test touch() that can leave after 5 SPI words.
Existing code reads all 10 words then does the x,y Point math and does
not store or return the calculated value.
On initializing with interrupt pin Poll calls for touch are ignored
unless preceded by falling edge on touch interrupt pin.

User calls are honored until touch detection records a failed pressure
test reading.

This allows the user code to call at a faster rate with no SPI impact so
that the start of a touch is not missed like when polled at a
conservative 100ms.

Included TouchTest sample modified for continuous loop() read to
demonstrate responsiveness and no SPI chatter, versus bright LED when
int pin is not used.
PaulStoffregen added a commit that referenced this pull request Nov 26, 2015
Please review these changes for inclusion
@PaulStoffregen PaulStoffregen merged commit d214293 into PaulStoffregen:master Nov 26, 2015
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 this pull request may close these issues.

2 participants