I/O Expanders: Interrupt detection logic should not ignore the no-change case. Still need to handle level interrupts even with no change.
This commit is contained in:
parent
803b540e8a
commit
1f9799b68d
@ -641,17 +641,13 @@ static ioe_pinset_t sim_int_update(FAR struct sim_dev_s *priv)
|
|||||||
|
|
||||||
input = priv->inval;
|
input = priv->inval;
|
||||||
diff = priv->last ^ input;
|
diff = priv->last ^ input;
|
||||||
if (diff == 0)
|
if (diff != 0)
|
||||||
{
|
{
|
||||||
/* Nothing has changed */
|
gpioinfo("toggles=%lx inval=%lx last=%lx diff=%lx\n",
|
||||||
|
(unsigned long)toggles, (unsigned long)priv->inval,
|
||||||
return 0;
|
(unsigned long)priv->last, (unsigned long)diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
gpioinfo("toggles=%lx inval=%lx last=%lx diff=%lx\n",
|
|
||||||
(unsigned long)toggles, (unsigned long)priv->inval,
|
|
||||||
(unsigned long)priv->last, (unsigned long)diff);
|
|
||||||
|
|
||||||
priv->last = input;
|
priv->last = input;
|
||||||
intstat = 0;
|
intstat = 0;
|
||||||
|
|
||||||
@ -684,7 +680,7 @@ static ioe_pinset_t sim_int_update(FAR struct sim_dev_s *priv)
|
|||||||
}
|
}
|
||||||
else /* if (SIM_LEVEL_SENSITIVE(priv, pin)) */
|
else /* if (SIM_LEVEL_SENSITIVE(priv, pin)) */
|
||||||
{
|
{
|
||||||
/* Level triggered. Set intstat if in match level type. */
|
/* Level triggered. Set intstat if imatch in level type. */
|
||||||
|
|
||||||
if ((pinval && SIM_LEVEL_HIGH(priv, pin)) ||
|
if ((pinval && SIM_LEVEL_HIGH(priv, pin)) ||
|
||||||
(!pinval && SIM_LEVEL_LOW(priv, pin)))
|
(!pinval && SIM_LEVEL_LOW(priv, pin)))
|
||||||
|
@ -797,15 +797,7 @@ static void pcf8574_int_update(void *handle, uint8_t input)
|
|||||||
|
|
||||||
/* Check the changed bits from last read */
|
/* Check the changed bits from last read */
|
||||||
|
|
||||||
diff = priv->input ^ input;
|
diff = priv->input ^ input;
|
||||||
if (diff == 0)
|
|
||||||
{
|
|
||||||
/* Nothing has changed */
|
|
||||||
|
|
||||||
leave_critical_section(flags);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
priv->input = input;
|
priv->input = input;
|
||||||
|
|
||||||
/* PCF8574 doesn't support irq trigger, we have to do this in software. */
|
/* PCF8574 doesn't support irq trigger, we have to do this in software. */
|
||||||
@ -829,7 +821,7 @@ static void pcf8574_int_update(void *handle, uint8_t input)
|
|||||||
}
|
}
|
||||||
else /* if (PCF8574_LEVEL_SENSITIVE(priv, pin)) */
|
else /* if (PCF8574_LEVEL_SENSITIVE(priv, pin)) */
|
||||||
{
|
{
|
||||||
/* Level triggered. Set intstat if in match level type. */
|
/* Level triggered. Set intstat if match in level type. */
|
||||||
|
|
||||||
if (((input & 1) != 0 && PCF8574_LEVEL_HIGH(priv, pin)) ||
|
if (((input & 1) != 0 && PCF8574_LEVEL_HIGH(priv, pin)) ||
|
||||||
((input & 1) == 0 && PCF8574_LEVEL_LOW(priv, pin)))
|
((input & 1) == 0 && PCF8574_LEVEL_LOW(priv, pin)))
|
||||||
|
@ -1038,17 +1038,8 @@ static void tca64_int_update(FAR struct tca64_dev_s *priv, ioe_pinset_t input,
|
|||||||
|
|
||||||
/* Check the changed bits from last read */
|
/* Check the changed bits from last read */
|
||||||
|
|
||||||
input = (priv->input & ~mask) | (input & mask);
|
input = (priv->input & ~mask) | (input & mask);
|
||||||
diff = priv->input ^ input;
|
diff = priv->input ^ input;
|
||||||
|
|
||||||
if (diff == 0)
|
|
||||||
{
|
|
||||||
/* Nothing has changed */
|
|
||||||
|
|
||||||
leave_critical_section(flags);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
priv->input = input;
|
priv->input = input;
|
||||||
|
|
||||||
/* TCA64XX doesn't support irq trigger, we have to do this in software. */
|
/* TCA64XX doesn't support irq trigger, we have to do this in software. */
|
||||||
@ -1072,7 +1063,7 @@ static void tca64_int_update(FAR struct tca64_dev_s *priv, ioe_pinset_t input,
|
|||||||
}
|
}
|
||||||
else /* if (TCA64_LEVEL_SENSITIVE(priv, pin)) */
|
else /* if (TCA64_LEVEL_SENSITIVE(priv, pin)) */
|
||||||
{
|
{
|
||||||
/* Level triggered. Set intstat if in match level type. */
|
/* Level triggered. Set intstat bit if match in level type. */
|
||||||
|
|
||||||
if (((input & 1) != 0 && TCA64_LEVEL_HIGH(priv, pin)) ||
|
if (((input & 1) != 0 && TCA64_LEVEL_HIGH(priv, pin)) ||
|
||||||
((input & 1) == 0 && TCA64_LEVEL_LOW(priv, pin)))
|
((input & 1) == 0 && TCA64_LEVEL_LOW(priv, pin)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user