Skip to content

Commit 14c0128

Browse files
authored
Merge pull request #60 from rianadon/patch-1
Add method for reading GPIO Interrupt flag
2 parents 9e06ac0 + 2ab7932 commit 14c0128

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

adafruit_seesaw/seesaw.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,12 @@ def set_GPIO_interrupts(self, pins, enabled):
222222
else:
223223
self.write(_GPIO_BASE, _GPIO_INTENCLR, cmd)
224224

225+
def get_GPIO_interrupt_flag(self, delay=0.008):
226+
"""Read and clear GPIO interrupts that have fired"""
227+
buf = bytearray(4)
228+
self.read(_GPIO_BASE, _GPIO_INTFLAG, buf, delay=delay)
229+
return struct.unpack(">I", buf)[0]
230+
225231
def analog_read(self, pin):
226232
"""Read the value of an analog pin by number"""
227233
buf = bytearray(2)

0 commit comments

Comments
 (0)