1
0
Fork 0

Fix bit shifting in CO_CANtxBufferInit

Shifting by 12 overlaps RTR bit if DLC is 8 bytes.
This commit is contained in:
Oleksii Slabchenko 2024-02-26 11:00:55 +01:00 committed by Janez
parent 91653819e7
commit 32274bef99

View file

@ -178,7 +178,7 @@ CO_CANtx_t *CO_CANtxBufferInit(
/* CAN identifier, DLC and rtr, bit aligned with CAN module transmit buffer.
* Microcontroller specific. */
buffer->ident = ((uint32_t)ident & 0x07FFU)
| ((uint32_t)(((uint32_t)noOfBytes & 0xFU) << 12U))
| ((uint32_t)(((uint32_t)noOfBytes & 0xFU) << 11U))
| ((uint32_t)(rtr ? 0x8000U : 0U));
buffer->bufferFull = false;