nRF5 SDK v17.1.0
Macros | Typedefs | Functions

Module to declare System CRC API. More...

Macros

#define SYS_CRC_INIT   0
 Defines an initial value for the CRC sum.
 

Typedefs

typedef uint16_t sys_crc_t
 CRC value type. This module uses 16-bit CRC.
 

Functions

sys_crc_t sys_crc_calc (const uint8_t *p_data, size_t length)
 Function for computing CRC value for given data. More...
 
sys_crc_t sys_crc_continue (sys_crc_t current_crc, const uint8_t *p_data, size_t length)
 Function for updating the CRC value taking into the account the previously counted value. More...
 

Detailed Description

Module to declare System CRC API.

The CRC module implements a set of routines to compute the 16-bit CRC value for octet arrays.

Function Documentation

sys_crc_t sys_crc_calc ( const uint8_t *  p_data,
size_t  length 
)

Function for computing CRC value for given data.

Parameters
[in]p_dataPointer to data to compute.
[in]lengthLength of data.
Returns
Returns the CRC value for input data.
sys_crc_t sys_crc_continue ( sys_crc_t  current_crc,
const uint8_t *  p_data,
size_t  length 
)

Function for updating the CRC value taking into the account the previously counted value.

This function is used when input data is represented by several pieces. Consequently, a call to this function for each piece will give a correct total CRC value.

Parameters
[in]current_crcPreviously counted CRC value. Should be SYS_CRC_INIT for the first piece.
[in]p_dataPointer to the current piece of data.
[in]lengthLength of the current piece of data.
Returns
Returns the updated CRC value.

Documentation feedback | Developer Zone | Subscribe | Updated