I wrote a driver for the PIM447 trackball in polling-mode, and now I’d like to rewrite it in interrupt-mode. Sadly, it turns out the INT signal toggles during I2C transactions (whatever the value of “INT_OUT” bit in REG_INT). See first capture below.
Also, even without touching the ball, the INT signal falls (which means new data are supposed to be available, which is not the case) a couple of milliseconds after registers are read, just as if the interruption was not cleared. See second capture below.
I took a look at the official driver, but despite having the “interrupt” keyword used here and there, it actually polls the INT signal; it doesn’t use it as a trigger (comments are mine):
while not trackball.get_interrupt(): time.sleep(0.001) [...] def get_interrupt(self): if self._interrupt_pin is not None: return GPIO.input(self._interrupt_pin) == 0 # poll pin level else: # or value = self.i2c_rdwr([REG_INT], 1) # poll register value return value & MSK_INT_TRIGGERED
In order to write an interrupt-mode driver I need a clean INT signal. Please, could you tell me:
how not to get the INT signal toggling during I2C transactions?
how not to get the INT signal falling even when no new data are available?
Thanks in advance,