adafruit / adafruit/Adafruit_CircuitPython_AW9523
Issue with clearing the Interrupt signal
- Dominant language
- Python
- Stars
- 8
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
**Expected behavior:**
The interrupt flag is set to reset automatically at every read action from the value (IO) registers.
**Issue**:
The interrupt does not seem to always reset and the behavior is sporadic.
**Possible fixes**:
According to the datasheet, a write action to read-only IO registers is required to reset the flag.
I ended up doing this in my code in a dirty way by writing to these registers in the python code.
```
def reset_interrupt_flags(self, i2c):
# Write to both registers to reset the interrupt flag
buffer = bytearray(2)
buffer[0] = 0x00
buffer[1] = 0x00
i2c.write(buffer)
i2c.write_then_readinto(buffer, buffer, out_end=1, in_start=1)
#print(buffer)
time.sleep(0.1)
buffer[0] = 0x01
buffer[1] = 0x00
i2c.write(buffer)
i2c.write_then_readinto(buffer, buffer, out_end=1, in_start=1)
time.sleep(0.1)
```
This logic should be abstracted out in the software so that every read automatically resets the interrupt or have a method expose to explicitly reset the interrupt.
You can see my project code that utilizes AW9523 here:
https://github.com/ubopod/ubo-sdk/blob/main/ubo_keypad/ubo_keypad.py
On the hardware side, it is best not to have floating input pins in hardware and make sure they are pulled up/down)
+ disabling interrupt for register bit (pins) that are not listening in the code.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing the AW9523 library's GPIO and interrupt-register read path, using the reset_interrupt_flags example in ubo_keypad.py as context. Compare the current behavior with the datasheet requirement for writes to the read-only IO registers, then verify that reads reliably clear the interrupt or that an explicit reset method works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100