Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to CRC peripheral by default #1715

Merged
merged 1 commit into from
May 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions cores/arduino/stm32/stm32yyxx_hal_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
#undef HAL_SAI_MODULE_ENABLED
#endif


#if !defined(HAL_SPI_MODULE_DISABLED)
#define HAL_SPI_MODULE_ENABLED
#else
Expand All @@ -71,6 +70,12 @@
#undef HAL_ICACHE_MODULE_ENABLED
#endif

#if !defined(HAL_CRC_MODULE_ENABLED)
#define HAL_CRC_MODULE_ENABLED
#else
#undef HAL_CRC_MODULE_ENABLED
#endif

/*
* Not defined by default
*/
Expand Down Expand Up @@ -127,7 +132,6 @@
HAL_CEC_MODULE_ENABLED
HAL_COMP_MODULE_ENABLED
HAL_CORDIC_MODULE_ENABLED
HAL_CRC_MODULE_ENABLED
HAL_CRYP_MODULE_ENABLED
HAL_DCMI_MODULE_ENABLED
HAL_DFSDM_MODULE_ENABLED
Expand Down
7 changes: 7 additions & 0 deletions libraries/SrcWrapper/src/stm32/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,13 @@ void configIPClock(void)
/* Enable SYSCFG clock, needed for example: Pin remap or Analog switch ... */
__HAL_RCC_SYSCFG_CLK_ENABLE();
#endif

/* Enable CRC clock, needed for example: MotionFX Library ... */
#if defined(__HAL_RCC_CRC2_CLK_ENABLE)
__HAL_RCC_CRC2_CLK_ENABLE();
#elif defined(__HAL_RCC_CRC_CLK_ENABLE)
__HAL_RCC_CRC_CLK_ENABLE();
#endif
}

#ifdef __cplusplus
Expand Down
14 changes: 14 additions & 0 deletions libraries/SrcWrapper/src/stm32/hw_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@
extern "C" {
#endif

#ifdef CRC2_BASE
#define CRC_INSTANCE CRC2
#elif defined(CRC_BASE)
#define CRC_INSTANCE CRC
#else
#error "No CRC instance available"
#endif
CRC_HandleTypeDef hcrc = {.Instance = CRC_INSTANCE};

/**
* @brief This function performs the global init of the system (HAL, IOs...)
* @param None
Expand Down Expand Up @@ -53,6 +62,11 @@ void hw_config_init(void)
/* Configure the system clock */
SystemClock_Config();

/* Initialize the CRC */
#if defined(CRC_INSTANCE)
HAL_CRC_Init(&hcrc);
fpistm marked this conversation as resolved.
Show resolved Hide resolved
#endif

#if defined (USBCON) && defined(USBD_USE_CDC)
USBD_CDC_init();
#endif
Expand Down