STM32L4xx_HAL_Driver  1.14.0
CRC Exported Types

Data Structures

struct  CRC_InitTypeDef
 CRC Init Structure definition. More...
 
struct  CRC_HandleTypeDef
 CRC Handle Structure definition. More...
 

Enumerations

enum  HAL_CRC_StateTypeDef {
  HAL_CRC_STATE_RESET = 0x00U, HAL_CRC_STATE_READY = 0x01U, HAL_CRC_STATE_BUSY = 0x02U, HAL_CRC_STATE_TIMEOUT = 0x03U,
  HAL_CRC_STATE_ERROR = 0x04U
}
 CRC HAL State Structure definition. More...
 

Detailed Description


Data Structure Documentation

◆ CRC_InitTypeDef

struct CRC_InitTypeDef

CRC Init Structure definition.

Definition at line 59 of file stm32l4xx_hal_crc.h.

Data Fields
uint32_t CRCLength

This parameter is a value of Polynomial sizes to configure the peripheral and indicates CRC length. Value can be either one of

  • CRC_POLYLENGTH_32B (32-bit CRC),
  • CRC_POLYLENGTH_16B (16-bit CRC),
  • CRC_POLYLENGTH_8B (8-bit CRC),
  • CRC_POLYLENGTH_7B (7-bit CRC).
uint8_t DefaultInitValueUse

This parameter is a value of Indicates whether or not default init value is used and indicates if default init value is used. If set to DEFAULT_INIT_VALUE_ENABLE, resort to default 0xFFFFFFFF value. In that case, there is no need to set InitValue field. If otherwise set to DEFAULT_INIT_VALUE_DISABLE, InitValue field must be set.

uint8_t DefaultPolynomialUse

This parameter is a value of Indicates whether or not default polynomial is used and indicates if default polynomial is used. If set to DEFAULT_POLYNOMIAL_ENABLE, resort to default X^32 + X^26 + X^23 + X^22 + X^16 + X^12 + X^11 + X^10 +X^8 + X^7 + X^5 + X^4 + X^2+ X +1. In that case, there is no need to set GeneratingPolynomial field. If otherwise set to DEFAULT_POLYNOMIAL_DISABLE, GeneratingPolynomial and CRCLength fields must be set.

uint32_t GeneratingPolynomial

Set CRC generating polynomial as a 7, 8, 16 or 32-bit long value for a polynomial degree respectively equal to 7, 8, 16 or 32. This field is written in normal representation, e.g., for a polynomial of degree 7, X^7 + X^6 + X^5 + X^2 + 1 is written 0x65. No need to specify it if DefaultPolynomialUse is set to DEFAULT_POLYNOMIAL_ENABLE.

uint32_t InitValue

Init value to initiate CRC computation. No need to specify it if DefaultInitValueUse is set to DEFAULT_INIT_VALUE_ENABLE.

uint32_t InputDataInversionMode

This parameter is a value of Input Data Inversion Modes and specifies input data inversion mode. Can be either one of the following values

  • CRC_INPUTDATA_INVERSION_NONE no input data inversion
  • CRC_INPUTDATA_INVERSION_BYTE byte-wise inversion, 0x1A2B3C4D becomes 0x58D43CB2
  • CRC_INPUTDATA_INVERSION_HALFWORD halfword-wise inversion, 0x1A2B3C4D becomes 0xD458B23C
  • CRC_INPUTDATA_INVERSION_WORD word-wise inversion, 0x1A2B3C4D becomes 0xB23CD458
uint32_t OutputDataInversionMode

This parameter is a value of Output Data Inversion Modes and specifies output data (i.e. CRC) inversion mode. Can be either

  • CRC_OUTPUTDATA_INVERSION_DISABLE no CRC inversion,
  • CRC_OUTPUTDATA_INVERSION_ENABLE CRC 0x11223344 is converted into 0x22CC4488

◆ CRC_HandleTypeDef

struct CRC_HandleTypeDef

CRC Handle Structure definition.

Definition at line 103 of file stm32l4xx_hal_crc.h.

Data Fields
CRC_InitTypeDef Init

CRC configuration parameters

uint32_t InputDataFormat

This parameter is a value of Input Buffer Format and specifies input data format. Can be either

  • CRC_INPUTDATA_FORMAT_BYTES input data is a stream of bytes (8-bit data)
  • CRC_INPUTDATA_FORMAT_HALFWORDS input data is a stream of half-words (16-bit data)
  • CRC_INPUTDATA_FORMAT_WORDS input data is a stream of words (32-bit data)

Note that constant CRC_INPUT_FORMAT_UNDEFINED is defined but an initialization error must occur if InputBufferFormat is not one of the three values listed above

CRC_TypeDef * Instance

Register base address

HAL_LockTypeDef Lock

CRC Locking object

__IO HAL_CRC_StateTypeDef State

CRC communication state

Enumeration Type Documentation

◆ HAL_CRC_StateTypeDef

CRC HAL State Structure definition.

Enumerator
HAL_CRC_STATE_RESET 

CRC not yet initialized or disabled

HAL_CRC_STATE_READY 

CRC initialized and ready for use

HAL_CRC_STATE_BUSY 

CRC internal process is ongoing

HAL_CRC_STATE_TIMEOUT 

CRC timeout state

HAL_CRC_STATE_ERROR 

CRC error state

Definition at line 47 of file stm32l4xx_hal_crc.h.