pub
Fork of CANnucleo by
Diff: can_api.c
- Revision:
- 10:227a455d0f9f
- Parent:
- 8:5c90d6b9a382
- Child:
- 11:439f3a34c42e
diff -r e9224f2c6d37 -r 227a455d0f9f can_api.c --- a/can_api.c Sat Oct 31 18:40:03 2015 +0000 +++ b/can_api.c Sat Dec 05 10:18:24 2015 +0000 @@ -192,11 +192,12 @@ * @retval */ int can_read(can_t* obj, CAN_Message* msg, int handle) { + int i; msg->id = _canHandle.pRxMsg->IDE == CAN_ID_STD ? _canHandle.pRxMsg->StdId : _canHandle.pRxMsg->ExtId; msg->type = _canHandle.pRxMsg->RTR == CAN_RTR_DATA ? CANData : CANRemote; msg->format = _canHandle.pRxMsg->IDE == CAN_ID_STD ? CANStandard : CANExtended; msg->len = _canHandle.pRxMsg->DLC; - for(int i = 0; i < msg->len; i++) + for(i = 0; i < msg->len; i++) msg->data[i] = _canHandle.pRxMsg->Data[i]; return msg->len;