Skip to content

Commit 52729bb

Browse files
committed
Fix rtthread CAN driver issue.
Reset rx tx handler when closing CAN device, Or it will not work after reopening. Change-Id: I43482c21263a989322f8df2ac9349128f7cb630a
1 parent 5e47dc4 commit 52729bb

File tree

1 file changed

+2
-0
lines changed
  • components/drivers/can

1 file changed

+2
-0
lines changed

components/drivers/can/can.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ static rt_err_t rt_can_close(struct rt_device *dev)
405405

406406
rt_free(rx_fifo);
407407
dev->open_flag &= ~RT_DEVICE_FLAG_INT_RX;
408+
can->can_rx = RT_NULL;
408409
/* configure low level device */
409410
can->ops->control(can, RT_DEVICE_CTRL_CLR_INT, (void *)RT_DEVICE_FLAG_INT_RX);
410411
}
@@ -418,6 +419,7 @@ static rt_err_t rt_can_close(struct rt_device *dev)
418419

419420
rt_free(tx_fifo);
420421
dev->open_flag &= ~RT_DEVICE_FLAG_INT_TX;
422+
can->can_tx = RT_NULL;
421423
/* configure low level device */
422424
can->ops->control(can, RT_DEVICE_CTRL_CLR_INT, (void *)RT_DEVICE_FLAG_INT_TX);
423425
}

0 commit comments

Comments
 (0)