Skip to content

How to enable interrupts #9

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

Open
gregorgebhardt opened this issue Aug 19, 2022 · 1 comment
Open

How to enable interrupts #9

gregorgebhardt opened this issue Aug 19, 2022 · 1 comment
Labels
bug Something isn't working enhancement New feature or request

Comments

@gregorgebhardt
Copy link

Hi,

I would like to enable interrupts on a Adafruit NeoKey 1x4 board. The NeoKey board is connected to a Raspberry Pi, the INT pin of the NeyKey board is connected to pin 16 of the RPI. Is use the following code to register a callback for the interrupts:

GPIO.setmode(GPIO.BCM)
GPIO.setup(INTRRPT_GPIO, GPIO.IN, pull_up_down=GPIO.PUD_UP)

logger.info(f"registering interrupt detection on pin {INTRRPT_GPIO}")
GPIO.add_event_detect(INTRRPT_GPIO, GPIO.FALLING, callback=on_neokey_interrupt, bouncetime=100)

where the function on_neokey_interrupt just prints some output. This is working fine, if I connect pin 16 to ground.

Using the parameter in the constructor has no effect:

self.interrupt_enabled = interrupt

This will only set the field interrupt_enabled since the property is only implemented in Keypad, not in Seesaw.

I tried the following, but also with no success:

neokeys = NeoKey1x4(board.I2C())
for k in range(4):
    neokeys.set_GPIO_interrupts(4 + k, True)

Any ideas what the problem could be?

@gregorgebhardt
Copy link
Author

Sorry, found it out. It has to be a bit mask:

self.neokeys.set_GPIO_interrupts(0xf0, True)

Still, the parameter in the constructor has no effect.

@tekktrik tekktrik added bug Something isn't working enhancement New feature or request labels Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants