Skip to content

Commit f44e2aa

Browse files
cparatafpistm
authored andcommitted
Add support to CRC peripheral by default
1 parent 0b6efb3 commit f44e2aa

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

Diff for: cores/arduino/stm32/stm32yyxx_hal_conf.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
#undef HAL_SAI_MODULE_ENABLED
5353
#endif
5454

55-
5655
#if !defined(HAL_SPI_MODULE_DISABLED)
5756
#define HAL_SPI_MODULE_ENABLED
5857
#else
@@ -71,6 +70,12 @@
7170
#undef HAL_ICACHE_MODULE_ENABLED
7271
#endif
7372

73+
#if !defined(HAL_CRC_MODULE_ENABLED)
74+
#define HAL_CRC_MODULE_ENABLED
75+
#else
76+
#undef HAL_CRC_MODULE_ENABLED
77+
#endif
78+
7479
/*
7580
* Not defined by default
7681
*/
@@ -127,7 +132,6 @@
127132
HAL_CEC_MODULE_ENABLED
128133
HAL_COMP_MODULE_ENABLED
129134
HAL_CORDIC_MODULE_ENABLED
130-
HAL_CRC_MODULE_ENABLED
131135
HAL_CRYP_MODULE_ENABLED
132136
HAL_DCMI_MODULE_ENABLED
133137
HAL_DFSDM_MODULE_ENABLED

Diff for: libraries/SrcWrapper/src/stm32/clock.c

+7
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,13 @@ void configIPClock(void)
173173
/* Enable SYSCFG clock, needed for example: Pin remap or Analog switch ... */
174174
__HAL_RCC_SYSCFG_CLK_ENABLE();
175175
#endif
176+
177+
/* Enable CRC clock, needed for example: MotionFX Library ... */
178+
#if defined(__HAL_RCC_CRC2_CLK_ENABLE)
179+
__HAL_RCC_CRC2_CLK_ENABLE();
180+
#elif defined(__HAL_RCC_CRC_CLK_ENABLE)
181+
__HAL_RCC_CRC_CLK_ENABLE();
182+
#endif
176183
}
177184

178185
#ifdef __cplusplus

Diff for: libraries/SrcWrapper/src/stm32/hw_config.c

+14
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@
1919
extern "C" {
2020
#endif
2121

22+
#ifdef CRC2_BASE
23+
#define CRC_INSTANCE CRC2
24+
#elif defined(CRC_BASE)
25+
#define CRC_INSTANCE CRC
26+
#else
27+
#error "No CRC instance available"
28+
#endif
29+
CRC_HandleTypeDef hcrc = {.Instance = CRC_INSTANCE};
30+
2231
/**
2332
* @brief This function performs the global init of the system (HAL, IOs...)
2433
* @param None
@@ -53,6 +62,11 @@ void hw_config_init(void)
5362
/* Configure the system clock */
5463
SystemClock_Config();
5564

65+
/* Initialize the CRC */
66+
#if defined(CRC_INSTANCE)
67+
HAL_CRC_Init(&hcrc);
68+
#endif
69+
5670
#if defined (USBCON) && defined(USBD_USE_CDC)
5771
USBD_CDC_init();
5872
#endif

0 commit comments

Comments
 (0)