|
1 | | -/** |
2 | | - ****************************************************************************** |
3 | | - * @file analog.c |
4 | | - * @author WI6LABS |
5 | | - * @version V1.0.0 |
6 | | - * @date 01-August-2016 |
7 | | - * @brief provide analog services (ADC + PWM) |
8 | | - * |
9 | | - ****************************************************************************** |
10 | | - * @attention |
11 | | - * |
12 | | - * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
13 | | - * |
14 | | - * Redistribution and use in source and binary forms, with or without modification, |
15 | | - * are permitted provided that the following conditions are met: |
16 | | - * 1. Redistributions of source code must retain the above copyright notice, |
17 | | - * this list of conditions and the following disclaimer. |
18 | | - * 2. Redistributions in binary form must reproduce the above copyright notice, |
19 | | - * this list of conditions and the following disclaimer in the documentation |
20 | | - * and/or other materials provided with the distribution. |
21 | | - * 3. Neither the name of STMicroelectronics nor the names of its contributors |
22 | | - * may be used to endorse or promote products derived from this software |
23 | | - * without specific prior written permission. |
24 | | - * |
25 | | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
26 | | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
27 | | - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
28 | | - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
29 | | - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
30 | | - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
31 | | - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
32 | | - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
33 | | - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
34 | | - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
35 | | - * |
36 | | - ****************************************************************************** |
37 | | - */ |
38 | | -#include "stm32_def.h" |
| 1 | +/* |
| 2 | + ******************************************************************************* |
| 3 | + * Copyright (c) 2016-2021, STMicroelectronics |
| 4 | + * All rights reserved. |
| 5 | + * |
| 6 | + * This software component is licensed by ST under BSD 3-Clause license, |
| 7 | + * the "License"; You may not use this file except in compliance with the |
| 8 | + * License. You may obtain a copy of the License at: |
| 9 | + * opensource.org/licenses/BSD-3-Clause |
| 10 | + * |
| 11 | + ******************************************************************************* |
| 12 | + */ |
39 | 13 | #include "analog.h" |
40 | | -#include "PinAF_STM32F1.h" |
| 14 | +#include "lock_resource.h" |
41 | 15 | #include "stm32yyxx_ll_adc.h" |
| 16 | +#include "PinAF_STM32F1.h" |
| 17 | + |
42 | 18 |
|
43 | 19 | #ifdef __cplusplus |
44 | 20 | extern "C" { |
@@ -628,8 +604,10 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc) |
628 | 604 | SystemClock_Config (variant.cpp) */ |
629 | 605 | #if defined(__HAL_RCC_ADC_CONFIG) && !defined(STM32F1xx) && \ |
630 | 606 | !defined(STM32H7xx) && !defined(STM32MP1xx) |
| 607 | + hsem_lock(CFG_HW_RCC_CRRCR_CCIPR_SEMID, HSEM_LOCK_DEFAULT_RETRY); |
631 | 608 | /* ADC Periph interface clock configuration */ |
632 | 609 | __HAL_RCC_ADC_CONFIG(RCC_ADCCLKSOURCE_SYSCLK); |
| 610 | + hsem_unlock(CFG_HW_RCC_CRRCR_CCIPR_SEMID); |
633 | 611 | #endif |
634 | 612 |
|
635 | 613 | /* Configure ADC GPIO pin */ |
|
0 commit comments