Skip to content

Commit dec12fa

Browse files
stack: map CANopenNode crc16_ccitt() to Zephyr crc16_itu_t()
Map the CANopenNode crc16_ccitt() function to the Zephyr crc16_itu_t() function in order to use correct CRC function with arguments in expected order. This is needed for SDO block transfers with CRC. Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
1 parent 53d3415 commit dec12fa

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

stack/crc16-ccitt.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,15 @@ extern "C" {
5656
* @return Calculated CRC.
5757
*/
5858
#ifdef CO_USE_OWN_CRC16
59-
extern
60-
#endif
59+
/* Map CANopenNode crc16_ccitt() to Zephyr crc16_itu_t() function */
60+
extern uint16_t crc16_itu_t(uint16_t seed, const uint8_t *src, size_t len);
61+
#define crc16_ccitt(block, blockLength, crc) crc16_itu_t(crc, block, blockLength)
62+
#else
6163
unsigned short crc16_ccitt(
6264
const unsigned char block[],
6365
unsigned int blockLength,
6466
unsigned short crc);
67+
#endif
6568

6669
#ifdef __cplusplus
6770
}

0 commit comments

Comments
 (0)