summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoe Xu <[email protected]>2018-12-23 00:50:47 -0800
committerNoe Xu <[email protected]>2019-01-13 23:37:15 -0800
commit52729bb62d126ace0c564268d47ae4232f69e684 (patch)
tree018bacfcb42233714529fb6770723698e1732840
parent5e47dc41b3b28534782ed6f7447e46badae6bb9a (diff)
Fix rtthread CAN driver issue.
Reset rx tx handler when closing CAN device, Or it will not work after reopening. Change-Id: I43482c21263a989322f8df2ac9349128f7cb630a
-rw-r--r--components/drivers/can/can.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/components/drivers/can/can.c b/components/drivers/can/can.c
index e20fcddcff..81fdf25a1e 100644
--- a/components/drivers/can/can.c
+++ b/components/drivers/can/can.c
@@ -405,6 +405,7 @@ static rt_err_t rt_can_close(struct rt_device *dev)
rt_free(rx_fifo);
dev->open_flag &= ~RT_DEVICE_FLAG_INT_RX;
+ can->can_rx = RT_NULL;
/* configure low level device */
can->ops->control(can, RT_DEVICE_CTRL_CLR_INT, (void *)RT_DEVICE_FLAG_INT_RX);
}
@@ -418,6 +419,7 @@ static rt_err_t rt_can_close(struct rt_device *dev)
rt_free(tx_fifo);
dev->open_flag &= ~RT_DEVICE_FLAG_INT_TX;
+ can->can_tx = RT_NULL;
/* configure low level device */
can->ops->control(can, RT_DEVICE_CTRL_CLR_INT, (void *)RT_DEVICE_FLAG_INT_TX);
}