Skip to content

Add option for IRQ pin to wait for _read #19

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

Merged
merged 5 commits into from
Feb 5, 2021

Conversation

kmatch98
Copy link
Contributor

@kmatch98 kmatch98 commented Feb 5, 2021

This is to help resolve crashes during writes/reads, from issue.

I added a connection to the IRQ pin of the (TFT display breakout) and polling it before the write cycle, and that seems to resolve the issue.

Here's the updated setup in my code.py file:

print("Setting up I2C...")

i2c = busio.I2C(board.IO42, board.IO41)
irq = DigitalInOut(board.IO39)
irq.direction = Direction.INPUT
ft = adafruit_focaltouch.Adafruit_FocalTouch(i2c, debug=False, irq_pin = irq)

Here's my code change to the FocalTouch library. I add an irq_pin in the initialization. Then in the _read I wait for the irq_pin to go low before sending the write command.

One issue: I had to eliminate the need to check for IRQ during initialization, because the display would hang in the Adafruit_FocalTouch.__init__ function while waiting for a touch interrupt. So, I ignore the interrupt in the init function, but require it for all other reads.

@ladyada
Copy link
Member

ladyada commented Feb 5, 2021

can ya add an example?

@kmatch98
Copy link
Contributor Author

kmatch98 commented Feb 5, 2021

Yep, added.

@ladyada ladyada merged commit 4ae52ac into adafruit:master Feb 5, 2021
@ladyada
Copy link
Member

ladyada commented Feb 5, 2021

thanx!

adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Feb 10, 2021
Updating https://github.com/adafruit/Adafruit_CircuitPython_CharLCD to 3.3.7 from 3.3.6:
  > Merge pull request adafruit/Adafruit_CircuitPython_CharLCD#57 from BiffoBear/fix-home-docstring

Updating https://github.com/adafruit/Adafruit_CircuitPython_DymoScale to 1.1.2 from 1.1.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_DymoScale#10 from adafruit/REUSE
  > Added pre-commit-config file

Updating https://github.com/adafruit/Adafruit_CircuitPython_EMC2101 to 1.1.3 from 1.1.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_EMC2101#4 from MaxBec/hotfix_pwm_freq

Updating https://github.com/adafruit/Adafruit_CircuitPython_FocalTouch to 1.2.4 from 1.2.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_FocalTouch#19 from kmatch98/add_irq

Updating https://github.com/adafruit/Adafruit_CircuitPython_PyPortal to 5.1.2 from 5.1.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_PyPortal#105 from jfurcean/fix_api_docs
  > Merge pull request adafruit/Adafruit_CircuitPython_PyPortal#104 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_RFM69 to 2.1.2 from 2.1.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_RFM69#35 from BiffoBear/add-timeout-to-op-mode_setter

Updating https://github.com/adafruit/Adafruit_CircuitPython_PIOASM to 0.1.4 from 0.1.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_PIOASM#5 from dglaude/patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_ProgressBar to 1.3.6 from 1.3.5:
  > Merge pull request adafruit/Adafruit_CircuitPython_ProgressBar#24 from adafruit/REUSE
  > Added pre-commit-config file

Updating https://github.com/adafruit/Adafruit_CircuitPython_RTTTL to 2.4.4 from 2.4.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_RTTTL#23 from adafruit/dherrada-patch-1
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