2014-10-22 05:13 AM
The generated code contains an additional fragment, which gives a compilation error
Мy cube project attached...Сode:void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc)
{ GPIO_InitTypeDef GPIO_InitStruct; if(hadc->Instance==ADC1) { /* USER CODE BEGIN ADC1_MspInit 0 */ /* USER CODE END ADC1_MspInit 0 */ /* Peripheral clock enable */ __ADC1_CLK_ENABLE(); /**ADC1 GPIO Configuration PA0 ------> ADC1_IN0 PA1 ------> ADC1_IN1 PA4 ------> ADC1_IN4 PA5 ------> ADC1_IN5 */ GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_4|GPIO_PIN_5; GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); /* Peripheral DMA init*/ hdma_adc1.Instance = DMA1_Channel1; hdma_adc1.Init.Direction = DMA_PERIPH_TO_MEMORY; hdma_adc1.Init.PeriphInc = DMA_PINC_DISABLE; hdma_adc1.Init.MemInc = DMA_MINC_ENABLE; hdma_adc1.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD; hdma_adc1.Init.MemDataAlignment = DMA_MDATAALIGN_WORD; hdma_adc1.Init.Mode = DMA_NORMAL; hdma_adc1.Init.Priority = DMA_PRIORITY_LOW; HAL_DMA_Init(&hdma_adc1); __HAL_LINKDMA(hadc,DMA_Handle,hdma_adc1);hdma_sdadc1.Instance = DMA2_Channel3;
hdma_sdadc1.Init.Direction = DMA_PERIPH_TO_MEMORY; hdma_sdadc1.Init.PeriphInc = DMA_PINC_DISABLE; hdma_sdadc1.Init.MemInc = DMA_MINC_ENABLE; hdma_sdadc1.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD; hdma_sdadc1.Init.MemDataAlignment = DMA_MDATAALIGN_WORD; hdma_sdadc1.Init.Mode = DMA_NORMAL; hdma_sdadc1.Init.Priority = DMA_PRIORITY_LOW; HAL_DMA_Init(&hdma_sdadc1); __HAL_LINKDMA(hadc,hdma,hdma_sdadc1); /* USER CODE BEGIN ADC1_MspInit 1 */ /* USER CODE END ADC1_MspInit 1 */ }}void HAL_ADC_MspDeInit(ADC_HandleTypeDef* hadc)
{ if(hadc->Instance==ADC1) { /* USER CODE BEGIN ADC1_MspDeInit 0 */ /* USER CODE END ADC1_MspDeInit 0 */ /* Peripheral clock disable */ __ADC1_CLK_DISABLE(); /**ADC1 GPIO Configuration PA0 ------> ADC1_IN0 PA1 ------> ADC1_IN1 PA4 ------> ADC1_IN4 PA5 ------> ADC1_IN5 */ HAL_GPIO_DeInit(GPIOA, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_4|GPIO_PIN_5); /* Peripheral DMA DeInit*/ HAL_DMA_DeInit(hadc->DMA_Handle);HAL_DMA_DeInit(hadc->hdma);
/* USER CODE BEGIN ADC1_MspDeInit 1 */ /* USER CODE END ADC1_MspDeInit 1 */ }}