/** * @brief Initializes the STM32303E-EVAL RevC's LCD and LEDs resources. * @param None * @retval None */ static void BSP_Config(void) { /* Initialize STM32303E-EVAL RevC's LEDs */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Enable the CRC Module */ __CRC_CLK_ENABLE(); }
/** * @brief Initializes the STM324xG-EVAL's LCD and LEDs resources. * @param None * @retval None */ static void BSP_Config(void) { /* Initialize STM324xG-EVAL's LEDs */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Initialize the Touch screen */ BSP_TS_Init(240, 320); /* Enable the CRC Module */ __CRC_CLK_ENABLE(); }
/** * @brief Initializes the STM32F429I-DISCO's LCD and LEDs resources. * @param None * @retval None */ static void BSP_Config(void) { /* Initialize STM32F429I-DISCO's LEDs */ BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Initializes the SDRAM device */ BSP_SDRAM_Init(); /* Initialize the Touch screen */ BSP_TS_Init(240, 320); /* Enable the CRC Module */ __CRC_CLK_ENABLE(); }
void HAL_CRC_MspInit(CRC_HandleTypeDef* hcrc) { if(hcrc->Instance==CRC) { /* USER CODE BEGIN CRC_MspInit 0 */ /* USER CODE END CRC_MspInit 0 */ /* Peripheral clock enable */ __CRC_CLK_ENABLE(); /* USER CODE BEGIN CRC_MspInit 1 */ /* USER CODE END CRC_MspInit 1 */ } }
/** * @brief Initialize the PDM library. * @param AudioFreq: Audio sampling frequency * @param ChnlNbr: Number of audio channels (1: mono; 2: stereo) * @retval None */ static void PDMDecoder_Init(uint32_t AudioFreq, uint32_t ChnlNbr) { uint32_t i = 0; /* Enable CRC peripheral to unlock the PDM library */ __CRC_CLK_ENABLE(); for(i = 0; i < ChnlNbr; i++) { /* Filter LP & HP Init */ Filter[i].LP_HZ = AudioFreq / 2; Filter[i].HP_HZ = 10; Filter[i].Fs = AudioFreq; Filter[i].Out_MicChannels = ChnlNbr; Filter[i].In_MicChannels = ChnlNbr; PDM_Filter_Init((PDMFilter_InitStruct *)&Filter[i]); } }
/** * @brief Initialize the PDM library. * @param AudioFreq: Audio sampling frequency * @param ChnlNbr: Number of audio channels (1: mono; 2: stereo) * @retval None */ static void PDMDecoder_Init(uint32_t AudioFreq, uint32_t ChnlNbr) { uint32_t i = 0; /* Enable CRC peripheral to unlock the PDM library */ __CRC_CLK_ENABLE(); for(i = 0; i < ChnlNbr; i++) { /* Filter LP & HP Init */ Filter[i].LP_HZ = AudioFreq / 2; Filter[i].HP_HZ = 10; Filter[i].Fs = AudioFreq; /* On STM32F401-Discovery a single microphone is mounted, samples are duplicated to make stereo audio streams */ Filter[i].Out_MicChannels = 2; Filter[i].In_MicChannels = ChnlNbr; PDM_Filter_Init((PDMFilter_InitStruct *)&Filter[i]); } }
/** * @brief Initializes LEDs, SDRAM, touch screen, CRC and SRAM. * @param None * @retval None */ void k_BspInit(void) { /* Configure LED1, LED2, LED3 and LED4 */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Initialize the SDRAM */ BSP_SDRAM_Init(); /* Initialize the Touch screen */ BSP_TS_Init(480, 272); /* Enable CRC to Unlock GUI */ __CRC_CLK_ENABLE(); /* Enable Back up SRAM */ __BKPSRAM_CLK_ENABLE(); }
/** * @brief CRC MSP Initialization * This function configures the hardware resources used in this example: * - Peripheral's clock enable * @param hcrc: CRC handle pointer * @retval None */ void HAL_CRC_MspInit(CRC_HandleTypeDef *hcrc) { /* CRC Peripheral clock enable */ __CRC_CLK_ENABLE(); }
/** * @brief Main program. * @param None * @retval None */ int main(void) { /* STM32F4xx HAL library initialization: - Configure the Flash prefetch, instruction and Data caches - Configure the Systick to generate an interrupt each 1 msec - Set NVIC Group Priority to 4 - Global MSP (MCU Support Package) initialization */ HAL_Init(); /* Configure the system clock to have a system clock = 180 Mhz */ SystemClock_Config(); /* Init the STemWin GUI Library */ BSP_SDRAM_Init(); /* Initializes the SDRAM device */ __CRC_CLK_ENABLE(); /* Enable the CRC Module */ // __PWR_CLK_ENABLE(); // HAL_PWR_EnableBkUpAccess(); // __HAL_RCC_LSE_CONFIG(RCC_LSE_BYPASS); // __HAL_RCC_RTC_ENABLE(); /*##-1- Configure the RTC peripheral #######################################*/ RtcHandle.Instance = RTC; /* Configure RTC prescaler and RTC data registers */ /* RTC configured as follow: - Hour Format = Format 24 - Asynch Prediv = Value according to source clock - Synch Prediv = Value according to source clock - OutPut = Output Disable - OutPutPolarity = High Polarity - OutPutType = Open Drain */ RtcHandle.Init.HourFormat = RTC_HOURFORMAT_24; RtcHandle.Init.AsynchPrediv = RTC_ASYNCH_PREDIV; RtcHandle.Init.SynchPrediv = RTC_SYNCH_PREDIV; RtcHandle.Init.OutPut = RTC_OUTPUT_DISABLE; RtcHandle.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH; RtcHandle.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN; if(HAL_RTC_Init(&RtcHandle) != HAL_OK) { /* Initialization Error */ Error_Handler(); } /*##-2- Check if Data stored in BackUp register0: No Need to reconfigure RTC#*/ /* Read the BackUp Register 0 Data */ if(HAL_RTCEx_BKUPRead(&RtcHandle, RTC_BKP_DR0) != 0x32F2) { /* Configure RTC Calendar */ RTC_CalendarConfig(); } else { /* Check if the Power On Reset flag is set */ if(__HAL_RCC_GET_FLAG(RCC_FLAG_PORRST) != RESET) { } /* Check if Pin Reset flag is set */ if(__HAL_RCC_GET_FLAG(RCC_FLAG_PINRST) != RESET) { } /* Clear Reset Flag */ __HAL_RCC_CLEAR_RESET_FLAGS(); } GUI_Init(); //GUI_Initialized = 1; GPIO_Config(); if(HAL_RTCEx_BKUPRead(&RtcHandle, RTC_BKP_DR1) ==0) { HAL_RTCEx_BKUPWrite(&RtcHandle,RTC_BKP_DR1,600); } Time3Enable(HAL_RTCEx_BKUPRead(&RtcHandle, RTC_BKP_DR1)); /* Activate the use of memory device feature */ WM_SetCreateFlags(WM_CF_MEMDEV); os_sys_init (init); }
/** * @brief CRC MSP Initialization * @param hcrc: CRC handle pointer * @retval None */ void HAL_CRC_MspInit(CRC_HandleTypeDef *hcrc) { (void) hcrc; // Avoid compile warning /* CRC Peripheral clock enable */ __CRC_CLK_ENABLE(); }