Skip to content

Commit

Permalink
imxrt:lpi2c ensure that on an error status reflects it.
Browse files Browse the repository at this point in the history
   After an error the STOP detect was overwriting the
   previous error status.
  • Loading branch information
davids5 committed Dec 21, 2019
1 parent 9ebeaa1 commit 0050ba9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion arch/arm/src/imxrt/imxrt_lpi2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -1364,6 +1364,10 @@ static int imxrt_lpi2c_isr_process(struct imxrt_lpi2c_priv_s *priv)
#ifndef CONFIG_I2C_POLLED
if (priv->intstate == INTSTATE_WAITING)
{
/* Update Status once at the end */

priv->status = status;

/* inform the thread that transfer is complete
* and wake it up
*/
Expand All @@ -1372,6 +1376,7 @@ static int imxrt_lpi2c_isr_process(struct imxrt_lpi2c_priv_s *priv)
priv->intstate = INTSTATE_DONE;
}
#else
priv->status = status;
priv->intstate = INTSTATE_DONE;
#endif
/* Mark that this transaction stopped */
Expand Down Expand Up @@ -1412,6 +1417,10 @@ static int imxrt_lpi2c_isr_process(struct imxrt_lpi2c_priv_s *priv)
#ifndef CONFIG_I2C_POLLED
if (priv->intstate == INTSTATE_WAITING)
{
/* Update Status once at the end */

priv->status = status;

/* inform the thread that transfer is complete
* and wake it up
*/
Expand All @@ -1420,11 +1429,11 @@ static int imxrt_lpi2c_isr_process(struct imxrt_lpi2c_priv_s *priv)
priv->intstate = INTSTATE_DONE;
}
#else
priv->status = status;
priv->intstate = INTSTATE_DONE;
#endif
}

priv->status = status;
return OK;
}

Expand Down

0 comments on commit 0050ba9

Please sign in to comment.