12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106 |
- /* USER CODE BEGIN Header */
- /**
- ******************************************************************************
- * File Name : stm32f4xx_hal_msp.c
- * Description : This file provides code for the MSP Initialization
- * and de-Initialization codes.
- ******************************************************************************
- ** This notice applies to any and all portions of this file
- * that are not between comment pairs USER CODE BEGIN and
- * USER CODE END. Other portions of this file, whether
- * inserted by the user or by software development tools
- * are owned by their respective copyright owners.
- *
- * COPYRIGHT(c) 2018 STMicroelectronics
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of STMicroelectronics nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */
- /* USER CODE END Header */
- /* Includes ------------------------------------------------------------------*/
- #include "main.h"
- /* USER CODE BEGIN Includes */
- #include <drv_common.h>
- /* USER CODE END Includes */
- /* Private typedef -----------------------------------------------------------*/
- /* USER CODE BEGIN TD */
- /* USER CODE END TD */
- /* Private define ------------------------------------------------------------*/
- /* USER CODE BEGIN Define */
- /* USER CODE END Define */
- /* Private macro -------------------------------------------------------------*/
- /* USER CODE BEGIN Macro */
- /* USER CODE END Macro */
- /* Private variables ---------------------------------------------------------*/
- /* USER CODE BEGIN PV */
- /* USER CODE END PV */
- /* Private function prototypes -----------------------------------------------*/
- /* USER CODE BEGIN PFP */
- /* USER CODE END PFP */
- /* External functions --------------------------------------------------------*/
- /* USER CODE BEGIN ExternalFunctions */
- /* USER CODE END ExternalFunctions */
- /* USER CODE BEGIN 0 */
- /* USER CODE END 0 */
- void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim);
- /**
- * Initializes the Global MSP.
- */
- void HAL_MspInit(void)
- {
- /* USER CODE BEGIN MspInit 0 */
- /* USER CODE END MspInit 0 */
- __HAL_RCC_SYSCFG_CLK_ENABLE();
- __HAL_RCC_PWR_CLK_ENABLE();
- /* System interrupt init*/
- /* USER CODE BEGIN MspInit 1 */
- /* USER CODE END MspInit 1 */
- }
- /**
- * @brief DAC MSP Initialization
- * This function configures the hardware resources used in this example
- * @param hdac: DAC handle pointer
- * @retval None
- */
- void HAL_DAC_MspInit(DAC_HandleTypeDef *hdac)
- {
- GPIO_InitTypeDef GPIO_InitStruct = {0};
- if (hdac->Instance==DAC)
- {
- /* USER CODE BEGIN DAC_MspInit 0 */
- /* USER CODE END DAC_MspInit 0 */
- /* Peripheral clock enable */
- __HAL_RCC_DAC_CLK_ENABLE();
- __HAL_RCC_GPIOA_CLK_ENABLE();
- /**DAC GPIO Configuration
- PA4 ------> DAC_OUT1
- PA5 ------> DAC_OUT2
- */
- GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_5;
- GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
- /* USER CODE BEGIN DAC_MspInit 1 */
- /* USER CODE END DAC_MspInit 1 */
- }
- }
- /**
- * @brief DAC MSP De-Initialization
- * This function freeze the hardware resources used in this example
- * @param hdac: DAC handle pointer
- * @retval None
- */
- void HAL_DAC_MspDeInit(DAC_HandleTypeDef *hdac)
- {
- if (hdac->Instance==DAC)
- {
- /* USER CODE BEGIN DAC_MspDeInit 0 */
- /* USER CODE END DAC_MspDeInit 0 */
- /* Peripheral clock disable */
- __HAL_RCC_DAC_CLK_DISABLE();
- /**DAC GPIO Configuration
- PA4 ------> DAC_OUT1
- PA5 ------> DAC_OUT2
- */
- HAL_GPIO_DeInit(GPIOA, GPIO_PIN_4|GPIO_PIN_5);
- /* USER CODE BEGIN DAC_MspDeInit 1 */
- /* USER CODE END DAC_MspDeInit 1 */
- }
- }
- /**
- * @brief ETH MSP Initialization
- * This function configures the hardware resources used in this example
- * @param heth: ETH handle pointer
- * @retval None
- */
- void HAL_ETH_MspInit(ETH_HandleTypeDef *heth)
- {
- GPIO_InitTypeDef GPIO_InitStruct = {0};
- if (heth->Instance==ETH)
- {
- /* USER CODE BEGIN ETH_MspInit 0 */
- /* USER CODE END ETH_MspInit 0 */
- /* Peripheral clock enable */
- __HAL_RCC_ETH_CLK_ENABLE();
- __HAL_RCC_GPIOC_CLK_ENABLE();
- __HAL_RCC_GPIOA_CLK_ENABLE();
- __HAL_RCC_GPIOG_CLK_ENABLE();
- /**ETH GPIO Configuration
- PC1 ------> ETH_MDC
- PA1 ------> ETH_REF_CLK
- PA2 ------> ETH_MDIO
- PA7 ------> ETH_CRS_DV
- PC4 ------> ETH_RXD0
- PC5 ------> ETH_RXD1
- PG11 ------> ETH_TX_EN
- PG13 ------> ETH_TXD0
- PG14 ------> ETH_TXD1
- */
- GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_4|GPIO_PIN_5;
- GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
- GPIO_InitStruct.Alternate = GPIO_AF11_ETH;
- HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
- GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_7;
- GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
- GPIO_InitStruct.Alternate = GPIO_AF11_ETH;
- HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
- GPIO_InitStruct.Pin = GPIO_PIN_11|GPIO_PIN_13|GPIO_PIN_14;
- GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
- GPIO_InitStruct.Alternate = GPIO_AF11_ETH;
- HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
- /* USER CODE BEGIN ETH_MspInit 1 */
- /* USER CODE END ETH_MspInit 1 */
- }
- }
- /**
- * @brief ETH MSP De-Initialization
- * This function freeze the hardware resources used in this example
- * @param heth: ETH handle pointer
- * @retval None
- */
- void HAL_ETH_MspDeInit(ETH_HandleTypeDef *heth)
- {
- if (heth->Instance==ETH)
- {
- /* USER CODE BEGIN ETH_MspDeInit 0 */
- /* USER CODE END ETH_MspDeInit 0 */
- /* Peripheral clock disable */
- __HAL_RCC_ETH_CLK_DISABLE();
- /**ETH GPIO Configuration
- PC1 ------> ETH_MDC
- PA1 ------> ETH_REF_CLK
- PA2 ------> ETH_MDIO
- PA7 ------> ETH_CRS_DV
- PC4 ------> ETH_RXD0
- PC5 ------> ETH_RXD1
- PG11 ------> ETH_TX_EN
- PG13 ------> ETH_TXD0
- PG14 ------> ETH_TXD1
- */
- HAL_GPIO_DeInit(GPIOC, GPIO_PIN_1|GPIO_PIN_4|GPIO_PIN_5);
- HAL_GPIO_DeInit(GPIOA, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_7);
- HAL_GPIO_DeInit(GPIOG, GPIO_PIN_11|GPIO_PIN_13|GPIO_PIN_14);
- /* USER CODE BEGIN ETH_MspDeInit 1 */
- /* USER CODE END ETH_MspDeInit 1 */
- }
- }
- /**
- * @brief RTC MSP Initialization
- * This function configures the hardware resources used in this example
- * @param hrtc: RTC handle pointer
- * @retval None
- */
- void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc)
- {
- if (hrtc->Instance==RTC)
- {
- /* USER CODE BEGIN RTC_MspInit 0 */
- /* USER CODE END RTC_MspInit 0 */
- /* Peripheral clock enable */
- __HAL_RCC_RTC_ENABLE();
- /* USER CODE BEGIN RTC_MspInit 1 */
- /* USER CODE END RTC_MspInit 1 */
- }
- }
- /**
- * @brief RTC MSP De-Initialization
- * This function freeze the hardware resources used in this example
- * @param hrtc: RTC handle pointer
- * @retval None
- */
- void HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc)
- {
- if (hrtc->Instance==RTC)
- {
- /* USER CODE BEGIN RTC_MspDeInit 0 */
- /* USER CODE END RTC_MspDeInit 0 */
- /* Peripheral clock disable */
- __HAL_RCC_RTC_DISABLE();
- /* USER CODE BEGIN RTC_MspDeInit 1 */
- /* USER CODE END RTC_MspDeInit 1 */
- }
- }
- /**
- * @brief SD MSP Initialization
- * This function configures the hardware resources used in this example
- * @param hsd: SD handle pointer
- * @retval None
- */
- void HAL_SD_MspInit(SD_HandleTypeDef *hsd)
- {
- GPIO_InitTypeDef GPIO_InitStruct = {0};
- if (hsd->Instance==SDIO)
- {
- /* USER CODE BEGIN SDIO_MspInit 0 */
- /* USER CODE END SDIO_MspInit 0 */
- /* Peripheral clock enable */
- __HAL_RCC_SDIO_CLK_ENABLE();
- __HAL_RCC_GPIOC_CLK_ENABLE();
- __HAL_RCC_GPIOD_CLK_ENABLE();
- /**SDIO GPIO Configuration
- PC8 ------> SDIO_D0
- PC9 ------> SDIO_D1
- PC10 ------> SDIO_D2
- PC11 ------> SDIO_D3
- PC12 ------> SDIO_CK
- PD2 ------> SDIO_CMD
- */
- GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11
- |GPIO_PIN_12;
- GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
- GPIO_InitStruct.Alternate = GPIO_AF12_SDIO;
- HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
- GPIO_InitStruct.Pin = GPIO_PIN_2;
- GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
- GPIO_InitStruct.Alternate = GPIO_AF12_SDIO;
- HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
- /* USER CODE BEGIN SDIO_MspInit 1 */
- /* USER CODE END SDIO_MspInit 1 */
- }
- }
- /**
- * @brief SD MSP De-Initialization
- * This function freeze the hardware resources used in this example
- * @param hsd: SD handle pointer
- * @retval None
- */
- void HAL_SD_MspDeInit(SD_HandleTypeDef *hsd)
- {
- if (hsd->Instance==SDIO)
- {
- /* USER CODE BEGIN SDIO_MspDeInit 0 */
- /* USER CODE END SDIO_MspDeInit 0 */
- /* Peripheral clock disable */
- __HAL_RCC_SDIO_CLK_DISABLE();
- /**SDIO GPIO Configuration
- PC8 ------> SDIO_D0
- PC9 ------> SDIO_D1
- PC10 ------> SDIO_D2
- PC11 ------> SDIO_D3
- PC12 ------> SDIO_CK
- PD2 ------> SDIO_CMD
- */
- HAL_GPIO_DeInit(GPIOC, GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11
- |GPIO_PIN_12);
- HAL_GPIO_DeInit(GPIOD, GPIO_PIN_2);
- /* USER CODE BEGIN SDIO_MspDeInit 1 */
- /* USER CODE END SDIO_MspDeInit 1 */
- }
- }
- /**
- * @brief SPI MSP Initialization
- * This function configures the hardware resources used in this example
- * @param hspi: SPI handle pointer
- * @retval None
- */
- void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi)
- {
- GPIO_InitTypeDef GPIO_InitStruct = {0};
- if (hspi->Instance==SPI1)
- {
- /* USER CODE BEGIN SPI1_MspInit 0 */
- /* USER CODE END SPI1_MspInit 0 */
- /* Peripheral clock enable */
- __HAL_RCC_SPI1_CLK_ENABLE();
- __HAL_RCC_GPIOB_CLK_ENABLE();
- /**SPI1 GPIO Configuration
- PB3 ------> SPI1_SCK
- PB4 ------> SPI1_MISO
- PB5 ------> SPI1_MOSI
- */
- GPIO_InitStruct.Pin = GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5;
- GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
- GPIO_InitStruct.Alternate = GPIO_AF5_SPI1;
- HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
- /* SPI1 interrupt Init */
- HAL_NVIC_SetPriority(SPI1_IRQn, 0, 0);
- HAL_NVIC_EnableIRQ(SPI1_IRQn);
- /* USER CODE BEGIN SPI1_MspInit 1 */
- /* USER CODE END SPI1_MspInit 1 */
- }
- else if (hspi->Instance==SPI2)
- {
- /* USER CODE BEGIN SPI2_MspInit 0 */
- /* USER CODE END SPI2_MspInit 0 */
- /* Peripheral clock enable */
- __HAL_RCC_SPI2_CLK_ENABLE();
- __HAL_RCC_GPIOC_CLK_ENABLE();
- __HAL_RCC_GPIOB_CLK_ENABLE();
- /**SPI2 GPIO Configuration
- PC2 ------> SPI2_MISO
- PC3 ------> SPI2_MOSI
- PB13 ------> SPI2_SCK
- */
- GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3;
- GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
- GPIO_InitStruct.Alternate = GPIO_AF5_SPI2;
- HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
- GPIO_InitStruct.Pin = GPIO_PIN_13;
- GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
- GPIO_InitStruct.Alternate = GPIO_AF5_SPI2;
- HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
- /* USER CODE BEGIN SPI2_MspInit 1 */
- /* USER CODE END SPI2_MspInit 1 */
- }
- }
- /**
- * @brief SPI MSP De-Initialization
- * This function freeze the hardware resources used in this example
- * @param hspi: SPI handle pointer
- * @retval None
- */
- void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi)
- {
- if (hspi->Instance==SPI1)
- {
- /* USER CODE BEGIN SPI1_MspDeInit 0 */
- /* USER CODE END SPI1_MspDeInit 0 */
- /* Peripheral clock disable */
- __HAL_RCC_SPI1_CLK_DISABLE();
- /**SPI1 GPIO Configuration
- PB3 ------> SPI1_SCK
- PB4 ------> SPI1_MISO
- PB5 ------> SPI1_MOSI
- */
- HAL_GPIO_DeInit(GPIOB, GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5);
- /* SPI1 interrupt DeInit */
- HAL_NVIC_DisableIRQ(SPI1_IRQn);
- /* USER CODE BEGIN SPI1_MspDeInit 1 */
- /* USER CODE END SPI1_MspDeInit 1 */
- }
- else if (hspi->Instance==SPI2)
- {
- /* USER CODE BEGIN SPI2_MspDeInit 0 */
- /* USER CODE END SPI2_MspDeInit 0 */
- /* Peripheral clock disable */
- __HAL_RCC_SPI2_CLK_DISABLE();
- /**SPI2 GPIO Configuration
- PC2 ------> SPI2_MISO
- PC3 ------> SPI2_MOSI
- PB13 ------> SPI2_SCK
- */
- HAL_GPIO_DeInit(GPIOC, GPIO_PIN_2|GPIO_PIN_3);
- HAL_GPIO_DeInit(GPIOB, GPIO_PIN_13);
- /* USER CODE BEGIN SPI2_MspDeInit 1 */
- /* USER CODE END SPI2_MspDeInit 1 */
- }
- }
- /**
- * @brief TIM_Base MSP Initialization
- * This function configures the hardware resources used in this example
- * @param htim_base: TIM_Base handle pointer
- * @retval None
- */
- void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
- {
- if (htim_base->Instance==TIM2)
- {
- /* USER CODE BEGIN TIM2_MspInit 0 */
- /* USER CODE END TIM2_MspInit 0 */
- /* Peripheral clock enable */
- __HAL_RCC_TIM2_CLK_ENABLE();
- /* USER CODE BEGIN TIM2_MspInit 1 */
- /* USER CODE END TIM2_MspInit 1 */
- }
- else if (htim_base->Instance==TIM11)
- {
- /* USER CODE BEGIN TIM11_MspInit 0 */
- /* USER CODE END TIM11_MspInit 0 */
- /* Peripheral clock enable */
- __HAL_RCC_TIM11_CLK_ENABLE();
- /* USER CODE BEGIN TIM11_MspInit 1 */
- /* USER CODE END TIM11_MspInit 1 */
- }
- else if (htim_base->Instance==TIM13)
- {
- /* USER CODE BEGIN TIM13_MspInit 0 */
- /* USER CODE END TIM13_MspInit 0 */
- /* Peripheral clock enable */
- __HAL_RCC_TIM13_CLK_ENABLE();
- /* USER CODE BEGIN TIM13_MspInit 1 */
- /* USER CODE END TIM13_MspInit 1 */
- }
- else if (htim_base->Instance==TIM14)
- {
- /* USER CODE BEGIN TIM14_MspInit 0 */
- /* USER CODE END TIM14_MspInit 0 */
- /* Peripheral clock enable */
- __HAL_RCC_TIM14_CLK_ENABLE();
- /* USER CODE BEGIN TIM14_MspInit 1 */
- /* USER CODE END TIM14_MspInit 1 */
- }
- }
- /**
- * @brief TIM_Encoder MSP Initialization
- * This function configures the hardware resources used in this example
- * @param htim_encoder: TIM_Encoder handle pointer
- * @retval None
- */
- void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef *htim_encoder)
- {
- GPIO_InitTypeDef GPIO_InitStruct = {0};
- if (htim_encoder->Instance==TIM4)
- {
- /* USER CODE BEGIN TIM4_MspInit 0 */
- /* USER CODE END TIM4_MspInit 0 */
- /* Peripheral clock enable */
- __HAL_RCC_TIM4_CLK_ENABLE();
- __HAL_RCC_GPIOB_CLK_ENABLE();
- /**TIM4 GPIO Configuration
- PB6 ------> TIM4_CH1
- PB7 ------> TIM4_CH2
- */
- GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_7;
- GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
- GPIO_InitStruct.Alternate = GPIO_AF2_TIM4;
- HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
- /* USER CODE BEGIN TIM4_MspInit 1 */
- /* USER CODE END TIM4_MspInit 1 */
- }
- }
- void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim)
- {
- GPIO_InitTypeDef GPIO_InitStruct = {0};
- if (htim->Instance==TIM2)
- {
- /* USER CODE BEGIN TIM2_MspPostInit 0 */
- /* USER CODE END TIM2_MspPostInit 0 */
- __HAL_RCC_GPIOA_CLK_ENABLE();
- /**TIM2 GPIO Configuration
- PA3 ------> TIM2_CH4
- */
- GPIO_InitStruct.Pin = GPIO_PIN_3;
- GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
- GPIO_InitStruct.Alternate = GPIO_AF1_TIM2;
- HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
- /* USER CODE BEGIN TIM2_MspPostInit 1 */
- /* USER CODE END TIM2_MspPostInit 1 */
- }
- }
- /**
- * @brief TIM_Base MSP De-Initialization
- * This function freeze the hardware resources used in this example
- * @param htim_base: TIM_Base handle pointer
- * @retval None
- */
- void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim_base)
- {
- if (htim_base->Instance==TIM2)
- {
- /* USER CODE BEGIN TIM2_MspDeInit 0 */
- /* USER CODE END TIM2_MspDeInit 0 */
- /* Peripheral clock disable */
- __HAL_RCC_TIM2_CLK_DISABLE();
- /* USER CODE BEGIN TIM2_MspDeInit 1 */
- /* USER CODE END TIM2_MspDeInit 1 */
- }
- else if (htim_base->Instance==TIM11)
- {
- /* USER CODE BEGIN TIM11_MspDeInit 0 */
- /* USER CODE END TIM11_MspDeInit 0 */
- /* Peripheral clock disable */
- __HAL_RCC_TIM11_CLK_DISABLE();
- /* USER CODE BEGIN TIM11_MspDeInit 1 */
- /* USER CODE END TIM11_MspDeInit 1 */
- }
- else if (htim_base->Instance==TIM13)
- {
- /* USER CODE BEGIN TIM13_MspDeInit 0 */
- /* USER CODE END TIM13_MspDeInit 0 */
- /* Peripheral clock disable */
- __HAL_RCC_TIM13_CLK_DISABLE();
- /* USER CODE BEGIN TIM13_MspDeInit 1 */
- /* USER CODE END TIM13_MspDeInit 1 */
- }
- else if (htim_base->Instance==TIM14)
- {
- /* USER CODE BEGIN TIM14_MspDeInit 0 */
- /* USER CODE END TIM14_MspDeInit 0 */
- /* Peripheral clock disable */
- __HAL_RCC_TIM14_CLK_DISABLE();
- /* USER CODE BEGIN TIM14_MspDeInit 1 */
- /* USER CODE END TIM14_MspDeInit 1 */
- }
- }
- /**
- * @brief TIM_Encoder MSP De-Initialization
- * This function freeze the hardware resources used in this example
- * @param htim_encoder: TIM_Encoder handle pointer
- * @retval None
- */
- void HAL_TIM_Encoder_MspDeInit(TIM_HandleTypeDef *htim_encoder)
- {
- if (htim_encoder->Instance==TIM4)
- {
- /* USER CODE BEGIN TIM4_MspDeInit 0 */
- /* USER CODE END TIM4_MspDeInit 0 */
- /* Peripheral clock disable */
- __HAL_RCC_TIM4_CLK_DISABLE();
- /**TIM4 GPIO Configuration
- PB6 ------> TIM4_CH1
- PB7 ------> TIM4_CH2
- */
- HAL_GPIO_DeInit(GPIOB, GPIO_PIN_6|GPIO_PIN_7);
- /* USER CODE BEGIN TIM4_MspDeInit 1 */
- /* USER CODE END TIM4_MspDeInit 1 */
- }
- }
- /**
- * @brief UART MSP Initialization
- * This function configures the hardware resources used in this example
- * @param huart: UART handle pointer
- * @retval None
- */
- void HAL_UART_MspInit(UART_HandleTypeDef *huart)
- {
- GPIO_InitTypeDef GPIO_InitStruct = {0};
- if (huart->Instance==USART1)
- {
- /* USER CODE BEGIN USART1_MspInit 0 */
- /* USER CODE END USART1_MspInit 0 */
- /* Peripheral clock enable */
- __HAL_RCC_USART1_CLK_ENABLE();
- __HAL_RCC_GPIOA_CLK_ENABLE();
- /**USART1 GPIO Configuration
- PA9 ------> USART1_TX
- PA10 ------> USART1_RX
- */
- GPIO_InitStruct.Pin = GPIO_PIN_9|GPIO_PIN_10;
- GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
- GPIO_InitStruct.Pull = GPIO_PULLUP;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
- GPIO_InitStruct.Alternate = GPIO_AF7_USART1;
- HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
- /* USART1 interrupt Init */
- HAL_NVIC_SetPriority(USART1_IRQn, 0, 0);
- HAL_NVIC_EnableIRQ(USART1_IRQn);
- /* USER CODE BEGIN USART1_MspInit 1 */
- /* USER CODE END USART1_MspInit 1 */
- }
- else if (huart->Instance==USART3)
- {
- /* USER CODE BEGIN USART3_MspInit 0 */
- /* USER CODE END USART3_MspInit 0 */
- /* Peripheral clock enable */
- __HAL_RCC_USART3_CLK_ENABLE();
- __HAL_RCC_GPIOB_CLK_ENABLE();
- /**USART3 GPIO Configuration
- PB10 ------> USART3_TX
- PB11 ------> USART3_RX
- */
- GPIO_InitStruct.Pin = GPIO_PIN_10|GPIO_PIN_11;
- GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
- GPIO_InitStruct.Pull = GPIO_PULLUP;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
- GPIO_InitStruct.Alternate = GPIO_AF7_USART3;
- HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
- /* USER CODE BEGIN USART3_MspInit 1 */
- /* USER CODE END USART3_MspInit 1 */
- }
- }
- /**
- * @brief UART MSP De-Initialization
- * This function freeze the hardware resources used in this example
- * @param huart: UART handle pointer
- * @retval None
- */
- void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
- {
- if (huart->Instance==USART1)
- {
- /* USER CODE BEGIN USART1_MspDeInit 0 */
- /* USER CODE END USART1_MspDeInit 0 */
- /* Peripheral clock disable */
- __HAL_RCC_USART1_CLK_DISABLE();
- /**USART1 GPIO Configuration
- PA9 ------> USART1_TX
- PA10 ------> USART1_RX
- */
- HAL_GPIO_DeInit(GPIOA, GPIO_PIN_9|GPIO_PIN_10);
- /* USART1 interrupt DeInit */
- HAL_NVIC_DisableIRQ(USART1_IRQn);
- /* USER CODE BEGIN USART1_MspDeInit 1 */
- /* USER CODE END USART1_MspDeInit 1 */
- }
- else if (huart->Instance==USART3)
- {
- /* USER CODE BEGIN USART3_MspDeInit 0 */
- /* USER CODE END USART3_MspDeInit 0 */
- /* Peripheral clock disable */
- __HAL_RCC_USART3_CLK_DISABLE();
- /**USART3 GPIO Configuration
- PB10 ------> USART3_TX
- PB11 ------> USART3_RX
- */
- HAL_GPIO_DeInit(GPIOB, GPIO_PIN_10|GPIO_PIN_11);
- /* USER CODE BEGIN USART3_MspDeInit 1 */
- /* USER CODE END USART3_MspDeInit 1 */
- }
- }
- /**
- * @brief PCD MSP Initialization
- * This function configures the hardware resources used in this example
- * @param hpcd: PCD handle pointer
- * @retval None
- */
- void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
- {
- GPIO_InitTypeDef GPIO_InitStruct = {0};
- if (hpcd->Instance==USB_OTG_FS)
- {
- /* USER CODE BEGIN USB_OTG_FS_MspInit 0 */
- /* USER CODE END USB_OTG_FS_MspInit 0 */
- __HAL_RCC_GPIOA_CLK_ENABLE();
- /**USB_OTG_FS GPIO Configuration
- PA11 ------> USB_OTG_FS_DM
- PA12 ------> USB_OTG_FS_DP
- */
- GPIO_InitStruct.Pin = GPIO_PIN_11|GPIO_PIN_12;
- GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
- GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS;
- HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
- /* Peripheral clock enable */
- __HAL_RCC_USB_OTG_FS_CLK_ENABLE();
- /* USB_OTG_FS interrupt Init */
- HAL_NVIC_SetPriority(OTG_FS_IRQn, 0, 0);
- HAL_NVIC_EnableIRQ(OTG_FS_IRQn);
- /* USER CODE BEGIN USB_OTG_FS_MspInit 1 */
- /* USER CODE END USB_OTG_FS_MspInit 1 */
- }
- }
- /**
- * @brief PCD MSP De-Initialization
- * This function freeze the hardware resources used in this example
- * @param hpcd: PCD handle pointer
- * @retval None
- */
- void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd)
- {
- if (hpcd->Instance==USB_OTG_FS)
- {
- /* USER CODE BEGIN USB_OTG_FS_MspDeInit 0 */
- /* USER CODE END USB_OTG_FS_MspDeInit 0 */
- /* Peripheral clock disable */
- __HAL_RCC_USB_OTG_FS_CLK_DISABLE();
- /**USB_OTG_FS GPIO Configuration
- PA11 ------> USB_OTG_FS_DM
- PA12 ------> USB_OTG_FS_DP
- */
- HAL_GPIO_DeInit(GPIOA, GPIO_PIN_11|GPIO_PIN_12);
- /* USB_OTG_FS interrupt DeInit */
- HAL_NVIC_DisableIRQ(OTG_FS_IRQn);
- /* USER CODE BEGIN USB_OTG_FS_MspDeInit 1 */
- /* USER CODE END USB_OTG_FS_MspDeInit 1 */
- }
- }
- static uint32_t FSMC_Initialized = 0;
- static void HAL_FSMC_MspInit(void)
- {
- /* USER CODE BEGIN FSMC_MspInit 0 */
- /* USER CODE END FSMC_MspInit 0 */
- GPIO_InitTypeDef GPIO_InitStruct = {0};
- if (FSMC_Initialized)
- {
- return;
- }
- FSMC_Initialized = 1;
- /* Peripheral clock enable */
- __HAL_RCC_FSMC_CLK_ENABLE();
- /** FSMC GPIO Configuration
- PF0 ------> FSMC_A0
- PF1 ------> FSMC_A1
- PF2 ------> FSMC_A2
- PF3 ------> FSMC_A3
- PF4 ------> FSMC_A4
- PF5 ------> FSMC_A5
- PF12 ------> FSMC_A6
- PF13 ------> FSMC_A7
- PF14 ------> FSMC_A8
- PF15 ------> FSMC_A9
- PG0 ------> FSMC_A10
- PG1 ------> FSMC_A11
- PE7 ------> FSMC_D4
- PE8 ------> FSMC_D5
- PE9 ------> FSMC_D6
- PE10 ------> FSMC_D7
- PE11 ------> FSMC_D8
- PE12 ------> FSMC_D9
- PE13 ------> FSMC_D10
- PE14 ------> FSMC_D11
- PE15 ------> FSMC_D12
- PD8 ------> FSMC_D13
- PD9 ------> FSMC_D14
- PD10 ------> FSMC_D15
- PD11 ------> FSMC_A16
- PD12 ------> FSMC_A17
- PD13 ------> FSMC_A18
- PD14 ------> FSMC_D0
- PD15 ------> FSMC_D1
- PG2 ------> FSMC_A12
- PG3 ------> FSMC_A13
- PG4 ------> FSMC_A14
- PG5 ------> FSMC_A15
- PD0 ------> FSMC_D2
- PD1 ------> FSMC_D3
- PD4 ------> FSMC_NOE
- PD5 ------> FSMC_NWE
- PG10 ------> FSMC_NE3
- PG12 ------> FSMC_NE4
- PE0 ------> FSMC_NBL0
- PE1 ------> FSMC_NBL1
- */
- GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3
- |GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_12|GPIO_PIN_13
- |GPIO_PIN_14|GPIO_PIN_15;
- GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
- GPIO_InitStruct.Alternate = GPIO_AF12_FSMC;
- HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
- GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3
- |GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_10|GPIO_PIN_12;
- GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
- GPIO_InitStruct.Alternate = GPIO_AF12_FSMC;
- HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
- GPIO_InitStruct.Pin = GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10
- |GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14
- |GPIO_PIN_15|GPIO_PIN_0|GPIO_PIN_1;
- GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
- GPIO_InitStruct.Alternate = GPIO_AF12_FSMC;
- HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
- GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11
- |GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15
- |GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_4|GPIO_PIN_5;
- GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
- GPIO_InitStruct.Alternate = GPIO_AF12_FSMC;
- HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
- /* USER CODE BEGIN FSMC_MspInit 1 */
- /* USER CODE END FSMC_MspInit 1 */
- }
- void HAL_SRAM_MspInit(SRAM_HandleTypeDef *hsram)
- {
- /* USER CODE BEGIN SRAM_MspInit 0 */
- /* USER CODE END SRAM_MspInit 0 */
- HAL_FSMC_MspInit();
- /* USER CODE BEGIN SRAM_MspInit 1 */
- /* USER CODE END SRAM_MspInit 1 */
- }
- static uint32_t FSMC_DeInitialized = 0;
- static void HAL_FSMC_MspDeInit(void)
- {
- /* USER CODE BEGIN FSMC_MspDeInit 0 */
- /* USER CODE END FSMC_MspDeInit 0 */
- if (FSMC_DeInitialized)
- {
- return;
- }
- FSMC_DeInitialized = 1;
- /* Peripheral clock enable */
- __HAL_RCC_FSMC_CLK_DISABLE();
- /** FSMC GPIO Configuration
- PF0 ------> FSMC_A0
- PF1 ------> FSMC_A1
- PF2 ------> FSMC_A2
- PF3 ------> FSMC_A3
- PF4 ------> FSMC_A4
- PF5 ------> FSMC_A5
- PF12 ------> FSMC_A6
- PF13 ------> FSMC_A7
- PF14 ------> FSMC_A8
- PF15 ------> FSMC_A9
- PG0 ------> FSMC_A10
- PG1 ------> FSMC_A11
- PE7 ------> FSMC_D4
- PE8 ------> FSMC_D5
- PE9 ------> FSMC_D6
- PE10 ------> FSMC_D7
- PE11 ------> FSMC_D8
- PE12 ------> FSMC_D9
- PE13 ------> FSMC_D10
- PE14 ------> FSMC_D11
- PE15 ------> FSMC_D12
- PD8 ------> FSMC_D13
- PD9 ------> FSMC_D14
- PD10 ------> FSMC_D15
- PD11 ------> FSMC_A16
- PD12 ------> FSMC_A17
- PD13 ------> FSMC_A18
- PD14 ------> FSMC_D0
- PD15 ------> FSMC_D1
- PG2 ------> FSMC_A12
- PG3 ------> FSMC_A13
- PG4 ------> FSMC_A14
- PG5 ------> FSMC_A15
- PD0 ------> FSMC_D2
- PD1 ------> FSMC_D3
- PD4 ------> FSMC_NOE
- PD5 ------> FSMC_NWE
- PG10 ------> FSMC_NE3
- PG12 ------> FSMC_NE4
- PE0 ------> FSMC_NBL0
- PE1 ------> FSMC_NBL1
- */
- HAL_GPIO_DeInit(GPIOF, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3
- |GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_12|GPIO_PIN_13
- |GPIO_PIN_14|GPIO_PIN_15);
- HAL_GPIO_DeInit(GPIOG, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3
- |GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_10|GPIO_PIN_12);
- HAL_GPIO_DeInit(GPIOE, GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10
- |GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14
- |GPIO_PIN_15|GPIO_PIN_0|GPIO_PIN_1);
- HAL_GPIO_DeInit(GPIOD, GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11
- |GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15
- |GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_4|GPIO_PIN_5);
- /* USER CODE BEGIN FSMC_MspDeInit 1 */
- /* USER CODE END FSMC_MspDeInit 1 */
- }
- void HAL_SRAM_MspDeInit(SRAM_HandleTypeDef *hsram)
- {
- /* USER CODE BEGIN SRAM_MspDeInit 0 */
- /* USER CODE END SRAM_MspDeInit 0 */
- HAL_FSMC_MspDeInit();
- /* USER CODE BEGIN SRAM_MspDeInit 1 */
- /* USER CODE END SRAM_MspDeInit 1 */
- }
- /* USER CODE BEGIN 1 */
- /* USER CODE END 1 */
- /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|