Merge pull request #1826 from jeromecoutant/PR_UpdateF0_driver_v1_5_0

[STM32F0] update Cube driver to v1.5.0
pull/1881/head
Martin Kojtal 2016-06-08 14:11:59 +01:00
commit d7a196e89e
116 changed files with 25628 additions and 21992 deletions

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx.h * @file stm32f0xx.h
* @author MCD Application Team * @author MCD Application Team
* @version V2.2.2 * @version V2.2.3
* @date 26-June-2015 * @date 29-January-2016
* @brief CMSIS STM32F0xx Device Peripheral Access Layer Header File. * @brief CMSIS STM32F0xx Device Peripheral Access Layer Header File.
* *
* The file is the unique include file that the application programmer * The file is the unique include file that the application programmer
@ -18,7 +18,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -95,7 +95,7 @@
/* #define STM32F072xB */ /*!< STM32F072x8, STM32F072xB Devices (STM32F072xx microcontrollers where the Flash memory ranges between 64 and 128 Kbytes) */ /* #define STM32F072xB */ /*!< STM32F072x8, STM32F072xB Devices (STM32F072xx microcontrollers where the Flash memory ranges between 64 and 128 Kbytes) */
/* #define STM32F078xx */ /*!< STM32F078xx Devices (STM32F078xx microcontrollers where the Flash memory is 128 Kbytes) */ /* #define STM32F078xx */ /*!< STM32F078xx Devices (STM32F078xx microcontrollers where the Flash memory is 128 Kbytes) */
/* #define STM32F030xC */ /*!< STM32F030xC Devices (STM32F030xC microcontrollers where the Flash memory is 256 Kbytes) */ /* #define STM32F030xC */ /*!< STM32F030xC Devices (STM32F030xC microcontrollers where the Flash memory is 256 Kbytes) */
/* #define STM32F091xC */ /*!< STM32F091xC Devices (STM32F091xx microcontrollers where the Flash memory is 256 Kbytes) */ /* #define STM32F091xC */ /*!< STM32F091xB, STM32F091xC Devices (STM32F091xx microcontrollers where the Flash memory ranges between 128 and 256 Kbytes) */
/* #define STM32F098xx */ /*!< STM32F098xx Devices (STM32F098xx microcontrollers where the Flash memory is 256 Kbytes) */ /* #define STM32F098xx */ /*!< STM32F098xx Devices (STM32F098xx microcontrollers where the Flash memory is 256 Kbytes) */
#endif #endif
@ -112,16 +112,16 @@
#endif /* USE_HAL_DRIVER */ #endif /* USE_HAL_DRIVER */
/** /**
* @brief CMSIS Device version number V2.2.2 * @brief CMSIS Device version number V2.2.3
*/ */
#define __STM32F0xx_CMSIS_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */ #define __STM32F0_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */
#define __STM32F0xx_CMSIS_DEVICE_VERSION_SUB1 (0x02) /*!< [23:16] sub1 version */ #define __STM32F0_DEVICE_VERSION_SUB1 (0x02) /*!< [23:16] sub1 version */
#define __STM32F0xx_CMSIS_DEVICE_VERSION_SUB2 (0x02) /*!< [15:8] sub2 version */ #define __STM32F0_DEVICE_VERSION_SUB2 (0x03) /*!< [15:8] sub2 version */
#define __STM32F0xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */ #define __STM32F0_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */
#define __STM32F0xx_CMSIS_DEVICE_VERSION ((__CMSIS_DEVICE_VERSION_MAIN << 24)\ #define __STM32F0_DEVICE_VERSION ((__STM32F0_DEVICE_VERSION_MAIN << 24)\
|(__CMSIS_DEVICE_HAL_VERSION_SUB1 << 16)\ |(__STM32F0_DEVICE_VERSION_SUB1 << 16)\
|(__CMSIS_DEVICE_HAL_VERSION_SUB2 << 8 )\ |(__STM32F0_DEVICE_VERSION_SUB2 << 8 )\
|(__CMSIS_DEVICE_HAL_VERSION_RC)) |(__STM32F0_DEVICE_VERSION_RC))
/** /**
* @} * @}

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file system_stm32f0xx.c * @file system_stm32f0xx.c
* @author MCD Application Team * @author MCD Application Team
* @version V2.2.2 * @version V2.2.3
* @date 26-June-2015 * @date 29-January-2016
* @brief CMSIS Cortex-M0 Device Peripheral Access Layer System Source File. * @brief CMSIS Cortex-M0 Device Peripheral Access Layer System Source File.
* *
* 1. This file provides two functions and one global variable to be called from * 1. This file provides two functions and one global variable to be called from
@ -42,7 +42,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -82,6 +82,7 @@
*/ */
#include "stm32f0xx.h" #include "stm32f0xx.h"
/** /**
* @} * @}
*/ */
@ -107,6 +108,10 @@
This value can be provided and adapted by the user application. */ This value can be provided and adapted by the user application. */
#endif /* HSI_VALUE */ #endif /* HSI_VALUE */
#if !defined (HSI48_VALUE)
#define HSI48_VALUE ((uint32_t)48000000) /*!< Default value of the HSI48 Internal oscillator in Hz.
This value can be provided and adapted by the user application. */
#endif /* HSI48_VALUE */
/** /**
* @} * @}
*/ */
@ -171,60 +176,60 @@ void SystemInit(void)
{ {
/* Reset the RCC clock configuration to the default reset state ------------*/ /* Reset the RCC clock configuration to the default reset state ------------*/
/* Set HSION bit */ /* Set HSION bit */
RCC->CR |= (uint32_t)0x00000001; RCC->CR |= (uint32_t)0x00000001U;
#if defined (STM32F051x8) || defined (STM32F058x8) #if defined (STM32F051x8) || defined (STM32F058x8)
/* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE and MCOSEL[2:0] bits */ /* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE and MCOSEL[2:0] bits */
RCC->CFGR &= (uint32_t)0xF8FFB80C; RCC->CFGR &= (uint32_t)0xF8FFB80CU;
#else #else
/* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE, MCOSEL[2:0], MCOPRE[2:0] and PLLNODIV bits */ /* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE, MCOSEL[2:0], MCOPRE[2:0] and PLLNODIV bits */
RCC->CFGR &= (uint32_t)0x08FFB80C; RCC->CFGR &= (uint32_t)0x08FFB80CU;
#endif /* STM32F051x8 or STM32F058x8 */ #endif /* STM32F051x8 or STM32F058x8 */
/* Reset HSEON, CSSON and PLLON bits */ /* Reset HSEON, CSSON and PLLON bits */
RCC->CR &= (uint32_t)0xFEF6FFFF; RCC->CR &= (uint32_t)0xFEF6FFFFU;
/* Reset HSEBYP bit */ /* Reset HSEBYP bit */
RCC->CR &= (uint32_t)0xFFFBFFFF; RCC->CR &= (uint32_t)0xFFFBFFFFU;
/* Reset PLLSRC, PLLXTPRE and PLLMUL[3:0] bits */ /* Reset PLLSRC, PLLXTPRE and PLLMUL[3:0] bits */
RCC->CFGR &= (uint32_t)0xFFC0FFFF; RCC->CFGR &= (uint32_t)0xFFC0FFFFU;
/* Reset PREDIV[3:0] bits */ /* Reset PREDIV[3:0] bits */
RCC->CFGR2 &= (uint32_t)0xFFFFFFF0; RCC->CFGR2 &= (uint32_t)0xFFFFFFF0U;
#if defined (STM32F072xB) || defined (STM32F078xx) #if defined (STM32F072xB) || defined (STM32F078xx)
/* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */ /* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFCFE2C; RCC->CFGR3 &= (uint32_t)0xFFFCFE2CU;
#elif defined (STM32F071xB) #elif defined (STM32F071xB)
/* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */ /* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFCEAC; RCC->CFGR3 &= (uint32_t)0xFFFFCEACU;
#elif defined (STM32F091xC) || defined (STM32F098xx) #elif defined (STM32F091xC) || defined (STM32F098xx)
/* Reset USART3SW[1:0], USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */ /* Reset USART3SW[1:0], USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFF0FEAC; RCC->CFGR3 &= (uint32_t)0xFFF0FEACU;
#elif defined (STM32F030x6) || defined (STM32F030x8) || defined (STM32F031x6) || defined (STM32F038xx) || defined (STM32F030xC) #elif defined (STM32F030x6) || defined (STM32F030x8) || defined (STM32F031x6) || defined (STM32F038xx) || defined (STM32F030xC)
/* Reset USART1SW[1:0], I2C1SW and ADCSW bits */ /* Reset USART1SW[1:0], I2C1SW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFFEEC; RCC->CFGR3 &= (uint32_t)0xFFFFFEECU;
#elif defined (STM32F051x8) || defined (STM32F058xx) #elif defined (STM32F051x8) || defined (STM32F058xx)
/* Reset USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */ /* Reset USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFFEAC; RCC->CFGR3 &= (uint32_t)0xFFFFFEACU;
#elif defined (STM32F042x6) || defined (STM32F048xx) #elif defined (STM32F042x6) || defined (STM32F048xx)
/* Reset USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */ /* Reset USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFFE2C; RCC->CFGR3 &= (uint32_t)0xFFFFFE2CU;
#elif defined (STM32F070x6) || defined (STM32F070xB) #elif defined (STM32F070x6) || defined (STM32F070xB)
/* Reset USART1SW[1:0], I2C1SW, USBSW and ADCSW bits */ /* Reset USART1SW[1:0], I2C1SW, USBSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFFE6C; RCC->CFGR3 &= (uint32_t)0xFFFFFE6CU;
/* Set default USB clock to PLLCLK, since there is no HSI48 */ /* Set default USB clock to PLLCLK, since there is no HSI48 */
RCC->CFGR3 |= (uint32_t)0x00000080; RCC->CFGR3 |= (uint32_t)0x00000080U;
#else #else
#warning "No target selected" #warning "No target selected"
#endif #endif
/* Reset HSI14 bit */ /* Reset HSI14 bit */
RCC->CR2 &= (uint32_t)0xFFFFFFFE; RCC->CR2 &= (uint32_t)0xFFFFFFFEU;
/* Disable all interrupts */ /* Disable all interrupts */
RCC->CIR = 0x00000000; RCC->CIR = 0x00000000U;
/* Enable SYSCFGENR in APB2EN, needed for 1st call of NVIC_SetVector, to copy vectors from flash to ram */ /* Enable SYSCFGENR in APB2EN, needed for 1st call of NVIC_SetVector, to copy vectors from flash to ram */
RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN; RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN;

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file system_stm32f0xx.h * @file system_stm32f0xx.h
* @author MCD Application Team * @author MCD Application Team
* @version V2.2.2 * @version V2.2.3
* @date 26-June-2015 * @date 29-January-2016
* @brief CMSIS Cortex-M0 Device System Source File for STM32F0xx devices. * @brief CMSIS Cortex-M0 Device System Source File for STM32F0xx devices.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -74,6 +74,7 @@
variable is updated automatically. variable is updated automatically.
*/ */
extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
extern const uint8_t AHBPrescTable[16]; /*!< AHB prescalers table values */
/** /**
* @} * @}

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx.h * @file stm32f0xx.h
* @author MCD Application Team * @author MCD Application Team
* @version V2.2.2 * @version V2.2.3
* @date 26-June-2015 * @date 29-January-2016
* @brief CMSIS STM32F0xx Device Peripheral Access Layer Header File. * @brief CMSIS STM32F0xx Device Peripheral Access Layer Header File.
* *
* The file is the unique include file that the application programmer * The file is the unique include file that the application programmer
@ -18,7 +18,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -95,7 +95,7 @@
/* #define STM32F072xB */ /*!< STM32F072x8, STM32F072xB Devices (STM32F072xx microcontrollers where the Flash memory ranges between 64 and 128 Kbytes) */ /* #define STM32F072xB */ /*!< STM32F072x8, STM32F072xB Devices (STM32F072xx microcontrollers where the Flash memory ranges between 64 and 128 Kbytes) */
/* #define STM32F078xx */ /*!< STM32F078xx Devices (STM32F078xx microcontrollers where the Flash memory is 128 Kbytes) */ /* #define STM32F078xx */ /*!< STM32F078xx Devices (STM32F078xx microcontrollers where the Flash memory is 128 Kbytes) */
/* #define STM32F030xC */ /*!< STM32F030xC Devices (STM32F030xC microcontrollers where the Flash memory is 256 Kbytes) */ /* #define STM32F030xC */ /*!< STM32F030xC Devices (STM32F030xC microcontrollers where the Flash memory is 256 Kbytes) */
/* #define STM32F091xC */ /*!< STM32F091xC Devices (STM32F091xx microcontrollers where the Flash memory is 256 Kbytes) */ /* #define STM32F091xC */ /*!< STM32F091xB, STM32F091xC Devices (STM32F091xx microcontrollers where the Flash memory ranges between 128 and 256 Kbytes) */
/* #define STM32F098xx */ /*!< STM32F098xx Devices (STM32F098xx microcontrollers where the Flash memory is 256 Kbytes) */ /* #define STM32F098xx */ /*!< STM32F098xx Devices (STM32F098xx microcontrollers where the Flash memory is 256 Kbytes) */
#endif #endif
@ -112,16 +112,16 @@
#endif /* USE_HAL_DRIVER */ #endif /* USE_HAL_DRIVER */
/** /**
* @brief CMSIS Device version number V2.2.2 * @brief CMSIS Device version number V2.2.3
*/ */
#define __STM32F0xx_CMSIS_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */ #define __STM32F0_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */
#define __STM32F0xx_CMSIS_DEVICE_VERSION_SUB1 (0x02) /*!< [23:16] sub1 version */ #define __STM32F0_DEVICE_VERSION_SUB1 (0x02) /*!< [23:16] sub1 version */
#define __STM32F0xx_CMSIS_DEVICE_VERSION_SUB2 (0x02) /*!< [15:8] sub2 version */ #define __STM32F0_DEVICE_VERSION_SUB2 (0x03) /*!< [15:8] sub2 version */
#define __STM32F0xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */ #define __STM32F0_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */
#define __STM32F0xx_CMSIS_DEVICE_VERSION ((__CMSIS_DEVICE_VERSION_MAIN << 24)\ #define __STM32F0_DEVICE_VERSION ((__STM32F0_DEVICE_VERSION_MAIN << 24)\
|(__CMSIS_DEVICE_HAL_VERSION_SUB1 << 16)\ |(__STM32F0_DEVICE_VERSION_SUB1 << 16)\
|(__CMSIS_DEVICE_HAL_VERSION_SUB2 << 8 )\ |(__STM32F0_DEVICE_VERSION_SUB2 << 8 )\
|(__CMSIS_DEVICE_HAL_VERSION_RC)) |(__STM32F0_DEVICE_VERSION_RC))
/** /**
* @} * @}

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file system_stm32f0xx.c * @file system_stm32f0xx.c
* @author MCD Application Team * @author MCD Application Team
* @version V2.2.2 * @version V2.2.3
* @date 26-June-2015 * @date 29-January-2016
* @brief CMSIS Cortex-M0 Device Peripheral Access Layer System Source File. * @brief CMSIS Cortex-M0 Device Peripheral Access Layer System Source File.
* *
* 1. This file provides two functions and one global variable to be called from * 1. This file provides two functions and one global variable to be called from
@ -42,7 +42,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -108,6 +108,10 @@
This value can be provided and adapted by the user application. */ This value can be provided and adapted by the user application. */
#endif /* HSI_VALUE */ #endif /* HSI_VALUE */
#if !defined (HSI48_VALUE)
#define HSI48_VALUE ((uint32_t)48000000) /*!< Default value of the HSI48 Internal oscillator in Hz.
This value can be provided and adapted by the user application. */
#endif /* HSI48_VALUE */
/** /**
* @} * @}
*/ */
@ -172,60 +176,60 @@ void SystemInit(void)
{ {
/* Reset the RCC clock configuration to the default reset state ------------*/ /* Reset the RCC clock configuration to the default reset state ------------*/
/* Set HSION bit */ /* Set HSION bit */
RCC->CR |= (uint32_t)0x00000001; RCC->CR |= (uint32_t)0x00000001U;
#if defined (STM32F051x8) || defined (STM32F058x8) #if defined (STM32F051x8) || defined (STM32F058x8)
/* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE and MCOSEL[2:0] bits */ /* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE and MCOSEL[2:0] bits */
RCC->CFGR &= (uint32_t)0xF8FFB80C; RCC->CFGR &= (uint32_t)0xF8FFB80CU;
#else #else
/* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE, MCOSEL[2:0], MCOPRE[2:0] and PLLNODIV bits */ /* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE, MCOSEL[2:0], MCOPRE[2:0] and PLLNODIV bits */
RCC->CFGR &= (uint32_t)0x08FFB80C; RCC->CFGR &= (uint32_t)0x08FFB80CU;
#endif /* STM32F051x8 or STM32F058x8 */ #endif /* STM32F051x8 or STM32F058x8 */
/* Reset HSEON, CSSON and PLLON bits */ /* Reset HSEON, CSSON and PLLON bits */
RCC->CR &= (uint32_t)0xFEF6FFFF; RCC->CR &= (uint32_t)0xFEF6FFFFU;
/* Reset HSEBYP bit */ /* Reset HSEBYP bit */
RCC->CR &= (uint32_t)0xFFFBFFFF; RCC->CR &= (uint32_t)0xFFFBFFFFU;
/* Reset PLLSRC, PLLXTPRE and PLLMUL[3:0] bits */ /* Reset PLLSRC, PLLXTPRE and PLLMUL[3:0] bits */
RCC->CFGR &= (uint32_t)0xFFC0FFFF; RCC->CFGR &= (uint32_t)0xFFC0FFFFU;
/* Reset PREDIV[3:0] bits */ /* Reset PREDIV[3:0] bits */
RCC->CFGR2 &= (uint32_t)0xFFFFFFF0; RCC->CFGR2 &= (uint32_t)0xFFFFFFF0U;
#if defined (STM32F072xB) || defined (STM32F078xx) #if defined (STM32F072xB) || defined (STM32F078xx)
/* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */ /* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFCFE2C; RCC->CFGR3 &= (uint32_t)0xFFFCFE2CU;
#elif defined (STM32F071xB) #elif defined (STM32F071xB)
/* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */ /* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFCEAC; RCC->CFGR3 &= (uint32_t)0xFFFFCEACU;
#elif defined (STM32F091xC) || defined (STM32F098xx) #elif defined (STM32F091xC) || defined (STM32F098xx)
/* Reset USART3SW[1:0], USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */ /* Reset USART3SW[1:0], USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFF0FEAC; RCC->CFGR3 &= (uint32_t)0xFFF0FEACU;
#elif defined (STM32F030x6) || defined (STM32F030x8) || defined (STM32F031x6) || defined (STM32F038xx) || defined (STM32F030xC) #elif defined (STM32F030x6) || defined (STM32F030x8) || defined (STM32F031x6) || defined (STM32F038xx) || defined (STM32F030xC)
/* Reset USART1SW[1:0], I2C1SW and ADCSW bits */ /* Reset USART1SW[1:0], I2C1SW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFFEEC; RCC->CFGR3 &= (uint32_t)0xFFFFFEECU;
#elif defined (STM32F051x8) || defined (STM32F058xx) #elif defined (STM32F051x8) || defined (STM32F058xx)
/* Reset USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */ /* Reset USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFFEAC; RCC->CFGR3 &= (uint32_t)0xFFFFFEACU;
#elif defined (STM32F042x6) || defined (STM32F048xx) #elif defined (STM32F042x6) || defined (STM32F048xx)
/* Reset USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */ /* Reset USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFFE2C; RCC->CFGR3 &= (uint32_t)0xFFFFFE2CU;
#elif defined (STM32F070x6) || defined (STM32F070xB) #elif defined (STM32F070x6) || defined (STM32F070xB)
/* Reset USART1SW[1:0], I2C1SW, USBSW and ADCSW bits */ /* Reset USART1SW[1:0], I2C1SW, USBSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFFE6C; RCC->CFGR3 &= (uint32_t)0xFFFFFE6CU;
/* Set default USB clock to PLLCLK, since there is no HSI48 */ /* Set default USB clock to PLLCLK, since there is no HSI48 */
RCC->CFGR3 |= (uint32_t)0x00000080; RCC->CFGR3 |= (uint32_t)0x00000080U;
#else #else
#warning "No target selected" #warning "No target selected"
#endif #endif
/* Reset HSI14 bit */ /* Reset HSI14 bit */
RCC->CR2 &= (uint32_t)0xFFFFFFFE; RCC->CR2 &= (uint32_t)0xFFFFFFFEU;
/* Disable all interrupts */ /* Disable all interrupts */
RCC->CIR = 0x00000000; RCC->CIR = 0x00000000U;
/* Enable SYSCFGENR in APB2EN, needed for 1st call of NVIC_SetVector, to copy vectors from flash to ram */ /* Enable SYSCFGENR in APB2EN, needed for 1st call of NVIC_SetVector, to copy vectors from flash to ram */
RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN; RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN;

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file system_stm32f0xx.h * @file system_stm32f0xx.h
* @author MCD Application Team * @author MCD Application Team
* @version V2.2.2 * @version V2.2.3
* @date 26-June-2015 * @date 29-January-2016
* @brief CMSIS Cortex-M0 Device System Source File for STM32F0xx devices. * @brief CMSIS Cortex-M0 Device System Source File for STM32F0xx devices.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -74,6 +74,7 @@
variable is updated automatically. variable is updated automatically.
*/ */
extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
extern const uint8_t AHBPrescTable[16]; /*!< AHB prescalers table values */
/** /**
* @} * @}

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx.h * @file stm32f0xx.h
* @author MCD Application Team * @author MCD Application Team
* @version V2.2.2 * @version V2.2.3
* @date 26-June-2015 * @date 29-January-2016
* @brief CMSIS STM32F0xx Device Peripheral Access Layer Header File. * @brief CMSIS STM32F0xx Device Peripheral Access Layer Header File.
* *
* The file is the unique include file that the application programmer * The file is the unique include file that the application programmer
@ -18,7 +18,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -95,7 +95,7 @@
/* #define STM32F072xB */ /*!< STM32F072x8, STM32F072xB Devices (STM32F072xx microcontrollers where the Flash memory ranges between 64 and 128 Kbytes) */ /* #define STM32F072xB */ /*!< STM32F072x8, STM32F072xB Devices (STM32F072xx microcontrollers where the Flash memory ranges between 64 and 128 Kbytes) */
/* #define STM32F078xx */ /*!< STM32F078xx Devices (STM32F078xx microcontrollers where the Flash memory is 128 Kbytes) */ /* #define STM32F078xx */ /*!< STM32F078xx Devices (STM32F078xx microcontrollers where the Flash memory is 128 Kbytes) */
/* #define STM32F030xC */ /*!< STM32F030xC Devices (STM32F030xC microcontrollers where the Flash memory is 256 Kbytes) */ /* #define STM32F030xC */ /*!< STM32F030xC Devices (STM32F030xC microcontrollers where the Flash memory is 256 Kbytes) */
/* #define STM32F091xC */ /*!< STM32F091xC Devices (STM32F091xx microcontrollers where the Flash memory is 256 Kbytes) */ /* #define STM32F091xC */ /*!< STM32F091xB, STM32F091xC Devices (STM32F091xx microcontrollers where the Flash memory ranges between 128 and 256 Kbytes) */
/* #define STM32F098xx */ /*!< STM32F098xx Devices (STM32F098xx microcontrollers where the Flash memory is 256 Kbytes) */ /* #define STM32F098xx */ /*!< STM32F098xx Devices (STM32F098xx microcontrollers where the Flash memory is 256 Kbytes) */
#endif #endif
@ -112,16 +112,16 @@
#endif /* USE_HAL_DRIVER */ #endif /* USE_HAL_DRIVER */
/** /**
* @brief CMSIS Device version number V2.2.2 * @brief CMSIS Device version number V2.2.3
*/ */
#define __STM32F0xx_CMSIS_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */ #define __STM32F0_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */
#define __STM32F0xx_CMSIS_DEVICE_VERSION_SUB1 (0x02) /*!< [23:16] sub1 version */ #define __STM32F0_DEVICE_VERSION_SUB1 (0x02) /*!< [23:16] sub1 version */
#define __STM32F0xx_CMSIS_DEVICE_VERSION_SUB2 (0x02) /*!< [15:8] sub2 version */ #define __STM32F0_DEVICE_VERSION_SUB2 (0x03) /*!< [15:8] sub2 version */
#define __STM32F0xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */ #define __STM32F0_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */
#define __STM32F0xx_CMSIS_DEVICE_VERSION ((__CMSIS_DEVICE_VERSION_MAIN << 24)\ #define __STM32F0_DEVICE_VERSION ((__STM32F0_DEVICE_VERSION_MAIN << 24)\
|(__CMSIS_DEVICE_HAL_VERSION_SUB1 << 16)\ |(__STM32F0_DEVICE_VERSION_SUB1 << 16)\
|(__CMSIS_DEVICE_HAL_VERSION_SUB2 << 8 )\ |(__STM32F0_DEVICE_VERSION_SUB2 << 8 )\
|(__CMSIS_DEVICE_HAL_VERSION_RC)) |(__STM32F0_DEVICE_VERSION_RC))
/** /**
* @} * @}

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file system_stm32f0xx.c * @file system_stm32f0xx.c
* @author MCD Application Team * @author MCD Application Team
* @version V2.2.2 * @version V2.2.3
* @date 26-June-2015 * @date 29-January-2016
* @brief CMSIS Cortex-M0 Device Peripheral Access Layer System Source File. * @brief CMSIS Cortex-M0 Device Peripheral Access Layer System Source File.
* *
* 1. This file provides two functions and one global variable to be called from * 1. This file provides two functions and one global variable to be called from
@ -42,7 +42,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -108,6 +108,10 @@
This value can be provided and adapted by the user application. */ This value can be provided and adapted by the user application. */
#endif /* HSI_VALUE */ #endif /* HSI_VALUE */
#if !defined (HSI48_VALUE)
#define HSI48_VALUE ((uint32_t)48000000) /*!< Default value of the HSI48 Internal oscillator in Hz.
This value can be provided and adapted by the user application. */
#endif /* HSI48_VALUE */
/** /**
* @} * @}
*/ */
@ -172,60 +176,60 @@ void SystemInit(void)
{ {
/* Reset the RCC clock configuration to the default reset state ------------*/ /* Reset the RCC clock configuration to the default reset state ------------*/
/* Set HSION bit */ /* Set HSION bit */
RCC->CR |= (uint32_t)0x00000001; RCC->CR |= (uint32_t)0x00000001U;
#if defined (STM32F051x8) || defined (STM32F058x8) #if defined (STM32F051x8) || defined (STM32F058x8)
/* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE and MCOSEL[2:0] bits */ /* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE and MCOSEL[2:0] bits */
RCC->CFGR &= (uint32_t)0xF8FFB80C; RCC->CFGR &= (uint32_t)0xF8FFB80CU;
#else #else
/* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE, MCOSEL[2:0], MCOPRE[2:0] and PLLNODIV bits */ /* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE, MCOSEL[2:0], MCOPRE[2:0] and PLLNODIV bits */
RCC->CFGR &= (uint32_t)0x08FFB80C; RCC->CFGR &= (uint32_t)0x08FFB80CU;
#endif /* STM32F051x8 or STM32F058x8 */ #endif /* STM32F051x8 or STM32F058x8 */
/* Reset HSEON, CSSON and PLLON bits */ /* Reset HSEON, CSSON and PLLON bits */
RCC->CR &= (uint32_t)0xFEF6FFFF; RCC->CR &= (uint32_t)0xFEF6FFFFU;
/* Reset HSEBYP bit */ /* Reset HSEBYP bit */
RCC->CR &= (uint32_t)0xFFFBFFFF; RCC->CR &= (uint32_t)0xFFFBFFFFU;
/* Reset PLLSRC, PLLXTPRE and PLLMUL[3:0] bits */ /* Reset PLLSRC, PLLXTPRE and PLLMUL[3:0] bits */
RCC->CFGR &= (uint32_t)0xFFC0FFFF; RCC->CFGR &= (uint32_t)0xFFC0FFFFU;
/* Reset PREDIV[3:0] bits */ /* Reset PREDIV[3:0] bits */
RCC->CFGR2 &= (uint32_t)0xFFFFFFF0; RCC->CFGR2 &= (uint32_t)0xFFFFFFF0U;
#if defined (STM32F072xB) || defined (STM32F078xx) #if defined (STM32F072xB) || defined (STM32F078xx)
/* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */ /* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFCFE2C; RCC->CFGR3 &= (uint32_t)0xFFFCFE2CU;
#elif defined (STM32F071xB) #elif defined (STM32F071xB)
/* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */ /* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFCEAC; RCC->CFGR3 &= (uint32_t)0xFFFFCEACU;
#elif defined (STM32F091xC) || defined (STM32F098xx) #elif defined (STM32F091xC) || defined (STM32F098xx)
/* Reset USART3SW[1:0], USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */ /* Reset USART3SW[1:0], USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFF0FEAC; RCC->CFGR3 &= (uint32_t)0xFFF0FEACU;
#elif defined (STM32F030x6) || defined (STM32F030x8) || defined (STM32F031x6) || defined (STM32F038xx) || defined (STM32F030xC) #elif defined (STM32F030x6) || defined (STM32F030x8) || defined (STM32F031x6) || defined (STM32F038xx) || defined (STM32F030xC)
/* Reset USART1SW[1:0], I2C1SW and ADCSW bits */ /* Reset USART1SW[1:0], I2C1SW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFFEEC; RCC->CFGR3 &= (uint32_t)0xFFFFFEECU;
#elif defined (STM32F051x8) || defined (STM32F058xx) #elif defined (STM32F051x8) || defined (STM32F058xx)
/* Reset USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */ /* Reset USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFFEAC; RCC->CFGR3 &= (uint32_t)0xFFFFFEACU;
#elif defined (STM32F042x6) || defined (STM32F048xx) #elif defined (STM32F042x6) || defined (STM32F048xx)
/* Reset USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */ /* Reset USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFFE2C; RCC->CFGR3 &= (uint32_t)0xFFFFFE2CU;
#elif defined (STM32F070x6) || defined (STM32F070xB) #elif defined (STM32F070x6) || defined (STM32F070xB)
/* Reset USART1SW[1:0], I2C1SW, USBSW and ADCSW bits */ /* Reset USART1SW[1:0], I2C1SW, USBSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFFE6C; RCC->CFGR3 &= (uint32_t)0xFFFFFE6CU;
/* Set default USB clock to PLLCLK, since there is no HSI48 */ /* Set default USB clock to PLLCLK, since there is no HSI48 */
RCC->CFGR3 |= (uint32_t)0x00000080; RCC->CFGR3 |= (uint32_t)0x00000080U;
#else #else
#warning "No target selected" #warning "No target selected"
#endif #endif
/* Reset HSI14 bit */ /* Reset HSI14 bit */
RCC->CR2 &= (uint32_t)0xFFFFFFFE; RCC->CR2 &= (uint32_t)0xFFFFFFFEU;
/* Disable all interrupts */ /* Disable all interrupts */
RCC->CIR = 0x00000000; RCC->CIR = 0x00000000U;
/* Enable SYSCFGENR in APB2EN, needed for 1st call of NVIC_SetVector, to copy vectors from flash to ram */ /* Enable SYSCFGENR in APB2EN, needed for 1st call of NVIC_SetVector, to copy vectors from flash to ram */
RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN; RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN;

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file system_stm32f0xx.h * @file system_stm32f0xx.h
* @author MCD Application Team * @author MCD Application Team
* @version V2.2.2 * @version V2.2.3
* @date 26-June-2015 * @date 29-January-2016
* @brief CMSIS Cortex-M0 Device System Source File for STM32F0xx devices. * @brief CMSIS Cortex-M0 Device System Source File for STM32F0xx devices.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -74,6 +74,7 @@
variable is updated automatically. variable is updated automatically.
*/ */
extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
extern const uint8_t AHBPrescTable[16]; /*!< AHB prescalers table values */
/** /**
* @} * @}

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx.h * @file stm32f0xx.h
* @author MCD Application Team * @author MCD Application Team
* @version V2.2.2 * @version V2.2.3
* @date 26-June-2015 * @date 29-January-2016
* @brief CMSIS STM32F0xx Device Peripheral Access Layer Header File. * @brief CMSIS STM32F0xx Device Peripheral Access Layer Header File.
* *
* The file is the unique include file that the application programmer * The file is the unique include file that the application programmer
@ -18,7 +18,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -95,7 +95,7 @@
/* #define STM32F072xB */ /*!< STM32F072x8, STM32F072xB Devices (STM32F072xx microcontrollers where the Flash memory ranges between 64 and 128 Kbytes) */ /* #define STM32F072xB */ /*!< STM32F072x8, STM32F072xB Devices (STM32F072xx microcontrollers where the Flash memory ranges between 64 and 128 Kbytes) */
/* #define STM32F078xx */ /*!< STM32F078xx Devices (STM32F078xx microcontrollers where the Flash memory is 128 Kbytes) */ /* #define STM32F078xx */ /*!< STM32F078xx Devices (STM32F078xx microcontrollers where the Flash memory is 128 Kbytes) */
/* #define STM32F030xC */ /*!< STM32F030xC Devices (STM32F030xC microcontrollers where the Flash memory is 256 Kbytes) */ /* #define STM32F030xC */ /*!< STM32F030xC Devices (STM32F030xC microcontrollers where the Flash memory is 256 Kbytes) */
/* #define STM32F091xC */ /*!< STM32F091xC Devices (STM32F091xx microcontrollers where the Flash memory is 256 Kbytes) */ /* #define STM32F091xC */ /*!< STM32F091xB, STM32F091xC Devices (STM32F091xx microcontrollers where the Flash memory ranges between 128 and 256 Kbytes) */
/* #define STM32F098xx */ /*!< STM32F098xx Devices (STM32F098xx microcontrollers where the Flash memory is 256 Kbytes) */ /* #define STM32F098xx */ /*!< STM32F098xx Devices (STM32F098xx microcontrollers where the Flash memory is 256 Kbytes) */
#endif #endif
@ -112,16 +112,16 @@
#endif /* USE_HAL_DRIVER */ #endif /* USE_HAL_DRIVER */
/** /**
* @brief CMSIS Device version number V2.2.2 * @brief CMSIS Device version number V2.2.3
*/ */
#define __STM32F0xx_CMSIS_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */ #define __STM32F0_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */
#define __STM32F0xx_CMSIS_DEVICE_VERSION_SUB1 (0x02) /*!< [23:16] sub1 version */ #define __STM32F0_DEVICE_VERSION_SUB1 (0x02) /*!< [23:16] sub1 version */
#define __STM32F0xx_CMSIS_DEVICE_VERSION_SUB2 (0x02) /*!< [15:8] sub2 version */ #define __STM32F0_DEVICE_VERSION_SUB2 (0x03) /*!< [15:8] sub2 version */
#define __STM32F0xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */ #define __STM32F0_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */
#define __STM32F0xx_CMSIS_DEVICE_VERSION ((__CMSIS_DEVICE_VERSION_MAIN << 24)\ #define __STM32F0_DEVICE_VERSION ((__STM32F0_DEVICE_VERSION_MAIN << 24)\
|(__CMSIS_DEVICE_HAL_VERSION_SUB1 << 16)\ |(__STM32F0_DEVICE_VERSION_SUB1 << 16)\
|(__CMSIS_DEVICE_HAL_VERSION_SUB2 << 8 )\ |(__STM32F0_DEVICE_VERSION_SUB2 << 8 )\
|(__CMSIS_DEVICE_HAL_VERSION_RC)) |(__STM32F0_DEVICE_VERSION_RC))
/** /**
* @} * @}

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file system_stm32f0xx.c * @file system_stm32f0xx.c
* @author MCD Application Team * @author MCD Application Team
* @version V2.2.2 * @version V2.2.3
* @date 26-June-2015 * @date 29-January-2016
* @brief CMSIS Cortex-M0 Device Peripheral Access Layer System Source File. * @brief CMSIS Cortex-M0 Device Peripheral Access Layer System Source File.
* *
* 1. This file provides two functions and one global variable to be called from * 1. This file provides two functions and one global variable to be called from
@ -42,7 +42,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -108,6 +108,10 @@
This value can be provided and adapted by the user application. */ This value can be provided and adapted by the user application. */
#endif /* HSI_VALUE */ #endif /* HSI_VALUE */
#if !defined (HSI48_VALUE)
#define HSI48_VALUE ((uint32_t)48000000) /*!< Default value of the HSI48 Internal oscillator in Hz.
This value can be provided and adapted by the user application. */
#endif /* HSI48_VALUE */
/** /**
* @} * @}
*/ */
@ -172,60 +176,60 @@ void SystemInit(void)
{ {
/* Reset the RCC clock configuration to the default reset state ------------*/ /* Reset the RCC clock configuration to the default reset state ------------*/
/* Set HSION bit */ /* Set HSION bit */
RCC->CR |= (uint32_t)0x00000001; RCC->CR |= (uint32_t)0x00000001U;
#if defined (STM32F051x8) || defined (STM32F058x8) #if defined (STM32F051x8) || defined (STM32F058x8)
/* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE and MCOSEL[2:0] bits */ /* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE and MCOSEL[2:0] bits */
RCC->CFGR &= (uint32_t)0xF8FFB80C; RCC->CFGR &= (uint32_t)0xF8FFB80CU;
#else #else
/* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE, MCOSEL[2:0], MCOPRE[2:0] and PLLNODIV bits */ /* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE, MCOSEL[2:0], MCOPRE[2:0] and PLLNODIV bits */
RCC->CFGR &= (uint32_t)0x08FFB80C; RCC->CFGR &= (uint32_t)0x08FFB80CU;
#endif /* STM32F051x8 or STM32F058x8 */ #endif /* STM32F051x8 or STM32F058x8 */
/* Reset HSEON, CSSON and PLLON bits */ /* Reset HSEON, CSSON and PLLON bits */
RCC->CR &= (uint32_t)0xFEF6FFFF; RCC->CR &= (uint32_t)0xFEF6FFFFU;
/* Reset HSEBYP bit */ /* Reset HSEBYP bit */
RCC->CR &= (uint32_t)0xFFFBFFFF; RCC->CR &= (uint32_t)0xFFFBFFFFU;
/* Reset PLLSRC, PLLXTPRE and PLLMUL[3:0] bits */ /* Reset PLLSRC, PLLXTPRE and PLLMUL[3:0] bits */
RCC->CFGR &= (uint32_t)0xFFC0FFFF; RCC->CFGR &= (uint32_t)0xFFC0FFFFU;
/* Reset PREDIV[3:0] bits */ /* Reset PREDIV[3:0] bits */
RCC->CFGR2 &= (uint32_t)0xFFFFFFF0; RCC->CFGR2 &= (uint32_t)0xFFFFFFF0U;
#if defined (STM32F072xB) || defined (STM32F078xx) #if defined (STM32F072xB) || defined (STM32F078xx)
/* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */ /* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFCFE2C; RCC->CFGR3 &= (uint32_t)0xFFFCFE2CU;
#elif defined (STM32F071xB) #elif defined (STM32F071xB)
/* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */ /* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFCEAC; RCC->CFGR3 &= (uint32_t)0xFFFFCEACU;
#elif defined (STM32F091xC) || defined (STM32F098xx) #elif defined (STM32F091xC) || defined (STM32F098xx)
/* Reset USART3SW[1:0], USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */ /* Reset USART3SW[1:0], USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFF0FEAC; RCC->CFGR3 &= (uint32_t)0xFFF0FEACU;
#elif defined (STM32F030x6) || defined (STM32F030x8) || defined (STM32F031x6) || defined (STM32F038xx) || defined (STM32F030xC) #elif defined (STM32F030x6) || defined (STM32F030x8) || defined (STM32F031x6) || defined (STM32F038xx) || defined (STM32F030xC)
/* Reset USART1SW[1:0], I2C1SW and ADCSW bits */ /* Reset USART1SW[1:0], I2C1SW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFFEEC; RCC->CFGR3 &= (uint32_t)0xFFFFFEECU;
#elif defined (STM32F051x8) || defined (STM32F058xx) #elif defined (STM32F051x8) || defined (STM32F058xx)
/* Reset USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */ /* Reset USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFFEAC; RCC->CFGR3 &= (uint32_t)0xFFFFFEACU;
#elif defined (STM32F042x6) || defined (STM32F048xx) #elif defined (STM32F042x6) || defined (STM32F048xx)
/* Reset USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */ /* Reset USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFFE2C; RCC->CFGR3 &= (uint32_t)0xFFFFFE2CU;
#elif defined (STM32F070x6) || defined (STM32F070xB) #elif defined (STM32F070x6) || defined (STM32F070xB)
/* Reset USART1SW[1:0], I2C1SW, USBSW and ADCSW bits */ /* Reset USART1SW[1:0], I2C1SW, USBSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFFE6C; RCC->CFGR3 &= (uint32_t)0xFFFFFE6CU;
/* Set default USB clock to PLLCLK, since there is no HSI48 */ /* Set default USB clock to PLLCLK, since there is no HSI48 */
RCC->CFGR3 |= (uint32_t)0x00000080; RCC->CFGR3 |= (uint32_t)0x00000080U;
#else #else
#warning "No target selected" #warning "No target selected"
#endif #endif
/* Reset HSI14 bit */ /* Reset HSI14 bit */
RCC->CR2 &= (uint32_t)0xFFFFFFFE; RCC->CR2 &= (uint32_t)0xFFFFFFFEU;
/* Disable all interrupts */ /* Disable all interrupts */
RCC->CIR = 0x00000000; RCC->CIR = 0x00000000U;
/* Enable SYSCFGENR in APB2EN, needed for 1st call of NVIC_SetVector, to copy vectors from flash to ram */ /* Enable SYSCFGENR in APB2EN, needed for 1st call of NVIC_SetVector, to copy vectors from flash to ram */
RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN; RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN;

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file system_stm32f0xx.h * @file system_stm32f0xx.h
* @author MCD Application Team * @author MCD Application Team
* @version V2.2.2 * @version V2.2.3
* @date 26-June-2015 * @date 29-January-2016
* @brief CMSIS Cortex-M0 Device System Source File for STM32F0xx devices. * @brief CMSIS Cortex-M0 Device System Source File for STM32F0xx devices.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -74,6 +74,7 @@
variable is updated automatically. variable is updated automatically.
*/ */
extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
extern const uint8_t AHBPrescTable[16]; /*!< AHB prescalers table values */
/** /**
* @} * @}

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx.h * @file stm32f0xx.h
* @author MCD Application Team * @author MCD Application Team
* @version V2.2.2 * @version V2.2.3
* @date 26-June-2015 * @date 29-January-2016
* @brief CMSIS STM32F0xx Device Peripheral Access Layer Header File. * @brief CMSIS STM32F0xx Device Peripheral Access Layer Header File.
* *
* The file is the unique include file that the application programmer * The file is the unique include file that the application programmer
@ -18,7 +18,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -95,7 +95,7 @@
/* #define STM32F072xB */ /*!< STM32F072x8, STM32F072xB Devices (STM32F072xx microcontrollers where the Flash memory ranges between 64 and 128 Kbytes) */ /* #define STM32F072xB */ /*!< STM32F072x8, STM32F072xB Devices (STM32F072xx microcontrollers where the Flash memory ranges between 64 and 128 Kbytes) */
/* #define STM32F078xx */ /*!< STM32F078xx Devices (STM32F078xx microcontrollers where the Flash memory is 128 Kbytes) */ /* #define STM32F078xx */ /*!< STM32F078xx Devices (STM32F078xx microcontrollers where the Flash memory is 128 Kbytes) */
/* #define STM32F030xC */ /*!< STM32F030xC Devices (STM32F030xC microcontrollers where the Flash memory is 256 Kbytes) */ /* #define STM32F030xC */ /*!< STM32F030xC Devices (STM32F030xC microcontrollers where the Flash memory is 256 Kbytes) */
/* #define STM32F091xC */ /*!< STM32F091xC Devices (STM32F091xx microcontrollers where the Flash memory is 256 Kbytes) */ /* #define STM32F091xC */ /*!< STM32F091xB, STM32F091xC Devices (STM32F091xx microcontrollers where the Flash memory ranges between 128 and 256 Kbytes) */
/* #define STM32F098xx */ /*!< STM32F098xx Devices (STM32F098xx microcontrollers where the Flash memory is 256 Kbytes) */ /* #define STM32F098xx */ /*!< STM32F098xx Devices (STM32F098xx microcontrollers where the Flash memory is 256 Kbytes) */
#endif #endif
@ -112,16 +112,16 @@
#endif /* USE_HAL_DRIVER */ #endif /* USE_HAL_DRIVER */
/** /**
* @brief CMSIS Device version number V2.2.2 * @brief CMSIS Device version number V2.2.3
*/ */
#define __STM32F0xx_CMSIS_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */ #define __STM32F0_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */
#define __STM32F0xx_CMSIS_DEVICE_VERSION_SUB1 (0x02) /*!< [23:16] sub1 version */ #define __STM32F0_DEVICE_VERSION_SUB1 (0x02) /*!< [23:16] sub1 version */
#define __STM32F0xx_CMSIS_DEVICE_VERSION_SUB2 (0x02) /*!< [15:8] sub2 version */ #define __STM32F0_DEVICE_VERSION_SUB2 (0x03) /*!< [15:8] sub2 version */
#define __STM32F0xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */ #define __STM32F0_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */
#define __STM32F0xx_CMSIS_DEVICE_VERSION ((__CMSIS_DEVICE_VERSION_MAIN << 24)\ #define __STM32F0_DEVICE_VERSION ((__STM32F0_DEVICE_VERSION_MAIN << 24)\
|(__CMSIS_DEVICE_HAL_VERSION_SUB1 << 16)\ |(__STM32F0_DEVICE_VERSION_SUB1 << 16)\
|(__CMSIS_DEVICE_HAL_VERSION_SUB2 << 8 )\ |(__STM32F0_DEVICE_VERSION_SUB2 << 8 )\
|(__CMSIS_DEVICE_HAL_VERSION_RC)) |(__STM32F0_DEVICE_VERSION_RC))
/** /**
* @} * @}

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file system_stm32f0xx.c * @file system_stm32f0xx.c
* @author MCD Application Team * @author MCD Application Team
* @version V2.2.2 * @version V2.2.3
* @date 26-June-2015 * @date 29-January-2016
* @brief CMSIS Cortex-M0 Device Peripheral Access Layer System Source File. * @brief CMSIS Cortex-M0 Device Peripheral Access Layer System Source File.
* *
* 1. This file provides two functions and one global variable to be called from * 1. This file provides two functions and one global variable to be called from
@ -42,7 +42,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -108,6 +108,10 @@
This value can be provided and adapted by the user application. */ This value can be provided and adapted by the user application. */
#endif /* HSI_VALUE */ #endif /* HSI_VALUE */
#if !defined (HSI48_VALUE)
#define HSI48_VALUE ((uint32_t)48000000) /*!< Default value of the HSI48 Internal oscillator in Hz.
This value can be provided and adapted by the user application. */
#endif /* HSI48_VALUE */
/** /**
* @} * @}
*/ */
@ -172,60 +176,60 @@ void SystemInit(void)
{ {
/* Reset the RCC clock configuration to the default reset state ------------*/ /* Reset the RCC clock configuration to the default reset state ------------*/
/* Set HSION bit */ /* Set HSION bit */
RCC->CR |= (uint32_t)0x00000001; RCC->CR |= (uint32_t)0x00000001U;
#if defined (STM32F051x8) || defined (STM32F058x8) #if defined (STM32F051x8) || defined (STM32F058x8)
/* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE and MCOSEL[2:0] bits */ /* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE and MCOSEL[2:0] bits */
RCC->CFGR &= (uint32_t)0xF8FFB80C; RCC->CFGR &= (uint32_t)0xF8FFB80CU;
#else #else
/* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE, MCOSEL[2:0], MCOPRE[2:0] and PLLNODIV bits */ /* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE, MCOSEL[2:0], MCOPRE[2:0] and PLLNODIV bits */
RCC->CFGR &= (uint32_t)0x08FFB80C; RCC->CFGR &= (uint32_t)0x08FFB80CU;
#endif /* STM32F051x8 or STM32F058x8 */ #endif /* STM32F051x8 or STM32F058x8 */
/* Reset HSEON, CSSON and PLLON bits */ /* Reset HSEON, CSSON and PLLON bits */
RCC->CR &= (uint32_t)0xFEF6FFFF; RCC->CR &= (uint32_t)0xFEF6FFFFU;
/* Reset HSEBYP bit */ /* Reset HSEBYP bit */
RCC->CR &= (uint32_t)0xFFFBFFFF; RCC->CR &= (uint32_t)0xFFFBFFFFU;
/* Reset PLLSRC, PLLXTPRE and PLLMUL[3:0] bits */ /* Reset PLLSRC, PLLXTPRE and PLLMUL[3:0] bits */
RCC->CFGR &= (uint32_t)0xFFC0FFFF; RCC->CFGR &= (uint32_t)0xFFC0FFFFU;
/* Reset PREDIV[3:0] bits */ /* Reset PREDIV[3:0] bits */
RCC->CFGR2 &= (uint32_t)0xFFFFFFF0; RCC->CFGR2 &= (uint32_t)0xFFFFFFF0U;
#if defined (STM32F072xB) || defined (STM32F078xx) #if defined (STM32F072xB) || defined (STM32F078xx)
/* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */ /* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFCFE2C; RCC->CFGR3 &= (uint32_t)0xFFFCFE2CU;
#elif defined (STM32F071xB) #elif defined (STM32F071xB)
/* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */ /* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFCEAC; RCC->CFGR3 &= (uint32_t)0xFFFFCEACU;
#elif defined (STM32F091xC) || defined (STM32F098xx) #elif defined (STM32F091xC) || defined (STM32F098xx)
/* Reset USART3SW[1:0], USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */ /* Reset USART3SW[1:0], USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFF0FEAC; RCC->CFGR3 &= (uint32_t)0xFFF0FEACU;
#elif defined (STM32F030x6) || defined (STM32F030x8) || defined (STM32F031x6) || defined (STM32F038xx) || defined (STM32F030xC) #elif defined (STM32F030x6) || defined (STM32F030x8) || defined (STM32F031x6) || defined (STM32F038xx) || defined (STM32F030xC)
/* Reset USART1SW[1:0], I2C1SW and ADCSW bits */ /* Reset USART1SW[1:0], I2C1SW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFFEEC; RCC->CFGR3 &= (uint32_t)0xFFFFFEECU;
#elif defined (STM32F051x8) || defined (STM32F058xx) #elif defined (STM32F051x8) || defined (STM32F058xx)
/* Reset USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */ /* Reset USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFFEAC; RCC->CFGR3 &= (uint32_t)0xFFFFFEACU;
#elif defined (STM32F042x6) || defined (STM32F048xx) #elif defined (STM32F042x6) || defined (STM32F048xx)
/* Reset USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */ /* Reset USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFFE2C; RCC->CFGR3 &= (uint32_t)0xFFFFFE2CU;
#elif defined (STM32F070x6) || defined (STM32F070xB) #elif defined (STM32F070x6) || defined (STM32F070xB)
/* Reset USART1SW[1:0], I2C1SW, USBSW and ADCSW bits */ /* Reset USART1SW[1:0], I2C1SW, USBSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFFE6C; RCC->CFGR3 &= (uint32_t)0xFFFFFE6CU;
/* Set default USB clock to PLLCLK, since there is no HSI48 */ /* Set default USB clock to PLLCLK, since there is no HSI48 */
RCC->CFGR3 |= (uint32_t)0x00000080; RCC->CFGR3 |= (uint32_t)0x00000080U;
#else #else
#warning "No target selected" #warning "No target selected"
#endif #endif
/* Reset HSI14 bit */ /* Reset HSI14 bit */
RCC->CR2 &= (uint32_t)0xFFFFFFFE; RCC->CR2 &= (uint32_t)0xFFFFFFFEU;
/* Disable all interrupts */ /* Disable all interrupts */
RCC->CIR = 0x00000000; RCC->CIR = 0x00000000U;
/* Enable SYSCFGENR in APB2EN, needed for 1st call of NVIC_SetVector, to copy vectors from flash to ram */ /* Enable SYSCFGENR in APB2EN, needed for 1st call of NVIC_SetVector, to copy vectors from flash to ram */
RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN; RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN;

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file system_stm32f0xx.h * @file system_stm32f0xx.h
* @author MCD Application Team * @author MCD Application Team
* @version V2.2.2 * @version V2.2.3
* @date 26-June-2015 * @date 29-January-2016
* @brief CMSIS Cortex-M0 Device System Source File for STM32F0xx devices. * @brief CMSIS Cortex-M0 Device System Source File for STM32F0xx devices.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -74,6 +74,7 @@
variable is updated automatically. variable is updated automatically.
*/ */
extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
extern const uint8_t AHBPrescTable[16]; /*!< AHB prescalers table values */
/** /**
* @} * @}

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx.h * @file stm32f0xx.h
* @author MCD Application Team * @author MCD Application Team
* @version V2.2.2 * @version V2.2.3
* @date 26-June-2015 * @date 29-January-2016
* @brief CMSIS STM32F0xx Device Peripheral Access Layer Header File. * @brief CMSIS STM32F0xx Device Peripheral Access Layer Header File.
* *
* The file is the unique include file that the application programmer * The file is the unique include file that the application programmer
@ -18,7 +18,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -95,7 +95,7 @@
#define STM32F072xB /*!< STM32F072x8, STM32F072xB Devices (STM32F072xx microcontrollers where the Flash memory ranges between 64 and 128 Kbytes) */ #define STM32F072xB /*!< STM32F072x8, STM32F072xB Devices (STM32F072xx microcontrollers where the Flash memory ranges between 64 and 128 Kbytes) */
/* #define STM32F078xx */ /*!< STM32F078xx Devices (STM32F078xx microcontrollers where the Flash memory is 128 Kbytes) */ /* #define STM32F078xx */ /*!< STM32F078xx Devices (STM32F078xx microcontrollers where the Flash memory is 128 Kbytes) */
/* #define STM32F030xC */ /*!< STM32F030xC Devices (STM32F030xC microcontrollers where the Flash memory is 256 Kbytes) */ /* #define STM32F030xC */ /*!< STM32F030xC Devices (STM32F030xC microcontrollers where the Flash memory is 256 Kbytes) */
/* #define STM32F091xC */ /*!< STM32F091xC Devices (STM32F091xx microcontrollers where the Flash memory is 256 Kbytes) */ /* #define STM32F091xC */ /*!< STM32F091xB, STM32F091xC Devices (STM32F091xx microcontrollers where the Flash memory ranges between 128 and 256 Kbytes) */
/* #define STM32F098xx */ /*!< STM32F098xx Devices (STM32F098xx microcontrollers where the Flash memory is 256 Kbytes) */ /* #define STM32F098xx */ /*!< STM32F098xx Devices (STM32F098xx microcontrollers where the Flash memory is 256 Kbytes) */
#endif #endif
@ -112,16 +112,16 @@
#endif /* USE_HAL_DRIVER */ #endif /* USE_HAL_DRIVER */
/** /**
* @brief CMSIS Device version number V2.2.2 * @brief CMSIS Device version number V2.2.3
*/ */
#define __STM32F0xx_CMSIS_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */ #define __STM32F0_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */
#define __STM32F0xx_CMSIS_DEVICE_VERSION_SUB1 (0x02) /*!< [23:16] sub1 version */ #define __STM32F0_DEVICE_VERSION_SUB1 (0x02) /*!< [23:16] sub1 version */
#define __STM32F0xx_CMSIS_DEVICE_VERSION_SUB2 (0x02) /*!< [15:8] sub2 version */ #define __STM32F0_DEVICE_VERSION_SUB2 (0x03) /*!< [15:8] sub2 version */
#define __STM32F0xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */ #define __STM32F0_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */
#define __STM32F0xx_CMSIS_DEVICE_VERSION ((__CMSIS_DEVICE_VERSION_MAIN << 24)\ #define __STM32F0_DEVICE_VERSION ((__STM32F0_DEVICE_VERSION_MAIN << 24)\
|(__CMSIS_DEVICE_HAL_VERSION_SUB1 << 16)\ |(__STM32F0_DEVICE_VERSION_SUB1 << 16)\
|(__CMSIS_DEVICE_HAL_VERSION_SUB2 << 8 )\ |(__STM32F0_DEVICE_VERSION_SUB2 << 8 )\
|(__CMSIS_DEVICE_HAL_VERSION_RC)) |(__STM32F0_DEVICE_VERSION_RC))
/** /**
* @} * @}

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file system_stm32f0xx.c * @file system_stm32f0xx.c
* @author MCD Application Team * @author MCD Application Team
* @version V2.2.2 * @version V2.2.3
* @date 26-June-2015 * @date 29-January-2016
* @brief CMSIS Cortex-M0 Device Peripheral Access Layer System Source File. * @brief CMSIS Cortex-M0 Device Peripheral Access Layer System Source File.
* *
* 1. This file provides two functions and one global variable to be called from * 1. This file provides two functions and one global variable to be called from
@ -42,7 +42,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -108,6 +108,10 @@
This value can be provided and adapted by the user application. */ This value can be provided and adapted by the user application. */
#endif /* HSI_VALUE */ #endif /* HSI_VALUE */
#if !defined (HSI48_VALUE)
#define HSI48_VALUE ((uint32_t)48000000) /*!< Default value of the HSI48 Internal oscillator in Hz.
This value can be provided and adapted by the user application. */
#endif /* HSI48_VALUE */
/** /**
* @} * @}
*/ */
@ -171,60 +175,60 @@ void SystemInit(void)
{ {
/* Reset the RCC clock configuration to the default reset state ------------*/ /* Reset the RCC clock configuration to the default reset state ------------*/
/* Set HSION bit */ /* Set HSION bit */
RCC->CR |= (uint32_t)0x00000001; RCC->CR |= (uint32_t)0x00000001U;
#if defined (STM32F051x8) || defined (STM32F058x8) #if defined (STM32F051x8) || defined (STM32F058x8)
/* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE and MCOSEL[2:0] bits */ /* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE and MCOSEL[2:0] bits */
RCC->CFGR &= (uint32_t)0xF8FFB80C; RCC->CFGR &= (uint32_t)0xF8FFB80CU;
#else #else
/* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE, MCOSEL[2:0], MCOPRE[2:0] and PLLNODIV bits */ /* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE, MCOSEL[2:0], MCOPRE[2:0] and PLLNODIV bits */
RCC->CFGR &= (uint32_t)0x08FFB80C; RCC->CFGR &= (uint32_t)0x08FFB80CU;
#endif /* STM32F051x8 or STM32F058x8 */ #endif /* STM32F051x8 or STM32F058x8 */
/* Reset HSEON, CSSON and PLLON bits */ /* Reset HSEON, CSSON and PLLON bits */
RCC->CR &= (uint32_t)0xFEF6FFFF; RCC->CR &= (uint32_t)0xFEF6FFFFU;
/* Reset HSEBYP bit */ /* Reset HSEBYP bit */
RCC->CR &= (uint32_t)0xFFFBFFFF; RCC->CR &= (uint32_t)0xFFFBFFFFU;
/* Reset PLLSRC, PLLXTPRE and PLLMUL[3:0] bits */ /* Reset PLLSRC, PLLXTPRE and PLLMUL[3:0] bits */
RCC->CFGR &= (uint32_t)0xFFC0FFFF; RCC->CFGR &= (uint32_t)0xFFC0FFFFU;
/* Reset PREDIV[3:0] bits */ /* Reset PREDIV[3:0] bits */
RCC->CFGR2 &= (uint32_t)0xFFFFFFF0; RCC->CFGR2 &= (uint32_t)0xFFFFFFF0U;
#if defined (STM32F072xB) || defined (STM32F078xx) #if defined (STM32F072xB) || defined (STM32F078xx)
/* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */ /* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFCFE2C; RCC->CFGR3 &= (uint32_t)0xFFFCFE2CU;
#elif defined (STM32F071xB) #elif defined (STM32F071xB)
/* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */ /* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFCEAC; RCC->CFGR3 &= (uint32_t)0xFFFFCEACU;
#elif defined (STM32F091xC) || defined (STM32F098xx) #elif defined (STM32F091xC) || defined (STM32F098xx)
/* Reset USART3SW[1:0], USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */ /* Reset USART3SW[1:0], USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFF0FEAC; RCC->CFGR3 &= (uint32_t)0xFFF0FEACU;
#elif defined (STM32F030x6) || defined (STM32F030x8) || defined (STM32F031x6) || defined (STM32F038xx) || defined (STM32F030xC) #elif defined (STM32F030x6) || defined (STM32F030x8) || defined (STM32F031x6) || defined (STM32F038xx) || defined (STM32F030xC)
/* Reset USART1SW[1:0], I2C1SW and ADCSW bits */ /* Reset USART1SW[1:0], I2C1SW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFFEEC; RCC->CFGR3 &= (uint32_t)0xFFFFFEECU;
#elif defined (STM32F051x8) || defined (STM32F058xx) #elif defined (STM32F051x8) || defined (STM32F058xx)
/* Reset USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */ /* Reset USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFFEAC; RCC->CFGR3 &= (uint32_t)0xFFFFFEACU;
#elif defined (STM32F042x6) || defined (STM32F048xx) #elif defined (STM32F042x6) || defined (STM32F048xx)
/* Reset USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */ /* Reset USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFFE2C; RCC->CFGR3 &= (uint32_t)0xFFFFFE2CU;
#elif defined (STM32F070x6) || defined (STM32F070xB) #elif defined (STM32F070x6) || defined (STM32F070xB)
/* Reset USART1SW[1:0], I2C1SW, USBSW and ADCSW bits */ /* Reset USART1SW[1:0], I2C1SW, USBSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFFE6C; RCC->CFGR3 &= (uint32_t)0xFFFFFE6CU;
/* Set default USB clock to PLLCLK, since there is no HSI48 */ /* Set default USB clock to PLLCLK, since there is no HSI48 */
RCC->CFGR3 |= (uint32_t)0x00000080; RCC->CFGR3 |= (uint32_t)0x00000080U;
#else #else
#warning "No target selected" #warning "No target selected"
#endif #endif
/* Reset HSI14 bit */ /* Reset HSI14 bit */
RCC->CR2 &= (uint32_t)0xFFFFFFFE; RCC->CR2 &= (uint32_t)0xFFFFFFFEU;
/* Disable all interrupts */ /* Disable all interrupts */
RCC->CIR = 0x00000000; RCC->CIR = 0x00000000U;
/* Enable SYSCFGENR in APB2EN, needed for 1st call of NVIC_SetVector, to copy vectors from flash to ram */ /* Enable SYSCFGENR in APB2EN, needed for 1st call of NVIC_SetVector, to copy vectors from flash to ram */
RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN; RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN;

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file system_stm32f0xx.h * @file system_stm32f0xx.h
* @author MCD Application Team * @author MCD Application Team
* @version V2.2.2 * @version V2.2.3
* @date 26-June-2015 * @date 29-January-2016
* @brief CMSIS Cortex-M0 Device System Source File for STM32F0xx devices. * @brief CMSIS Cortex-M0 Device System Source File for STM32F0xx devices.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -74,6 +74,7 @@
variable is updated automatically. variable is updated automatically.
*/ */
extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
extern const uint8_t AHBPrescTable[16]; /*!< AHB prescalers table values */
/** /**
* @} * @}

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx.h * @file stm32f0xx.h
* @author MCD Application Team * @author MCD Application Team
* @version V2.2.2 * @version V2.2.3
* @date 26-June-2015 * @date 29-January-2016
* @brief CMSIS STM32F0xx Device Peripheral Access Layer Header File. * @brief CMSIS STM32F0xx Device Peripheral Access Layer Header File.
* *
* The file is the unique include file that the application programmer * The file is the unique include file that the application programmer
@ -18,7 +18,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -112,16 +112,16 @@
#endif /* USE_HAL_DRIVER */ #endif /* USE_HAL_DRIVER */
/** /**
* @brief CMSIS Device version number V2.2.2 * @brief CMSIS Device version number V2.2.3
*/ */
#define __STM32F0xx_CMSIS_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */ #define __STM32F0_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */
#define __STM32F0xx_CMSIS_DEVICE_VERSION_SUB1 (0x02) /*!< [23:16] sub1 version */ #define __STM32F0_DEVICE_VERSION_SUB1 (0x02) /*!< [23:16] sub1 version */
#define __STM32F0xx_CMSIS_DEVICE_VERSION_SUB2 (0x02) /*!< [15:8] sub2 version */ #define __STM32F0_DEVICE_VERSION_SUB2 (0x03) /*!< [15:8] sub2 version */
#define __STM32F0xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */ #define __STM32F0_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */
#define __STM32F0xx_CMSIS_DEVICE_VERSION ((__CMSIS_DEVICE_VERSION_MAIN << 24)\ #define __STM32F0_DEVICE_VERSION ((__STM32F0_DEVICE_VERSION_MAIN << 24)\
|(__CMSIS_DEVICE_HAL_VERSION_SUB1 << 16)\ |(__STM32F0_DEVICE_VERSION_SUB1 << 16)\
|(__CMSIS_DEVICE_HAL_VERSION_SUB2 << 8 )\ |(__STM32F0_DEVICE_VERSION_SUB2 << 8 )\
|(__CMSIS_DEVICE_HAL_VERSION_RC)) |(__STM32F0_DEVICE_VERSION_RC))
/** /**
* @} * @}

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file system_stm32f0xx.c * @file system_stm32f0xx.c
* @author MCD Application Team * @author MCD Application Team
* @version V2.2.2 * @version V2.2.3
* @date 26-June-2015 * @date 29-January-2016
* @brief CMSIS Cortex-M0 Device Peripheral Access Layer System Source File. * @brief CMSIS Cortex-M0 Device Peripheral Access Layer System Source File.
* *
* 1. This file provides two functions and one global variable to be called from * 1. This file provides two functions and one global variable to be called from
@ -42,7 +42,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -108,6 +108,10 @@
This value can be provided and adapted by the user application. */ This value can be provided and adapted by the user application. */
#endif /* HSI_VALUE */ #endif /* HSI_VALUE */
#if !defined (HSI48_VALUE)
#define HSI48_VALUE ((uint32_t)48000000) /*!< Default value of the HSI48 Internal oscillator in Hz.
This value can be provided and adapted by the user application. */
#endif /* HSI48_VALUE */
/** /**
* @} * @}
*/ */
@ -171,60 +175,60 @@ void SystemInit(void)
{ {
/* Reset the RCC clock configuration to the default reset state ------------*/ /* Reset the RCC clock configuration to the default reset state ------------*/
/* Set HSION bit */ /* Set HSION bit */
RCC->CR |= (uint32_t)0x00000001; RCC->CR |= (uint32_t)0x00000001U;
#if defined (STM32F051x8) || defined (STM32F058x8) #if defined (STM32F051x8) || defined (STM32F058x8)
/* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE and MCOSEL[2:0] bits */ /* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE and MCOSEL[2:0] bits */
RCC->CFGR &= (uint32_t)0xF8FFB80C; RCC->CFGR &= (uint32_t)0xF8FFB80CU;
#else #else
/* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE, MCOSEL[2:0], MCOPRE[2:0] and PLLNODIV bits */ /* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE, MCOSEL[2:0], MCOPRE[2:0] and PLLNODIV bits */
RCC->CFGR &= (uint32_t)0x08FFB80C; RCC->CFGR &= (uint32_t)0x08FFB80CU;
#endif /* STM32F051x8 or STM32F058x8 */ #endif /* STM32F051x8 or STM32F058x8 */
/* Reset HSEON, CSSON and PLLON bits */ /* Reset HSEON, CSSON and PLLON bits */
RCC->CR &= (uint32_t)0xFEF6FFFF; RCC->CR &= (uint32_t)0xFEF6FFFFU;
/* Reset HSEBYP bit */ /* Reset HSEBYP bit */
RCC->CR &= (uint32_t)0xFFFBFFFF; RCC->CR &= (uint32_t)0xFFFBFFFFU;
/* Reset PLLSRC, PLLXTPRE and PLLMUL[3:0] bits */ /* Reset PLLSRC, PLLXTPRE and PLLMUL[3:0] bits */
RCC->CFGR &= (uint32_t)0xFFC0FFFF; RCC->CFGR &= (uint32_t)0xFFC0FFFFU;
/* Reset PREDIV[3:0] bits */ /* Reset PREDIV[3:0] bits */
RCC->CFGR2 &= (uint32_t)0xFFFFFFF0; RCC->CFGR2 &= (uint32_t)0xFFFFFFF0U;
#if defined (STM32F072xB) || defined (STM32F078xx) #if defined (STM32F072xB) || defined (STM32F078xx)
/* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */ /* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFCFE2C; RCC->CFGR3 &= (uint32_t)0xFFFCFE2CU;
#elif defined (STM32F071xB) #elif defined (STM32F071xB)
/* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */ /* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFCEAC; RCC->CFGR3 &= (uint32_t)0xFFFFCEACU;
#elif defined (STM32F091xC) || defined (STM32F098xx) #elif defined (STM32F091xC) || defined (STM32F098xx)
/* Reset USART3SW[1:0], USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */ /* Reset USART3SW[1:0], USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFF0FEAC; RCC->CFGR3 &= (uint32_t)0xFFF0FEACU;
#elif defined (STM32F030x6) || defined (STM32F030x8) || defined (STM32F031x6) || defined (STM32F038xx) || defined (STM32F030xC) #elif defined (STM32F030x6) || defined (STM32F030x8) || defined (STM32F031x6) || defined (STM32F038xx) || defined (STM32F030xC)
/* Reset USART1SW[1:0], I2C1SW and ADCSW bits */ /* Reset USART1SW[1:0], I2C1SW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFFEEC; RCC->CFGR3 &= (uint32_t)0xFFFFFEECU;
#elif defined (STM32F051x8) || defined (STM32F058xx) #elif defined (STM32F051x8) || defined (STM32F058xx)
/* Reset USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */ /* Reset USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFFEAC; RCC->CFGR3 &= (uint32_t)0xFFFFFEACU;
#elif defined (STM32F042x6) || defined (STM32F048xx) #elif defined (STM32F042x6) || defined (STM32F048xx)
/* Reset USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */ /* Reset USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFFE2C; RCC->CFGR3 &= (uint32_t)0xFFFFFE2CU;
#elif defined (STM32F070x6) || defined (STM32F070xB) #elif defined (STM32F070x6) || defined (STM32F070xB)
/* Reset USART1SW[1:0], I2C1SW, USBSW and ADCSW bits */ /* Reset USART1SW[1:0], I2C1SW, USBSW and ADCSW bits */
RCC->CFGR3 &= (uint32_t)0xFFFFFE6C; RCC->CFGR3 &= (uint32_t)0xFFFFFE6CU;
/* Set default USB clock to PLLCLK, since there is no HSI48 */ /* Set default USB clock to PLLCLK, since there is no HSI48 */
RCC->CFGR3 |= (uint32_t)0x00000080; RCC->CFGR3 |= (uint32_t)0x00000080U;
#else #else
#warning "No target selected" #warning "No target selected"
#endif #endif
/* Reset HSI14 bit */ /* Reset HSI14 bit */
RCC->CR2 &= (uint32_t)0xFFFFFFFE; RCC->CR2 &= (uint32_t)0xFFFFFFFEU;
/* Disable all interrupts */ /* Disable all interrupts */
RCC->CIR = 0x00000000; RCC->CIR = 0x00000000U;
/* Enable SYSCFGENR in APB2EN, needed for 1st call of NVIC_SetVector, to copy vectors from flash to ram */ /* Enable SYSCFGENR in APB2EN, needed for 1st call of NVIC_SetVector, to copy vectors from flash to ram */
RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN; RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN;

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file system_stm32f0xx.h * @file system_stm32f0xx.h
* @author MCD Application Team * @author MCD Application Team
* @version V2.2.2 * @version V2.2.3
* @date 26-June-2015 * @date 29-January-2016
* @brief CMSIS Cortex-M0 Device System Source File for STM32F0xx devices. * @brief CMSIS Cortex-M0 Device System Source File for STM32F0xx devices.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -74,6 +74,7 @@
variable is updated automatically. variable is updated automatically.
*/ */
extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
extern const uint8_t AHBPrescTable[16]; /*!< AHB prescalers table values */
/** /**
* @} * @}

View File

@ -2,14 +2,14 @@
****************************************************************************** ******************************************************************************
* @file stm32_hal_legacy.h * @file stm32_hal_legacy.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief This file contains aliases definition for the STM32Cube HAL constants * @brief This file contains aliases definition for the STM32Cube HAL constants
* macros and functions maintained for legacy purpose. * macros and functions maintained for legacy purpose.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -103,6 +103,15 @@
#define ADC_EXTERNALTRIG_EDGE_RISING ADC_EXTERNALTRIGCONVEDGE_RISING #define ADC_EXTERNALTRIG_EDGE_RISING ADC_EXTERNALTRIGCONVEDGE_RISING
#define ADC_EXTERNALTRIG_EDGE_FALLING ADC_EXTERNALTRIGCONVEDGE_FALLING #define ADC_EXTERNALTRIG_EDGE_FALLING ADC_EXTERNALTRIGCONVEDGE_FALLING
#define ADC_EXTERNALTRIG_EDGE_RISINGFALLING ADC_EXTERNALTRIGCONVEDGE_RISINGFALLING #define ADC_EXTERNALTRIG_EDGE_RISINGFALLING ADC_EXTERNALTRIGCONVEDGE_RISINGFALLING
#define ADC_SAMPLETIME_2CYCLE_5 ADC_SAMPLETIME_2CYCLES_5
#define HAL_ADC_STATE_BUSY_REG HAL_ADC_STATE_REG_BUSY
#define HAL_ADC_STATE_BUSY_INJ HAL_ADC_STATE_INJ_BUSY
#define HAL_ADC_STATE_EOC_REG HAL_ADC_STATE_REG_EOC
#define HAL_ADC_STATE_EOC_INJ HAL_ADC_STATE_INJ_EOC
#define HAL_ADC_STATE_ERROR HAL_ADC_STATE_ERROR_INTERNAL
#define HAL_ADC_STATE_BUSY HAL_ADC_STATE_BUSY_INTERNAL
#define HAL_ADC_STATE_AWD HAL_ADC_STATE_AWD1
/** /**
* @} * @}
*/ */
@ -125,7 +134,24 @@
#define COMP_WINDOWMODE_ENABLED COMP_WINDOWMODE_ENABLE #define COMP_WINDOWMODE_ENABLED COMP_WINDOWMODE_ENABLE
#define COMP_EXTI_LINE_COMP1_EVENT COMP_EXTI_LINE_COMP1 #define COMP_EXTI_LINE_COMP1_EVENT COMP_EXTI_LINE_COMP1
#define COMP_EXTI_LINE_COMP2_EVENT COMP_EXTI_LINE_COMP2 #define COMP_EXTI_LINE_COMP2_EVENT COMP_EXTI_LINE_COMP2
#define COMP_EXTI_LINE_COMP3_EVENT COMP_EXTI_LINE_COMP3
#define COMP_EXTI_LINE_COMP4_EVENT COMP_EXTI_LINE_COMP4
#define COMP_EXTI_LINE_COMP5_EVENT COMP_EXTI_LINE_COMP5
#define COMP_EXTI_LINE_COMP6_EVENT COMP_EXTI_LINE_COMP6
#define COMP_EXTI_LINE_COMP7_EVENT COMP_EXTI_LINE_COMP7
#define COMP_OUTPUT_COMP6TIM2OCREFCLR COMP_OUTPUT_COMP6_TIM2OCREFCLR
#if defined(STM32F373xC) || defined(STM32F378xx)
#define COMP_OUTPUT_TIM3IC1 COMP_OUTPUT_COMP1_TIM3IC1
#define COMP_OUTPUT_TIM3OCREFCLR COMP_OUTPUT_COMP1_TIM3OCREFCLR
#endif /* STM32F373xC || STM32F378xx */
/**
* @}
*/
/** @defgroup HAL_CORTEX_Aliased_Defines HAL CORTEX Aliased Defines maintained for legacy purpose
* @{
*/
#define __HAL_CORTEX_SYSTICKCLK_CONFIG HAL_SYSTICK_CLKSourceConfig
/** /**
* @} * @}
*/ */
@ -148,7 +174,7 @@
#define DAC1_CHANNEL_1 DAC_CHANNEL_1 #define DAC1_CHANNEL_1 DAC_CHANNEL_1
#define DAC1_CHANNEL_2 DAC_CHANNEL_2 #define DAC1_CHANNEL_2 DAC_CHANNEL_2
#define DAC2_CHANNEL_1 DAC_CHANNEL_1 #define DAC2_CHANNEL_1 DAC_CHANNEL_1
#define DAC_WAVE_NONE ((uint32_t)0x00000000) #define DAC_WAVE_NONE ((uint32_t)0x00000000U)
#define DAC_WAVE_NOISE ((uint32_t)DAC_CR_WAVE1_0) #define DAC_WAVE_NOISE ((uint32_t)DAC_CR_WAVE1_0)
#define DAC_WAVE_TRIANGLE ((uint32_t)DAC_CR_WAVE1_1) #define DAC_WAVE_TRIANGLE ((uint32_t)DAC_CR_WAVE1_1)
#define DAC_WAVEGENERATION_NONE DAC_WAVE_NONE #define DAC_WAVEGENERATION_NONE DAC_WAVE_NONE
@ -255,7 +281,14 @@
#define FLASH_ERROR_ERS HAL_FLASH_ERROR_ERS #define FLASH_ERROR_ERS HAL_FLASH_ERROR_ERS
#define OB_WDG_SW OB_IWDG_SW #define OB_WDG_SW OB_IWDG_SW
#define OB_WDG_HW OB_IWDG_HW #define OB_WDG_HW OB_IWDG_HW
#define OB_SDADC12_VDD_MONITOR_SET OB_SDACD_VDD_MONITOR_SET
#define OB_SDADC12_VDD_MONITOR_RESET OB_SDACD_VDD_MONITOR_RESET
#define OB_RAM_PARITY_CHECK_SET OB_SRAM_PARITY_SET
#define OB_RAM_PARITY_CHECK_RESET OB_SRAM_PARITY_RESET
#define IS_OB_SDADC12_VDD_MONITOR IS_OB_SDACD_VDD_MONITOR
#define OB_RDP_LEVEL0 OB_RDP_LEVEL_0
#define OB_RDP_LEVEL1 OB_RDP_LEVEL_1
#define OB_RDP_LEVEL2 OB_RDP_LEVEL_2
/** /**
* @} * @}
*/ */
@ -264,14 +297,15 @@
* @{ * @{
*/ */
#define SYSCFG_FASTMODEPLUS_I2C_PB6 I2C_FASTMODEPLUS_PB6 #define HAL_SYSCFG_FASTMODEPLUS_I2C_PA9 I2C_FASTMODEPLUS_PA9
#define SYSCFG_FASTMODEPLUS_I2C_PB7 I2C_FASTMODEPLUS_PB7 #define HAL_SYSCFG_FASTMODEPLUS_I2C_PA10 I2C_FASTMODEPLUS_PA10
#define SYSCFG_FASTMODEPLUS_I2C_PB8 I2C_FASTMODEPLUS_PB8 #define HAL_SYSCFG_FASTMODEPLUS_I2C_PB6 I2C_FASTMODEPLUS_PB6
#define SYSCFG_FASTMODEPLUS_I2C_PB9 I2C_FASTMODEPLUS_PB9 #define HAL_SYSCFG_FASTMODEPLUS_I2C_PB7 I2C_FASTMODEPLUS_PB7
#define SYSCFG_FASTMODEPLUS_I2C1 I2C_FASTMODEPLUS_I2C1 #define HAL_SYSCFG_FASTMODEPLUS_I2C_PB8 I2C_FASTMODEPLUS_PB8
#define SYSCFG_FASTMODEPLUS_I2C2 I2C_FASTMODEPLUS_I2C2 #define HAL_SYSCFG_FASTMODEPLUS_I2C_PB9 I2C_FASTMODEPLUS_PB9
#define SYSCFG_FASTMODEPLUS_I2C3 I2C_FASTMODEPLUS_I2C3 #define HAL_SYSCFG_FASTMODEPLUS_I2C1 I2C_FASTMODEPLUS_I2C1
#define HAL_SYSCFG_FASTMODEPLUS_I2C2 I2C_FASTMODEPLUS_I2C2
#define HAL_SYSCFG_FASTMODEPLUS_I2C3 I2C_FASTMODEPLUS_I2C3
/** /**
* @} * @}
*/ */
@ -330,6 +364,26 @@
#define GPIO_AF1_LPTIM GPIO_AF1_LPTIM1 #define GPIO_AF1_LPTIM GPIO_AF1_LPTIM1
#define GPIO_AF2_LPTIM GPIO_AF2_LPTIM1 #define GPIO_AF2_LPTIM GPIO_AF2_LPTIM1
#if defined(STM32L0) || defined(STM32L4) || defined(STM32F4) || defined(STM32F2) || defined(STM32F7)
#define GPIO_SPEED_LOW GPIO_SPEED_FREQ_LOW
#define GPIO_SPEED_MEDIUM GPIO_SPEED_FREQ_MEDIUM
#define GPIO_SPEED_FAST GPIO_SPEED_FREQ_HIGH
#define GPIO_SPEED_HIGH GPIO_SPEED_FREQ_VERY_HIGH
#endif /* STM32L0 || STM32L4 || STM32F4 || STM32F2 || STM32F7 */
#if defined(STM32L1)
#define GPIO_SPEED_VERY_LOW GPIO_SPEED_FREQ_LOW
#define GPIO_SPEED_LOW GPIO_SPEED_FREQ_MEDIUM
#define GPIO_SPEED_MEDIUM GPIO_SPEED_FREQ_HIGH
#define GPIO_SPEED_HIGH GPIO_SPEED_FREQ_VERY_HIGH
#endif /* STM32L1 */
#if defined(STM32F0) || defined(STM32F3) || defined(STM32F1)
#define GPIO_SPEED_LOW GPIO_SPEED_FREQ_LOW
#define GPIO_SPEED_MEDIUM GPIO_SPEED_FREQ_MEDIUM
#define GPIO_SPEED_HIGH GPIO_SPEED_FREQ_HIGH
#endif /* STM32F0 || STM32F3 || STM32F1 */
/** /**
* @} * @}
*/ */
@ -346,6 +400,15 @@
#define HRTIM_TIMDELAYEDPROTECTION_DELAYEDOUT2_DEEV79 HRTIM_TIMER_A_B_C_DELAYEDPROTECTION_DELAYEDOUT2_DEEV7 #define HRTIM_TIMDELAYEDPROTECTION_DELAYEDOUT2_DEEV79 HRTIM_TIMER_A_B_C_DELAYEDPROTECTION_DELAYEDOUT2_DEEV7
#define HRTIM_TIMDELAYEDPROTECTION_DELAYEDBOTH_EEV79 HRTIM_TIMER_A_B_C_DELAYEDPROTECTION_DELAYEDBOTH_EEV7 #define HRTIM_TIMDELAYEDPROTECTION_DELAYEDBOTH_EEV79 HRTIM_TIMER_A_B_C_DELAYEDPROTECTION_DELAYEDBOTH_EEV7
#define HRTIM_TIMDELAYEDPROTECTION_BALANCED_EEV79 HRTIM_TIMER_A_B_C_DELAYEDPROTECTION_BALANCED_EEV7 #define HRTIM_TIMDELAYEDPROTECTION_BALANCED_EEV79 HRTIM_TIMER_A_B_C_DELAYEDPROTECTION_BALANCED_EEV7
#define __HAL_HRTIM_SetCounter __HAL_HRTIM_SETCOUNTER
#define __HAL_HRTIM_GetCounter __HAL_HRTIM_GETCOUNTER
#define __HAL_HRTIM_SetPeriod __HAL_HRTIM_SETPERIOD
#define __HAL_HRTIM_GetPeriod __HAL_HRTIM_GETPERIOD
#define __HAL_HRTIM_SetClockPrescaler __HAL_HRTIM_SETCLOCKPRESCALER
#define __HAL_HRTIM_GetClockPrescaler __HAL_HRTIM_GETCLOCKPRESCALER
#define __HAL_HRTIM_SetCompare __HAL_HRTIM_SETCOMPARE
#define __HAL_HRTIM_GetCompare __HAL_HRTIM_GETCOMPARE
/** /**
* @} * @}
*/ */
@ -361,6 +424,14 @@
#define I2C_NOSTRETCH_ENABLED I2C_NOSTRETCH_ENABLE #define I2C_NOSTRETCH_ENABLED I2C_NOSTRETCH_ENABLE
#define I2C_ANALOGFILTER_ENABLED I2C_ANALOGFILTER_ENABLE #define I2C_ANALOGFILTER_ENABLED I2C_ANALOGFILTER_ENABLE
#define I2C_ANALOGFILTER_DISABLED I2C_ANALOGFILTER_DISABLE #define I2C_ANALOGFILTER_DISABLED I2C_ANALOGFILTER_DISABLE
#if defined(STM32F0) || defined(STM32F1) || defined(STM32F3) || defined(STM32G0) || defined(STM32L4)
#define HAL_I2C_STATE_MEM_BUSY_TX HAL_I2C_STATE_BUSY_TX
#define HAL_I2C_STATE_MEM_BUSY_RX HAL_I2C_STATE_BUSY_RX
#define HAL_I2C_STATE_MASTER_BUSY_TX HAL_I2C_STATE_BUSY_TX
#define HAL_I2C_STATE_MASTER_BUSY_RX HAL_I2C_STATE_BUSY_RX
#define HAL_I2C_STATE_SLAVE_BUSY_TX HAL_I2C_STATE_BUSY_TX
#define HAL_I2C_STATE_SLAVE_BUSY_RX HAL_I2C_STATE_BUSY_RX
#endif
/** /**
* @} * @}
*/ */
@ -399,9 +470,16 @@
#define LPTIM_CLOCKPOLARITY_FALLINGEDGE LPTIM_CLOCKPOLARITY_FALLING #define LPTIM_CLOCKPOLARITY_FALLINGEDGE LPTIM_CLOCKPOLARITY_FALLING
#define LPTIM_CLOCKPOLARITY_BOTHEDGES LPTIM_CLOCKPOLARITY_RISING_FALLING #define LPTIM_CLOCKPOLARITY_BOTHEDGES LPTIM_CLOCKPOLARITY_RISING_FALLING
#define LPTIM_TRIGSAMPLETIME_2TRANSITION LPTIM_TRIGSAMPLETIME_2TRANSISTIONS #define LPTIM_TRIGSAMPLETIME_DIRECTTRANSISTION LPTIM_TRIGSAMPLETIME_DIRECTTRANSITION
#define LPTIM_TRIGSAMPLETIME_4TRANSITION LPTIM_TRIGSAMPLETIME_4TRANSISTIONS #define LPTIM_TRIGSAMPLETIME_2TRANSISTIONS LPTIM_TRIGSAMPLETIME_2TRANSITIONS
#define LPTIM_TRIGSAMPLETIME_8TRANSITION LPTIM_TRIGSAMPLETIME_8TRANSISTIONS #define LPTIM_TRIGSAMPLETIME_4TRANSISTIONS LPTIM_TRIGSAMPLETIME_4TRANSITIONS
#define LPTIM_TRIGSAMPLETIME_8TRANSISTIONS LPTIM_TRIGSAMPLETIME_8TRANSITIONS
/* The following 3 definition have also been present in a temporary version of lptim.h */
/* They need to be renamed also to the right name, just in case */
#define LPTIM_TRIGSAMPLETIME_2TRANSITION LPTIM_TRIGSAMPLETIME_2TRANSITIONS
#define LPTIM_TRIGSAMPLETIME_4TRANSITION LPTIM_TRIGSAMPLETIME_4TRANSITIONS
#define LPTIM_TRIGSAMPLETIME_8TRANSITION LPTIM_TRIGSAMPLETIME_8TRANSITIONS
/** /**
* @} * @}
@ -530,9 +608,17 @@
#define RTC_TAMPER1_2_3_INTERRUPT RTC_ALL_TAMPER_INTERRUPT #define RTC_TAMPER1_2_3_INTERRUPT RTC_ALL_TAMPER_INTERRUPT
#define RTC_TIMESTAMPPIN_PC13 RTC_TIMESTAMPPIN_DEFAULT #define RTC_TIMESTAMPPIN_PC13 RTC_TIMESTAMPPIN_DEFAULT
#define RTC_TIMESTAMPPIN_PA0 RTC_TIMESTAMPPIN_POS1
#define RTC_TIMESTAMPPIN_PI8 RTC_TIMESTAMPPIN_POS1
#define RTC_TIMESTAMPPIN_PC1 RTC_TIMESTAMPPIN_POS2
#define RTC_OUTPUT_REMAP_PC13 RTC_OUTPUT_REMAP_NONE #define RTC_OUTPUT_REMAP_PC13 RTC_OUTPUT_REMAP_NONE
#define RTC_OUTPUT_REMAP_PB14 RTC_OUTPUT_REMAP_POS1 #define RTC_OUTPUT_REMAP_PB14 RTC_OUTPUT_REMAP_POS1
#define RTC_OUTPUT_REMAP_PB2 RTC_OUTPUT_REMAP_POS1
#define RTC_TAMPERPIN_PC13 RTC_TAMPERPIN_DEFAULT
#define RTC_TAMPERPIN_PA0 RTC_TAMPERPIN_POS1
#define RTC_TAMPERPIN_PI8 RTC_TAMPERPIN_POS1
/** /**
* @} * @}
@ -731,9 +817,9 @@
#define CAN_IT_RQCP2 CAN_IT_TME #define CAN_IT_RQCP2 CAN_IT_TME
#define INAK_TIMEOUT CAN_TIMEOUT_VALUE #define INAK_TIMEOUT CAN_TIMEOUT_VALUE
#define SLAK_TIMEOUT CAN_TIMEOUT_VALUE #define SLAK_TIMEOUT CAN_TIMEOUT_VALUE
#define CAN_TXSTATUS_FAILED ((uint8_t)0x00) #define CAN_TXSTATUS_FAILED ((uint8_t)0x00U)
#define CAN_TXSTATUS_OK ((uint8_t)0x01) #define CAN_TXSTATUS_OK ((uint8_t)0x01U)
#define CAN_TXSTATUS_PENDING ((uint8_t)0x02) #define CAN_TXSTATUS_PENDING ((uint8_t)0x02U)
/** /**
* @} * @}
@ -752,17 +838,45 @@
#define MACFCR_CLEAR_MASK ETH_MACFCR_CLEAR_MASK #define MACFCR_CLEAR_MASK ETH_MACFCR_CLEAR_MASK
#define DMAOMR_CLEAR_MASK ETH_DMAOMR_CLEAR_MASK #define DMAOMR_CLEAR_MASK ETH_DMAOMR_CLEAR_MASK
#define ETH_MMCCR ((uint32_t)0x00000100) #define ETH_MMCCR ((uint32_t)0x00000100U)
#define ETH_MMCRIR ((uint32_t)0x00000104) #define ETH_MMCRIR ((uint32_t)0x00000104U)
#define ETH_MMCTIR ((uint32_t)0x00000108) #define ETH_MMCTIR ((uint32_t)0x00000108U)
#define ETH_MMCRIMR ((uint32_t)0x0000010C) #define ETH_MMCRIMR ((uint32_t)0x0000010CU)
#define ETH_MMCTIMR ((uint32_t)0x00000110) #define ETH_MMCTIMR ((uint32_t)0x00000110U)
#define ETH_MMCTGFSCCR ((uint32_t)0x0000014C) #define ETH_MMCTGFSCCR ((uint32_t)0x0000014CU)
#define ETH_MMCTGFMSCCR ((uint32_t)0x00000150) #define ETH_MMCTGFMSCCR ((uint32_t)0x00000150U)
#define ETH_MMCTGFCR ((uint32_t)0x00000168) #define ETH_MMCTGFCR ((uint32_t)0x00000168U)
#define ETH_MMCRFCECR ((uint32_t)0x00000194) #define ETH_MMCRFCECR ((uint32_t)0x00000194U)
#define ETH_MMCRFAECR ((uint32_t)0x00000198) #define ETH_MMCRFAECR ((uint32_t)0x00000198U)
#define ETH_MMCRGUFCR ((uint32_t)0x000001C4) #define ETH_MMCRGUFCR ((uint32_t)0x000001C4U)
#define ETH_MAC_TXFIFO_FULL ((uint32_t)0x02000000) /* Tx FIFO full */
#define ETH_MAC_TXFIFONOT_EMPTY ((uint32_t)0x01000000) /* Tx FIFO not empty */
#define ETH_MAC_TXFIFO_WRITE_ACTIVE ((uint32_t)0x00400000) /* Tx FIFO write active */
#define ETH_MAC_TXFIFO_IDLE ((uint32_t)0x00000000) /* Tx FIFO read status: Idle */
#define ETH_MAC_TXFIFO_READ ((uint32_t)0x00100000) /* Tx FIFO read status: Read (transferring data to the MAC transmitter) */
#define ETH_MAC_TXFIFO_WAITING ((uint32_t)0x00200000) /* Tx FIFO read status: Waiting for TxStatus from MAC transmitter */
#define ETH_MAC_TXFIFO_WRITING ((uint32_t)0x00300000) /* Tx FIFO read status: Writing the received TxStatus or flushing the TxFIFO */
#define ETH_MAC_TRANSMISSION_PAUSE ((uint32_t)0x00080000) /* MAC transmitter in pause */
#define ETH_MAC_TRANSMITFRAMECONTROLLER_IDLE ((uint32_t)0x00000000) /* MAC transmit frame controller: Idle */
#define ETH_MAC_TRANSMITFRAMECONTROLLER_WAITING ((uint32_t)0x00020000) /* MAC transmit frame controller: Waiting for Status of previous frame or IFG/backoff period to be over */
#define ETH_MAC_TRANSMITFRAMECONTROLLER_GENRATING_PCF ((uint32_t)0x00040000) /* MAC transmit frame controller: Generating and transmitting a Pause control frame (in full duplex mode) */
#define ETH_MAC_TRANSMITFRAMECONTROLLER_TRANSFERRING ((uint32_t)0x00060000) /* MAC transmit frame controller: Transferring input frame for transmission */
#define ETH_MAC_MII_TRANSMIT_ACTIVE ((uint32_t)0x00010000) /* MAC MII transmit engine active */
#define ETH_MAC_RXFIFO_EMPTY ((uint32_t)0x00000000) /* Rx FIFO fill level: empty */
#define ETH_MAC_RXFIFO_BELOW_THRESHOLD ((uint32_t)0x00000100) /* Rx FIFO fill level: fill-level below flow-control de-activate threshold */
#define ETH_MAC_RXFIFO_ABOVE_THRESHOLD ((uint32_t)0x00000200) /* Rx FIFO fill level: fill-level above flow-control activate threshold */
#define ETH_MAC_RXFIFO_FULL ((uint32_t)0x00000300) /* Rx FIFO fill level: full */
#define ETH_MAC_READCONTROLLER_IDLE ((uint32_t)0x00000000) /* Rx FIFO read controller IDLE state */
#define ETH_MAC_READCONTROLLER_READING_DATA ((uint32_t)0x00000020) /* Rx FIFO read controller Reading frame data */
#define ETH_MAC_READCONTROLLER_READING_STATUS ((uint32_t)0x00000040) /* Rx FIFO read controller Reading frame status (or time-stamp) */
#define ETH_MAC_READCONTROLLER_FLUSHING ((uint32_t)0x00000060) /* Rx FIFO read controller Flushing the frame data and status */
#define ETH_MAC_RXFIFO_WRITE_ACTIVE ((uint32_t)0x00000010) /* Rx FIFO write controller active */
#define ETH_MAC_SMALL_FIFO_NOTACTIVE ((uint32_t)0x00000000) /* MAC small FIFO read / write controllers not active */
#define ETH_MAC_SMALL_FIFO_READ_ACTIVE ((uint32_t)0x00000002) /* MAC small FIFO read controller active */
#define ETH_MAC_SMALL_FIFO_WRITE_ACTIVE ((uint32_t)0x00000004) /* MAC small FIFO write controller active */
#define ETH_MAC_SMALL_FIFO_RW_ACTIVE ((uint32_t)0x00000006) /* MAC small FIFO read / write controllers active */
#define ETH_MAC_MII_RECEIVE_PROTOCOL_ACTIVE ((uint32_t)0x00000001) /* MAC MII receive protocol engine active */
/** /**
* @} * @}
@ -789,7 +903,8 @@
/** @defgroup HAL_HASH_Aliased_Functions HAL HASH Aliased Functions maintained for legacy purpose /** @defgroup HAL_HASH_Aliased_Functions HAL HASH Aliased Functions maintained for legacy purpose
* @{ * @{
*/ */
#define HAL_HASH_STATETypeDef HAL_HASH_StateTypeDef
#define HAL_HASHPhaseTypeDef HAL_HASH_PhaseTypeDef
#define HAL_HMAC_MD5_Finish HAL_HASH_MD5_Finish #define HAL_HMAC_MD5_Finish HAL_HASH_MD5_Finish
#define HAL_HMAC_SHA1_Finish HAL_HASH_SHA1_Finish #define HAL_HMAC_SHA1_Finish HAL_HASH_SHA1_Finish
#define HAL_HMAC_SHA224_Finish HAL_HASH_SHA224_Finish #define HAL_HMAC_SHA224_Finish HAL_HASH_SHA224_Finish
@ -850,6 +965,8 @@
*/ */
#define HAL_I2CEx_AnalogFilter_Config HAL_I2CEx_ConfigAnalogFilter #define HAL_I2CEx_AnalogFilter_Config HAL_I2CEx_ConfigAnalogFilter
#define HAL_I2CEx_DigitalFilter_Config HAL_I2CEx_ConfigDigitalFilter #define HAL_I2CEx_DigitalFilter_Config HAL_I2CEx_ConfigDigitalFilter
#define HAL_FMPI2CEx_AnalogFilter_Config HAL_FMPI2CEx_ConfigAnalogFilter
#define HAL_FMPI2CEx_DigitalFilter_Config HAL_FMPI2CEx_ConfigDigitalFilter
#define HAL_I2CFastModePlusConfig(SYSCFG_I2CFastModePlus, cmd) (((cmd)==ENABLE)? HAL_I2CEx_EnableFastModePlus(SYSCFG_I2CFastModePlus): HAL_I2CEx_DisableFastModePlus(SYSCFG_I2CFastModePlus)) #define HAL_I2CFastModePlusConfig(SYSCFG_I2CFastModePlus, cmd) (((cmd)==ENABLE)? HAL_I2CEx_EnableFastModePlus(SYSCFG_I2CFastModePlus): HAL_I2CEx_DisableFastModePlus(SYSCFG_I2CFastModePlus))
/** /**
@ -1163,14 +1280,137 @@
/** @defgroup HAL_COMP_Aliased_Macros HAL COMP Aliased Macros maintained for legacy purpose /** @defgroup HAL_COMP_Aliased_Macros HAL COMP Aliased Macros maintained for legacy purpose
* @{ * @{
*/ */
#if defined(STM32F3)
#define COMP_START __HAL_COMP_ENABLE
#define COMP_STOP __HAL_COMP_DISABLE
#define COMP_LOCK __HAL_COMP_LOCK
#if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx) || defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx)
#define __HAL_COMP_EXTI_RISING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_ENABLE_RISING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_ENABLE_RISING_EDGE() : \
__HAL_COMP_COMP6_EXTI_ENABLE_RISING_EDGE())
#define __HAL_COMP_EXTI_RISING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_DISABLE_RISING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_DISABLE_RISING_EDGE() : \
__HAL_COMP_COMP6_EXTI_DISABLE_RISING_EDGE())
#define __HAL_COMP_EXTI_FALLING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_ENABLE_FALLING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_ENABLE_FALLING_EDGE() : \
__HAL_COMP_COMP6_EXTI_ENABLE_FALLING_EDGE())
#define __HAL_COMP_EXTI_FALLING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_DISABLE_FALLING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_DISABLE_FALLING_EDGE() : \
__HAL_COMP_COMP6_EXTI_DISABLE_FALLING_EDGE())
#define __HAL_COMP_EXTI_ENABLE_IT(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_ENABLE_IT() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_ENABLE_IT() : \
__HAL_COMP_COMP6_EXTI_ENABLE_IT())
#define __HAL_COMP_EXTI_DISABLE_IT(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_DISABLE_IT() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_DISABLE_IT() : \
__HAL_COMP_COMP6_EXTI_DISABLE_IT())
#define __HAL_COMP_EXTI_GET_FLAG(__FLAG__) (((__FLAG__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_GET_FLAG() : \
((__FLAG__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_GET_FLAG() : \
__HAL_COMP_COMP6_EXTI_GET_FLAG())
#define __HAL_COMP_EXTI_CLEAR_FLAG(__FLAG__) (((__FLAG__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_CLEAR_FLAG() : \
((__FLAG__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_CLEAR_FLAG() : \
__HAL_COMP_COMP6_EXTI_CLEAR_FLAG())
# endif
# if defined(STM32F302xE) || defined(STM32F302xC)
#define __HAL_COMP_EXTI_RISING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_RISING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_ENABLE_RISING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_ENABLE_RISING_EDGE() : \
__HAL_COMP_COMP6_EXTI_ENABLE_RISING_EDGE())
#define __HAL_COMP_EXTI_RISING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_RISING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_DISABLE_RISING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_DISABLE_RISING_EDGE() : \
__HAL_COMP_COMP6_EXTI_DISABLE_RISING_EDGE())
#define __HAL_COMP_EXTI_FALLING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_FALLING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_ENABLE_FALLING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_ENABLE_FALLING_EDGE() : \
__HAL_COMP_COMP6_EXTI_ENABLE_FALLING_EDGE())
#define __HAL_COMP_EXTI_FALLING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_FALLING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_DISABLE_FALLING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_DISABLE_FALLING_EDGE() : \
__HAL_COMP_COMP6_EXTI_DISABLE_FALLING_EDGE())
#define __HAL_COMP_EXTI_ENABLE_IT(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_IT() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_ENABLE_IT() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_ENABLE_IT() : \
__HAL_COMP_COMP6_EXTI_ENABLE_IT())
#define __HAL_COMP_EXTI_DISABLE_IT(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_IT() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_DISABLE_IT() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_DISABLE_IT() : \
__HAL_COMP_COMP6_EXTI_DISABLE_IT())
#define __HAL_COMP_EXTI_GET_FLAG(__FLAG__) (((__FLAG__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_GET_FLAG() : \
((__FLAG__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_GET_FLAG() : \
((__FLAG__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_GET_FLAG() : \
__HAL_COMP_COMP6_EXTI_GET_FLAG())
#define __HAL_COMP_EXTI_CLEAR_FLAG(__FLAG__) (((__FLAG__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_CLEAR_FLAG() : \
((__FLAG__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_CLEAR_FLAG() : \
((__FLAG__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_CLEAR_FLAG() : \
__HAL_COMP_COMP6_EXTI_CLEAR_FLAG())
# endif
# if defined(STM32F303xE) || defined(STM32F398xx) || defined(STM32F303xC) || defined(STM32F358xx)
#define __HAL_COMP_EXTI_RISING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_RISING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_ENABLE_RISING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP3) ? __HAL_COMP_COMP3_EXTI_ENABLE_RISING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_ENABLE_RISING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP5) ? __HAL_COMP_COMP5_EXTI_ENABLE_RISING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP6) ? __HAL_COMP_COMP6_EXTI_ENABLE_RISING_EDGE() : \
__HAL_COMP_COMP7_EXTI_ENABLE_RISING_EDGE())
#define __HAL_COMP_EXTI_RISING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_RISING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_DISABLE_RISING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP3) ? __HAL_COMP_COMP3_EXTI_DISABLE_RISING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_DISABLE_RISING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP5) ? __HAL_COMP_COMP5_EXTI_DISABLE_RISING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP6) ? __HAL_COMP_COMP6_EXTI_DISABLE_RISING_EDGE() : \
__HAL_COMP_COMP7_EXTI_DISABLE_RISING_EDGE())
#define __HAL_COMP_EXTI_FALLING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_FALLING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_ENABLE_FALLING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP3) ? __HAL_COMP_COMP3_EXTI_ENABLE_FALLING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_ENABLE_FALLING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP5) ? __HAL_COMP_COMP5_EXTI_ENABLE_FALLING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP6) ? __HAL_COMP_COMP6_EXTI_ENABLE_FALLING_EDGE() : \
__HAL_COMP_COMP7_EXTI_ENABLE_FALLING_EDGE())
#define __HAL_COMP_EXTI_FALLING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_FALLING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_DISABLE_FALLING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP3) ? __HAL_COMP_COMP3_EXTI_DISABLE_FALLING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_DISABLE_FALLING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP5) ? __HAL_COMP_COMP5_EXTI_DISABLE_FALLING_EDGE() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP6) ? __HAL_COMP_COMP6_EXTI_DISABLE_FALLING_EDGE() : \
__HAL_COMP_COMP7_EXTI_DISABLE_FALLING_EDGE())
#define __HAL_COMP_EXTI_ENABLE_IT(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_IT() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_ENABLE_IT() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP3) ? __HAL_COMP_COMP3_EXTI_ENABLE_IT() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_ENABLE_IT() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP5) ? __HAL_COMP_COMP5_EXTI_ENABLE_IT() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP6) ? __HAL_COMP_COMP6_EXTI_ENABLE_IT() : \
__HAL_COMP_COMP7_EXTI_ENABLE_IT())
#define __HAL_COMP_EXTI_DISABLE_IT(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_IT() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_DISABLE_IT() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP3) ? __HAL_COMP_COMP3_EXTI_DISABLE_IT() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_DISABLE_IT() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP5) ? __HAL_COMP_COMP5_EXTI_DISABLE_IT() : \
((__EXTILINE__) == COMP_EXTI_LINE_COMP6) ? __HAL_COMP_COMP6_EXTI_DISABLE_IT() : \
__HAL_COMP_COMP7_EXTI_DISABLE_IT())
#define __HAL_COMP_EXTI_GET_FLAG(__FLAG__) (((__FLAG__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_GET_FLAG() : \
((__FLAG__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_GET_FLAG() : \
((__FLAG__) == COMP_EXTI_LINE_COMP3) ? __HAL_COMP_COMP3_EXTI_GET_FLAG() : \
((__FLAG__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_GET_FLAG() : \
((__FLAG__) == COMP_EXTI_LINE_COMP5) ? __HAL_COMP_COMP5_EXTI_GET_FLAG() : \
((__FLAG__) == COMP_EXTI_LINE_COMP6) ? __HAL_COMP_COMP6_EXTI_GET_FLAG() : \
__HAL_COMP_COMP7_EXTI_GET_FLAG())
#define __HAL_COMP_EXTI_CLEAR_FLAG(__FLAG__) (((__FLAG__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_CLEAR_FLAG() : \
((__FLAG__) == COMP_EXTI_LINE_COMP2) ? __HAL_COMP_COMP2_EXTI_CLEAR_FLAG() : \
((__FLAG__) == COMP_EXTI_LINE_COMP3) ? __HAL_COMP_COMP3_EXTI_CLEAR_FLAG() : \
((__FLAG__) == COMP_EXTI_LINE_COMP4) ? __HAL_COMP_COMP4_EXTI_CLEAR_FLAG() : \
((__FLAG__) == COMP_EXTI_LINE_COMP5) ? __HAL_COMP_COMP5_EXTI_CLEAR_FLAG() : \
((__FLAG__) == COMP_EXTI_LINE_COMP6) ? __HAL_COMP_COMP6_EXTI_CLEAR_FLAG() : \
__HAL_COMP_COMP7_EXTI_CLEAR_FLAG())
# endif
# if defined(STM32F373xC) ||defined(STM32F378xx)
#define __HAL_COMP_EXTI_RISING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_RISING_EDGE() : \ #define __HAL_COMP_EXTI_RISING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_RISING_EDGE() : \
__HAL_COMP_COMP2_EXTI_ENABLE_RISING_EDGE()) __HAL_COMP_COMP2_EXTI_ENABLE_RISING_EDGE())
#define __HAL_COMP_EXTI_RISING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_RISING_EDGE() : \ #define __HAL_COMP_EXTI_RISING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_RISING_EDGE() : \
__HAL_COMP_COMP2_EXTI_DISABLE_RISING_EDGE()) __HAL_COMP_COMP2_EXTI_DISABLE_RISING_EDGE())
#define __HAL_COMP_EXTI_FALLING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_FALLING_EDGE() : \ #define __HAL_COMP_EXTI_FALLING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_FALLING_EDGE() : \
__HAL_COMP_COMP2_EXTI_ENABLE_FALLING_EDGE()) __HAL_COMP_COMP2_EXTI_ENABLE_FALLING_EDGE())
#define __HAL_COMP_EXTI_FALLING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_FALLING_EDGE() : \ #define __HAL_COMP_EXTI_FALLING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_FALLING_EDGE() : \
__HAL_COMP_COMP2_EXTI_DISABLE_FALLING_EDGE()) __HAL_COMP_COMP2_EXTI_DISABLE_FALLING_EDGE())
#define __HAL_COMP_EXTI_ENABLE_IT(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_IT() : \ #define __HAL_COMP_EXTI_ENABLE_IT(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_IT() : \
__HAL_COMP_COMP2_EXTI_ENABLE_IT()) __HAL_COMP_COMP2_EXTI_ENABLE_IT())
@ -1180,6 +1420,26 @@
__HAL_COMP_COMP2_EXTI_GET_FLAG()) __HAL_COMP_COMP2_EXTI_GET_FLAG())
#define __HAL_COMP_EXTI_CLEAR_FLAG(__FLAG__) (((__FLAG__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_CLEAR_FLAG() : \ #define __HAL_COMP_EXTI_CLEAR_FLAG(__FLAG__) (((__FLAG__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_CLEAR_FLAG() : \
__HAL_COMP_COMP2_EXTI_CLEAR_FLAG()) __HAL_COMP_COMP2_EXTI_CLEAR_FLAG())
# endif
#else
#define __HAL_COMP_EXTI_RISING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_RISING_EDGE() : \
__HAL_COMP_COMP2_EXTI_ENABLE_RISING_EDGE())
#define __HAL_COMP_EXTI_RISING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_RISING_EDGE() : \
__HAL_COMP_COMP2_EXTI_DISABLE_RISING_EDGE())
#define __HAL_COMP_EXTI_FALLING_IT_ENABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_FALLING_EDGE() : \
__HAL_COMP_COMP2_EXTI_ENABLE_FALLING_EDGE())
#define __HAL_COMP_EXTI_FALLING_IT_DISABLE(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_FALLING_EDGE() : \
__HAL_COMP_COMP2_EXTI_DISABLE_FALLING_EDGE())
#define __HAL_COMP_EXTI_ENABLE_IT(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_ENABLE_IT() : \
__HAL_COMP_COMP2_EXTI_ENABLE_IT())
#define __HAL_COMP_EXTI_DISABLE_IT(__EXTILINE__) (((__EXTILINE__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_DISABLE_IT() : \
__HAL_COMP_COMP2_EXTI_DISABLE_IT())
#define __HAL_COMP_EXTI_GET_FLAG(__FLAG__) (((__FLAG__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_GET_FLAG() : \
__HAL_COMP_COMP2_EXTI_GET_FLAG())
#define __HAL_COMP_EXTI_CLEAR_FLAG(__FLAG__) (((__FLAG__) == COMP_EXTI_LINE_COMP1) ? __HAL_COMP_COMP1_EXTI_CLEAR_FLAG() : \
__HAL_COMP_COMP2_EXTI_CLEAR_FLAG())
#endif
#define __HAL_COMP_GET_EXTI_LINE COMP_GET_EXTI_LINE #define __HAL_COMP_GET_EXTI_LINE COMP_GET_EXTI_LINE
/** /**
@ -1331,7 +1591,7 @@
#define __HAL_PWR_INTERNALWAKEUP_ENABLE HAL_PWREx_EnableInternalWakeUpLine #define __HAL_PWR_INTERNALWAKEUP_ENABLE HAL_PWREx_EnableInternalWakeUpLine
#define __HAL_PWR_PULL_UP_DOWN_CONFIG_DISABLE HAL_PWREx_DisablePullUpPullDownConfig #define __HAL_PWR_PULL_UP_DOWN_CONFIG_DISABLE HAL_PWREx_DisablePullUpPullDownConfig
#define __HAL_PWR_PULL_UP_DOWN_CONFIG_ENABLE HAL_PWREx_EnablePullUpPullDownConfig #define __HAL_PWR_PULL_UP_DOWN_CONFIG_ENABLE HAL_PWREx_EnablePullUpPullDownConfig
#define __HAL_PWR_PVD_EXTI_CLEAR_EGDE_TRIGGER() __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE();__HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE() #define __HAL_PWR_PVD_EXTI_CLEAR_EGDE_TRIGGER() do { __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE();__HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE(); } while(0)
#define __HAL_PWR_PVD_EXTI_EVENT_DISABLE __HAL_PWR_PVD_EXTI_DISABLE_EVENT #define __HAL_PWR_PVD_EXTI_EVENT_DISABLE __HAL_PWR_PVD_EXTI_DISABLE_EVENT
#define __HAL_PWR_PVD_EXTI_EVENT_ENABLE __HAL_PWR_PVD_EXTI_ENABLE_EVENT #define __HAL_PWR_PVD_EXTI_EVENT_ENABLE __HAL_PWR_PVD_EXTI_ENABLE_EVENT
#define __HAL_PWR_PVD_EXTI_FALLINGTRIGGER_DISABLE __HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE #define __HAL_PWR_PVD_EXTI_FALLINGTRIGGER_DISABLE __HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE
@ -1340,8 +1600,8 @@
#define __HAL_PWR_PVD_EXTI_RISINGTRIGGER_ENABLE __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE #define __HAL_PWR_PVD_EXTI_RISINGTRIGGER_ENABLE __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE
#define __HAL_PWR_PVD_EXTI_SET_FALLING_EGDE_TRIGGER __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE #define __HAL_PWR_PVD_EXTI_SET_FALLING_EGDE_TRIGGER __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE
#define __HAL_PWR_PVD_EXTI_SET_RISING_EDGE_TRIGGER __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE #define __HAL_PWR_PVD_EXTI_SET_RISING_EDGE_TRIGGER __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE
#define __HAL_PWR_PVM_DISABLE() HAL_PWREx_DisablePVM1();HAL_PWREx_DisablePVM2();HAL_PWREx_DisablePVM3();HAL_PWREx_DisablePVM4() #define __HAL_PWR_PVM_DISABLE() do { HAL_PWREx_DisablePVM1();HAL_PWREx_DisablePVM2();HAL_PWREx_DisablePVM3();HAL_PWREx_DisablePVM4(); } while(0)
#define __HAL_PWR_PVM_ENABLE() HAL_PWREx_EnablePVM1();HAL_PWREx_EnablePVM2();HAL_PWREx_EnablePVM3();HAL_PWREx_EnablePVM4() #define __HAL_PWR_PVM_ENABLE() do { HAL_PWREx_EnablePVM1();HAL_PWREx_EnablePVM2();HAL_PWREx_EnablePVM3();HAL_PWREx_EnablePVM4(); } while(0)
#define __HAL_PWR_SRAM2CONTENT_PRESERVE_DISABLE HAL_PWREx_DisableSRAM2ContentRetention #define __HAL_PWR_SRAM2CONTENT_PRESERVE_DISABLE HAL_PWREx_DisableSRAM2ContentRetention
#define __HAL_PWR_SRAM2CONTENT_PRESERVE_ENABLE HAL_PWREx_EnableSRAM2ContentRetention #define __HAL_PWR_SRAM2CONTENT_PRESERVE_ENABLE HAL_PWREx_EnableSRAM2ContentRetention
#define __HAL_PWR_VDDIO2_DISABLE HAL_PWREx_DisableVddIO2 #define __HAL_PWR_VDDIO2_DISABLE HAL_PWREx_DisableVddIO2
@ -2033,14 +2293,178 @@
#define __HAL_RCC_OTGFS_FORCE_RESET __HAL_RCC_USB_OTG_FS_FORCE_RESET #define __HAL_RCC_OTGFS_FORCE_RESET __HAL_RCC_USB_OTG_FS_FORCE_RESET
#define __HAL_RCC_OTGFS_RELEASE_RESET __HAL_RCC_USB_OTG_FS_RELEASE_RESET #define __HAL_RCC_OTGFS_RELEASE_RESET __HAL_RCC_USB_OTG_FS_RELEASE_RESET
#define __ADC12_CLK_ENABLE __HAL_RCC_ADC12_CLK_ENABLE
#define __ADC12_CLK_DISABLE __HAL_RCC_ADC12_CLK_DISABLE
#define __ADC34_CLK_ENABLE __HAL_RCC_ADC34_CLK_ENABLE
#define __ADC34_CLK_DISABLE __HAL_RCC_ADC34_CLK_DISABLE
#define __ADC12_CLK_ENABLE __HAL_RCC_ADC12_CLK_ENABLE
#define __ADC12_CLK_DISABLE __HAL_RCC_ADC12_CLK_DISABLE
#define __DAC2_CLK_ENABLE __HAL_RCC_DAC2_CLK_ENABLE
#define __DAC2_CLK_DISABLE __HAL_RCC_DAC2_CLK_DISABLE
#define __TIM18_CLK_ENABLE __HAL_RCC_TIM18_CLK_ENABLE
#define __TIM18_CLK_DISABLE __HAL_RCC_TIM18_CLK_DISABLE
#define __TIM19_CLK_ENABLE __HAL_RCC_TIM19_CLK_ENABLE
#define __TIM19_CLK_DISABLE __HAL_RCC_TIM19_CLK_DISABLE
#define __TIM20_CLK_ENABLE __HAL_RCC_TIM20_CLK_ENABLE
#define __TIM20_CLK_DISABLE __HAL_RCC_TIM20_CLK_DISABLE
#define __HRTIM1_CLK_ENABLE __HAL_RCC_HRTIM1_CLK_ENABLE
#define __HRTIM1_CLK_DISABLE __HAL_RCC_HRTIM1_CLK_DISABLE
#define __SDADC1_CLK_ENABLE __HAL_RCC_SDADC1_CLK_ENABLE
#define __SDADC2_CLK_ENABLE __HAL_RCC_SDADC2_CLK_ENABLE
#define __SDADC3_CLK_ENABLE __HAL_RCC_SDADC3_CLK_ENABLE
#define __SDADC1_CLK_DISABLE __HAL_RCC_SDADC1_CLK_DISABLE
#define __SDADC2_CLK_DISABLE __HAL_RCC_SDADC2_CLK_DISABLE
#define __SDADC3_CLK_DISABLE __HAL_RCC_SDADC3_CLK_DISABLE
#define __ADC12_FORCE_RESET __HAL_RCC_ADC12_FORCE_RESET
#define __ADC12_RELEASE_RESET __HAL_RCC_ADC12_RELEASE_RESET
#define __ADC34_FORCE_RESET __HAL_RCC_ADC34_FORCE_RESET
#define __ADC34_RELEASE_RESET __HAL_RCC_ADC34_RELEASE_RESET
#define __ADC12_FORCE_RESET __HAL_RCC_ADC12_FORCE_RESET
#define __ADC12_RELEASE_RESET __HAL_RCC_ADC12_RELEASE_RESET
#define __DAC2_FORCE_RESET __HAL_RCC_DAC2_FORCE_RESET
#define __DAC2_RELEASE_RESET __HAL_RCC_DAC2_RELEASE_RESET
#define __TIM18_FORCE_RESET __HAL_RCC_TIM18_FORCE_RESET
#define __TIM18_RELEASE_RESET __HAL_RCC_TIM18_RELEASE_RESET
#define __TIM19_FORCE_RESET __HAL_RCC_TIM19_FORCE_RESET
#define __TIM19_RELEASE_RESET __HAL_RCC_TIM19_RELEASE_RESET
#define __TIM20_FORCE_RESET __HAL_RCC_TIM20_FORCE_RESET
#define __TIM20_RELEASE_RESET __HAL_RCC_TIM20_RELEASE_RESET
#define __HRTIM1_FORCE_RESET __HAL_RCC_HRTIM1_FORCE_RESET
#define __HRTIM1_RELEASE_RESET __HAL_RCC_HRTIM1_RELEASE_RESET
#define __SDADC1_FORCE_RESET __HAL_RCC_SDADC1_FORCE_RESET
#define __SDADC2_FORCE_RESET __HAL_RCC_SDADC2_FORCE_RESET
#define __SDADC3_FORCE_RESET __HAL_RCC_SDADC3_FORCE_RESET
#define __SDADC1_RELEASE_RESET __HAL_RCC_SDADC1_RELEASE_RESET
#define __SDADC2_RELEASE_RESET __HAL_RCC_SDADC2_RELEASE_RESET
#define __SDADC3_RELEASE_RESET __HAL_RCC_SDADC3_RELEASE_RESET
#define __ADC1_IS_CLK_ENABLED __HAL_RCC_ADC1_IS_CLK_ENABLED
#define __ADC1_IS_CLK_DISABLED __HAL_RCC_ADC1_IS_CLK_DISABLED
#define __ADC12_IS_CLK_ENABLED __HAL_RCC_ADC12_IS_CLK_ENABLED
#define __ADC12_IS_CLK_DISABLED __HAL_RCC_ADC12_IS_CLK_DISABLED
#define __ADC34_IS_CLK_ENABLED __HAL_RCC_ADC34_IS_CLK_ENABLED
#define __ADC34_IS_CLK_DISABLED __HAL_RCC_ADC34_IS_CLK_DISABLED
#define __CEC_IS_CLK_ENABLED __HAL_RCC_CEC_IS_CLK_ENABLED
#define __CEC_IS_CLK_DISABLED __HAL_RCC_CEC_IS_CLK_DISABLED
#define __CRC_IS_CLK_ENABLED __HAL_RCC_CRC_IS_CLK_ENABLED
#define __CRC_IS_CLK_DISABLED __HAL_RCC_CRC_IS_CLK_DISABLED
#define __DAC1_IS_CLK_ENABLED __HAL_RCC_DAC1_IS_CLK_ENABLED
#define __DAC1_IS_CLK_DISABLED __HAL_RCC_DAC1_IS_CLK_DISABLED
#define __DAC2_IS_CLK_ENABLED __HAL_RCC_DAC2_IS_CLK_ENABLED
#define __DAC2_IS_CLK_DISABLED __HAL_RCC_DAC2_IS_CLK_DISABLED
#define __DMA1_IS_CLK_ENABLED __HAL_RCC_DMA1_IS_CLK_ENABLED
#define __DMA1_IS_CLK_DISABLED __HAL_RCC_DMA1_IS_CLK_DISABLED
#define __DMA2_IS_CLK_ENABLED __HAL_RCC_DMA2_IS_CLK_ENABLED
#define __DMA2_IS_CLK_DISABLED __HAL_RCC_DMA2_IS_CLK_DISABLED
#define __FLITF_IS_CLK_ENABLED __HAL_RCC_FLITF_IS_CLK_ENABLED
#define __FLITF_IS_CLK_DISABLED __HAL_RCC_FLITF_IS_CLK_DISABLED
#define __FMC_IS_CLK_ENABLED __HAL_RCC_FMC_IS_CLK_ENABLED
#define __FMC_IS_CLK_DISABLED __HAL_RCC_FMC_IS_CLK_DISABLED
#define __GPIOA_IS_CLK_ENABLED __HAL_RCC_GPIOA_IS_CLK_ENABLED
#define __GPIOA_IS_CLK_DISABLED __HAL_RCC_GPIOA_IS_CLK_DISABLED
#define __GPIOB_IS_CLK_ENABLED __HAL_RCC_GPIOB_IS_CLK_ENABLED
#define __GPIOB_IS_CLK_DISABLED __HAL_RCC_GPIOB_IS_CLK_DISABLED
#define __GPIOC_IS_CLK_ENABLED __HAL_RCC_GPIOC_IS_CLK_ENABLED
#define __GPIOC_IS_CLK_DISABLED __HAL_RCC_GPIOC_IS_CLK_DISABLED
#define __GPIOD_IS_CLK_ENABLED __HAL_RCC_GPIOD_IS_CLK_ENABLED
#define __GPIOD_IS_CLK_DISABLED __HAL_RCC_GPIOD_IS_CLK_DISABLED
#define __GPIOE_IS_CLK_ENABLED __HAL_RCC_GPIOE_IS_CLK_ENABLED
#define __GPIOE_IS_CLK_DISABLED __HAL_RCC_GPIOE_IS_CLK_DISABLED
#define __GPIOF_IS_CLK_ENABLED __HAL_RCC_GPIOF_IS_CLK_ENABLED
#define __GPIOF_IS_CLK_DISABLED __HAL_RCC_GPIOF_IS_CLK_DISABLED
#define __GPIOG_IS_CLK_ENABLED __HAL_RCC_GPIOG_IS_CLK_ENABLED
#define __GPIOG_IS_CLK_DISABLED __HAL_RCC_GPIOG_IS_CLK_DISABLED
#define __GPIOH_IS_CLK_ENABLED __HAL_RCC_GPIOH_IS_CLK_ENABLED
#define __GPIOH_IS_CLK_DISABLED __HAL_RCC_GPIOH_IS_CLK_DISABLED
#define __HRTIM1_IS_CLK_ENABLED __HAL_RCC_HRTIM1_IS_CLK_ENABLED
#define __HRTIM1_IS_CLK_DISABLED __HAL_RCC_HRTIM1_IS_CLK_DISABLED
#define __I2C1_IS_CLK_ENABLED __HAL_RCC_I2C1_IS_CLK_ENABLED
#define __I2C1_IS_CLK_DISABLED __HAL_RCC_I2C1_IS_CLK_DISABLED
#define __I2C2_IS_CLK_ENABLED __HAL_RCC_I2C2_IS_CLK_ENABLED
#define __I2C2_IS_CLK_DISABLED __HAL_RCC_I2C2_IS_CLK_DISABLED
#define __I2C3_IS_CLK_ENABLED __HAL_RCC_I2C3_IS_CLK_ENABLED
#define __I2C3_IS_CLK_DISABLED __HAL_RCC_I2C3_IS_CLK_DISABLED
#define __PWR_IS_CLK_ENABLED __HAL_RCC_PWR_IS_CLK_ENABLED
#define __PWR_IS_CLK_DISABLED __HAL_RCC_PWR_IS_CLK_DISABLED
#define __SYSCFG_IS_CLK_ENABLED __HAL_RCC_SYSCFG_IS_CLK_ENABLED
#define __SYSCFG_IS_CLK_DISABLED __HAL_RCC_SYSCFG_IS_CLK_DISABLED
#define __SPI1_IS_CLK_ENABLED __HAL_RCC_SPI1_IS_CLK_ENABLED
#define __SPI1_IS_CLK_DISABLED __HAL_RCC_SPI1_IS_CLK_DISABLED
#define __SPI2_IS_CLK_ENABLED __HAL_RCC_SPI2_IS_CLK_ENABLED
#define __SPI2_IS_CLK_DISABLED __HAL_RCC_SPI2_IS_CLK_DISABLED
#define __SPI3_IS_CLK_ENABLED __HAL_RCC_SPI3_IS_CLK_ENABLED
#define __SPI3_IS_CLK_DISABLED __HAL_RCC_SPI3_IS_CLK_DISABLED
#define __SPI4_IS_CLK_ENABLED __HAL_RCC_SPI4_IS_CLK_ENABLED
#define __SPI4_IS_CLK_DISABLED __HAL_RCC_SPI4_IS_CLK_DISABLED
#define __SDADC1_IS_CLK_ENABLED __HAL_RCC_SDADC1_IS_CLK_ENABLED
#define __SDADC1_IS_CLK_DISABLED __HAL_RCC_SDADC1_IS_CLK_DISABLED
#define __SDADC2_IS_CLK_ENABLED __HAL_RCC_SDADC2_IS_CLK_ENABLED
#define __SDADC2_IS_CLK_DISABLED __HAL_RCC_SDADC2_IS_CLK_DISABLED
#define __SDADC3_IS_CLK_ENABLED __HAL_RCC_SDADC3_IS_CLK_ENABLED
#define __SDADC3_IS_CLK_DISABLED __HAL_RCC_SDADC3_IS_CLK_DISABLED
#define __SRAM_IS_CLK_ENABLED __HAL_RCC_SRAM_IS_CLK_ENABLED
#define __SRAM_IS_CLK_DISABLED __HAL_RCC_SRAM_IS_CLK_DISABLED
#define __TIM1_IS_CLK_ENABLED __HAL_RCC_TIM1_IS_CLK_ENABLED
#define __TIM1_IS_CLK_DISABLED __HAL_RCC_TIM1_IS_CLK_DISABLED
#define __TIM2_IS_CLK_ENABLED __HAL_RCC_TIM2_IS_CLK_ENABLED
#define __TIM2_IS_CLK_DISABLED __HAL_RCC_TIM2_IS_CLK_DISABLED
#define __TIM3_IS_CLK_ENABLED __HAL_RCC_TIM3_IS_CLK_ENABLED
#define __TIM3_IS_CLK_DISABLED __HAL_RCC_TIM3_IS_CLK_DISABLED
#define __TIM4_IS_CLK_ENABLED __HAL_RCC_TIM4_IS_CLK_ENABLED
#define __TIM4_IS_CLK_DISABLED __HAL_RCC_TIM4_IS_CLK_DISABLED
#define __TIM5_IS_CLK_ENABLED __HAL_RCC_TIM5_IS_CLK_ENABLED
#define __TIM5_IS_CLK_DISABLED __HAL_RCC_TIM5_IS_CLK_DISABLED
#define __TIM6_IS_CLK_ENABLED __HAL_RCC_TIM6_IS_CLK_ENABLED
#define __TIM6_IS_CLK_DISABLED __HAL_RCC_TIM6_IS_CLK_DISABLED
#define __TIM7_IS_CLK_ENABLED __HAL_RCC_TIM7_IS_CLK_ENABLED
#define __TIM7_IS_CLK_DISABLED __HAL_RCC_TIM7_IS_CLK_DISABLED
#define __TIM8_IS_CLK_ENABLED __HAL_RCC_TIM8_IS_CLK_ENABLED
#define __TIM8_IS_CLK_DISABLED __HAL_RCC_TIM8_IS_CLK_DISABLED
#define __TIM12_IS_CLK_ENABLED __HAL_RCC_TIM12_IS_CLK_ENABLED
#define __TIM12_IS_CLK_DISABLED __HAL_RCC_TIM12_IS_CLK_DISABLED
#define __TIM13_IS_CLK_ENABLED __HAL_RCC_TIM13_IS_CLK_ENABLED
#define __TIM13_IS_CLK_DISABLED __HAL_RCC_TIM13_IS_CLK_DISABLED
#define __TIM14_IS_CLK_ENABLED __HAL_RCC_TIM14_IS_CLK_ENABLED
#define __TIM14_IS_CLK_DISABLED __HAL_RCC_TIM14_IS_CLK_DISABLED
#define __TIM15_IS_CLK_ENABLED __HAL_RCC_TIM15_IS_CLK_ENABLED
#define __TIM15_IS_CLK_DISABLED __HAL_RCC_TIM15_IS_CLK_DISABLED
#define __TIM16_IS_CLK_ENABLED __HAL_RCC_TIM16_IS_CLK_ENABLED
#define __TIM16_IS_CLK_DISABLED __HAL_RCC_TIM16_IS_CLK_DISABLED
#define __TIM17_IS_CLK_ENABLED __HAL_RCC_TIM17_IS_CLK_ENABLED
#define __TIM17_IS_CLK_DISABLED __HAL_RCC_TIM17_IS_CLK_DISABLED
#define __TIM18_IS_CLK_ENABLED __HAL_RCC_TIM18_IS_CLK_ENABLED
#define __TIM18_IS_CLK_DISABLED __HAL_RCC_TIM18_IS_CLK_DISABLED
#define __TIM19_IS_CLK_ENABLED __HAL_RCC_TIM19_IS_CLK_ENABLED
#define __TIM19_IS_CLK_DISABLED __HAL_RCC_TIM19_IS_CLK_DISABLED
#define __TIM20_IS_CLK_ENABLED __HAL_RCC_TIM20_IS_CLK_ENABLED
#define __TIM20_IS_CLK_DISABLED __HAL_RCC_TIM20_IS_CLK_DISABLED
#define __TSC_IS_CLK_ENABLED __HAL_RCC_TSC_IS_CLK_ENABLED
#define __TSC_IS_CLK_DISABLED __HAL_RCC_TSC_IS_CLK_DISABLED
#define __UART4_IS_CLK_ENABLED __HAL_RCC_UART4_IS_CLK_ENABLED
#define __UART4_IS_CLK_DISABLED __HAL_RCC_UART4_IS_CLK_DISABLED
#define __UART5_IS_CLK_ENABLED __HAL_RCC_UART5_IS_CLK_ENABLED
#define __UART5_IS_CLK_DISABLED __HAL_RCC_UART5_IS_CLK_DISABLED
#define __USART1_IS_CLK_ENABLED __HAL_RCC_USART1_IS_CLK_ENABLED
#define __USART1_IS_CLK_DISABLED __HAL_RCC_USART1_IS_CLK_DISABLED
#define __USART2_IS_CLK_ENABLED __HAL_RCC_USART2_IS_CLK_ENABLED
#define __USART2_IS_CLK_DISABLED __HAL_RCC_USART2_IS_CLK_DISABLED
#define __USART3_IS_CLK_ENABLED __HAL_RCC_USART3_IS_CLK_ENABLED
#define __USART3_IS_CLK_DISABLED __HAL_RCC_USART3_IS_CLK_DISABLED
#define __USB_IS_CLK_ENABLED __HAL_RCC_USB_IS_CLK_ENABLED
#define __USB_IS_CLK_DISABLED __HAL_RCC_USB_IS_CLK_DISABLED
#define __WWDG_IS_CLK_ENABLED __HAL_RCC_WWDG_IS_CLK_ENABLED
#define __WWDG_IS_CLK_DISABLED __HAL_RCC_WWDG_IS_CLK_DISABLED
#if defined(STM32F4) #if defined(STM32F4)
#define __HAL_RCC_SDMMC1_CLK_ENABLE __HAL_RCC_SDIO_CLK_ENABLE
#define __HAL_RCC_SDMMC1_FORCE_RESET __HAL_RCC_SDIO_FORCE_RESET #define __HAL_RCC_SDMMC1_FORCE_RESET __HAL_RCC_SDIO_FORCE_RESET
#define __HAL_RCC_SDMMC1_RELEASE_RESET __HAL_RCC_SDIO_RELEASE_RESET #define __HAL_RCC_SDMMC1_RELEASE_RESET __HAL_RCC_SDIO_RELEASE_RESET
#define __HAL_RCC_SDMMC1_CLK_SLEEP_ENABLE __HAL_RCC_SDIO_CLK_SLEEP_ENABLE #define __HAL_RCC_SDMMC1_CLK_SLEEP_ENABLE __HAL_RCC_SDIO_CLK_SLEEP_ENABLE
#define __HAL_RCC_SDMMC1_CLK_SLEEP_DISABLE __HAL_RCC_SDIO_CLK_SLEEP_DISABLE #define __HAL_RCC_SDMMC1_CLK_SLEEP_DISABLE __HAL_RCC_SDIO_CLK_SLEEP_DISABLE
#define __HAL_RCC_SDMMC1_CLK_ENABLE __HAL_RCC_SDIO_CLK_ENABLE #define __HAL_RCC_SDMMC1_CLK_ENABLE __HAL_RCC_SDIO_CLK_ENABLE
#define __HAL_RCC_SDMMC1_CLK_DISABLE __HAL_RCC_SDIO_CLK_DISABLE #define __HAL_RCC_SDMMC1_CLK_DISABLE __HAL_RCC_SDIO_CLK_DISABLE
#define __HAL_RCC_SDMMC1_IS_CLK_ENABLED __HAL_RCC_SDIO_IS_CLK_ENABLED
#define __HAL_RCC_SDMMC1_IS_CLK_DISABLED __HAL_RCC_SDIO_IS_CLK_DISABLED
#define Sdmmc1ClockSelection SdioClockSelection #define Sdmmc1ClockSelection SdioClockSelection
#define RCC_PERIPHCLK_SDMMC1 RCC_PERIPHCLK_SDIO #define RCC_PERIPHCLK_SDMMC1 RCC_PERIPHCLK_SDIO
#define RCC_SDMMC1CLKSOURCE_CLK48 RCC_SDIOCLKSOURCE_CK48 #define RCC_SDMMC1CLKSOURCE_CLK48 RCC_SDIOCLKSOURCE_CK48
@ -2050,13 +2474,14 @@
#endif #endif
#if defined(STM32F7) || defined(STM32L4) #if defined(STM32F7) || defined(STM32L4)
#define __HAL_RCC_SDIO_CLK_ENABLE __HAL_RCC_SDMMC1_CLK_ENABLE
#define __HAL_RCC_SDIO_FORCE_RESET __HAL_RCC_SDMMC1_FORCE_RESET #define __HAL_RCC_SDIO_FORCE_RESET __HAL_RCC_SDMMC1_FORCE_RESET
#define __HAL_RCC_SDIO_RELEASE_RESET __HAL_RCC_SDMMC1_RELEASE_RESET #define __HAL_RCC_SDIO_RELEASE_RESET __HAL_RCC_SDMMC1_RELEASE_RESET
#define __HAL_RCC_SDIO_CLK_SLEEP_ENABLE __HAL_RCC_SDMMC1_CLK_SLEEP_ENABLE #define __HAL_RCC_SDIO_CLK_SLEEP_ENABLE __HAL_RCC_SDMMC1_CLK_SLEEP_ENABLE
#define __HAL_RCC_SDIO_CLK_SLEEP_DISABLE __HAL_RCC_SDMMC1_CLK_SLEEP_DISABLE #define __HAL_RCC_SDIO_CLK_SLEEP_DISABLE __HAL_RCC_SDMMC1_CLK_SLEEP_DISABLE
#define __HAL_RCC_SDIO_CLK_ENABLE __HAL_RCC_SDMMC1_CLK_ENABLE #define __HAL_RCC_SDIO_CLK_ENABLE __HAL_RCC_SDMMC1_CLK_ENABLE
#define __HAL_RCC_SDIO_CLK_DISABLE __HAL_RCC_SDMMC1_CLK_DISABLE #define __HAL_RCC_SDIO_CLK_DISABLE __HAL_RCC_SDMMC1_CLK_DISABLE
#define __HAL_RCC_SDIO_IS_CLK_ENABLED __HAL_RCC_SDMMC1_IS_CLK_ENABLED
#define __HAL_RCC_SDIO_IS_CLK_DISABLED __HAL_RCC_SDMMC1_IS_CLK_DISABLED
#define SdioClockSelection Sdmmc1ClockSelection #define SdioClockSelection Sdmmc1ClockSelection
#define RCC_PERIPHCLK_SDIO RCC_PERIPHCLK_SDMMC1 #define RCC_PERIPHCLK_SDIO RCC_PERIPHCLK_SDMMC1
#define __HAL_RCC_SDIO_CONFIG __HAL_RCC_SDMMC1_CONFIG #define __HAL_RCC_SDIO_CONFIG __HAL_RCC_SDMMC1_CONFIG
@ -2077,22 +2502,75 @@
#define IS_RCC_RTCCLK_SOURCE IS_RCC_RTCCLKSOURCE #define IS_RCC_RTCCLK_SOURCE IS_RCC_RTCCLKSOURCE
#define IS_RCC_SYSCLK_DIV IS_RCC_HCLK #define IS_RCC_SYSCLK_DIV IS_RCC_HCLK
#define IS_RCC_HCLK_DIV IS_RCC_PCLK #define IS_RCC_HCLK_DIV IS_RCC_PCLK
#define IS_RCC_PERIPHCLK IS_RCC_PERIPHCLOCK
#define RCC_IT_HSI14 RCC_IT_HSI14RDY
#if defined(STM32L0)
#define RCC_IT_LSECSS RCC_IT_CSSLSE
#define RCC_IT_CSS RCC_IT_CSSHSE
#endif
#define IS_RCC_MCOSOURCE IS_RCC_MCO1SOURCE #define IS_RCC_MCOSOURCE IS_RCC_MCO1SOURCE
#define __HAL_RCC_MCO_CONFIG __HAL_RCC_MCO1_CONFIG
#define RCC_MCO_NODIV RCC_MCODIV_1 #define RCC_MCO_NODIV RCC_MCODIV_1
#define RCC_MCO_DIV1 RCC_MCODIV_1
#define RCC_MCO_DIV2 RCC_MCODIV_2
#define RCC_MCO_DIV4 RCC_MCODIV_4
#define RCC_MCO_DIV8 RCC_MCODIV_8
#define RCC_MCO_DIV16 RCC_MCODIV_16
#define RCC_MCO_DIV32 RCC_MCODIV_32
#define RCC_MCO_DIV64 RCC_MCODIV_64
#define RCC_MCO_DIV128 RCC_MCODIV_128
#define RCC_MCOSOURCE_NONE RCC_MCO1SOURCE_NOCLOCK
#define RCC_MCOSOURCE_LSI RCC_MCO1SOURCE_LSI
#define RCC_MCOSOURCE_LSE RCC_MCO1SOURCE_LSE
#define RCC_MCOSOURCE_SYSCLK RCC_MCO1SOURCE_SYSCLK
#define RCC_MCOSOURCE_HSI RCC_MCO1SOURCE_HSI
#define RCC_MCOSOURCE_HSI14 RCC_MCO1SOURCE_HSI14
#define RCC_MCOSOURCE_HSI48 RCC_MCO1SOURCE_HSI48
#define RCC_MCOSOURCE_HSE RCC_MCO1SOURCE_HSE
#define RCC_MCOSOURCE_PLLCLK_DIV1 RCC_MCO1SOURCE_PLLCLK
#define RCC_MCOSOURCE_PLLCLK_NODIV RCC_MCO1SOURCE_PLLCLK
#define RCC_MCOSOURCE_PLLCLK_DIV2 RCC_MCO1SOURCE_PLLCLK_DIV2
#define RCC_RTCCLKSOURCE_NONE RCC_RTCCLKSOURCE_NO_CLK #define RCC_RTCCLKSOURCE_NONE RCC_RTCCLKSOURCE_NO_CLK
#define RCC_USBCLK_PLLSAI1 RCC_USBCLKSOURCE_PLLSAI1
#define RCC_USBCLK_PLL RCC_USBCLKSOURCE_PLL
#define RCC_USBCLK_MSI RCC_USBCLKSOURCE_MSI
#define RCC_USBCLKSOURCE_PLLCLK RCC_USBCLKSOURCE_PLL
#define RCC_USBPLLCLK_DIV1 RCC_USBCLKSOURCE_PLL
#define RCC_USBPLLCLK_DIV1_5 RCC_USBCLKSOURCE_PLL_DIV1_5
#define RCC_USBPLLCLK_DIV2 RCC_USBCLKSOURCE_PLL_DIV2
#define RCC_USBPLLCLK_DIV3 RCC_USBCLKSOURCE_PLL_DIV3
#define HSION_BitNumber RCC_HSION_BIT_NUMBER #define HSION_BitNumber RCC_HSION_BIT_NUMBER
#define HSION_BITNUMBER RCC_HSION_BIT_NUMBER
#define HSEON_BitNumber RCC_HSEON_BIT_NUMBER
#define HSEON_BITNUMBER RCC_HSEON_BIT_NUMBER
#define MSION_BITNUMBER RCC_MSION_BIT_NUMBER
#define CSSON_BitNumber RCC_CSSON_BIT_NUMBER #define CSSON_BitNumber RCC_CSSON_BIT_NUMBER
#define CSSON_BITNUMBER RCC_CSSON_BIT_NUMBER
#define PLLON_BitNumber RCC_PLLON_BIT_NUMBER #define PLLON_BitNumber RCC_PLLON_BIT_NUMBER
#define PLLON_BITNUMBER RCC_PLLON_BIT_NUMBER
#define PLLI2SON_BitNumber RCC_PLLI2SON_BIT_NUMBER #define PLLI2SON_BitNumber RCC_PLLI2SON_BIT_NUMBER
#define I2SSRC_BitNumber RCC_I2SSRC_BIT_NUMBER #define I2SSRC_BitNumber RCC_I2SSRC_BIT_NUMBER
#define RTCEN_BitNumber RCC_RTCEN_BIT_NUMBER #define RTCEN_BitNumber RCC_RTCEN_BIT_NUMBER
#define RTCEN_BITNUMBER RCC_RTCEN_BIT_NUMBER
#define BDRST_BitNumber RCC_BDRST_BIT_NUMBER #define BDRST_BitNumber RCC_BDRST_BIT_NUMBER
#define BDRST_BITNUMBER RCC_BDRST_BIT_NUMBER
#define RTCRST_BITNUMBER RCC_RTCRST_BIT_NUMBER
#define LSION_BitNumber RCC_LSION_BIT_NUMBER #define LSION_BitNumber RCC_LSION_BIT_NUMBER
#define LSION_BITNUMBER RCC_LSION_BIT_NUMBER
#define LSEON_BitNumber RCC_LSEON_BIT_NUMBER
#define LSEON_BITNUMBER RCC_LSEON_BIT_NUMBER
#define LSEBYP_BITNUMBER RCC_LSEBYP_BIT_NUMBER
#define PLLSAION_BitNumber RCC_PLLSAION_BIT_NUMBER #define PLLSAION_BitNumber RCC_PLLSAION_BIT_NUMBER
#define TIMPRE_BitNumber RCC_TIMPRE_BIT_NUMBER #define TIMPRE_BitNumber RCC_TIMPRE_BIT_NUMBER
#define RMVF_BitNumber RCC_RMVF_BIT_NUMBER
#define RMVF_BITNUMBER RCC_RMVF_BIT_NUMBER
#define RCC_CR2_HSI14TRIM_BitNumber RCC_HSI14TRIM_BIT_NUMBER
#define CR_BYTE2_ADDRESS RCC_CR_BYTE2_ADDRESS #define CR_BYTE2_ADDRESS RCC_CR_BYTE2_ADDRESS
#define CIR_BYTE1_ADDRESS RCC_CIR_BYTE1_ADDRESS #define CIR_BYTE1_ADDRESS RCC_CIR_BYTE1_ADDRESS
#define CIR_BYTE2_ADDRESS RCC_CIR_BYTE2_ADDRESS #define CIR_BYTE2_ADDRESS RCC_CIR_BYTE2_ADDRESS
@ -2113,9 +2591,18 @@
#define CFGR_I2SSRC_BB RCC_CFGR_I2SSRC_BB #define CFGR_I2SSRC_BB RCC_CFGR_I2SSRC_BB
#define BDCR_RTCEN_BB RCC_BDCR_RTCEN_BB #define BDCR_RTCEN_BB RCC_BDCR_RTCEN_BB
#define BDCR_BDRST_BB RCC_BDCR_BDRST_BB #define BDCR_BDRST_BB RCC_BDCR_BDRST_BB
#define CR_HSEON_BB RCC_CR_HSEON_BB
#define CSR_RMVF_BB RCC_CSR_RMVF_BB
#define CR_PLLSAION_BB RCC_CR_PLLSAION_BB #define CR_PLLSAION_BB RCC_CR_PLLSAION_BB
#define DCKCFGR_TIMPRE_BB RCC_DCKCFGR_TIMPRE_BB #define DCKCFGR_TIMPRE_BB RCC_DCKCFGR_TIMPRE_BB
#define __HAL_RCC_CRS_ENABLE_FREQ_ERROR_COUNTER __HAL_RCC_CRS_FREQ_ERROR_COUNTER_ENABLE
#define __HAL_RCC_CRS_DISABLE_FREQ_ERROR_COUNTER __HAL_RCC_CRS_FREQ_ERROR_COUNTER_DISABLE
#define __HAL_RCC_CRS_ENABLE_AUTOMATIC_CALIB __HAL_RCC_CRS_AUTOMATIC_CALIB_ENABLE
#define __HAL_RCC_CRS_DISABLE_AUTOMATIC_CALIB __HAL_RCC_CRS_AUTOMATIC_CALIB_DISABLE
#define __HAL_RCC_CRS_CALCULATE_RELOADVALUE __HAL_RCC_CRS_RELOADVALUE_CALCULATE
#define __HAL_RCC_GET_IT_SOURCE __HAL_RCC_GET_IT
/** /**
* @} * @}
*/ */
@ -2404,32 +2891,6 @@
#define __HAL_TIM_GetICPrescaler __HAL_TIM_GET_ICPRESCALER #define __HAL_TIM_GetICPrescaler __HAL_TIM_GET_ICPRESCALER
#define __HAL_TIM_SetCompare __HAL_TIM_SET_COMPARE #define __HAL_TIM_SetCompare __HAL_TIM_SET_COMPARE
#define __HAL_TIM_GetCompare __HAL_TIM_GET_COMPARE #define __HAL_TIM_GetCompare __HAL_TIM_GET_COMPARE
#define TIM_TS_ITR0 ((uint32_t)0x0000)
#define TIM_TS_ITR1 ((uint32_t)0x0010)
#define TIM_TS_ITR2 ((uint32_t)0x0020)
#define TIM_TS_ITR3 ((uint32_t)0x0030)
#define IS_TIM_INTERNAL_TRIGGER_SELECTION(SELECTION) (((SELECTION) == TIM_TS_ITR0) || \
((SELECTION) == TIM_TS_ITR1) || \
((SELECTION) == TIM_TS_ITR2) || \
((SELECTION) == TIM_TS_ITR3))
#define TIM_CHANNEL_1 ((uint32_t)0x0000)
#define TIM_CHANNEL_2 ((uint32_t)0x0004)
#define IS_TIM_PWMI_CHANNELS(CHANNEL) (((CHANNEL) == TIM_CHANNEL_1) || \
((CHANNEL) == TIM_CHANNEL_2))
#define TIM_OUTPUTNSTATE_DISABLE ((uint32_t)0x0000)
#define TIM_OUTPUTNSTATE_ENABLE (TIM_CCER_CC1NE)
#define IS_TIM_OUTPUTN_STATE(STATE) (((STATE) == TIM_OUTPUTNSTATE_DISABLE) || \
((STATE) == TIM_OUTPUTNSTATE_ENABLE))
#define TIM_OUTPUTSTATE_DISABLE ((uint32_t)0x0000)
#define TIM_OUTPUTSTATE_ENABLE (TIM_CCER_CC1E)
#define IS_TIM_OUTPUT_STATE(STATE) (((STATE) == TIM_OUTPUTSTATE_DISABLE) || \
((STATE) == TIM_OUTPUTSTATE_ENABLE))
/** /**
* @} * @}
*/ */
@ -2476,7 +2937,8 @@
#define SAI_FIFOStatus_3QuartersFull SAI_FIFOSTATUS_3QUARTERFULL #define SAI_FIFOStatus_3QuartersFull SAI_FIFOSTATUS_3QUARTERFULL
#define SAI_FIFOStatus_Full SAI_FIFOSTATUS_FULL #define SAI_FIFOStatus_Full SAI_FIFOSTATUS_FULL
#define IS_SAI_BLOCK_MONO_STREO_MODE IS_SAI_BLOCK_MONO_STEREO_MODE #define IS_SAI_BLOCK_MONO_STREO_MODE IS_SAI_BLOCK_MONO_STEREO_MODE
#define SAI_SYNCHRONOUS_EXT SAI_SYNCHRONOUS_EXT_SAI1
#define SAI_SYNCEXT_IN_ENABLE SAI_SYNCEXT_OUTBLOCKA_ENABLE
/** /**
* @} * @}
*/ */

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal.c * @file stm32f0xx_hal.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief HAL module driver. * @brief HAL module driver.
* This is the common part of the HAL initialization * This is the common part of the HAL initialization
* *
@ -23,7 +23,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -70,11 +70,11 @@
* @{ * @{
*/ */
/** /**
* @brief STM32F0xx HAL Driver version number V1.3.0 * @brief STM32F0xx HAL Driver version number V1.3.1
*/ */
#define __STM32F0xx_HAL_VERSION_MAIN (0x01) /*!< [31:24] main version */ #define __STM32F0xx_HAL_VERSION_MAIN (0x01) /*!< [31:24] main version */
#define __STM32F0xx_HAL_VERSION_SUB1 (0x03) /*!< [23:16] sub1 version */ #define __STM32F0xx_HAL_VERSION_SUB1 (0x03) /*!< [23:16] sub1 version */
#define __STM32F0xx_HAL_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */ #define __STM32F0xx_HAL_VERSION_SUB2 (0x01) /*!< [15:8] sub2 version */
#define __STM32F0xx_HAL_VERSION_RC (0x00) /*!< [7:0] release candidate */ #define __STM32F0xx_HAL_VERSION_RC (0x00) /*!< [7:0] release candidate */
#define __STM32F0xx_HAL_VERSION ((__STM32F0xx_HAL_VERSION_MAIN << 24)\ #define __STM32F0xx_HAL_VERSION ((__STM32F0xx_HAL_VERSION_MAIN << 24)\
|(__STM32F0xx_HAL_VERSION_SUB1 << 16)\ |(__STM32F0xx_HAL_VERSION_SUB1 << 16)\

View File

@ -2,14 +2,14 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal.h * @file stm32f0xx_hal.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief This file contains all the functions prototypes for the HAL * @brief This file contains all the functions prototypes for the HAL
* module driver. * module driver.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_adc.c * @file stm32f0xx_hal_adc.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief This file provides firmware functions to manage the following * @brief This file provides firmware functions to manage the following
* functionalities of the Analog to Digital Convertor (ADC) * functionalities of the Analog to Digital Convertor (ADC)
* peripheral: * peripheral:
@ -227,7 +227,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -478,12 +478,26 @@ HAL_StatusTypeDef HAL_ADC_Init(ADC_HandleTypeDef* hadc)
ADC_CFGR1_DMACONTREQ(hadc->Init.DMAContinuousRequests) ); ADC_CFGR1_DMACONTREQ(hadc->Init.DMAContinuousRequests) );
/* Enable discontinuous mode only if continuous mode is disabled */ /* Enable discontinuous mode only if continuous mode is disabled */
if ((hadc->Init.DiscontinuousConvMode == ENABLE) && if (hadc->Init.DiscontinuousConvMode == ENABLE)
(hadc->Init.ContinuousConvMode == DISABLE) )
{ {
/* Enable discontinuous mode of regular group */ if (hadc->Init.ContinuousConvMode == DISABLE)
{
/* Enable the selected ADC group regular discontinuous mode */
tmpCFGR1 |= ADC_CFGR1_DISCEN; tmpCFGR1 |= ADC_CFGR1_DISCEN;
} }
else
{
/* ADC regular group discontinuous was intended to be enabled, */
/* but ADC regular group modes continuous and sequencer discontinuous */
/* cannot be enabled simultaneously. */
/* Update ADC state machine to error */
SET_BIT(hadc->State, HAL_ADC_STATE_ERROR_CONFIG);
/* Set ADC error code to ADC IP internal error */
SET_BIT(hadc->ErrorCode, HAL_ADC_ERROR_INTERNAL);
}
}
/* Enable external trigger if trigger selection is different of software */ /* Enable external trigger if trigger selection is different of software */
/* start. */ /* start. */
@ -688,6 +702,9 @@ HAL_StatusTypeDef HAL_ADC_DeInit(ADC_HandleTypeDef* hadc)
*/ */
__weak void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc) __weak void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hadc);
/* NOTE : This function should not be modified. When the callback is needed, /* NOTE : This function should not be modified. When the callback is needed,
function HAL_ADC_MspInit must be implemented in the user file. function HAL_ADC_MspInit must be implemented in the user file.
*/ */
@ -700,6 +717,9 @@ __weak void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc)
*/ */
__weak void HAL_ADC_MspDeInit(ADC_HandleTypeDef* hadc) __weak void HAL_ADC_MspDeInit(ADC_HandleTypeDef* hadc)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hadc);
/* NOTE : This function should not be modified. When the callback is needed, /* NOTE : This function should not be modified. When the callback is needed,
function HAL_ADC_MspDeInit must be implemented in the user file. function HAL_ADC_MspDeInit must be implemented in the user file.
*/ */
@ -1001,7 +1021,7 @@ HAL_StatusTypeDef HAL_ADC_PollForEvent(ADC_HandleTypeDef* hadc, uint32_t EventTy
/* Process unlocked */ /* Process unlocked */
__HAL_UNLOCK(hadc); __HAL_UNLOCK(hadc);
return HAL_ERROR; return HAL_TIMEOUT;
} }
} }
} }
@ -1340,12 +1360,22 @@ HAL_StatusTypeDef HAL_ADC_Stop_DMA(ADC_HandleTypeDef* hadc)
/** /**
* @brief Get ADC regular group conversion result. * @brief Get ADC regular group conversion result.
* @note Reading DR register automatically clears EOC (end of conversion of * @note Reading register DR automatically clears ADC flag EOC
* regular group) flag. * (ADC group regular end of unitary conversion).
* Additionally, this functions clears EOS (end of sequence of * @note This function does not clear ADC flag EOS
* regular group) flag, in case of the end of the sequence is reached. * (ADC group regular end of sequence conversion).
* Occurrence of flag EOS rising:
* - If sequencer is composed of 1 rank, flag EOS is equivalent
* to flag EOC.
* - If sequencer is composed of several ranks, during the scan
* sequence flag EOC only is raised, at the end of the scan sequence
* both flags EOC and EOS are raised.
* To clear this flag, either use function:
* in programming model IT: @ref HAL_ADC_IRQHandler(), in programming
* model polling: @ref HAL_ADC_PollForConversion()
* or @ref __HAL_ADC_CLEAR_FLAG(&hadc, ADC_FLAG_EOS).
* @param hadc: ADC handle * @param hadc: ADC handle
* @retval Converted value * @retval ADC group regular conversion data
*/ */
uint32_t HAL_ADC_GetValue(ADC_HandleTypeDef* hadc) uint32_t HAL_ADC_GetValue(ADC_HandleTypeDef* hadc)
{ {
@ -1355,9 +1385,6 @@ uint32_t HAL_ADC_GetValue(ADC_HandleTypeDef* hadc)
/* Note: EOC flag is not cleared here by software because automatically */ /* Note: EOC flag is not cleared here by software because automatically */
/* cleared by hardware when reading register DR. */ /* cleared by hardware when reading register DR. */
/* Clear regular group end of sequence flag */
__HAL_ADC_CLEAR_FLAG(hadc, ADC_FLAG_EOS);
/* Return ADC converted value */ /* Return ADC converted value */
return hadc->Instance->DR; return hadc->Instance->DR;
} }
@ -1485,6 +1512,9 @@ void HAL_ADC_IRQHandler(ADC_HandleTypeDef* hadc)
*/ */
__weak void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc) __weak void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hadc);
/* NOTE : This function should not be modified. When the callback is needed, /* NOTE : This function should not be modified. When the callback is needed,
function HAL_ADC_ConvCpltCallback must be implemented in the user file. function HAL_ADC_ConvCpltCallback must be implemented in the user file.
*/ */
@ -1497,6 +1527,9 @@ __weak void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)
*/ */
__weak void HAL_ADC_ConvHalfCpltCallback(ADC_HandleTypeDef* hadc) __weak void HAL_ADC_ConvHalfCpltCallback(ADC_HandleTypeDef* hadc)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hadc);
/* NOTE : This function should not be modified. When the callback is needed, /* NOTE : This function should not be modified. When the callback is needed,
function HAL_ADC_ConvHalfCpltCallback must be implemented in the user file. function HAL_ADC_ConvHalfCpltCallback must be implemented in the user file.
*/ */
@ -1509,6 +1542,9 @@ __weak void HAL_ADC_ConvHalfCpltCallback(ADC_HandleTypeDef* hadc)
*/ */
__weak void HAL_ADC_LevelOutOfWindowCallback(ADC_HandleTypeDef* hadc) __weak void HAL_ADC_LevelOutOfWindowCallback(ADC_HandleTypeDef* hadc)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hadc);
/* NOTE : This function should not be modified. When the callback is needed, /* NOTE : This function should not be modified. When the callback is needed,
function HAL_ADC_LevelOoutOfWindowCallback must be implemented in the user file. function HAL_ADC_LevelOoutOfWindowCallback must be implemented in the user file.
*/ */
@ -1522,6 +1558,9 @@ __weak void HAL_ADC_LevelOutOfWindowCallback(ADC_HandleTypeDef* hadc)
*/ */
__weak void HAL_ADC_ErrorCallback(ADC_HandleTypeDef *hadc) __weak void HAL_ADC_ErrorCallback(ADC_HandleTypeDef *hadc)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hadc);
/* NOTE : This function should not be modified. When the callback is needed, /* NOTE : This function should not be modified. When the callback is needed,
function HAL_ADC_ErrorCallback must be implemented in the user file. function HAL_ADC_ErrorCallback must be implemented in the user file.
*/ */
@ -1817,7 +1856,12 @@ HAL_StatusTypeDef HAL_ADC_AnalogWDGConfig(ADC_HandleTypeDef* hadc, ADC_AnalogWDG
*/ */
/** /**
* @brief return the ADC state * @brief Return the ADC state
* @note ADC state machine is managed by bitfields, ADC status must be
* compared with states bits.
* For example:
* " if (HAL_IS_BIT_SET(HAL_ADC_GetState(hadc1), HAL_ADC_STATE_REG_BUSY)) "
* " if (HAL_IS_BIT_SET(HAL_ADC_GetState(hadc1), HAL_ADC_STATE_AWD1) ) "
* @param hadc: ADC handle * @param hadc: ADC handle
* @retval HAL state * @retval HAL state
*/ */

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_adc.h * @file stm32f0xx_hal_adc.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file containing functions prototypes of ADC HAL library. * @brief Header file containing functions prototypes of ADC HAL library.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -180,6 +180,11 @@ typedef struct
/** /**
* @brief HAL ADC state machine: ADC states definition (bitfields) * @brief HAL ADC state machine: ADC states definition (bitfields)
* @note ADC state machine is managed by bitfields, state must be compared
* with bit by bit.
* For example:
* " if (HAL_IS_BIT_SET(HAL_ADC_GetState(hadc1), HAL_ADC_STATE_REG_BUSY)) "
* " if (HAL_IS_BIT_SET(HAL_ADC_GetState(hadc1), HAL_ADC_STATE_AWD1) ) "
*/ */
/* States of ADC global scope */ /* States of ADC global scope */
#define HAL_ADC_STATE_RESET ((uint32_t)0x00000000) /*!< ADC not yet initialized or disabled */ #define HAL_ADC_STATE_RESET ((uint32_t)0x00000000) /*!< ADC not yet initialized or disabled */

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_adc_ex.c * @file stm32f0xx_hal_adc_ex.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief This file provides firmware functions to manage the following * @brief This file provides firmware functions to manage the following
* functionalities of the Analog to Digital Convertor (ADC) * functionalities of the Analog to Digital Convertor (ADC)
* peripheral: * peripheral:
@ -21,7 +21,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_adc_ex.h * @file stm32f0xx_hal_adc_ex.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of ADC HAL Extension module. * @brief Header file of ADC HAL Extension module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -198,7 +198,7 @@
)? \ )? \
(ADC_CCR_TSEN) \ (ADC_CCR_TSEN) \
: \ : \
(ADC_CHANNEL_VREFINT) \ (ADC_CCR_VREFEN) \
) )
#endif #endif

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_can.c * @file stm32f0xx_hal_can.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief CAN HAL module driver. * @brief CAN HAL module driver.
* This file provides firmware functions to manage the following * This file provides firmware functions to manage the following
* functionalities of the Controller Area Network (CAN) peripheral: * functionalities of the Controller Area Network (CAN) peripheral:
@ -71,7 +71,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -481,6 +481,9 @@ HAL_StatusTypeDef HAL_CAN_DeInit(CAN_HandleTypeDef* hcan)
*/ */
__weak void HAL_CAN_MspInit(CAN_HandleTypeDef* hcan) __weak void HAL_CAN_MspInit(CAN_HandleTypeDef* hcan)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hcan);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_CAN_MspInit could be implemented in the user file the HAL_CAN_MspInit could be implemented in the user file
*/ */
@ -494,6 +497,9 @@ __weak void HAL_CAN_MspInit(CAN_HandleTypeDef* hcan)
*/ */
__weak void HAL_CAN_MspDeInit(CAN_HandleTypeDef* hcan) __weak void HAL_CAN_MspDeInit(CAN_HandleTypeDef* hcan)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hcan);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_CAN_MspDeInit could be implemented in the user file the HAL_CAN_MspDeInit could be implemented in the user file
*/ */
@ -537,6 +543,10 @@ HAL_StatusTypeDef HAL_CAN_Transmit(CAN_HandleTypeDef* hcan, uint32_t Timeout)
assert_param(IS_CAN_RTR(hcan->pTxMsg->RTR)); assert_param(IS_CAN_RTR(hcan->pTxMsg->RTR));
assert_param(IS_CAN_DLC(hcan->pTxMsg->DLC)); assert_param(IS_CAN_DLC(hcan->pTxMsg->DLC));
if(((hcan->Instance->TSR&CAN_TSR_TME0) == CAN_TSR_TME0) || \
((hcan->Instance->TSR&CAN_TSR_TME1) == CAN_TSR_TME1) || \
((hcan->Instance->TSR&CAN_TSR_TME2) == CAN_TSR_TME2))
{
/* Process locked */ /* Process locked */
__HAL_LOCK(hcan); __HAL_LOCK(hcan);
@ -560,13 +570,11 @@ HAL_StatusTypeDef HAL_CAN_Transmit(CAN_HandleTypeDef* hcan, uint32_t Timeout)
{ {
transmitmailbox = 1; transmitmailbox = 1;
} }
else if ((hcan->Instance->TSR&CAN_TSR_TME2) == CAN_TSR_TME2) else
{ {
transmitmailbox = 2; transmitmailbox = 2;
} }
if (transmitmailbox != CAN_TXSTATUS_NOMAILBOX)
{
/* Set up the Id */ /* Set up the Id */
hcan->Instance->sTxMailBox[transmitmailbox].TIR &= CAN_TI0R_TXRQ; hcan->Instance->sTxMailBox[transmitmailbox].TIR &= CAN_TI0R_TXRQ;
if (hcan->pTxMsg->IDE == CAN_ID_STD) if (hcan->pTxMsg->IDE == CAN_ID_STD)
@ -585,7 +593,7 @@ HAL_StatusTypeDef HAL_CAN_Transmit(CAN_HandleTypeDef* hcan, uint32_t Timeout)
/* Set up the DLC */ /* Set up the DLC */
hcan->pTxMsg->DLC &= (uint8_t)0x0000000F; hcan->pTxMsg->DLC &= (uint8_t)0x0000000F;
hcan->Instance->sTxMailBox[transmitmailbox].TDTR &= (uint32_t)0xFFFFFFF0; hcan->Instance->sTxMailBox[transmitmailbox].TDTR &= (uint32_t)0xFFFFFFF0U;
hcan->Instance->sTxMailBox[transmitmailbox].TDTR |= hcan->pTxMsg->DLC; hcan->Instance->sTxMailBox[transmitmailbox].TDTR |= hcan->pTxMsg->DLC;
/* Set up the data field */ /* Set up the data field */
@ -640,9 +648,6 @@ HAL_StatusTypeDef HAL_CAN_Transmit(CAN_HandleTypeDef* hcan, uint32_t Timeout)
/* Change CAN state */ /* Change CAN state */
hcan->State = HAL_CAN_STATE_ERROR; hcan->State = HAL_CAN_STATE_ERROR;
/* Process unlocked */
__HAL_UNLOCK(hcan);
/* Return function status */ /* Return function status */
return HAL_ERROR; return HAL_ERROR;
} }
@ -663,7 +668,9 @@ HAL_StatusTypeDef HAL_CAN_Transmit_IT(CAN_HandleTypeDef* hcan)
assert_param(IS_CAN_RTR(hcan->pTxMsg->RTR)); assert_param(IS_CAN_RTR(hcan->pTxMsg->RTR));
assert_param(IS_CAN_DLC(hcan->pTxMsg->DLC)); assert_param(IS_CAN_DLC(hcan->pTxMsg->DLC));
if((hcan->State == HAL_CAN_STATE_READY) || (hcan->State == HAL_CAN_STATE_BUSY_RX)) if(((hcan->Instance->TSR&CAN_TSR_TME0) == CAN_TSR_TME0) || \
((hcan->Instance->TSR&CAN_TSR_TME1) == CAN_TSR_TME1) || \
((hcan->Instance->TSR&CAN_TSR_TME2) == CAN_TSR_TME2))
{ {
/* Process Locked */ /* Process Locked */
__HAL_LOCK(hcan); __HAL_LOCK(hcan);
@ -677,13 +684,11 @@ HAL_StatusTypeDef HAL_CAN_Transmit_IT(CAN_HandleTypeDef* hcan)
{ {
transmitmailbox = 1; transmitmailbox = 1;
} }
else if((hcan->Instance->TSR&CAN_TSR_TME2) == CAN_TSR_TME2) else
{ {
transmitmailbox = 2; transmitmailbox = 2;
} }
if(transmitmailbox != CAN_TXSTATUS_NOMAILBOX)
{
/* Set up the Id */ /* Set up the Id */
hcan->Instance->sTxMailBox[transmitmailbox].TIR &= CAN_TI0R_TXRQ; hcan->Instance->sTxMailBox[transmitmailbox].TIR &= CAN_TI0R_TXRQ;
if(hcan->pTxMsg->IDE == CAN_ID_STD) if(hcan->pTxMsg->IDE == CAN_ID_STD)
@ -702,7 +707,7 @@ HAL_StatusTypeDef HAL_CAN_Transmit_IT(CAN_HandleTypeDef* hcan)
/* Set up the DLC */ /* Set up the DLC */
hcan->pTxMsg->DLC &= (uint8_t)0x0000000F; hcan->pTxMsg->DLC &= (uint8_t)0x0000000F;
hcan->Instance->sTxMailBox[transmitmailbox].TDTR &= (uint32_t)0xFFFFFFF0; hcan->Instance->sTxMailBox[transmitmailbox].TDTR &= (uint32_t)0xFFFFFFF0U;
hcan->Instance->sTxMailBox[transmitmailbox].TDTR |= hcan->pTxMsg->DLC; hcan->Instance->sTxMailBox[transmitmailbox].TDTR |= hcan->pTxMsg->DLC;
/* Set up the data field */ /* Set up the data field */
@ -753,10 +758,13 @@ HAL_StatusTypeDef HAL_CAN_Transmit_IT(CAN_HandleTypeDef* hcan)
/* Request transmission */ /* Request transmission */
hcan->Instance->sTxMailBox[transmitmailbox].TIR |= CAN_TI0R_TXRQ; hcan->Instance->sTxMailBox[transmitmailbox].TIR |= CAN_TI0R_TXRQ;
} }
}
else else
{ {
return HAL_BUSY; /* Change CAN state */
hcan->State = HAL_CAN_STATE_ERROR;
/* Return function status */
return HAL_ERROR;
} }
return HAL_OK; return HAL_OK;
@ -1153,6 +1161,8 @@ void HAL_CAN_IRQHandler(CAN_HandleTypeDef* hcan)
/* Call the Error call Back in case of Errors */ /* Call the Error call Back in case of Errors */
if(hcan->ErrorCode != HAL_CAN_ERROR_NONE) if(hcan->ErrorCode != HAL_CAN_ERROR_NONE)
{ {
/* Clear ERRI Flag */
hcan->Instance->MSR |= CAN_MSR_ERRI;
/* Set the CAN state ready to be able to start again the process */ /* Set the CAN state ready to be able to start again the process */
hcan->State = HAL_CAN_STATE_READY; hcan->State = HAL_CAN_STATE_READY;
/* Call Error callback function */ /* Call Error callback function */
@ -1168,6 +1178,9 @@ void HAL_CAN_IRQHandler(CAN_HandleTypeDef* hcan)
*/ */
__weak void HAL_CAN_TxCpltCallback(CAN_HandleTypeDef* hcan) __weak void HAL_CAN_TxCpltCallback(CAN_HandleTypeDef* hcan)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hcan);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_CAN_TxCpltCallback could be implemented in the user file the HAL_CAN_TxCpltCallback could be implemented in the user file
*/ */
@ -1181,6 +1194,9 @@ __weak void HAL_CAN_TxCpltCallback(CAN_HandleTypeDef* hcan)
*/ */
__weak void HAL_CAN_RxCpltCallback(CAN_HandleTypeDef* hcan) __weak void HAL_CAN_RxCpltCallback(CAN_HandleTypeDef* hcan)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hcan);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_CAN_RxCpltCallback could be implemented in the user file the HAL_CAN_RxCpltCallback could be implemented in the user file
*/ */
@ -1194,6 +1210,9 @@ __weak void HAL_CAN_RxCpltCallback(CAN_HandleTypeDef* hcan)
*/ */
__weak void HAL_CAN_ErrorCallback(CAN_HandleTypeDef *hcan) __weak void HAL_CAN_ErrorCallback(CAN_HandleTypeDef *hcan)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hcan);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_CAN_ErrorCallback could be implemented in the user file the HAL_CAN_ErrorCallback could be implemented in the user file
*/ */

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_can.h * @file stm32f0xx_hal_can.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of CAN HAL module. * @brief Header file of CAN HAL module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_cec.c * @file stm32f0xx_hal_cec.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief CEC HAL module driver. * @brief CEC HAL module driver.
* This file provides firmware functions to manage the following * This file provides firmware functions to manage the following
* functionalities of the High Definition Multimedia Interface * functionalities of the High Definition Multimedia Interface
@ -47,7 +47,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -249,6 +249,9 @@ HAL_StatusTypeDef HAL_CEC_DeInit(CEC_HandleTypeDef *hcec)
*/ */
__weak void HAL_CEC_MspInit(CEC_HandleTypeDef *hcec) __weak void HAL_CEC_MspInit(CEC_HandleTypeDef *hcec)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hcec);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_CEC_MspInit can be implemented in the user file the HAL_CEC_MspInit can be implemented in the user file
*/ */
@ -261,6 +264,9 @@ HAL_StatusTypeDef HAL_CEC_DeInit(CEC_HandleTypeDef *hcec)
*/ */
__weak void HAL_CEC_MspDeInit(CEC_HandleTypeDef *hcec) __weak void HAL_CEC_MspDeInit(CEC_HandleTypeDef *hcec)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hcec);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_CEC_MspDeInit can be implemented in the user file the HAL_CEC_MspDeInit can be implemented in the user file
*/ */
@ -884,6 +890,9 @@ void HAL_CEC_IRQHandler(CEC_HandleTypeDef *hcec)
*/ */
__weak void HAL_CEC_TxCpltCallback(CEC_HandleTypeDef *hcec) __weak void HAL_CEC_TxCpltCallback(CEC_HandleTypeDef *hcec)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hcec);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_CEC_TxCpltCallback can be implemented in the user file the HAL_CEC_TxCpltCallback can be implemented in the user file
*/ */
@ -896,6 +905,9 @@ void HAL_CEC_IRQHandler(CEC_HandleTypeDef *hcec)
*/ */
__weak void HAL_CEC_RxCpltCallback(CEC_HandleTypeDef *hcec) __weak void HAL_CEC_RxCpltCallback(CEC_HandleTypeDef *hcec)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hcec);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_CEC_TxCpltCallback can be implemented in the user file the HAL_CEC_TxCpltCallback can be implemented in the user file
*/ */
@ -908,6 +920,9 @@ __weak void HAL_CEC_RxCpltCallback(CEC_HandleTypeDef *hcec)
*/ */
__weak void HAL_CEC_ErrorCallback(CEC_HandleTypeDef *hcec) __weak void HAL_CEC_ErrorCallback(CEC_HandleTypeDef *hcec)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hcec);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_CEC_ErrorCallback can be implemented in the user file the HAL_CEC_ErrorCallback can be implemented in the user file
*/ */

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_cec.h * @file stm32f0xx_hal_cec.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of CEC HAL module. * @brief Header file of CEC HAL module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_comp.c * @file stm32f0xx_hal_comp.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief COMP HAL module driver. * @brief COMP HAL module driver.
* This file provides firmware functions to manage the following * This file provides firmware functions to manage the following
* functionalities of the COMP peripheral: * functionalities of the COMP peripheral:
@ -128,7 +128,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -350,6 +350,9 @@ HAL_StatusTypeDef HAL_COMP_DeInit(COMP_HandleTypeDef *hcomp)
*/ */
__weak void HAL_COMP_MspInit(COMP_HandleTypeDef *hcomp) __weak void HAL_COMP_MspInit(COMP_HandleTypeDef *hcomp)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hcomp);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_COMP_MspInit could be implenetd in the user file the HAL_COMP_MspInit could be implenetd in the user file
*/ */
@ -362,6 +365,9 @@ __weak void HAL_COMP_MspInit(COMP_HandleTypeDef *hcomp)
*/ */
__weak void HAL_COMP_MspDeInit(COMP_HandleTypeDef *hcomp) __weak void HAL_COMP_MspDeInit(COMP_HandleTypeDef *hcomp)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hcomp);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_COMP_MspDeInit could be implenetd in the user file the HAL_COMP_MspDeInit could be implenetd in the user file
*/ */
@ -648,6 +654,9 @@ uint32_t HAL_COMP_GetOutputLevel(COMP_HandleTypeDef *hcomp)
*/ */
__weak void HAL_COMP_TriggerCallback(COMP_HandleTypeDef *hcomp) __weak void HAL_COMP_TriggerCallback(COMP_HandleTypeDef *hcomp)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hcomp);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_COMP_TriggerCallback should be implemented in the user file the HAL_COMP_TriggerCallback should be implemented in the user file
*/ */

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_comp.h * @file stm32f0xx_hal_comp.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of COMP HAL module. * @brief Header file of COMP HAL module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_conf.h * @file stm32f0xx_hal_conf.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief HAL configuration file. * @brief HAL configuration file.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -93,7 +93,7 @@
* Timeout value * Timeout value
*/ */
#if !defined (HSE_STARTUP_TIMEOUT) #if !defined (HSE_STARTUP_TIMEOUT)
#define HSE_STARTUP_TIMEOUT ((uint32_t)200) /*!< Time out for HSE start up, in ms */ #define HSE_STARTUP_TIMEOUT ((uint32_t)100) /*!< Time out for HSE start up, in ms */
#endif /* HSE_STARTUP_TIMEOUT */ #endif /* HSE_STARTUP_TIMEOUT */
/** /**
@ -110,7 +110,7 @@
* Timeout value * Timeout value
*/ */
#if !defined (HSI_STARTUP_TIMEOUT) #if !defined (HSI_STARTUP_TIMEOUT)
#define HSI_STARTUP_TIMEOUT ((uint32_t)100) /*!< Time out for HSI start up */ #define HSI_STARTUP_TIMEOUT ((uint32_t)5000) /*!< Time out for HSI start up */
#endif /* HSI_STARTUP_TIMEOUT */ #endif /* HSI_STARTUP_TIMEOUT */
/** /**
@ -146,9 +146,12 @@
#define LSE_VALUE ((uint32_t)32768) /*!< Value of the External Low Speed oscillator in Hz */ #define LSE_VALUE ((uint32_t)32768) /*!< Value of the External Low Speed oscillator in Hz */
#endif /* LSE_VALUE */ #endif /* LSE_VALUE */
/**
* @brief Time out for LSE start up value in ms.
*/
#if !defined (LSE_STARTUP_TIMEOUT) #if !defined (LSE_STARTUP_TIMEOUT)
#define LSE_STARTUP_TIMEOUT ((uint32_t)5000) /*!< Time out for LSE start up, in ms */ #define LSE_STARTUP_TIMEOUT ((uint32_t)5000) /*!< Time out for LSE start up, in ms */
#endif /* HSE_STARTUP_TIMEOUT */ #endif /* LSE_STARTUP_TIMEOUT */
/* Tip: To avoid modifying this file each time you need to use different HSE, /* Tip: To avoid modifying this file each time you need to use different HSE,

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_cortex.c * @file stm32f0xx_hal_cortex.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief CORTEX HAL module driver. * @brief CORTEX HAL module driver.
* This file provides firmware functions to manage the following * This file provides firmware functions to manage the following
* functionalities of the CORTEX: * functionalities of the CORTEX:
@ -52,8 +52,8 @@
(++) Starts the SysTick Counter. (++) Starts the SysTick Counter.
(+) You can change the SysTick Clock source to be HCLK_Div8 by calling the macro (+) You can change the SysTick Clock source to be HCLK_Div8 by calling the macro
__HAL_CORTEX_SYSTICKCLK_CONFIG(SYSTICK_CLKSOURCE_HCLK_DIV8) just after the HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK_DIV8) just after the
HAL_SYSTICK_Config() function call. The __HAL_CORTEX_SYSTICKCLK_CONFIG() macro is defined HAL_SYSTICK_Config() function call. The HAL_SYSTICK_CLKSourceConfig() macro is defined
inside the stm32f0xx_hal_cortex.h file. inside the stm32f0xx_hal_cortex.h file.
(+) You can change the SysTick IRQ priority by calling the (+) You can change the SysTick IRQ priority by calling the
@ -70,7 +70,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_cortex.h * @file stm32f0xx_hal_cortex.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of CORTEX HAL module. * @brief Header file of CORTEX HAL module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -75,30 +75,6 @@
*/ */
/* Exported Macros -----------------------------------------------------------*/ /* Exported Macros -----------------------------------------------------------*/
/** @defgroup CORTEX_Exported_Macro CORTEX Exported Macro
* @{
*/
/** @brief Configures the SysTick clock source.
* @param __CLKSRC__: specifies the SysTick clock source.
* This parameter can be one of the following values:
* @arg SYSTICK_CLKSOURCE_HCLK_DIV8: AHB clock divided by 8 selected as SysTick clock source.
* @arg SYSTICK_CLKSOURCE_HCLK: AHB clock selected as SysTick clock source.
* @retval None
*/
#define __HAL_CORTEX_SYSTICKCLK_CONFIG(__CLKSRC__) \
do { \
if ((__CLKSRC__) == SYSTICK_CLKSOURCE_HCLK) \
{ \
SysTick->CTRL |= SYSTICK_CLKSOURCE_HCLK; \
} \
else \
SysTick->CTRL &= ~SYSTICK_CLKSOURCE_HCLK; \
} while(0)
/**
* @}
*/
/* Exported functions --------------------------------------------------------*/ /* Exported functions --------------------------------------------------------*/
/** @addtogroup CORTEX_Exported_Functions CORTEX Exported Functions /** @addtogroup CORTEX_Exported_Functions CORTEX Exported Functions

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_crc.c * @file stm32f0xx_hal_crc.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief CRC HAL module driver. * @brief CRC HAL module driver.
* This file provides firmware functions to manage the following * This file provides firmware functions to manage the following
* functionalities of the Cyclic Redundancy Check (CRC) peripheral: * functionalities of the Cyclic Redundancy Check (CRC) peripheral:
@ -33,7 +33,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -225,6 +225,9 @@ HAL_StatusTypeDef HAL_CRC_DeInit(CRC_HandleTypeDef *hcrc)
*/ */
__weak void HAL_CRC_MspInit(CRC_HandleTypeDef *hcrc) __weak void HAL_CRC_MspInit(CRC_HandleTypeDef *hcrc)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hcrc);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_CRC_MspInit can be implemented in the user file the HAL_CRC_MspInit can be implemented in the user file
*/ */
@ -237,6 +240,9 @@ __weak void HAL_CRC_MspInit(CRC_HandleTypeDef *hcrc)
*/ */
__weak void HAL_CRC_MspDeInit(CRC_HandleTypeDef *hcrc) __weak void HAL_CRC_MspDeInit(CRC_HandleTypeDef *hcrc)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hcrc);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_CRC_MspDeInit can be implemented in the user file the HAL_CRC_MspDeInit can be implemented in the user file
*/ */
@ -272,7 +278,13 @@ __weak void HAL_CRC_MspDeInit(CRC_HandleTypeDef *hcrc)
* @param hcrc: CRC handle * @param hcrc: CRC handle
* @param pBuffer: pointer to the input data buffer, exact input data format is * @param pBuffer: pointer to the input data buffer, exact input data format is
* provided by hcrc->InputDataFormat. * provided by hcrc->InputDataFormat.
* @param BufferLength: input data buffer length * @param BufferLength: input data buffer length (number of bytes if pBuffer
* type is * uint8_t, number of half-words if pBuffer type is * uint16_t,
* number of words if pBuffer type is * uint32_t).
* @note By default, the API expects a uint32_t pointer as input buffer parameter.
* Input buffer pointers with other types simply need to be cast in uint32_t
* and the API will internally adjust its input data processing based on the
* handle field hcrc->InputDataFormat.
* @retval uint32_t CRC (returned value LSBs for CRC shorter than 32 bits) * @retval uint32_t CRC (returned value LSBs for CRC shorter than 32 bits)
*/ */
uint32_t HAL_CRC_Accumulate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength) uint32_t HAL_CRC_Accumulate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength)
@ -326,7 +338,13 @@ uint32_t HAL_CRC_Accumulate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_
* @param hcrc: CRC handle * @param hcrc: CRC handle
* @param pBuffer: pointer to the input data buffer, exact input data format is * @param pBuffer: pointer to the input data buffer, exact input data format is
* provided by hcrc->InputDataFormat. * provided by hcrc->InputDataFormat.
* @param BufferLength: input data buffer length * @param BufferLength: input data buffer length (number of bytes if pBuffer
* type is * uint8_t, number of half-words if pBuffer type is * uint16_t,
* number of words if pBuffer type is * uint32_t).
* @note By default, the API expects a uint32_t pointer as input buffer parameter.
* Input buffer pointers with other types simply need to be cast in uint32_t
* and the API will internally adjust its input data processing based on the
* handle field hcrc->InputDataFormat.
* @retval uint32_t CRC (returned value LSBs for CRC shorter than 32 bits) * @retval uint32_t CRC (returned value LSBs for CRC shorter than 32 bits)
*/ */
uint32_t HAL_CRC_Calculate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength) uint32_t HAL_CRC_Calculate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength)

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_crc.h * @file stm32f0xx_hal_crc.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of CRC HAL module. * @brief Header file of CRC HAL module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -157,7 +157,7 @@ typedef struct
/** @defgroup CRC_Default_InitValue Default CRC computation initialization value /** @defgroup CRC_Default_InitValue Default CRC computation initialization value
* @{ * @{
*/ */
#define DEFAULT_CRC_INITVALUE 0xFFFFFFFF #define DEFAULT_CRC_INITVALUE 0xFFFFFFFFU
/** /**
* @} * @}

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_crc_ex.c * @file stm32f0xx_hal_crc_ex.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Extended CRC HAL module driver. * @brief Extended CRC HAL module driver.
* This file provides firmware functions to manage the following * This file provides firmware functions to manage the following
* functionalities of the CRC peripheral: * functionalities of the CRC peripheral:
@ -11,9 +11,6 @@
* *
@verbatim @verbatim
================================================================================ ================================================================================
##### Product specific features #####
================================================================================
##### How to use this driver ##### ##### How to use this driver #####
================================================================================ ================================================================================
[..] [..]
@ -25,7 +22,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_crc_ex.h * @file stm32f0xx_hal_crc_ex.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of CRC HAL extension module. * @brief Header file of CRC HAL extension module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_dac.c * @file stm32f0xx_hal_dac.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief DAC HAL module driver. * @brief DAC HAL module driver.
* This file provides firmware functions to manage the following * This file provides firmware functions to manage the following
* functionalities of the Digital to Analog Converter (DAC) peripheral: * functionalities of the Digital to Analog Converter (DAC) peripheral:
@ -168,7 +168,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -337,6 +337,9 @@ HAL_StatusTypeDef HAL_DAC_DeInit(DAC_HandleTypeDef* hdac)
*/ */
__weak void HAL_DAC_MspInit(DAC_HandleTypeDef* hdac) __weak void HAL_DAC_MspInit(DAC_HandleTypeDef* hdac)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hdac);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_DAC_MspInit could be implemented in the user file the HAL_DAC_MspInit could be implemented in the user file
*/ */
@ -350,6 +353,9 @@ __weak void HAL_DAC_MspInit(DAC_HandleTypeDef* hdac)
*/ */
__weak void HAL_DAC_MspDeInit(DAC_HandleTypeDef* hdac) __weak void HAL_DAC_MspDeInit(DAC_HandleTypeDef* hdac)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hdac);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_DAC_MspDeInit could be implemented in the user file the HAL_DAC_MspDeInit could be implemented in the user file
*/ */
@ -389,6 +395,10 @@ __weak void HAL_DAC_MspDeInit(DAC_HandleTypeDef* hdac)
*/ */
__weak HAL_StatusTypeDef HAL_DAC_Start(DAC_HandleTypeDef* hdac, uint32_t Channel) __weak HAL_StatusTypeDef HAL_DAC_Start(DAC_HandleTypeDef* hdac, uint32_t Channel)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hdac);
UNUSED(Channel);
/* Note : This function is defined into this file for library reference. */ /* Note : This function is defined into this file for library reference. */
/* Function content is located into file stm32f0xx_hal_dac_ex.c */ /* Function content is located into file stm32f0xx_hal_dac_ex.c */
@ -440,6 +450,13 @@ HAL_StatusTypeDef HAL_DAC_Stop(DAC_HandleTypeDef* hdac, uint32_t Channel)
*/ */
__weak HAL_StatusTypeDef HAL_DAC_Start_DMA(DAC_HandleTypeDef* hdac, uint32_t Channel, uint32_t* pData, uint32_t Length, uint32_t Alignment) __weak HAL_StatusTypeDef HAL_DAC_Start_DMA(DAC_HandleTypeDef* hdac, uint32_t Channel, uint32_t* pData, uint32_t Length, uint32_t Alignment)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hdac);
UNUSED(Channel);
UNUSED(pData);
UNUSED(Length);
UNUSED(Alignment);
/* Note : This function is defined into this file for library reference. */ /* Note : This function is defined into this file for library reference. */
/* Function content is located into file stm32f0xx_hal_dac_ex.c */ /* Function content is located into file stm32f0xx_hal_dac_ex.c */
@ -520,6 +537,9 @@ HAL_StatusTypeDef HAL_DAC_Stop_DMA(DAC_HandleTypeDef* hdac, uint32_t Channel)
*/ */
__weak void HAL_DAC_IRQHandler(DAC_HandleTypeDef* hdac) __weak void HAL_DAC_IRQHandler(DAC_HandleTypeDef* hdac)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hdac);
/* Note : This function is defined into this file for library reference. */ /* Note : This function is defined into this file for library reference. */
/* Function content is located into file stm32f0xx_hal_dac_ex.c */ /* Function content is located into file stm32f0xx_hal_dac_ex.c */
} }
@ -574,6 +594,9 @@ HAL_StatusTypeDef HAL_DAC_SetValue(DAC_HandleTypeDef* hdac, uint32_t Channel, ui
*/ */
__weak void HAL_DAC_ConvCpltCallbackCh1(DAC_HandleTypeDef* hdac) __weak void HAL_DAC_ConvCpltCallbackCh1(DAC_HandleTypeDef* hdac)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hdac);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_DAC_ConvCpltCallbackCh1 could be implemented in the user file the HAL_DAC_ConvCpltCallbackCh1 could be implemented in the user file
*/ */
@ -587,6 +610,9 @@ __weak void HAL_DAC_ConvCpltCallbackCh1(DAC_HandleTypeDef* hdac)
*/ */
__weak void HAL_DAC_ConvHalfCpltCallbackCh1(DAC_HandleTypeDef* hdac) __weak void HAL_DAC_ConvHalfCpltCallbackCh1(DAC_HandleTypeDef* hdac)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hdac);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_DAC_ConvHalfCpltCallbackCh1 could be implemented in the user file the HAL_DAC_ConvHalfCpltCallbackCh1 could be implemented in the user file
*/ */
@ -600,6 +626,9 @@ __weak void HAL_DAC_ConvHalfCpltCallbackCh1(DAC_HandleTypeDef* hdac)
*/ */
__weak void HAL_DAC_ErrorCallbackCh1(DAC_HandleTypeDef *hdac) __weak void HAL_DAC_ErrorCallbackCh1(DAC_HandleTypeDef *hdac)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hdac);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_DAC_ErrorCallbackCh1 could be implemented in the user file the HAL_DAC_ErrorCallbackCh1 could be implemented in the user file
*/ */
@ -613,6 +642,9 @@ __weak void HAL_DAC_ErrorCallbackCh1(DAC_HandleTypeDef *hdac)
*/ */
__weak void HAL_DAC_DMAUnderrunCallbackCh1(DAC_HandleTypeDef *hdac) __weak void HAL_DAC_DMAUnderrunCallbackCh1(DAC_HandleTypeDef *hdac)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hdac);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_DAC_DMAUnderrunCallbackCh1 could be implemented in the user file the HAL_DAC_DMAUnderrunCallbackCh1 could be implemented in the user file
*/ */
@ -649,6 +681,10 @@ __weak void HAL_DAC_DMAUnderrunCallbackCh1(DAC_HandleTypeDef *hdac)
*/ */
__weak uint32_t HAL_DAC_GetValue(DAC_HandleTypeDef* hdac, uint32_t Channel) __weak uint32_t HAL_DAC_GetValue(DAC_HandleTypeDef* hdac, uint32_t Channel)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hdac);
UNUSED(Channel);
/* Note : This function is defined into this file for library reference. */ /* Note : This function is defined into this file for library reference. */
/* Function content is located into file stm32f0xx_hal_dac_ex.c */ /* Function content is located into file stm32f0xx_hal_dac_ex.c */
@ -669,6 +705,11 @@ __weak uint32_t HAL_DAC_GetValue(DAC_HandleTypeDef* hdac, uint32_t Channel)
*/ */
__weak HAL_StatusTypeDef HAL_DAC_ConfigChannel(DAC_HandleTypeDef* hdac, DAC_ChannelConfTypeDef* sConfig, uint32_t Channel) __weak HAL_StatusTypeDef HAL_DAC_ConfigChannel(DAC_HandleTypeDef* hdac, DAC_ChannelConfTypeDef* sConfig, uint32_t Channel)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hdac);
UNUSED(sConfig);
UNUSED(Channel);
/* Note : This function is defined into this file for library reference. */ /* Note : This function is defined into this file for library reference. */
/* Function content is located into file stm32f0xx_hal_dac_ex.c */ /* Function content is located into file stm32f0xx_hal_dac_ex.c */

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_dac.h * @file stm32f0xx_hal_dac.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of DAC HAL module. * @brief Header file of DAC HAL module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_dac_ex.c * @file stm32f0xx_hal_dac_ex.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief DAC HAL module driver. * @brief DAC HAL module driver.
* This file provides firmware functions to manage the extended * This file provides firmware functions to manage the extended
* functionalities of the DAC peripheral. * functionalities of the DAC peripheral.
@ -24,7 +24,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -1109,6 +1109,9 @@ HAL_StatusTypeDef HAL_DACEx_DualSetValue(DAC_HandleTypeDef* hdac, uint32_t Align
*/ */
__weak void HAL_DACEx_ConvCpltCallbackCh2(DAC_HandleTypeDef* hdac) __weak void HAL_DACEx_ConvCpltCallbackCh2(DAC_HandleTypeDef* hdac)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hdac);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_DAC_ConvCpltCallback could be implemented in the user file the HAL_DAC_ConvCpltCallback could be implemented in the user file
*/ */
@ -1122,6 +1125,9 @@ __weak void HAL_DACEx_ConvCpltCallbackCh2(DAC_HandleTypeDef* hdac)
*/ */
__weak void HAL_DACEx_ConvHalfCpltCallbackCh2(DAC_HandleTypeDef* hdac) __weak void HAL_DACEx_ConvHalfCpltCallbackCh2(DAC_HandleTypeDef* hdac)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hdac);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_DAC_ConvHalfCpltCallbackCh2 could be implemented in the user file the HAL_DAC_ConvHalfCpltCallbackCh2 could be implemented in the user file
*/ */
@ -1135,6 +1141,9 @@ __weak void HAL_DACEx_ConvHalfCpltCallbackCh2(DAC_HandleTypeDef* hdac)
*/ */
__weak void HAL_DACEx_ErrorCallbackCh2(DAC_HandleTypeDef *hdac) __weak void HAL_DACEx_ErrorCallbackCh2(DAC_HandleTypeDef *hdac)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hdac);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_DAC_ErrorCallback could be implemented in the user file the HAL_DAC_ErrorCallback could be implemented in the user file
*/ */
@ -1148,6 +1157,9 @@ __weak void HAL_DACEx_ErrorCallbackCh2(DAC_HandleTypeDef *hdac)
*/ */
__weak void HAL_DACEx_DMAUnderrunCallbackCh2(DAC_HandleTypeDef *hdac) __weak void HAL_DACEx_DMAUnderrunCallbackCh2(DAC_HandleTypeDef *hdac)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hdac);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_DAC_DMAUnderrunCallbackCh2 could be implemented in the user file the HAL_DAC_DMAUnderrunCallbackCh2 could be implemented in the user file
*/ */

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_dac_ex.h * @file stm32f0xx_hal_dac_ex.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of DAC HAL Extension module. * @brief Header file of DAC HAL Extension module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:

View File

@ -2,14 +2,14 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_def.h * @file stm32f0xx_hal_def.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief This file contains HAL common defines, enumeration, macros and * @brief This file contains HAL common defines, enumeration, macros and
* structures definitions. * structures definitions.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -73,7 +73,7 @@ typedef enum
/* Exported macro ------------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/
#define HAL_MAX_DELAY 0xFFFFFFFF #define HAL_MAX_DELAY 0xFFFFFFFFU
#define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != RESET) #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != RESET)
#define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == RESET) #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == RESET)

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_dma.c * @file stm32f0xx_hal_dma.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief DMA HAL module driver. * @brief DMA HAL module driver.
* *
* This file provides firmware functions to manage the following * This file provides firmware functions to manage the following
@ -73,7 +73,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_dma.h * @file stm32f0xx_hal_dma.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of DMA HAL module. * @brief Header file of DMA HAL module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_dma_ex.h * @file stm32f0xx_hal_dma_ex.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of DMA HAL Extension module. * @brief Header file of DMA HAL Extension module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_flash.c * @file stm32f0xx_hal_flash.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief FLASH HAL module driver. * @brief FLASH HAL module driver.
* This file provides firmware functions to manage the following * This file provides firmware functions to manage the following
* functionalities of the internal FLASH memory: * functionalities of the internal FLASH memory:
@ -63,7 +63,7 @@
[..] In addition to these function, this driver includes a set of macros allowing [..] In addition to these function, this driver includes a set of macros allowing
to handle the following operations: to handle the following operations:
(+) Set the latency (+) Set/Get the latency
(+) Enable/Disable the prefetch buffer (+) Enable/Disable the prefetch buffer
(+) Enable/Disable the FLASH interrupts (+) Enable/Disable the FLASH interrupts
(+) Monitor the FLASH flags status (+) Monitor the FLASH flags status
@ -72,7 +72,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -307,14 +307,18 @@ void HAL_FLASH_IRQHandler(void)
/* Check FLASH operation error flags */ /* Check FLASH operation error flags */
if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_WRPERR) ||__HAL_FLASH_GET_FLAG(FLASH_FLAG_PGERR)) if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_WRPERR) ||__HAL_FLASH_GET_FLAG(FLASH_FLAG_PGERR))
{ {
/*return the faulty address*/
addresstmp = pFlash.Address;
/* Reset address */
pFlash.Address = 0xFFFFFFFFU;
/*Save the Error code*/ /*Save the Error code*/
FLASH_SetErrorCode(); FLASH_SetErrorCode();
/* FLASH error interrupt user callback */ /* FLASH error interrupt user callback */
HAL_FLASH_OperationErrorCallback(pFlash.Address); HAL_FLASH_OperationErrorCallback(addresstmp);
/* Reset address and stop the procedure ongoing*/ /* Stop the procedure ongoing*/
pFlash.Address = 0xFFFFFFFF;
pFlash.ProcedureOnGoing = FLASH_PROC_NONE; pFlash.ProcedureOnGoing = FLASH_PROC_NONE;
} }
@ -332,28 +336,30 @@ void HAL_FLASH_IRQHandler(void)
/* Nb of pages to erased can be decreased */ /* Nb of pages to erased can be decreased */
pFlash.DataRemaining--; pFlash.DataRemaining--;
/* Indicate user which page address has been erased*/
HAL_FLASH_EndOfOperationCallback(pFlash.Address);
/* Check if there are still pages to erase*/ /* Check if there are still pages to erase*/
if(pFlash.DataRemaining != 0) if(pFlash.DataRemaining != 0)
{ {
/* Increment page address to next page */
pFlash.Address += FLASH_PAGE_SIZE;
addresstmp = pFlash.Address; addresstmp = pFlash.Address;
/*Indicate user which sector has been erased*/
HAL_FLASH_EndOfOperationCallback(addresstmp);
/* Operation is completed, disable the PER Bit */ /*Increment sector number*/
addresstmp = pFlash.Address + FLASH_PAGE_SIZE;
pFlash.Address = addresstmp;
/* If the erase operation is completed, disable the PER Bit */
CLEAR_BIT(FLASH->CR, FLASH_CR_PER); CLEAR_BIT(FLASH->CR, FLASH_CR_PER);
FLASH_PageErase(addresstmp); FLASH_PageErase(addresstmp);
} }
else else
{ {
/*No more pages to Erase*/ /*No more pages to Erase, user callback can be called.*/
/*Reset Sector and stop Erase pages procedure*/
/*Reset Address and stop Erase pages procedure*/ pFlash.Address = addresstmp = 0xFFFFFFFFU;
pFlash.Address = 0xFFFFFFFF;
pFlash.ProcedureOnGoing = FLASH_PROC_NONE; pFlash.ProcedureOnGoing = FLASH_PROC_NONE;
/* FLASH EOP interrupt user callback */
HAL_FLASH_EndOfOperationCallback(addresstmp);
} }
} }
else if(pFlash.ProcedureOnGoing == FLASH_PROC_MASSERASE) else if(pFlash.ProcedureOnGoing == FLASH_PROC_MASSERASE)
@ -407,7 +413,7 @@ void HAL_FLASH_IRQHandler(void)
} }
/* Reset Address and stop Program procedure*/ /* Reset Address and stop Program procedure*/
pFlash.Address = 0xFFFFFFFF; pFlash.Address = 0xFFFFFFFFU;
pFlash.ProcedureOnGoing = FLASH_PROC_NONE; pFlash.ProcedureOnGoing = FLASH_PROC_NONE;
} }
} }
@ -434,11 +440,15 @@ void HAL_FLASH_IRQHandler(void)
* @param ReturnValue: The value saved in this parameter depends on the ongoing procedure * @param ReturnValue: The value saved in this parameter depends on the ongoing procedure
* - Mass Erase: No return value expected * - Mass Erase: No return value expected
* - Pages Erase: Address of the page which has been erased * - Pages Erase: Address of the page which has been erased
* (if 0xFFFFFFFF, it means that all the selected pages have been erased)
* - Program: Address which was selected for data program * - Program: Address which was selected for data program
* @retval none * @retval none
*/ */
__weak void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue) __weak void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(ReturnValue);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_FLASH_EndOfOperationCallback could be implemented in the user file the HAL_FLASH_EndOfOperationCallback could be implemented in the user file
*/ */
@ -454,6 +464,9 @@ __weak void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue)
*/ */
__weak void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue) __weak void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(ReturnValue);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_FLASH_OperationErrorCallback could be implemented in the user file the HAL_FLASH_OperationErrorCallback could be implemented in the user file
*/ */
@ -551,7 +564,7 @@ HAL_StatusTypeDef HAL_FLASH_OB_Lock(void)
*/ */
HAL_StatusTypeDef HAL_FLASH_OB_Launch(void) HAL_StatusTypeDef HAL_FLASH_OB_Launch(void)
{ {
/* Set the OBL_Launch bit to lauch the option byte loading */ /* Set the OBL_Launch bit to launch the option byte loading */
SET_BIT(FLASH->CR, FLASH_CR_OBL_LAUNCH); SET_BIT(FLASH->CR, FLASH_CR_OBL_LAUNCH);
/* Wait for last operation to be completed */ /* Wait for last operation to be completed */
@ -596,6 +609,7 @@ uint32_t HAL_FLASH_GetError(void)
/** @addtogroup FLASH_Private_Functions /** @addtogroup FLASH_Private_Functions
* @{ * @{
*/ */
/** /**
* @brief Program a half-word (16-bit) at a specified address. * @brief Program a half-word (16-bit) at a specified address.
* @param Address: specifies the address to be programmed. * @param Address: specifies the address to be programmed.
@ -616,7 +630,7 @@ static void FLASH_Program_HalfWord(uint32_t Address, uint16_t Data)
/** /**
* @brief Wait for a FLASH operation to complete. * @brief Wait for a FLASH operation to complete.
* @param Timeout: maximum flash operationtimeout * @param Timeout: maximum flash operation timeout
* @retval HAL_StatusTypeDef HAL Status * @retval HAL_StatusTypeDef HAL Status
*/ */
HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout) HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout)
@ -645,7 +659,8 @@ HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout)
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP); __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP);
} }
if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_WRPERR) || __HAL_FLASH_GET_FLAG(FLASH_FLAG_PGERR)) if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_WRPERR) ||
__HAL_FLASH_GET_FLAG(FLASH_FLAG_PGERR))
{ {
/*Save the error code*/ /*Save the error code*/
FLASH_SetErrorCode(); FLASH_SetErrorCode();
@ -654,7 +669,6 @@ HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout)
/* If there is no error flag set */ /* If there is no error flag set */
return HAL_OK; return HAL_OK;
} }

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_flash.h * @file stm32f0xx_hal_flash.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of Flash HAL module. * @brief Header file of Flash HAL module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -128,9 +128,9 @@ typedef struct
* @{ * @{
*/ */
#define HAL_FLASH_ERROR_NONE ((uint32_t)0x00) #define HAL_FLASH_ERROR_NONE ((uint32_t)0x00) /*!< No error */
#define HAL_FLASH_ERROR_PROG ((uint32_t)0x01) #define HAL_FLASH_ERROR_PROG ((uint32_t)0x01) /*!< Programming error */
#define HAL_FLASH_ERROR_WRP ((uint32_t)0x02) #define HAL_FLASH_ERROR_WRP ((uint32_t)0x02) /*!< Write protection error */
/** /**
* @} * @}
@ -189,14 +189,15 @@ typedef struct
* @{ * @{
*/ */
/** @defgroup FLASH_Latency FLASH Latency
/** @defgroup FLASH_EM_Latency FLASH Latency
* @brief macros to handle FLASH Latency * @brief macros to handle FLASH Latency
* @{ * @{
*/ */
/** /**
* @brief Set the FLASH Latency. * @brief Set the FLASH Latency.
* @param __LATENCY__: FLASH Latency * @param __LATENCY__ FLASH Latency
* The value of this parameter depend on device used within the same series * The value of this parameter depend on device used within the same series
* @retval None * @retval None
*/ */
@ -241,44 +242,43 @@ typedef struct
/** /**
* @brief Enable the specified FLASH interrupt. * @brief Enable the specified FLASH interrupt.
* @param __INTERRUPT__ : FLASH interrupt * @param __INTERRUPT__ FLASH interrupt
* This parameter can be any combination of the following values: * This parameter can be any combination of the following values:
* @arg FLASH_IT_EOP: End of FLASH Operation Interrupt * @arg @ref FLASH_IT_EOP End of FLASH Operation Interrupt
* @arg FLASH_IT_ERR: Error Interrupt * @arg @ref FLASH_IT_ERR Error Interrupt
* @retval none * @retval none
*/ */
#define __HAL_FLASH_ENABLE_IT(__INTERRUPT__) SET_BIT((FLASH->CR), (__INTERRUPT__)) #define __HAL_FLASH_ENABLE_IT(__INTERRUPT__) SET_BIT((FLASH->CR), (__INTERRUPT__))
/** /**
* @brief Disable the specified FLASH interrupt. * @brief Disable the specified FLASH interrupt.
* @param __INTERRUPT__ : FLASH interrupt * @param __INTERRUPT__ FLASH interrupt
* This parameter can be any combination of the following values: * This parameter can be any combination of the following values:
* @arg FLASH_IT_EOP: End of FLASH Operation Interrupt * @arg @ref FLASH_IT_EOP End of FLASH Operation Interrupt
* @arg FLASH_IT_ERR: Error Interrupt * @arg @ref FLASH_IT_ERR Error Interrupt
* @retval none * @retval none
*/ */
#define __HAL_FLASH_DISABLE_IT(__INTERRUPT__) CLEAR_BIT((FLASH->CR), (uint32_t)(__INTERRUPT__)) #define __HAL_FLASH_DISABLE_IT(__INTERRUPT__) CLEAR_BIT((FLASH->CR), (uint32_t)(__INTERRUPT__))
/** /**
* @brief Get the specified FLASH flag status. * @brief Get the specified FLASH flag status.
* @param __FLAG__: specifies the FLASH flag to check. * @param __FLAG__ specifies the FLASH flag to check.
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg FLASH_FLAG_BSY : FLASH Busy flag * @arg @ref FLASH_FLAG_BSY FLASH Busy flag
* @arg FLASH_FLAG_EOP : FLASH End of Operation flag * @arg @ref FLASH_FLAG_EOP FLASH End of Operation flag
* @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag * @arg @ref FLASH_FLAG_WRPERR FLASH Write protected error flag
* @arg FLASH_FLAG_PGERR : FLASH Programming error flag * @arg @ref FLASH_FLAG_PGERR FLASH Programming error flag
* @retval The new state of __FLAG__ (SET or RESET). * @retval The new state of __FLAG__ (SET or RESET).
*/ */
#define __HAL_FLASH_GET_FLAG(__FLAG__) (((FLASH->SR) & (__FLAG__)) == (__FLAG__)) #define __HAL_FLASH_GET_FLAG(__FLAG__) (((FLASH->SR) & (__FLAG__)) == (__FLAG__))
/** /**
* @brief Clear the specified FLASH flag. * @brief Clear the specified FLASH flag.
* @param __FLAG__: specifies the FLASH flags to clear. * @param __FLAG__ specifies the FLASH flags to clear.
* This parameter can be any combination of the following values: * This parameter can be any combination of the following values:
* @arg FLASH_FLAG_BSY : FLASH Busy flag * @arg @ref FLASH_FLAG_EOP FLASH End of Operation flag
* @arg FLASH_FLAG_EOP : FLASH End of Operation flag * @arg @ref FLASH_FLAG_WRPERR FLASH Write protected error flag
* @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag * @arg @ref FLASH_FLAG_PGERR FLASH Programming error flag
* @arg FLASH_FLAG_PGERR : FLASH Programming error flag
* @retval none * @retval none
*/ */
#define __HAL_FLASH_CLEAR_FLAG(__FLAG__) ((FLASH->SR) = (__FLAG__)) #define __HAL_FLASH_CLEAR_FLAG(__FLAG__) ((FLASH->SR) = (__FLAG__))
@ -306,7 +306,7 @@ typedef struct
HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data); HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data);
HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data); HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data);
/* FLASH IRQ handler method */ /* FLASH IRQ handler function */
void HAL_FLASH_IRQHandler(void); void HAL_FLASH_IRQHandler(void);
/* Callbacks in non blocking modes */ /* Callbacks in non blocking modes */
void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue); void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue);

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_flash_ex.c * @file stm32f0xx_hal_flash_ex.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Extended FLASH HAL module driver. * @brief Extended FLASH HAL module driver.
* *
* This file provides firmware functions to manage the following * This file provides firmware functions to manage the following
@ -30,7 +30,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -82,7 +82,7 @@ extern FLASH_ProcessTypeDef pFlash;
*/ */
/** @defgroup FLASHEx FLASHEx /** @defgroup FLASHEx FLASHEx
* @brief FLASH Extended HAL module driver * @brief FLASH HAL Extension module driver
* @{ * @{
*/ */
@ -92,6 +92,8 @@ extern FLASH_ProcessTypeDef pFlash;
* @{ * @{
*/ */
#define FLASH_POSITION_IWDGSW_BIT (uint32_t)8 #define FLASH_POSITION_IWDGSW_BIT (uint32_t)8
#define FLASH_POSITION_OB_USERDATA0_BIT (uint32_t)16
#define FLASH_POSITION_OB_USERDATA1_BIT (uint32_t)24
/** /**
* @} * @}
*/ */
@ -119,7 +121,7 @@ static HAL_StatusTypeDef FLASH_OB_RDP_LevelConfig(uint8_t ReadProtectLevel);
static HAL_StatusTypeDef FLASH_OB_UserConfig(uint8_t UserConfig); static HAL_StatusTypeDef FLASH_OB_UserConfig(uint8_t UserConfig);
static HAL_StatusTypeDef FLASH_OB_ProgramData(uint32_t Address, uint8_t Data); static HAL_StatusTypeDef FLASH_OB_ProgramData(uint32_t Address, uint8_t Data);
static uint32_t FLASH_OB_GetWRP(void); static uint32_t FLASH_OB_GetWRP(void);
static uint8_t FLASH_OB_GetRDP(void); static uint32_t FLASH_OB_GetRDP(void);
static uint8_t FLASH_OB_GetUser(void); static uint8_t FLASH_OB_GetUser(void);
/** /**
@ -131,13 +133,25 @@ static uint8_t FLASH_OB_GetUser(void);
* @{ * @{
*/ */
/** @defgroup FLASHEx_Exported_Functions_Group1 Extended Input and Output operation functions /** @defgroup FLASHEx_Exported_Functions_Group1 FLASHEx Memory Erasing functions
* @brief I/O operation functions * @brief FLASH Memory Erasing functions
* *
@verbatim @verbatim
=============================================================================== ==============================================================================
##### IO operation functions ##### ##### FLASH Erasing Programming functions #####
=============================================================================== ==============================================================================
[..] The FLASH Memory Erasing functions, includes the following functions:
(+) @ref HAL_FLASHEx_Erase: return only when erase has been done
(+) @ref HAL_FLASHEx_Erase_IT: end of erase is done when @ref HAL_FLASH_EndOfOperationCallback
is called with parameter 0xFFFFFFFF
[..] Any operation of erase should follow these steps:
(#) Call the @ref HAL_FLASH_Unlock() function to enable the flash control register and
program memory access.
(#) Call the desired function to erase page.
(#) Call the @ref HAL_FLASH_Lock() to disable the flash program memory access
(recommended to protect the FLASH memory against possible unwanted operation).
@endverbatim @endverbatim
* @{ * @{
@ -146,12 +160,14 @@ static uint8_t FLASH_OB_GetUser(void);
/** /**
* @brief Perform a mass erase or erase the specified FLASH memory pages * @brief Perform a mass erase or erase the specified FLASH memory pages
* @note The function HAL_FLASH_Unlock() should be called before to unlock the FLASH interface * @note To correctly run this function, the @ref HAL_FLASH_Unlock() function
* The function HAL_FLASH_Lock() should be called after to lock the FLASH interface * must be called before.
* @param[in] pEraseInit: pointer to an FLASH_EraseInitTypeDef structure that * Call the @ref HAL_FLASH_Lock() to disable the flash memory access
* (recommended to protect the FLASH memory against possible unwanted operation)
* @param[in] pEraseInit pointer to an FLASH_EraseInitTypeDef structure that
* contains the configuration information for the erasing. * contains the configuration information for the erasing.
* *
* @param[out] PageError: pointer to variable that * @param[out] PageError pointer to variable that
* contains the configuration information on faulty page in case of error * contains the configuration information on faulty page in case of error
* (0xFFFFFFFF means that all the pages have been correctly erased) * (0xFFFFFFFF means that all the pages have been correctly erased)
* *
@ -196,11 +212,11 @@ HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t
if (FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE) == HAL_OK) if (FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE) == HAL_OK)
{ {
/*Initialization of PageError variable*/ /*Initialization of PageError variable*/
*PageError = 0xFFFFFFFF; *PageError = 0xFFFFFFFFU;
/* Erase by page by page to be done*/ /* Erase page by page to be done*/
for(address = pEraseInit->PageAddress; for(address = pEraseInit->PageAddress;
address < (pEraseInit->PageAddress + (pEraseInit->NbPages)*FLASH_PAGE_SIZE); address < ((pEraseInit->NbPages * FLASH_PAGE_SIZE) + pEraseInit->PageAddress);
address += FLASH_PAGE_SIZE) address += FLASH_PAGE_SIZE)
{ {
FLASH_PageErase(address); FLASH_PageErase(address);
@ -228,10 +244,12 @@ HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t
} }
/** /**
* @brief Perform a mass erase or erase the specified FLASH memory sectors with interrupt enabled * @brief Perform a mass erase or erase the specified FLASH memory pages with interrupt enabled
* @note The function HAL_FLASH_Unlock() should be called before to unlock the FLASH interface * @note To correctly run this function, the @ref HAL_FLASH_Unlock() function
* The function HAL_FLASH_Lock() should be called after to lock the FLASH interface * must be called before.
* @param pEraseInit: pointer to an FLASH_EraseInitTypeDef structure that * Call the @ref HAL_FLASH_Lock() to disable the flash memory access
* (recommended to protect the FLASH memory against possible unwanted operation)
* @param pEraseInit pointer to an FLASH_EraseInitTypeDef structure that
* contains the configuration information for the erasing. * contains the configuration information for the erasing.
* *
* @retval HAL_StatusTypeDef HAL Status * @retval HAL_StatusTypeDef HAL Status
@ -253,7 +271,7 @@ HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit)
assert_param(IS_FLASH_TYPEERASE(pEraseInit->TypeErase)); assert_param(IS_FLASH_TYPEERASE(pEraseInit->TypeErase));
/* Enable End of FLASH Operation and Error source interrupts */ /* Enable End of FLASH Operation and Error source interrupts */
__HAL_FLASH_ENABLE_IT((FLASH_IT_EOP | FLASH_IT_ERR)); __HAL_FLASH_ENABLE_IT(FLASH_IT_EOP | FLASH_IT_ERR);
if (pEraseInit->TypeErase == FLASH_TYPEERASE_MASSERASE) if (pEraseInit->TypeErase == FLASH_TYPEERASE_MASSERASE)
{ {
@ -284,16 +302,16 @@ HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit)
* @} * @}
*/ */
/** @defgroup FLASHEx_Exported_Functions_Group2 Extended Peripheral Control functions /** @defgroup FLASHEx_Exported_Functions_Group2 Option Bytes Programming functions
* @brief Peripheral Control functions * @brief Option Bytes Programming functions
* *
@verbatim @verbatim
=============================================================================== ==============================================================================
##### Peripheral Control functions ##### ##### Option Bytes Programming functions #####
=============================================================================== ==============================================================================
[..] [..]
This subsection provides a set of functions allowing to control the FLASH This subsection provides a set of functions allowing to control the FLASH
memory operations. option bytes operations.
@endverbatim @endverbatim
* @{ * @{
@ -302,9 +320,9 @@ HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit)
/** /**
* @brief Erases the FLASH option bytes. * @brief Erases the FLASH option bytes.
* @note This functions erases all option bytes except the Read protection (RDP). * @note This functions erases all option bytes except the Read protection (RDP).
* The function HAL_FLASH_Unlock() should be called before to unlock the FLASH interface * The function @ref HAL_FLASH_Unlock() should be called before to unlock the FLASH interface
* The function HAL_FLASH_OB_Unlock() should be called before to unlock the options bytes * The function @ref HAL_FLASH_OB_Unlock() should be called before to unlock the options bytes
* The function HAL_FLASH_OB_Launch() should be called after to force the reload of the options bytes * The function @ref HAL_FLASH_OB_Launch() should be called after to force the reload of the options bytes
* (system reset will occur) * (system reset will occur)
* @retval HAL status * @retval HAL status
*/ */
@ -348,12 +366,12 @@ HAL_StatusTypeDef HAL_FLASHEx_OBErase(void)
/** /**
* @brief Program option bytes * @brief Program option bytes
* @note The function HAL_FLASH_Unlock() should be called before to unlock the FLASH interface * @note The function @ref HAL_FLASH_Unlock() should be called before to unlock the FLASH interface
* The function HAL_FLASH_OB_Unlock() should be called before to unlock the options bytes * The function @ref HAL_FLASH_OB_Unlock() should be called before to unlock the options bytes
* The function HAL_FLASH_OB_Launch() should be called after to force the reload of the options bytes * The function @ref HAL_FLASH_OB_Launch() should be called after to force the reload of the options bytes
* (system reset will occur) * (system reset will occur)
* *
* @param pOBInit: pointer to an FLASH_OBInitStruct structure that * @param pOBInit pointer to an FLASH_OBInitStruct structure that
* contains the configuration information for the programming. * contains the configuration information for the programming.
* *
* @retval HAL_StatusTypeDef HAL Status * @retval HAL_StatusTypeDef HAL Status
@ -362,6 +380,9 @@ HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit)
{ {
HAL_StatusTypeDef status = HAL_ERROR; HAL_StatusTypeDef status = HAL_ERROR;
/* Process Locked */
__HAL_LOCK(&pFlash);
/* Check the parameters */ /* Check the parameters */
assert_param(IS_OPTIONBYTE(pOBInit->OptionType)); assert_param(IS_OPTIONBYTE(pOBInit->OptionType));
@ -379,32 +400,59 @@ HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit)
/* Disable of Write protection on the selected page */ /* Disable of Write protection on the selected page */
status = FLASH_OB_DisableWRP(pOBInit->WRPPage); status = FLASH_OB_DisableWRP(pOBInit->WRPPage);
} }
if (status != HAL_OK)
{
/* Process Unlocked */
__HAL_UNLOCK(&pFlash);
return status;
}
} }
/* Read protection configuration */ /* Read protection configuration */
if((pOBInit->OptionType & OPTIONBYTE_RDP) == OPTIONBYTE_RDP) if((pOBInit->OptionType & OPTIONBYTE_RDP) == OPTIONBYTE_RDP)
{ {
status = FLASH_OB_RDP_LevelConfig(pOBInit->RDPLevel); status = FLASH_OB_RDP_LevelConfig(pOBInit->RDPLevel);
if (status != HAL_OK)
{
/* Process Unlocked */
__HAL_UNLOCK(&pFlash);
return status;
}
} }
/* USER configuration */ /* USER configuration */
if((pOBInit->OptionType & OPTIONBYTE_USER) == OPTIONBYTE_USER) if((pOBInit->OptionType & OPTIONBYTE_USER) == OPTIONBYTE_USER)
{ {
status = FLASH_OB_UserConfig(pOBInit->USERConfig); status = FLASH_OB_UserConfig(pOBInit->USERConfig);
if (status != HAL_OK)
{
/* Process Unlocked */
__HAL_UNLOCK(&pFlash);
return status;
}
} }
/* DATA configuration*/ /* DATA configuration*/
if((pOBInit->OptionType & OPTIONBYTE_DATA) == OPTIONBYTE_DATA) if((pOBInit->OptionType & OPTIONBYTE_DATA) == OPTIONBYTE_DATA)
{ {
status = FLASH_OB_ProgramData(pOBInit->DATAAddress, pOBInit->DATAData); status = FLASH_OB_ProgramData(pOBInit->DATAAddress, pOBInit->DATAData);
if (status != HAL_OK)
{
/* Process Unlocked */
__HAL_UNLOCK(&pFlash);
return status;
} }
}
/* Process Unlocked */
__HAL_UNLOCK(&pFlash);
return status; return status;
} }
/** /**
* @brief Get the Option byte configuration * @brief Get the Option byte configuration
* @param pOBInit: pointer to an FLASH_OBInitStruct structure that * @param pOBInit pointer to an FLASH_OBInitStruct structure that
* contains the configuration information for the programming. * contains the configuration information for the programming.
* *
* @retval None * @retval None
@ -423,6 +471,32 @@ void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit)
pOBInit->USERConfig = FLASH_OB_GetUser(); pOBInit->USERConfig = FLASH_OB_GetUser();
} }
/**
* @brief Get the Option byte user data
* @param DATAAdress Address of the option byte DATA
* This parameter can be one of the following values:
* @arg @ref OB_DATA_ADDRESS_DATA0
* @arg @ref OB_DATA_ADDRESS_DATA1
* @retval Value programmed in USER data
*/
uint32_t HAL_FLASHEx_OBGetUserData(uint32_t DATAAdress)
{
uint32_t value = 0;
if (DATAAdress == OB_DATA_ADDRESS_DATA0)
{
/* Get value programmed in OB USER Data0 */
value = READ_BIT(FLASH->OBR, FLASH_OBR_DATA0) >> FLASH_POSITION_OB_USERDATA0_BIT;
}
else
{
/* Get value programmed in OB USER Data1 */
value = READ_BIT(FLASH->OBR, FLASH_OBR_DATA1) >> FLASH_POSITION_OB_USERDATA1_BIT;
}
return value;
}
/** /**
* @} * @}
*/ */
@ -438,7 +512,7 @@ void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit)
/** /**
* @brief Full erase of FLASH memory Bank * @brief Full erase of FLASH memory Bank
* *
* @retval HAL Status * @retval None
*/ */
static void FLASH_MassErase(void) static void FLASH_MassErase(void)
{ {
@ -457,7 +531,7 @@ static void FLASH_MassErase(void)
* it is not possible to program or erase the flash page i if * it is not possible to program or erase the flash page i if
* debug features are connected or boot code is executed in RAM, even if nWRPi = 1 * debug features are connected or boot code is executed in RAM, even if nWRPi = 1
* *
* @param WriteProtectPage: specifies the page(s) to be write protected. * @param WriteProtectPage specifies the page(s) to be write protected.
* The value of this parameter depend on device used within the same series * The value of this parameter depend on device used within the same series
* @retval HAL status * @retval HAL status
*/ */
@ -481,16 +555,16 @@ static HAL_StatusTypeDef FLASH_OB_EnableWRP(uint32_t WriteProtectPage)
/* Get current write protected pages and the new pages to be protected ******/ /* Get current write protected pages and the new pages to be protected ******/
WriteProtectPage = (uint32_t)(~((~FLASH_OB_GetWRP()) | WriteProtectPage)); WriteProtectPage = (uint32_t)(~((~FLASH_OB_GetWRP()) | WriteProtectPage));
#if defined(OB_WRP_PAGES0TO31MASK) #if defined(OB_WRP_PAGES0TO15MASK)
WRP0_Data = (uint16_t)(WriteProtectPage & OB_WRP_PAGES0TO31MASK);
#elif defined(OB_WRP_PAGES0TO15MASK)
WRP0_Data = (uint16_t)(WriteProtectPage & OB_WRP_PAGES0TO15MASK); WRP0_Data = (uint16_t)(WriteProtectPage & OB_WRP_PAGES0TO15MASK);
#elif defined(OB_WRP_PAGES0TO31MASK)
WRP0_Data = (uint16_t)(WriteProtectPage & OB_WRP_PAGES0TO31MASK);
#endif /* OB_WRP_PAGES0TO31MASK */ #endif /* OB_WRP_PAGES0TO31MASK */
#if defined(OB_WRP_PAGES32TO63MASK) #if defined(OB_WRP_PAGES16TO31MASK)
WRP1_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES32TO63MASK) >> 8);
#elif defined(OB_WRP_PAGES16TO31MASK)
WRP1_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES16TO31MASK) >> 8); WRP1_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES16TO31MASK) >> 8);
#elif defined(OB_WRP_PAGES32TO63MASK)
WRP1_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES32TO63MASK) >> 8);
#endif /* OB_WRP_PAGES32TO63MASK */ #endif /* OB_WRP_PAGES32TO63MASK */
#if defined(OB_WRP_PAGES32TO47MASK) #if defined(OB_WRP_PAGES32TO47MASK)
@ -573,7 +647,7 @@ static HAL_StatusTypeDef FLASH_OB_EnableWRP(uint32_t WriteProtectPage)
* it is not possible to program or erase the flash page i if * it is not possible to program or erase the flash page i if
* debug features are connected or boot code is executed in RAM, even if nWRPi = 1 * debug features are connected or boot code is executed in RAM, even if nWRPi = 1
* *
* @param WriteProtectPage: specifies the page(s) to be write unprotected. * @param WriteProtectPage specifies the page(s) to be write unprotected.
* The value of this parameter depend on device used within the same series * The value of this parameter depend on device used within the same series
* @retval HAL status * @retval HAL status
*/ */
@ -597,16 +671,16 @@ static HAL_StatusTypeDef FLASH_OB_DisableWRP(uint32_t WriteProtectPage)
/* Get current write protected pages and the new pages to be unprotected ******/ /* Get current write protected pages and the new pages to be unprotected ******/
WriteProtectPage = (FLASH_OB_GetWRP() | WriteProtectPage); WriteProtectPage = (FLASH_OB_GetWRP() | WriteProtectPage);
#if defined(OB_WRP_PAGES0TO31MASK) #if defined(OB_WRP_PAGES0TO15MASK)
WRP0_Data = (uint16_t)(WriteProtectPage & OB_WRP_PAGES0TO31MASK);
#elif defined(OB_WRP_PAGES0TO15MASK)
WRP0_Data = (uint16_t)(WriteProtectPage & OB_WRP_PAGES0TO15MASK); WRP0_Data = (uint16_t)(WriteProtectPage & OB_WRP_PAGES0TO15MASK);
#elif defined(OB_WRP_PAGES0TO31MASK)
WRP0_Data = (uint16_t)(WriteProtectPage & OB_WRP_PAGES0TO31MASK);
#endif /* OB_WRP_PAGES0TO31MASK */ #endif /* OB_WRP_PAGES0TO31MASK */
#if defined(OB_WRP_PAGES32TO63MASK) #if defined(OB_WRP_PAGES16TO31MASK)
WRP1_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES32TO63MASK) >> 8);
#elif defined(OB_WRP_PAGES16TO31MASK)
WRP1_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES16TO31MASK) >> 8); WRP1_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES16TO31MASK) >> 8);
#elif defined(OB_WRP_PAGES32TO63MASK)
WRP1_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES32TO63MASK) >> 8);
#endif /* OB_WRP_PAGES32TO63MASK */ #endif /* OB_WRP_PAGES32TO63MASK */
#if defined(OB_WRP_PAGES32TO47MASK) #if defined(OB_WRP_PAGES32TO47MASK)
@ -619,6 +693,7 @@ static HAL_StatusTypeDef FLASH_OB_DisableWRP(uint32_t WriteProtectPage)
WRP3_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES48TO127MASK) >> 24); WRP3_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES48TO127MASK) >> 24);
#endif /* OB_WRP_PAGES48TO63MASK */ #endif /* OB_WRP_PAGES48TO63MASK */
/* Wait for last operation to be completed */ /* Wait for last operation to be completed */
status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE);
@ -682,11 +757,11 @@ static HAL_StatusTypeDef FLASH_OB_DisableWRP(uint32_t WriteProtectPage)
/** /**
* @brief Set the read protection level. * @brief Set the read protection level.
* @param ReadProtectLevel: specifies the read protection level. * @param ReadProtectLevel specifies the read protection level.
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg OB_RDP_LEVEL_0: No protection * @arg @ref OB_RDP_LEVEL_0 No protection
* @arg OB_RDP_LEVEL_1: Read protection of the memory * @arg @ref OB_RDP_LEVEL_1 Read protection of the memory
* @arg OB_RDP_LEVEL_2: Full chip protection * @arg @ref OB_RDP_LEVEL_2 Full chip protection
* @note Warning: When enabling OB_RDP level 2 it's no more possible to go back to level 1 or 0 * @note Warning: When enabling OB_RDP level 2 it's no more possible to go back to level 1 or 0
* @retval HAL status * @retval HAL status
*/ */
@ -736,7 +811,7 @@ static HAL_StatusTypeDef FLASH_OB_RDP_LevelConfig(uint8_t ReadProtectLevel)
/** /**
* @brief Program the FLASH User Option Byte. * @brief Program the FLASH User Option Byte.
* @note Programming of the OB should be performed only after an erase (otherwise PGERR occurs) * @note Programming of the OB should be performed only after an erase (otherwise PGERR occurs)
* @param UserConfig: The FLASH User Option Bytes values: IWDG_SW(Bit0), RST_STOP(Bit1), RST_STDBY(Bit2), nBOOT1(Bit4), * @param UserConfig The FLASH User Option Bytes values: IWDG_SW(Bit0), RST_STOP(Bit1), RST_STDBY(Bit2), nBOOT1(Bit4),
* VDDA_Analog_Monitoring(Bit5) and SRAM_Parity_Enable(Bit6). * VDDA_Analog_Monitoring(Bit5) and SRAM_Parity_Enable(Bit6).
* For few devices, following option bytes are available: nBOOT0(Bit3) & BOOT_SEL(Bit7). * For few devices, following option bytes are available: nBOOT0(Bit3) & BOOT_SEL(Bit7).
* @retval HAL status * @retval HAL status
@ -751,7 +826,7 @@ static HAL_StatusTypeDef FLASH_OB_UserConfig(uint8_t UserConfig)
assert_param(IS_OB_STDBY_SOURCE((UserConfig&OB_STDBY_NO_RST))); assert_param(IS_OB_STDBY_SOURCE((UserConfig&OB_STDBY_NO_RST)));
assert_param(IS_OB_BOOT1((UserConfig&OB_BOOT1_SET))); assert_param(IS_OB_BOOT1((UserConfig&OB_BOOT1_SET)));
assert_param(IS_OB_VDDA_ANALOG((UserConfig&OB_VDDA_ANALOG_ON))); assert_param(IS_OB_VDDA_ANALOG((UserConfig&OB_VDDA_ANALOG_ON)));
assert_param(IS_OB_SRAM_PARITY((UserConfig&OB_RAM_PARITY_CHECK_RESET))); assert_param(IS_OB_SRAM_PARITY((UserConfig&OB_SRAM_PARITY_RESET)));
#if defined(FLASH_OBR_BOOT_SEL) #if defined(FLASH_OBR_BOOT_SEL)
assert_param(IS_OB_BOOT_SEL((UserConfig&OB_BOOT_SEL_SET))); assert_param(IS_OB_BOOT_SEL((UserConfig&OB_BOOT_SEL_SET)));
assert_param(IS_OB_BOOT0((UserConfig&OB_BOOT0_SET))); assert_param(IS_OB_BOOT0((UserConfig&OB_BOOT0_SET)));
@ -772,7 +847,7 @@ static HAL_StatusTypeDef FLASH_OB_UserConfig(uint8_t UserConfig)
OB->USER = UserConfig; OB->USER = UserConfig;
#else #else
OB->USER = (UserConfig | 0x88); OB->USER = (UserConfig | 0x88);
#endif /* FLASH_OBR_BOOT_SEL */ #endif
/* Wait for last operation to be completed */ /* Wait for last operation to be completed */
status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE); status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE);
@ -786,14 +861,14 @@ static HAL_StatusTypeDef FLASH_OB_UserConfig(uint8_t UserConfig)
/** /**
* @brief Programs a half word at a specified Option Byte Data address. * @brief Programs a half word at a specified Option Byte Data address.
* @note The function HAL_FLASH_Unlock() should be called before to unlock the FLASH interface * @note The function @ref HAL_FLASH_Unlock() should be called before to unlock the FLASH interface
* The function HAL_FLASH_OB_Unlock() should be called before to unlock the options bytes * The function @ref HAL_FLASH_OB_Unlock() should be called before to unlock the options bytes
* The function HAL_FLASH_OB_Launch() should be called after to force the reload of the options bytes * The function @ref HAL_FLASH_OB_Launch() should be called after to force the reload of the options bytes
* (system reset will occur) * (system reset will occur)
* Programming of the OB should be performed only after an erase (otherwise PGERR occurs) * Programming of the OB should be performed only after an erase (otherwise PGERR occurs)
* @param Address: specifies the address to be programmed. * @param Address specifies the address to be programmed.
* This parameter can be 0x1FFFF804 or 0x1FFFF806. * This parameter can be 0x1FFFF804 or 0x1FFFF806.
* @param Data: specifies the data to be programmed. * @param Data specifies the data to be programmed.
* @retval HAL status * @retval HAL status
*/ */
static HAL_StatusTypeDef FLASH_OB_ProgramData(uint32_t Address, uint8_t Data) static HAL_StatusTypeDef FLASH_OB_ProgramData(uint32_t Address, uint8_t Data)
@ -839,19 +914,23 @@ static uint32_t FLASH_OB_GetWRP(void)
* @brief Returns the FLASH Read Protection level. * @brief Returns the FLASH Read Protection level.
* @retval FLASH ReadOut Protection Status: * @retval FLASH ReadOut Protection Status:
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg OB_RDP_LEVEL_0: No protection * @arg @ref OB_RDP_LEVEL_0 No protection
* @arg OB_RDP_LEVEL_1: Read protection of the memory * @arg @ref OB_RDP_LEVEL_1 Read protection of the memory
* @arg OB_RDP_LEVEL_2: Full chip protection * @arg @ref OB_RDP_LEVEL_2 Full chip protection
*/ */
static uint8_t FLASH_OB_GetRDP(void) static uint32_t FLASH_OB_GetRDP(void)
{ {
uint8_t readstatus = OB_RDP_LEVEL_0; uint32_t readstatus = OB_RDP_LEVEL_0;
uint32_t tmp_reg = 0;
if (HAL_IS_BIT_SET(FLASH->OBR, FLASH_OBR_RDPRT1)) /* Read RDP level bits */
tmp_reg = READ_BIT(FLASH->OBR, (FLASH_OBR_RDPRT1 | FLASH_OBR_RDPRT2));
if (tmp_reg == FLASH_OBR_RDPRT1)
{ {
readstatus = OB_RDP_LEVEL_1; readstatus = OB_RDP_LEVEL_1;
} }
else if (HAL_IS_BIT_SET(FLASH->OBR, FLASH_OBR_RDPRT2)) else if (tmp_reg == FLASH_OBR_RDPRT2)
{ {
readstatus = OB_RDP_LEVEL_2; readstatus = OB_RDP_LEVEL_2;
} }
@ -865,10 +944,9 @@ static uint8_t FLASH_OB_GetRDP(void)
/** /**
* @brief Return the FLASH User Option Byte value. * @brief Return the FLASH User Option Byte value.
* @retval The FLASH User Option Bytes values: FLASH_OBR_IWDG_SW(Bit0), FLASH_OBR_nRST_STOP(Bit1), * @retval The FLASH User Option Bytes values: IWDG_SW(Bit0), RST_STOP(Bit1), RST_STDBY(Bit2), nBOOT1(Bit4),
* FLASH_OBR_nRST_STDBY(Bit2), FLASH_OBR_nBOOT1(Bit4), * VDDA_Analog_Monitoring(Bit5) and SRAM_Parity_Enable(Bit6).
* FLASH_OBR_VDDA_MONITOR(Bit5), FLASH_OBR_RAM_PARITY_CHECK(Bit6) and FLASH_OBR_BOOT_SEL(Bit7) (*). * For few devices, following option bytes are available: nBOOT0(Bit3) & BOOT_SEL(Bit7).
* @note (*) not present on all the devices.
*/ */
static uint8_t FLASH_OB_GetUser(void) static uint8_t FLASH_OB_GetUser(void)
{ {
@ -888,14 +966,13 @@ static uint8_t FLASH_OB_GetUser(void)
* @{ * @{
*/ */
/** @addtogroup FLASH_Private_Functions /** @addtogroup FLASH_Private_Functions
* @{ * @{
*/ */
/** /**
* @brief Erase the specified FLASH memory page * @brief Erase the specified FLASH memory page
* @param PageAddress: FLASH page to erase * @param PageAddress FLASH page to erase
* The value of this parameter depend on device used within the same series * The value of this parameter depend on device used within the same series
* *
* @retval None * @retval None
@ -919,10 +996,6 @@ void FLASH_PageErase(uint32_t PageAddress)
* @} * @}
*/ */
/**
* @}
*/
#endif /* HAL_FLASH_MODULE_ENABLED */ #endif /* HAL_FLASH_MODULE_ENABLED */
/** /**
* @} * @}

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_flash_ex.h * @file stm32f0xx_hal_flash_ex.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of Flash HAL Extended module. * @brief Header file of Flash HAL Extended module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -81,22 +81,24 @@
#define IS_OB_VDDA_ANALOG(ANALOG) (((ANALOG) == OB_VDDA_ANALOG_ON) || ((ANALOG) == OB_VDDA_ANALOG_OFF)) #define IS_OB_VDDA_ANALOG(ANALOG) (((ANALOG) == OB_VDDA_ANALOG_ON) || ((ANALOG) == OB_VDDA_ANALOG_OFF))
#define IS_OB_SRAM_PARITY(PARITY) (((PARITY) == OB_RAM_PARITY_CHECK_SET) || ((PARITY) == OB_RAM_PARITY_CHECK_RESET)) #define IS_OB_SRAM_PARITY(PARITY) (((PARITY) == OB_SRAM_PARITY_SET) || ((PARITY) == OB_SRAM_PARITY_RESET))
#if defined(FLASH_OBR_BOOT_SEL) #if defined(FLASH_OBR_BOOT_SEL)
#define IS_OB_BOOT_SEL(BOOT_SEL) (((BOOT_SEL) == OB_BOOT_SEL_RESET) || ((BOOT_SEL) == OB_BOOT_SEL_SET)) #define IS_OB_BOOT_SEL(BOOT_SEL) (((BOOT_SEL) == OB_BOOT_SEL_RESET) || ((BOOT_SEL) == OB_BOOT_SEL_SET))
#define IS_OB_BOOT0(BOOT0) (((BOOT0) == OB_BOOT0_RESET) || ((BOOT0) == OB_BOOT0_SET)) #define IS_OB_BOOT0(BOOT0) (((BOOT0) == OB_BOOT0_RESET) || ((BOOT0) == OB_BOOT0_SET))
#endif /* FLASH_OBR_BOOT_SEL */ #endif /* FLASH_OBR_BOOT_SEL */
#define IS_FLASH_NB_PAGES(ADDRESS,NBPAGES) ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= FLASH_BANK1_END)
#define IS_OB_WRP(PAGE) (((PAGE) != 0x0000000)) #define IS_OB_WRP(PAGE) (((PAGE) != 0x0000000))
#define IS_FLASH_NB_PAGES(ADDRESS,NBPAGES) ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= FLASH_BANK1_END)
#define IS_FLASH_PROGRAM_ADDRESS(ADDRESS) (((ADDRESS) >= FLASH_BASE) && ((ADDRESS) <= FLASH_BANK1_END)) #define IS_FLASH_PROGRAM_ADDRESS(ADDRESS) (((ADDRESS) >= FLASH_BASE) && ((ADDRESS) <= FLASH_BANK1_END))
/** /**
* @} * @}
*/ */
/* Exported types ------------------------------------------------------------*/ /* Exported types ------------------------------------------------------------*/
/** @defgroup FLASHEx_Exported_Types FLASHEx Exported Types /** @defgroup FLASHEx_Exported_Types FLASHEx Exported Types
* @{ * @{
@ -136,7 +138,7 @@ typedef struct
uint8_t USERConfig; /*!< USERConfig: Program the FLASH User Option Byte: uint8_t USERConfig; /*!< USERConfig: Program the FLASH User Option Byte:
IWDG / STOP / STDBY / BOOT1 / VDDA_ANALOG / SRAM_PARITY IWDG / STOP / STDBY / BOOT1 / VDDA_ANALOG / SRAM_PARITY
This parameter can be a combination of @ref FLASHEx_OB_Watchdog, @ref FLASHEx_OB_nRST_STOP, This parameter can be a combination of @ref FLASHEx_OB_IWatchdog, @ref FLASHEx_OB_nRST_STOP,
@ref FLASHEx_OB_nRST_STDBY, @ref FLASHEx_OB_BOOT1, @ref FLASHEx_OB_VDDA_Analog_Monitoring and @ref FLASHEx_OB_nRST_STDBY, @ref FLASHEx_OB_BOOT1, @ref FLASHEx_OB_VDDA_Analog_Monitoring and
@ref FLASHEx_OB_RAM_Parity_Check_Enable */ @ref FLASHEx_OB_RAM_Parity_Check_Enable */
@ -154,6 +156,7 @@ typedef struct
/** @defgroup FLASHEx_Exported_Constants FLASHEx Exported Constants /** @defgroup FLASHEx_Exported_Constants FLASHEx Exported Constants
* @{ * @{
*/ */
/** @defgroup FLASHEx_Page_Size FLASHEx Page Size /** @defgroup FLASHEx_Page_Size FLASHEx Page Size
* @{ * @{
*/ */
@ -166,7 +169,6 @@ typedef struct
|| defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
#define FLASH_PAGE_SIZE 0x800 #define FLASH_PAGE_SIZE 0x800
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx || STM32F030xC */ #endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx || STM32F030xC */
/** /**
* @} * @}
*/ */
@ -181,7 +183,11 @@ typedef struct
* @} * @}
*/ */
/** @defgroup FLASHEx_OB_Type FLASH Option Bytes Type /** @defgroup FLASHEx_OptionByte_Constants Option Byte Constants
* @{
*/
/** @defgroup FLASHEx_OB_Type Option Bytes Type
* @{ * @{
*/ */
#define OPTIONBYTE_WRP ((uint32_t)0x01) /*!<WRP option byte configuration*/ #define OPTIONBYTE_WRP ((uint32_t)0x01) /*!<WRP option byte configuration*/
@ -193,8 +199,7 @@ typedef struct
* @} * @}
*/ */
/** @defgroup FLASHEx_OB_WRP_State Option Byte WRP State
/** @defgroup FLASHEx_OB_WRP_State FLASH WRP State
* @{ * @{
*/ */
#define OB_WRPSTATE_DISABLE ((uint32_t)0x00) /*!<Disable the write protection of the desired pages*/ #define OB_WRPSTATE_DISABLE ((uint32_t)0x00) /*!<Disable the write protection of the desired pages*/
@ -280,34 +285,34 @@ typedef struct
#define OB_WRP_PAGES58TO59 ((uint32_t)0x20000000) /* Write protection of page 58 to 59 */ #define OB_WRP_PAGES58TO59 ((uint32_t)0x20000000) /* Write protection of page 58 to 59 */
#define OB_WRP_PAGES60TO61 ((uint32_t)0x40000000) /* Write protection of page 60 to 61 */ #define OB_WRP_PAGES60TO61 ((uint32_t)0x40000000) /* Write protection of page 60 to 61 */
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) #if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB)
#define OB_WRP_PAGES62TO63 ((uint32_t)0x80000000) /* Write protection of page 62 to 63 */ #define OB_WRP_PAGES62TO63 ((uint32_t)0x80000000U) /* Write protection of page 62 to 63 */
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F070xB */ #endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F070xB */
#if defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC) #if defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
#define OB_WRP_PAGES62TO127 ((uint32_t)0x80000000) /* Write protection of page 62 to 127 */ #define OB_WRP_PAGES62TO127 ((uint32_t)0x80000000U) /* Write protection of page 62 to 127 */
#endif /* STM32F091xC || STM32F098xx || STM32F030xC */ #endif /* STM32F091xC || STM32F098xx || STM32F030xC */
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) \ #if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) \
|| defined(STM32F091xC) || defined(STM32F098xx)|| defined(STM32F030xC) || defined(STM32F091xC) || defined(STM32F098xx)|| defined(STM32F030xC)
#define OB_WRP_PAGES0TO15MASK ((uint32_t)0x000000FF) #define OB_WRP_PAGES0TO15MASK ((uint32_t)0x000000FFU)
#define OB_WRP_PAGES16TO31MASK ((uint32_t)0x0000FF00) #define OB_WRP_PAGES16TO31MASK ((uint32_t)0x0000FF00U)
#define OB_WRP_PAGES32TO47MASK ((uint32_t)0x00FF0000) #define OB_WRP_PAGES32TO47MASK ((uint32_t)0x00FF0000U)
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx || STM32F070xB || STM32F030xC */ #endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx || STM32F070xB || STM32F030xC */
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) #if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB)
#define OB_WRP_PAGES48TO63MASK ((uint32_t)0xFF000000) #define OB_WRP_PAGES48TO63MASK ((uint32_t)0xFF000000U)
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F070xB */ #endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F070xB */
#if defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC) #if defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
#define OB_WRP_PAGES48TO127MASK ((uint32_t)0xFF000000) #define OB_WRP_PAGES48TO127MASK ((uint32_t)0xFF000000U)
#endif /* STM32F091xC || STM32F098xx || STM32F030xC */ #endif /* STM32F091xC || STM32F098xx || STM32F030xC */
#define OB_WRP_ALLPAGES ((uint32_t)0xFFFFFFFF) /*!< Write protection of all pages */ #define OB_WRP_ALLPAGES ((uint32_t)0xFFFFFFFFU) /*!< Write protection of all pages */
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx || STM32F030xC || STM32F070xB */ #endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx || STM32F030xC || STM32F070xB */
/** /**
* @} * @}
*/ */
/** @defgroup FLASHEx_OB_Read_Protection FLASH OB Read Protection /** @defgroup FLASHEx_OB_Read_Protection Option Byte Read Protection
* @{ * @{
*/ */
#define OB_RDP_LEVEL_0 ((uint8_t)0xAA) #define OB_RDP_LEVEL_0 ((uint8_t)0xAA)
@ -318,16 +323,16 @@ typedef struct
* @} * @}
*/ */
/** @defgroup FLASHEx_OB_Watchdog FLASH OB Watchdog /** @defgroup FLASHEx_OB_IWatchdog Option Byte IWatchdog
* @{ * @{
*/ */
#define OB_IWDG_SW ((uint8_t)0x01) /*!< Software WDG selected */ #define OB_IWDG_SW ((uint8_t)0x01) /*!< Software IWDG selected */
#define OB_IWDG_HW ((uint8_t)0x00) /*!< Hardware WDG selected */ #define OB_IWDG_HW ((uint8_t)0x00) /*!< Hardware IWDG selected */
/** /**
* @} * @}
*/ */
/** @defgroup FLASHEx_OB_nRST_STOP FLASH OB nRST STOP /** @defgroup FLASHEx_OB_nRST_STOP Option Byte nRST STOP
* @{ * @{
*/ */
#define OB_STOP_NO_RST ((uint8_t)0x02) /*!< No reset generated when entering in STOP */ #define OB_STOP_NO_RST ((uint8_t)0x02) /*!< No reset generated when entering in STOP */
@ -336,7 +341,7 @@ typedef struct
* @} * @}
*/ */
/** @defgroup FLASHEx_OB_nRST_STDBY FLASH OB nRST STDBY /** @defgroup FLASHEx_OB_nRST_STDBY Option Byte nRST STDBY
* @{ * @{
*/ */
#define OB_STDBY_NO_RST ((uint8_t)0x04) /*!< No reset generated when entering in STANDBY */ #define OB_STDBY_NO_RST ((uint8_t)0x04) /*!< No reset generated when entering in STANDBY */
@ -345,7 +350,7 @@ typedef struct
* @} * @}
*/ */
/** @defgroup FLASHEx_OB_BOOT1 FLASH OB BOOT1 /** @defgroup FLASHEx_OB_BOOT1 Option Byte BOOT1
* @{ * @{
*/ */
#define OB_BOOT1_RESET ((uint8_t)0x00) /*!< BOOT1 Reset */ #define OB_BOOT1_RESET ((uint8_t)0x00) /*!< BOOT1 Reset */
@ -354,7 +359,7 @@ typedef struct
* @} * @}
*/ */
/** @defgroup FLASHEx_OB_VDDA_Analog_Monitoring FLASH OB VDDA Analog Monitoring /** @defgroup FLASHEx_OB_VDDA_Analog_Monitoring Option Byte VDDA Analog Monitoring
* @{ * @{
*/ */
#define OB_VDDA_ANALOG_ON ((uint8_t)0x20) /*!< Analog monitoring on VDDA Power source ON */ #define OB_VDDA_ANALOG_ON ((uint8_t)0x20) /*!< Analog monitoring on VDDA Power source ON */
@ -363,16 +368,17 @@ typedef struct
* @} * @}
*/ */
/** @defgroup FLASHEx_OB_RAM_Parity_Check_Enable FLASH OB RAM Parity Check Enable /** @defgroup FLASHEx_OB_RAM_Parity_Check_Enable Option Byte SRAM Parity Check Enable
* @{ * @{
*/ */
#define OB_RAM_PARITY_CHECK_SET ((uint8_t)0x00) /*!< RAM parity check enable set */ #define OB_SRAM_PARITY_SET ((uint8_t)0x00) /*!< SRAM parity check enable set */
#define OB_RAM_PARITY_CHECK_RESET ((uint8_t)0x40) /*!< RAM parity check enable reset */ #define OB_SRAM_PARITY_RESET ((uint8_t)0x40) /*!< SRAM parity check enable reset */
/** /**
* @} * @}
*/ */
#if defined(FLASH_OBR_BOOT_SEL) #if defined(FLASH_OBR_BOOT_SEL)
/** @defgroup FLASHEx_OB_BOOT_SEL FLASHEx OB BOOT SEL /** @defgroup FLASHEx_OB_BOOT_SEL FLASHEx Option Byte BOOT SEL
* @{ * @{
*/ */
#define OB_BOOT_SEL_RESET ((uint8_t)0x00) /*!< BOOT_SEL Reset */ #define OB_BOOT_SEL_RESET ((uint8_t)0x00) /*!< BOOT_SEL Reset */
@ -381,7 +387,7 @@ typedef struct
* @} * @}
*/ */
/** @defgroup FLASHEx_OB_BOOT0 FLASHEx OB BOOT0 /** @defgroup FLASHEx_OB_BOOT0 FLASHEx Option Byte BOOT0
* @{ * @{
*/ */
#define OB_BOOT0_RESET ((uint8_t)0x00) /*!< BOOT0 Reset */ #define OB_BOOT0_RESET ((uint8_t)0x00) /*!< BOOT0 Reset */
@ -391,6 +397,7 @@ typedef struct
*/ */
#endif /* FLASH_OBR_BOOT_SEL */ #endif /* FLASH_OBR_BOOT_SEL */
/** @defgroup FLASHEx_OB_Data_Address Option Byte Data Address /** @defgroup FLASHEx_OB_Data_Address Option Byte Data Address
* @{ * @{
*/ */
@ -404,7 +411,9 @@ typedef struct
* @} * @}
*/ */
/* Exported macro ------------------------------------------------------------*/ /**
* @}
*/
/* Exported functions --------------------------------------------------------*/ /* Exported functions --------------------------------------------------------*/
/** @addtogroup FLASHEx_Exported_Functions /** @addtogroup FLASHEx_Exported_Functions
@ -429,6 +438,7 @@ HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit);
HAL_StatusTypeDef HAL_FLASHEx_OBErase(void); HAL_StatusTypeDef HAL_FLASHEx_OBErase(void);
HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit); HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit);
void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit); void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit);
uint32_t HAL_FLASHEx_OBGetUserData(uint32_t DATAAdress);
/** /**
* @} * @}

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_gpio.c * @file stm32f0xx_hal_gpio.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief GPIO HAL module driver. * @brief GPIO HAL module driver.
* This file provides firmware functions to manage the following * This file provides firmware functions to manage the following
* functionalities of the General Purpose Input/Output (GPIO) peripheral: * functionalities of the General Purpose Input/Output (GPIO) peripheral:
@ -98,7 +98,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -516,6 +516,9 @@ void HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin)
*/ */
__weak void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) __weak void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(GPIO_Pin);
/* NOTE: This function should not be modified, when the callback is needed, /* NOTE: This function should not be modified, when the callback is needed,
the HAL_GPIO_EXTI_Callback could be implemented in the user file the HAL_GPIO_EXTI_Callback could be implemented in the user file
*/ */

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_gpio.h * @file stm32f0xx_hal_gpio.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of GPIO HAL module. * @brief Header file of GPIO HAL module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -152,10 +152,9 @@ typedef enum
* @brief GPIO Output Maximum frequency * @brief GPIO Output Maximum frequency
* @{ * @{
*/ */
#define GPIO_SPEED_LOW ((uint32_t)0x00000000) /*!< Low speed */ #define GPIO_SPEED_FREQ_LOW ((uint32_t)0x00000000) /*!< range up to 2 MHz, please refer to the product datasheet */
#define GPIO_SPEED_MEDIUM ((uint32_t)0x00000001) /*!< Medium speed */ #define GPIO_SPEED_FREQ_MEDIUM ((uint32_t)0x00000001) /*!< range 4 MHz to 10 MHz, please refer to the product datasheet */
#define GPIO_SPEED_HIGH ((uint32_t)0x00000003) /*!< High speed */ #define GPIO_SPEED_FREQ_HIGH ((uint32_t)0x00000003) /*!< range 10 MHz to 50 MHz, please refer to the product datasheet */
/** /**
* @} * @}
*/ */
@ -245,9 +244,9 @@ typedef enum
((__MODE__) == GPIO_MODE_EVT_RISING_FALLING) ||\ ((__MODE__) == GPIO_MODE_EVT_RISING_FALLING) ||\
((__MODE__) == GPIO_MODE_ANALOG)) ((__MODE__) == GPIO_MODE_ANALOG))
#define IS_GPIO_SPEED(__SPEED__) (((__SPEED__) == GPIO_SPEED_LOW) ||\ #define IS_GPIO_SPEED(__SPEED__) (((__SPEED__) == GPIO_SPEED_FREQ_LOW) ||\
((__SPEED__) == GPIO_SPEED_MEDIUM) ||\ ((__SPEED__) == GPIO_SPEED_FREQ_MEDIUM) ||\
((__SPEED__) == GPIO_SPEED_HIGH)) ((__SPEED__) == GPIO_SPEED_FREQ_HIGH))
#define IS_GPIO_PULL(__PULL__) (((__PULL__) == GPIO_NOPULL) ||\ #define IS_GPIO_PULL(__PULL__) (((__PULL__) == GPIO_NOPULL) ||\
((__PULL__) == GPIO_PULLUP) || \ ((__PULL__) == GPIO_PULLUP) || \

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_gpio_ex.h * @file stm32f0xx_hal_gpio_ex.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of GPIO HAL Extension module. * @brief Header file of GPIO HAL Extension module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -761,8 +761,7 @@
/** @defgroup GPIOEx_Get_Port_Index GPIOEx_Get Port Index /** @defgroup GPIOEx_Get_Port_Index GPIOEx_Get Port Index
* @{ * @{
*/ */
#if defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \ #if defined(GPIOD) && defined(GPIOE)
defined (STM32F091xC) || defined (STM32F098xx)
#define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\ #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
((__GPIOx__) == (GPIOB))? 1U :\ ((__GPIOx__) == (GPIOB))? 1U :\
((__GPIOx__) == (GPIOC))? 2U :\ ((__GPIOx__) == (GPIOC))? 2U :\
@ -770,16 +769,21 @@
((__GPIOx__) == (GPIOE))? 4U : 5U) ((__GPIOx__) == (GPIOE))? 4U : 5U)
#endif #endif
#if defined (STM32F030x6) || defined (STM32F030x8) || defined (STM32F070xB) || defined (STM32F030xC) || \ #if defined(GPIOD) && !defined(GPIOE)
defined (STM32F051x8) || defined (STM32F058xx)
#define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\ #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
((__GPIOx__) == (GPIOB))? 1U :\ ((__GPIOx__) == (GPIOB))? 1U :\
((__GPIOx__) == (GPIOC))? 2U :\ ((__GPIOx__) == (GPIOC))? 2U :\
((__GPIOx__) == (GPIOD))? 3U : 5U) ((__GPIOx__) == (GPIOD))? 3U : 5U)
#endif #endif
#if defined (STM32F031x6) || defined (STM32F038xx) || \ #if !defined(GPIOD) && defined(GPIOE)
defined (STM32F042x6) || defined (STM32F048xx) || defined (STM32F070x6) #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
((__GPIOx__) == (GPIOB))? 1U :\
((__GPIOx__) == (GPIOC))? 2U :\
((__GPIOx__) == (GPIOE))? 4U : 5U)
#endif
#if !defined(GPIOD) && !defined(GPIOE)
#define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\ #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
((__GPIOx__) == (GPIOB))? 1U :\ ((__GPIOx__) == (GPIOB))? 1U :\
((__GPIOx__) == (GPIOC))? 2U : 5U) ((__GPIOx__) == (GPIOC))? 2U : 5U)

File diff suppressed because it is too large Load Diff

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_i2c.h * @file stm32f0xx_hal_i2c.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of I2C HAL module. * @brief Header file of I2C HAL module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -103,23 +103,33 @@ typedef struct
typedef enum typedef enum
{ {
HAL_I2C_STATE_RESET = 0x00, /*!< I2C not yet initialized or disabled */ HAL_I2C_STATE_RESET = 0x00, /*!< Peripheral is not yet Initialized */
HAL_I2C_STATE_READY = 0x01, /*!< I2C initialized and ready for use */ HAL_I2C_STATE_READY = 0x20, /*!< Peripheral Initialized and ready for use */
HAL_I2C_STATE_BUSY = 0x02, /*!< I2C internal process is ongoing */ HAL_I2C_STATE_BUSY = 0x24, /*!< An internal process is ongoing */
HAL_I2C_STATE_MASTER_BUSY_TX = 0x12, /*!< Master Data Transmission process is ongoing */ HAL_I2C_STATE_BUSY_TX = 0x21, /*!< Data Transmission process is ongoing */
HAL_I2C_STATE_MASTER_BUSY_RX = 0x22, /*!< Master Data Reception process is ongoing */ HAL_I2C_STATE_BUSY_RX = 0x22, /*!< Data Reception process is ongoing */
HAL_I2C_STATE_SLAVE_BUSY_TX = 0x32, /*!< Slave Data Transmission process is ongoing */ HAL_I2C_STATE_TIMEOUT = 0xA0, /*!< Timeout state */
HAL_I2C_STATE_SLAVE_BUSY_RX = 0x42, /*!< Slave Data Reception process is ongoing */ HAL_I2C_STATE_ERROR = 0xE0 /*!< Error */
HAL_I2C_STATE_MEM_BUSY_TX = 0x52, /*!< Memory Data Transmission process is ongoing */
HAL_I2C_STATE_MEM_BUSY_RX = 0x62, /*!< Memory Data Reception process is ongoing */
HAL_I2C_STATE_TIMEOUT = 0x03, /*!< Timeout state */
HAL_I2C_STATE_ERROR = 0x04 /*!< Reception process is ongoing */
}HAL_I2C_StateTypeDef; }HAL_I2C_StateTypeDef;
/** /**
* @} * @}
*/ */
/** @defgroup HAL_mode_structure_definition HAL mode structure definition
* @brief HAL Mode structure definition
* @{
*/
typedef enum
{
HAL_I2C_MODE_NONE = 0x00, /*!< No I2C communication on going */
HAL_I2C_MODE_MASTER = 0x10, /*!< I2C communication is in Master Mode */
HAL_I2C_MODE_SLAVE = 0x20, /*!< I2C communication is in Slave Mode */
HAL_I2C_MODE_MEM = 0x40 /*!< I2C communication is in Memory Mode */
}HAL_I2C_ModeTypeDef;
/** @defgroup I2C_Error_Code_definition I2C Error Code definition /** @defgroup I2C_Error_Code_definition I2C Error Code definition
* @brief I2C Error Code definition * @brief I2C Error Code definition
* @{ * @{
@ -160,6 +170,8 @@ typedef struct
__IO HAL_I2C_StateTypeDef State; /*!< I2C communication state */ __IO HAL_I2C_StateTypeDef State; /*!< I2C communication state */
__IO HAL_I2C_ModeTypeDef Mode; /*!< I2C communication mode */
__IO uint32_t ErrorCode; /*!< I2C Error code */ __IO uint32_t ErrorCode; /*!< I2C Error code */
}I2C_HandleTypeDef; }I2C_HandleTypeDef;
@ -310,22 +322,22 @@ typedef struct
*/ */
/** @brief Reset I2C handle state. /** @brief Reset I2C handle state.
* @param __HANDLE__: specifies the I2C Handle. * @param __HANDLE__ specifies the I2C Handle.
* @retval None * @retval None
*/ */
#define __HAL_I2C_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_I2C_STATE_RESET) #define __HAL_I2C_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_I2C_STATE_RESET)
/** @brief Enable the specified I2C interrupt. /** @brief Enable the specified I2C interrupt.
* @param __HANDLE__: specifies the I2C Handle. * @param __HANDLE__ specifies the I2C Handle.
* @param __INTERRUPT__: specifies the interrupt source to enable. * @param __INTERRUPT__: specifies the interrupt source to enable.
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg I2C_IT_ERRI: Errors interrupt enable * @arg @ref I2C_IT_ERRI Errors interrupt enable
* @arg I2C_IT_TCI: Transfer complete interrupt enable * @arg @ref I2C_IT_TCI Transfer complete interrupt enable
* @arg I2C_IT_STOPI: STOP detection interrupt enable * @arg @ref I2C_IT_STOPI STOP detection interrupt enable
* @arg I2C_IT_NACKI: NACK received interrupt enable * @arg @ref I2C_IT_NACKI NACK received interrupt enable
* @arg I2C_IT_ADDRI: Address match interrupt enable * @arg @ref I2C_IT_ADDRI Address match interrupt enable
* @arg I2C_IT_RXI: RX interrupt enable * @arg @ref I2C_IT_RXI RX interrupt enable
* @arg I2C_IT_TXI: TX interrupt enable * @arg @ref I2C_IT_TXI TX interrupt enable
* *
* @retval None * @retval None
*/ */
@ -333,89 +345,91 @@ typedef struct
#define __HAL_I2C_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR1 |= (__INTERRUPT__)) #define __HAL_I2C_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR1 |= (__INTERRUPT__))
/** @brief Disable the specified I2C interrupt. /** @brief Disable the specified I2C interrupt.
* @param __HANDLE__: specifies the I2C Handle. * @param __HANDLE__ specifies the I2C Handle.
* @param __INTERRUPT__: specifies the interrupt source to disable. * @param __INTERRUPT__: specifies the interrupt source to disable.
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg I2C_IT_ERRI: Errors interrupt enable * @arg @ref I2C_IT_ERRI Errors interrupt enable
* @arg I2C_IT_TCI: Transfer complete interrupt enable * @arg @ref I2C_IT_TCI Transfer complete interrupt enable
* @arg I2C_IT_STOPI: STOP detection interrupt enable * @arg @ref I2C_IT_STOPI STOP detection interrupt enable
* @arg I2C_IT_NACKI: NACK received interrupt enable * @arg @ref I2C_IT_NACKI NACK received interrupt enable
* @arg I2C_IT_ADDRI: Address match interrupt enable * @arg @ref I2C_IT_ADDRI Address match interrupt enable
* @arg I2C_IT_RXI: RX interrupt enable * @arg @ref I2C_IT_RXI RX interrupt enable
* @arg I2C_IT_TXI: TX interrupt enable * @arg @ref I2C_IT_TXI TX interrupt enable
* *
* @retval None * @retval None
*/ */
#define __HAL_I2C_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR1 &= (~(__INTERRUPT__))) #define __HAL_I2C_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR1 &= (~(__INTERRUPT__)))
/** @brief Check whether the specified I2C interrupt source is enabled or not. /** @brief Check whether the specified I2C interrupt source is enabled or not.
* @param __HANDLE__: specifies the I2C Handle. * @param __HANDLE__ specifies the I2C Handle.
* @param __INTERRUPT__: specifies the I2C interrupt source to check. * @param __INTERRUPT__: specifies the I2C interrupt source to check.
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg I2C_IT_ERRI: Errors interrupt enable * @arg @ref I2C_IT_ERRI Errors interrupt enable
* @arg I2C_IT_TCI: Transfer complete interrupt enable * @arg @ref I2C_IT_TCI Transfer complete interrupt enable
* @arg I2C_IT_STOPI: STOP detection interrupt enable * @arg @ref I2C_IT_STOPI STOP detection interrupt enable
* @arg I2C_IT_NACKI: NACK received interrupt enable * @arg @ref I2C_IT_NACKI NACK received interrupt enable
* @arg I2C_IT_ADDRI: Address match interrupt enable * @arg @ref I2C_IT_ADDRI Address match interrupt enable
* @arg I2C_IT_RXI: RX interrupt enable * @arg @ref I2C_IT_RXI RX interrupt enable
* @arg I2C_IT_TXI: TX interrupt enable * @arg @ref I2C_IT_TXI TX interrupt enable
* *
* @retval The new state of __INTERRUPT__ (TRUE or FALSE). * @retval The new state of __INTERRUPT__ (TRUE or FALSE).
*/ */
#define __HAL_I2C_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->CR1 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET) #define __HAL_I2C_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->CR1 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
/** @brief Check whether the specified I2C flag is set or not. /** @brief Check whether the specified I2C flag is set or not.
* @param __HANDLE__: specifies the I2C Handle. * @param __HANDLE__ specifies the I2C Handle.
* @param __FLAG__: specifies the flag to check. * @param __FLAG__ specifies the flag to check.
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg I2C_FLAG_TXE: Transmit data register empty * @arg @ref I2C_FLAG_TXE Transmit data register empty
* @arg I2C_FLAG_TXIS: Transmit interrupt status * @arg @ref I2C_FLAG_TXIS Transmit interrupt status
* @arg I2C_FLAG_RXNE: Receive data register not empty * @arg @ref I2C_FLAG_RXNE Receive data register not empty
* @arg I2C_FLAG_ADDR: Address matched (slave mode) * @arg @ref I2C_FLAG_ADDR Address matched (slave mode)
* @arg I2C_FLAG_AF: Acknowledge failure received flag * @arg @ref I2C_FLAG_AF Acknowledge failure received flag
* @arg I2C_FLAG_STOPF: STOP detection flag * @arg @ref I2C_FLAG_STOPF STOP detection flag
* @arg I2C_FLAG_TC: Transfer complete (master mode) * @arg @ref I2C_FLAG_TC Transfer complete (master mode)
* @arg I2C_FLAG_TCR: Transfer complete reload * @arg @ref I2C_FLAG_TCR Transfer complete reload
* @arg I2C_FLAG_BERR: Bus error * @arg @ref I2C_FLAG_BERR Bus error
* @arg I2C_FLAG_ARLO: Arbitration lost * @arg @ref I2C_FLAG_ARLO Arbitration lost
* @arg I2C_FLAG_OVR: Overrun/Underrun * @arg @ref I2C_FLAG_OVR Overrun/Underrun
* @arg I2C_FLAG_PECERR: PEC error in reception * @arg @ref I2C_FLAG_PECERR PEC error in reception
* @arg I2C_FLAG_TIMEOUT: Timeout or Tlow detection flag * @arg @ref I2C_FLAG_TIMEOUT Timeout or Tlow detection flag
* @arg I2C_FLAG_ALERT: SMBus alert * @arg @ref I2C_FLAG_ALERT SMBus alert
* @arg I2C_FLAG_BUSY: Bus busy * @arg @ref I2C_FLAG_BUSY Bus busy
* @arg I2C_FLAG_DIR: Transfer direction (slave mode) * @arg @ref I2C_FLAG_DIR Transfer direction (slave mode)
* *
* @retval The new state of __FLAG__ (TRUE or FALSE). * @retval The new state of __FLAG__ (TRUE or FALSE).
*/ */
#define I2C_FLAG_MASK ((uint32_t)0x0001FFFF) #define __HAL_I2C_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->ISR) & (__FLAG__)) == (__FLAG__))
#define __HAL_I2C_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & ((__FLAG__) & I2C_FLAG_MASK)) == ((__FLAG__) & I2C_FLAG_MASK)))
/** @brief Clear the I2C pending flags which are cleared by writing 1 in a specific bit. /** @brief Clear the I2C pending flags which are cleared by writing 1 in a specific bit.
* @param __HANDLE__: specifies the I2C Handle. * @param __HANDLE__ specifies the I2C Handle.
* @param __FLAG__: specifies the flag to clear. * @param __FLAG__ specifies the flag to clear.
* This parameter can be any combination of the following values: * This parameter can be any combination of the following values:
* @arg I2C_FLAG_ADDR: Address matched (slave mode) * @arg @ref I2C_FLAG_TXE Transmit data register empty
* @arg I2C_FLAG_AF: Acknowledge failure received flag * @arg @ref I2C_FLAG_ADDR Address matched (slave mode)
* @arg I2C_FLAG_STOPF: STOP detection flag * @arg @ref I2C_FLAG_AF Acknowledge failure received flag
* @arg I2C_FLAG_BERR: Bus error * @arg @ref I2C_FLAG_STOPF STOP detection flag
* @arg I2C_FLAG_ARLO: Arbitration lost * @arg @ref I2C_FLAG_BERR Bus error
* @arg I2C_FLAG_OVR: Overrun/Underrun * @arg @ref I2C_FLAG_ARLO Arbitration lost
* @arg I2C_FLAG_PECERR: PEC error in reception * @arg @ref I2C_FLAG_OVR Overrun/Underrun
* @arg I2C_FLAG_TIMEOUT: Timeout or Tlow detection flag * @arg @ref I2C_FLAG_PECERR PEC error in reception
* @arg I2C_FLAG_ALERT: SMBus alert * @arg @ref I2C_FLAG_TIMEOUT Timeout or Tlow detection flag
* @arg @ref I2C_FLAG_ALERT SMBus alert
* *
* @retval None * @retval None
*/ */
#define __HAL_I2C_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = ((__FLAG__) & I2C_FLAG_MASK)) #define __HAL_I2C_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__FLAG__) == I2C_FLAG_TXE) ? ((__HANDLE__)->Instance->ISR |= (__FLAG__)) \
: ((__HANDLE__)->Instance->ICR = (__FLAG__)))
/** @brief Enable the specified I2C peripheral. /** @brief Enable the specified I2C peripheral.
* @param __HANDLE__: specifies the I2C Handle. * @param __HANDLE__ specifies the I2C Handle.
* @retval None * @retval None
*/ */
#define __HAL_I2C_ENABLE(__HANDLE__) (SET_BIT((__HANDLE__)->Instance->CR1, I2C_CR1_PE)) #define __HAL_I2C_ENABLE(__HANDLE__) (SET_BIT((__HANDLE__)->Instance->CR1, I2C_CR1_PE))
/** @brief Disable the specified I2C peripheral. /** @brief Disable the specified I2C peripheral.
* @param __HANDLE__: specifies the I2C Handle. * @param __HANDLE__ specifies the I2C Handle.
* @retval None * @retval None
*/ */
#define __HAL_I2C_DISABLE(__HANDLE__) (CLEAR_BIT((__HANDLE__)->Instance->CR1, I2C_CR1_PE)) #define __HAL_I2C_DISABLE(__HANDLE__) (CLEAR_BIT((__HANDLE__)->Instance->CR1, I2C_CR1_PE))
@ -493,11 +507,12 @@ void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c);
* @} * @}
*/ */
/** @addtogroup I2C_Exported_Functions_Group3 Peripheral State and Errors functions /** @addtogroup I2C_Exported_Functions_Group3 Peripheral State, Mode and Error functions
* @{ * @{
*/ */
/* Peripheral State and Errors functions *************************************/ /* Peripheral State, Mode and Error functions *********************************/
HAL_I2C_StateTypeDef HAL_I2C_GetState(I2C_HandleTypeDef *hi2c); HAL_I2C_StateTypeDef HAL_I2C_GetState(I2C_HandleTypeDef *hi2c);
HAL_I2C_ModeTypeDef HAL_I2C_GetMode(I2C_HandleTypeDef *hi2c);
uint32_t HAL_I2C_GetError(I2C_HandleTypeDef *hi2c); uint32_t HAL_I2C_GetError(I2C_HandleTypeDef *hi2c);
/** /**
@ -573,7 +588,7 @@ uint32_t HAL_I2C_GetError(I2C_HandleTypeDef *hi2c);
/** @defgroup I2C_Private_Functions I2C Private Functions /** @defgroup I2C_Private_Functions I2C Private Functions
* @{ * @{
*/ */
/* Private functions are defined in stm32l4xx_hal_i2c.c file */ /* Private functions are defined in stm32f0xx_hal_i2c.c file */
/** /**
* @} * @}
*/ */
@ -586,6 +601,11 @@ uint32_t HAL_I2C_GetError(I2C_HandleTypeDef *hi2c);
* @} * @}
*/ */
/**
* @}
*/
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_i2c_ex.c * @file stm32f0xx_hal_i2c_ex.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief I2C Extended HAL module driver. * @brief I2C Extended HAL module driver.
* This file provides firmware functions to manage the following * This file provides firmware functions to manage the following
* functionalities of I2C Extended peripheral: * functionalities of I2C Extended peripheral:
@ -23,7 +23,7 @@
##### How to use this driver ##### ##### How to use this driver #####
============================================================================== ==============================================================================
[..] This driver provides functions to configure Noise Filter [..] This driver provides functions to configure Noise Filter and Wake Up Feature
(#) Configure I2C Analog noise filter using the function HAL_I2CEx_ConfigAnalogFilter() (#) Configure I2C Analog noise filter using the function HAL_I2CEx_ConfigAnalogFilter()
(#) Configure I2C Digital noise filter using the function HAL_I2CEx_ConfigDigitalFilter() (#) Configure I2C Digital noise filter using the function HAL_I2CEx_ConfigDigitalFilter()
(#) Configure the enable or disable of I2C Wake Up Mode using the functions : (#) Configure the enable or disable of I2C Wake Up Mode using the functions :
@ -36,7 +36,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -103,7 +103,7 @@
*/ */
/** /**
* @brief Configures I2C Analog noise filter. * @brief Configure I2C Analog noise filter.
* @param hi2c : pointer to a I2C_HandleTypeDef structure that contains * @param hi2c : pointer to a I2C_HandleTypeDef structure that contains
* the configuration information for the specified I2Cx peripheral. * the configuration information for the specified I2Cx peripheral.
* @param AnalogFilter : new state of the Analog filter. * @param AnalogFilter : new state of the Analog filter.
@ -115,12 +115,8 @@ HAL_StatusTypeDef HAL_I2CEx_ConfigAnalogFilter(I2C_HandleTypeDef *hi2c, uint32_t
assert_param(IS_I2C_ALL_INSTANCE(hi2c->Instance)); assert_param(IS_I2C_ALL_INSTANCE(hi2c->Instance));
assert_param(IS_I2C_ANALOG_FILTER(AnalogFilter)); assert_param(IS_I2C_ANALOG_FILTER(AnalogFilter));
if((hi2c->State == HAL_I2C_STATE_BUSY) || (hi2c->State == HAL_I2C_STATE_MASTER_BUSY_TX) || (hi2c->State == HAL_I2C_STATE_MASTER_BUSY_RX) if(hi2c->State == HAL_I2C_STATE_READY)
|| (hi2c->State == HAL_I2C_STATE_SLAVE_BUSY_TX) || (hi2c->State == HAL_I2C_STATE_SLAVE_BUSY_RX))
{ {
return HAL_BUSY;
}
/* Process Locked */ /* Process Locked */
__HAL_LOCK(hi2c); __HAL_LOCK(hi2c);
@ -143,10 +139,15 @@ HAL_StatusTypeDef HAL_I2CEx_ConfigAnalogFilter(I2C_HandleTypeDef *hi2c, uint32_t
__HAL_UNLOCK(hi2c); __HAL_UNLOCK(hi2c);
return HAL_OK; return HAL_OK;
}
else
{
return HAL_BUSY;
}
} }
/** /**
* @brief Configures I2C Digital noise filter. * @brief Configure I2C Digital noise filter.
* @param hi2c : pointer to a I2C_HandleTypeDef structure that contains * @param hi2c : pointer to a I2C_HandleTypeDef structure that contains
* the configuration information for the specified I2Cx peripheral. * the configuration information for the specified I2Cx peripheral.
* @param DigitalFilter : Coefficient of digital noise filter between 0x00 and 0x0F. * @param DigitalFilter : Coefficient of digital noise filter between 0x00 and 0x0F.
@ -160,12 +161,8 @@ HAL_StatusTypeDef HAL_I2CEx_ConfigDigitalFilter(I2C_HandleTypeDef *hi2c, uint32_
assert_param(IS_I2C_ALL_INSTANCE(hi2c->Instance)); assert_param(IS_I2C_ALL_INSTANCE(hi2c->Instance));
assert_param(IS_I2C_DIGITAL_FILTER(DigitalFilter)); assert_param(IS_I2C_DIGITAL_FILTER(DigitalFilter));
if((hi2c->State == HAL_I2C_STATE_BUSY) || (hi2c->State == HAL_I2C_STATE_MASTER_BUSY_TX) || (hi2c->State == HAL_I2C_STATE_MASTER_BUSY_RX) if(hi2c->State == HAL_I2C_STATE_READY)
|| (hi2c->State == HAL_I2C_STATE_SLAVE_BUSY_TX) || (hi2c->State == HAL_I2C_STATE_SLAVE_BUSY_RX))
{ {
return HAL_BUSY;
}
/* Process Locked */ /* Process Locked */
__HAL_LOCK(hi2c); __HAL_LOCK(hi2c);
@ -178,7 +175,7 @@ HAL_StatusTypeDef HAL_I2CEx_ConfigDigitalFilter(I2C_HandleTypeDef *hi2c, uint32_
tmpreg = hi2c->Instance->CR1; tmpreg = hi2c->Instance->CR1;
/* Reset I2Cx DNF bits [11:8] */ /* Reset I2Cx DNF bits [11:8] */
tmpreg &= ~(I2C_CR1_DFN); tmpreg &= ~(I2C_CR1_DNF);
/* Set I2Cx DNF coefficient */ /* Set I2Cx DNF coefficient */
tmpreg |= DigitalFilter << 8; tmpreg |= DigitalFilter << 8;
@ -194,11 +191,16 @@ HAL_StatusTypeDef HAL_I2CEx_ConfigDigitalFilter(I2C_HandleTypeDef *hi2c, uint32_
__HAL_UNLOCK(hi2c); __HAL_UNLOCK(hi2c);
return HAL_OK; return HAL_OK;
}
else
{
return HAL_BUSY;
}
} }
#if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) #if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
/** /**
* @brief Enables I2C wakeup from stop mode. * @brief Enable I2C wakeup from stop mode.
* @param hi2c : pointer to a I2C_HandleTypeDef structure that contains * @param hi2c : pointer to a I2C_HandleTypeDef structure that contains
* the configuration information for the specified I2Cx peripheral. * the configuration information for the specified I2Cx peripheral.
* @retval HAL status * @retval HAL status
@ -208,12 +210,8 @@ HAL_StatusTypeDef HAL_I2CEx_EnableWakeUp (I2C_HandleTypeDef *hi2c)
/* Check the parameters */ /* Check the parameters */
assert_param(IS_I2C_ALL_INSTANCE(hi2c->Instance)); assert_param(IS_I2C_ALL_INSTANCE(hi2c->Instance));
if((hi2c->State == HAL_I2C_STATE_BUSY) || (hi2c->State == HAL_I2C_STATE_MASTER_BUSY_TX) || (hi2c->State == HAL_I2C_STATE_MASTER_BUSY_RX) if(hi2c->State == HAL_I2C_STATE_READY)
|| (hi2c->State == HAL_I2C_STATE_SLAVE_BUSY_TX) || (hi2c->State == HAL_I2C_STATE_SLAVE_BUSY_RX))
{ {
return HAL_BUSY;
}
/* Process Locked */ /* Process Locked */
__HAL_LOCK(hi2c); __HAL_LOCK(hi2c);
@ -233,11 +231,16 @@ HAL_StatusTypeDef HAL_I2CEx_EnableWakeUp (I2C_HandleTypeDef *hi2c)
__HAL_UNLOCK(hi2c); __HAL_UNLOCK(hi2c);
return HAL_OK; return HAL_OK;
}
else
{
return HAL_BUSY;
}
} }
/** /**
* @brief Disables I2C wakeup from stop mode. * @brief Disable I2C wakeup from stop mode.
* @param hi2c : pointer to a I2C_HandleTypeDef structure that contains * @param hi2c : pointer to a I2C_HandleTypeDef structure that contains
* the configuration information for the specified I2Cx peripheral. * the configuration information for the specified I2Cx peripheral.
* @retval HAL status * @retval HAL status
@ -247,12 +250,8 @@ HAL_StatusTypeDef HAL_I2CEx_DisableWakeUp (I2C_HandleTypeDef *hi2c)
/* Check the parameters */ /* Check the parameters */
assert_param(IS_I2C_ALL_INSTANCE(hi2c->Instance)); assert_param(IS_I2C_ALL_INSTANCE(hi2c->Instance));
if((hi2c->State == HAL_I2C_STATE_BUSY) || (hi2c->State == HAL_I2C_STATE_MASTER_BUSY_TX) || (hi2c->State == HAL_I2C_STATE_MASTER_BUSY_RX) if(hi2c->State == HAL_I2C_STATE_READY)
|| (hi2c->State == HAL_I2C_STATE_SLAVE_BUSY_TX) || (hi2c->State == HAL_I2C_STATE_SLAVE_BUSY_RX))
{ {
return HAL_BUSY;
}
/* Process Locked */ /* Process Locked */
__HAL_LOCK(hi2c); __HAL_LOCK(hi2c);
@ -272,6 +271,11 @@ HAL_StatusTypeDef HAL_I2CEx_DisableWakeUp (I2C_HandleTypeDef *hi2c)
__HAL_UNLOCK(hi2c); __HAL_UNLOCK(hi2c);
return HAL_OK; return HAL_OK;
}
else
{
return HAL_BUSY;
}
} }
#endif /* !(STM32F030x6) && !(STM32F030x8) && !(STM32F070x6) && !(STM32F070xB) && !(STM32F030xC) */ #endif /* !(STM32F030x6) && !(STM32F030x8) && !(STM32F070x6) && !(STM32F070xB) && !(STM32F030xC) */

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_i2c_ex.h * @file stm32f0xx_hal_i2c_ex.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of I2C HAL Extended module. * @brief Header file of I2C HAL Extended module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -50,18 +50,18 @@
* @{ * @{
*/ */
/** @addtogroup I2CEx I2CEx /** @addtogroup I2CEx
* @{ * @{
*/ */
/* Exported types ------------------------------------------------------------*/ /* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/
/** @defgroup I2CEx_Exported_Constants I2CEx Exported Constants /** @defgroup I2CEx_Exported_Constants I2C Extended Exported Constants
* @{ * @{
*/ */
/** @defgroup I2CEx_Analog_Filter I2CEx Analog Filter /** @defgroup I2CEx_Analog_Filter I2C Extended Analog Filter
* @{ * @{
*/ */
#define I2C_ANALOGFILTER_ENABLE ((uint32_t)0x00000000) #define I2C_ANALOGFILTER_ENABLE ((uint32_t)0x00000000)
@ -120,7 +120,7 @@
/* Exported macro ------------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/
/* Exported functions --------------------------------------------------------*/ /* Exported functions --------------------------------------------------------*/
/** @addtogroup I2CEx_Exported_Functions /** @addtogroup I2CEx_Exported_Functions I2C Extended Exported Functions
* @{ * @{
*/ */

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_i2s.c * @file stm32f0xx_hal_i2s.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief I2S HAL module driver. * @brief I2S HAL module driver.
* This file provides firmware functions to manage the following * This file provides firmware functions to manage the following
* functionalities of the Integrated Interchip Sound (I2S) peripheral: * functionalities of the Integrated Interchip Sound (I2S) peripheral:
@ -108,7 +108,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -371,6 +371,9 @@ HAL_StatusTypeDef HAL_I2S_DeInit(I2S_HandleTypeDef *hi2s)
*/ */
__weak void HAL_I2S_MspInit(I2S_HandleTypeDef *hi2s) __weak void HAL_I2S_MspInit(I2S_HandleTypeDef *hi2s)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hi2s);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_I2S_MspInit could be implemented in the user file the HAL_I2S_MspInit could be implemented in the user file
*/ */
@ -384,6 +387,9 @@ HAL_StatusTypeDef HAL_I2S_DeInit(I2S_HandleTypeDef *hi2s)
*/ */
__weak void HAL_I2S_MspDeInit(I2S_HandleTypeDef *hi2s) __weak void HAL_I2S_MspDeInit(I2S_HandleTypeDef *hi2s)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hi2s);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_I2S_MspDeInit could be implemented in the user file the HAL_I2S_MspDeInit could be implemented in the user file
*/ */
@ -1073,6 +1079,9 @@ void HAL_I2S_IRQHandler(I2S_HandleTypeDef *hi2s)
*/ */
__weak void HAL_I2S_TxHalfCpltCallback(I2S_HandleTypeDef *hi2s) __weak void HAL_I2S_TxHalfCpltCallback(I2S_HandleTypeDef *hi2s)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hi2s);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_I2S_TxHalfCpltCallback could be implemented in the user file the HAL_I2S_TxHalfCpltCallback could be implemented in the user file
*/ */
@ -1086,6 +1095,9 @@ void HAL_I2S_IRQHandler(I2S_HandleTypeDef *hi2s)
*/ */
__weak void HAL_I2S_TxCpltCallback(I2S_HandleTypeDef *hi2s) __weak void HAL_I2S_TxCpltCallback(I2S_HandleTypeDef *hi2s)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hi2s);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_I2S_TxCpltCallback could be implemented in the user file the HAL_I2S_TxCpltCallback could be implemented in the user file
*/ */
@ -1099,6 +1111,9 @@ void HAL_I2S_IRQHandler(I2S_HandleTypeDef *hi2s)
*/ */
__weak void HAL_I2S_RxHalfCpltCallback(I2S_HandleTypeDef *hi2s) __weak void HAL_I2S_RxHalfCpltCallback(I2S_HandleTypeDef *hi2s)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hi2s);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_I2S_RxCpltCallback could be implemented in the user file the HAL_I2S_RxCpltCallback could be implemented in the user file
*/ */
@ -1112,6 +1127,9 @@ __weak void HAL_I2S_RxHalfCpltCallback(I2S_HandleTypeDef *hi2s)
*/ */
__weak void HAL_I2S_RxCpltCallback(I2S_HandleTypeDef *hi2s) __weak void HAL_I2S_RxCpltCallback(I2S_HandleTypeDef *hi2s)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hi2s);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_I2S_RxCpltCallback could be implemented in the user file the HAL_I2S_RxCpltCallback could be implemented in the user file
*/ */
@ -1125,6 +1143,9 @@ __weak void HAL_I2S_RxCpltCallback(I2S_HandleTypeDef *hi2s)
*/ */
__weak void HAL_I2S_ErrorCallback(I2S_HandleTypeDef *hi2s) __weak void HAL_I2S_ErrorCallback(I2S_HandleTypeDef *hi2s)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hi2s);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_I2S_ErrorCallback could be implemented in the user file the HAL_I2S_ErrorCallback could be implemented in the user file
*/ */

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_i2s.h * @file stm32f0xx_hal_i2s.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of I2S HAL module. * @brief Header file of I2S HAL module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_irda.c * @file stm32f0xx_hal_irda.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief IRDA HAL module driver. * @brief IRDA HAL module driver.
* This file provides firmware functions to manage the following * This file provides firmware functions to manage the following
* functionalities of the IrDA (Infrared Data Association) Peripheral * functionalities of the IrDA (Infrared Data Association) Peripheral
@ -111,7 +111,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -349,6 +349,9 @@ HAL_StatusTypeDef HAL_IRDA_DeInit(IRDA_HandleTypeDef *hirda)
*/ */
__weak void HAL_IRDA_MspInit(IRDA_HandleTypeDef *hirda) __weak void HAL_IRDA_MspInit(IRDA_HandleTypeDef *hirda)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hirda);
/* NOTE: This function should not be modified, when the callback is needed, /* NOTE: This function should not be modified, when the callback is needed,
the HAL_IRDA_MspInit can be implemented in the user file the HAL_IRDA_MspInit can be implemented in the user file
*/ */
@ -362,6 +365,9 @@ HAL_StatusTypeDef HAL_IRDA_DeInit(IRDA_HandleTypeDef *hirda)
*/ */
__weak void HAL_IRDA_MspDeInit(IRDA_HandleTypeDef *hirda) __weak void HAL_IRDA_MspDeInit(IRDA_HandleTypeDef *hirda)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hirda);
/* NOTE: This function should not be modified, when the callback is needed, /* NOTE: This function should not be modified, when the callback is needed,
the HAL_IRDA_MspDeInit can be implemented in the user file the HAL_IRDA_MspDeInit can be implemented in the user file
*/ */
@ -1044,6 +1050,9 @@ void HAL_IRDA_IRQHandler(IRDA_HandleTypeDef *hirda)
*/ */
__weak void HAL_IRDA_TxCpltCallback(IRDA_HandleTypeDef *hirda) __weak void HAL_IRDA_TxCpltCallback(IRDA_HandleTypeDef *hirda)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hirda);
/* NOTE: This function should not be modified, when the callback is needed, /* NOTE: This function should not be modified, when the callback is needed,
the HAL_IRDA_TxCpltCallback can be implemented in the user file. the HAL_IRDA_TxCpltCallback can be implemented in the user file.
*/ */
@ -1057,6 +1066,9 @@ void HAL_IRDA_IRQHandler(IRDA_HandleTypeDef *hirda)
*/ */
__weak void HAL_IRDA_TxHalfCpltCallback(IRDA_HandleTypeDef *hirda) __weak void HAL_IRDA_TxHalfCpltCallback(IRDA_HandleTypeDef *hirda)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hirda);
/* NOTE: This function should not be modified, when the callback is needed, /* NOTE: This function should not be modified, when the callback is needed,
the HAL_IRDA_TxHalfCpltCallback can be implemented in the user file. the HAL_IRDA_TxHalfCpltCallback can be implemented in the user file.
*/ */
@ -1070,6 +1082,9 @@ void HAL_IRDA_IRQHandler(IRDA_HandleTypeDef *hirda)
*/ */
__weak void HAL_IRDA_RxCpltCallback(IRDA_HandleTypeDef *hirda) __weak void HAL_IRDA_RxCpltCallback(IRDA_HandleTypeDef *hirda)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hirda);
/* NOTE: This function should not be modified, when the callback is needed, /* NOTE: This function should not be modified, when the callback is needed,
the HAL_IRDA_RxCpltCallback can be implemented in the user file. the HAL_IRDA_RxCpltCallback can be implemented in the user file.
*/ */
@ -1083,6 +1098,9 @@ __weak void HAL_IRDA_RxCpltCallback(IRDA_HandleTypeDef *hirda)
*/ */
__weak void HAL_IRDA_RxHalfCpltCallback(IRDA_HandleTypeDef *hirda) __weak void HAL_IRDA_RxHalfCpltCallback(IRDA_HandleTypeDef *hirda)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hirda);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_IRDA_RxHalfCpltCallback can be implemented in the user file. the HAL_IRDA_RxHalfCpltCallback can be implemented in the user file.
*/ */
@ -1096,6 +1114,9 @@ __weak void HAL_IRDA_RxHalfCpltCallback(IRDA_HandleTypeDef *hirda)
*/ */
__weak void HAL_IRDA_ErrorCallback(IRDA_HandleTypeDef *hirda) __weak void HAL_IRDA_ErrorCallback(IRDA_HandleTypeDef *hirda)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hirda);
/* NOTE: This function should not be modified, when the callback is needed, /* NOTE: This function should not be modified, when the callback is needed,
the HAL_IRDA_ErrorCallback can be implemented in the user file. the HAL_IRDA_ErrorCallback can be implemented in the user file.
*/ */

View File

@ -2,14 +2,14 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_irda.h * @file stm32f0xx_hal_irda.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief This file contains all the functions prototypes for the IRDA * @brief This file contains all the functions prototypes for the IRDA
* firmware library. * firmware library.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -82,7 +82,7 @@ typedef struct
word length is set to 8 data bits). */ word length is set to 8 data bits). */
uint32_t Mode; /*!< Specifies whether the Receive or Transmit mode is enabled or disabled. uint32_t Mode; /*!< Specifies whether the Receive or Transmit mode is enabled or disabled.
This parameter can be a value of @ref IRDA_Mode */ This parameter can be a value of @ref IRDA_Transfer_Mode */
uint8_t Prescaler; /*!< Specifies the Prescaler value for dividing the UART/USART source clock uint8_t Prescaler; /*!< Specifies the Prescaler value for dividing the UART/USART source clock
to achieve low-power frequency. to achieve low-power frequency.

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_irda_ex.h * @file stm32f0xx_hal_irda_ex.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of IRDA HAL Extension module. * @brief Header file of IRDA HAL Extension module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_iwdg.c * @file stm32f0xx_hal_iwdg.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief IWDG HAL module driver. * @brief IWDG HAL module driver.
* This file provides firmware functions to manage the following * This file provides firmware functions to manage the following
* functionalities of the Independent Watchdog (IWDG) peripheral: * functionalities of the Independent Watchdog (IWDG) peripheral:
@ -77,7 +77,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -242,6 +242,9 @@ HAL_StatusTypeDef HAL_IWDG_Init(IWDG_HandleTypeDef *hiwdg)
*/ */
__weak void HAL_IWDG_MspInit(IWDG_HandleTypeDef *hiwdg) __weak void HAL_IWDG_MspInit(IWDG_HandleTypeDef *hiwdg)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hiwdg);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_IWDG_MspInit could be implemented in the user file the HAL_IWDG_MspInit could be implemented in the user file
*/ */

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_iwdg.h * @file stm32f0xx_hal_iwdg.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of IWDG HAL module. * @brief Header file of IWDG HAL module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_pcd.c * @file stm32f0xx_hal_pcd.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief PCD HAL module driver. * @brief PCD HAL module driver.
* This file provides firmware functions to manage the following * This file provides firmware functions to manage the following
* functionalities of the USB Peripheral Controller: * functionalities of the USB Peripheral Controller:
@ -44,7 +44,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -244,6 +244,9 @@ HAL_StatusTypeDef HAL_PCD_DeInit(PCD_HandleTypeDef *hpcd)
*/ */
__weak void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd) __weak void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hpcd);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_PCD_MspInit could be implemented in the user file the HAL_PCD_MspInit could be implemented in the user file
*/ */
@ -256,6 +259,9 @@ __weak void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
*/ */
__weak void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd) __weak void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hpcd);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_PCD_MspDeInit could be implemented in the user file the HAL_PCD_MspDeInit could be implemented in the user file
*/ */
@ -401,6 +407,10 @@ void HAL_PCD_IRQHandler(PCD_HandleTypeDef *hpcd)
*/ */
__weak void HAL_PCD_DataOutStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum) __weak void HAL_PCD_DataOutStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hpcd);
UNUSED(epnum);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_PCD_DataOutStageCallback could be implemented in the user file the HAL_PCD_DataOutStageCallback could be implemented in the user file
*/ */
@ -414,6 +424,10 @@ void HAL_PCD_IRQHandler(PCD_HandleTypeDef *hpcd)
*/ */
__weak void HAL_PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum) __weak void HAL_PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hpcd);
UNUSED(epnum);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_PCD_DataInStageCallback could be implemented in the user file the HAL_PCD_DataInStageCallback could be implemented in the user file
*/ */
@ -425,6 +439,9 @@ void HAL_PCD_IRQHandler(PCD_HandleTypeDef *hpcd)
*/ */
__weak void HAL_PCD_SetupStageCallback(PCD_HandleTypeDef *hpcd) __weak void HAL_PCD_SetupStageCallback(PCD_HandleTypeDef *hpcd)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hpcd);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_PCD_SetupStageCallback could be implemented in the user file the HAL_PCD_SetupStageCallback could be implemented in the user file
*/ */
@ -437,6 +454,9 @@ void HAL_PCD_IRQHandler(PCD_HandleTypeDef *hpcd)
*/ */
__weak void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd) __weak void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hpcd);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_PCD_SOFCallback could be implemented in the user file the HAL_PCD_SOFCallback could be implemented in the user file
*/ */
@ -449,6 +469,9 @@ void HAL_PCD_IRQHandler(PCD_HandleTypeDef *hpcd)
*/ */
__weak void HAL_PCD_ResetCallback(PCD_HandleTypeDef *hpcd) __weak void HAL_PCD_ResetCallback(PCD_HandleTypeDef *hpcd)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hpcd);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_PCD_ResetCallback could be implemented in the user file the HAL_PCD_ResetCallback could be implemented in the user file
*/ */
@ -461,6 +484,9 @@ void HAL_PCD_IRQHandler(PCD_HandleTypeDef *hpcd)
*/ */
__weak void HAL_PCD_SuspendCallback(PCD_HandleTypeDef *hpcd) __weak void HAL_PCD_SuspendCallback(PCD_HandleTypeDef *hpcd)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hpcd);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_PCD_SuspendCallback could be implemented in the user file the HAL_PCD_SuspendCallback could be implemented in the user file
*/ */
@ -473,6 +499,9 @@ void HAL_PCD_IRQHandler(PCD_HandleTypeDef *hpcd)
*/ */
__weak void HAL_PCD_ResumeCallback(PCD_HandleTypeDef *hpcd) __weak void HAL_PCD_ResumeCallback(PCD_HandleTypeDef *hpcd)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hpcd);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_PCD_ResumeCallback could be implemented in the user file the HAL_PCD_ResumeCallback could be implemented in the user file
*/ */
@ -486,6 +515,10 @@ void HAL_PCD_IRQHandler(PCD_HandleTypeDef *hpcd)
*/ */
__weak void HAL_PCD_ISOOUTIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum) __weak void HAL_PCD_ISOOUTIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hpcd);
UNUSED(epnum);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_PCD_ISOOUTIncompleteCallback could be implemented in the user file the HAL_PCD_ISOOUTIncompleteCallback could be implemented in the user file
*/ */
@ -499,6 +532,10 @@ void HAL_PCD_IRQHandler(PCD_HandleTypeDef *hpcd)
*/ */
__weak void HAL_PCD_ISOINIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum) __weak void HAL_PCD_ISOINIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hpcd);
UNUSED(epnum);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_PCD_ISOINIncompleteCallback could be implemented in the user file the HAL_PCD_ISOINIncompleteCallback could be implemented in the user file
*/ */
@ -511,6 +548,9 @@ void HAL_PCD_IRQHandler(PCD_HandleTypeDef *hpcd)
*/ */
__weak void HAL_PCD_ConnectCallback(PCD_HandleTypeDef *hpcd) __weak void HAL_PCD_ConnectCallback(PCD_HandleTypeDef *hpcd)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hpcd);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_PCD_ConnectCallback could be implemented in the user file the HAL_PCD_ConnectCallback could be implemented in the user file
*/ */
@ -523,6 +563,9 @@ void HAL_PCD_IRQHandler(PCD_HandleTypeDef *hpcd)
*/ */
__weak void HAL_PCD_DisconnectCallback(PCD_HandleTypeDef *hpcd) __weak void HAL_PCD_DisconnectCallback(PCD_HandleTypeDef *hpcd)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hpcd);
/* NOTE : This function Should not be modified, when the callback is needed, /* NOTE : This function Should not be modified, when the callback is needed,
the HAL_PCD_DisconnectCallback could be implemented in the user file the HAL_PCD_DisconnectCallback could be implemented in the user file
*/ */
@ -823,7 +866,7 @@ HAL_StatusTypeDef HAL_PCD_EP_Receive(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, u
else else
{ {
/*Set the Double buffer counter*/ /*Set the Double buffer counter*/
PCD_SET_EP_DBUF1_CNT(hpcd->Instance, ep->num, ep->is_in, len); PCD_SET_EP_DBUF_CNT(hpcd->Instance, ep->num, ep->is_in, len);
} }
PCD_SET_EP_RX_STATUS(hpcd->Instance, ep->num, USB_EP_RX_VALID); PCD_SET_EP_RX_STATUS(hpcd->Instance, ep->num, USB_EP_RX_VALID);

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_pcd.h * @file stm32f0xx_hal_pcd.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of PCD HAL module. * @brief Header file of PCD HAL module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_pcd_ex.c * @file stm32f0xx_hal_pcd_ex.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Extended PCD HAL module driver. * @brief Extended PCD HAL module driver.
* This file provides firmware functions to manage the following * This file provides firmware functions to manage the following
* functionalities of the USB Peripheral Controller: * functionalities of the USB Peripheral Controller:
@ -12,7 +12,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -128,7 +128,7 @@ HAL_StatusTypeDef HAL_PCDEx_PMAConfig(PCD_HandleTypeDef *hpcd,
ep->doublebuffer = 1; ep->doublebuffer = 1;
/*Configure the PMA*/ /*Configure the PMA*/
ep->pmaaddr0 = pmaadress & 0xFFFF; ep->pmaaddr0 = pmaadress & 0xFFFF;
ep->pmaaddr1 = (pmaadress & 0xFFFF0000) >> 16; ep->pmaaddr1 = (pmaadress & 0xFFFF0000U) >> 16;
} }
return HAL_OK; return HAL_OK;

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_pcd_ex.h * @file stm32f0xx_hal_pcd_ex.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of PCD HAL Extension module. * @brief Header file of PCD HAL Extension module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_pwr.c * @file stm32f0xx_hal_pwr.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief PWR HAL module driver. * @brief PWR HAL module driver.
* This file provides firmware functions to manage the following * This file provides firmware functions to manage the following
* functionalities of the Power Controller (PWR) peripheral: * functionalities of the Power Controller (PWR) peripheral:
@ -14,7 +14,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_pwr.h * @file stm32f0xx_hal_pwr.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of PWR HAL module. * @brief Header file of PWR HAL module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_pwr_ex.c * @file stm32f0xx_hal_pwr_ex.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Extended PWR HAL module driver. * @brief Extended PWR HAL module driver.
* This file provides firmware functions to manage the following * This file provides firmware functions to manage the following
* functionalities of the Power Controller (PWR) peripheral: * functionalities of the Power Controller (PWR) peripheral:
@ -13,7 +13,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_pwr_ex.h * @file stm32f0xx_hal_pwr_ex.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of PWR HAL Extension module. * @brief Header file of PWR HAL Extension module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -333,8 +333,11 @@ typedef struct
* @brief Vddio2 Monitor EXTI line configuration: clear falling edge and rising edge trigger. * @brief Vddio2 Monitor EXTI line configuration: clear falling edge and rising edge trigger.
* @retval None. * @retval None.
*/ */
#define __HAL_PWR_VDDIO2_EXTI_DISABLE_FALLING_EDGE() EXTI->FTSR &= ~(PWR_EXTI_LINE_VDDIO2); \ #define __HAL_PWR_VDDIO2_EXTI_DISABLE_FALLING_EDGE() \
EXTI->RTSR &= ~(PWR_EXTI_LINE_VDDIO2) do{ \
EXTI->FTSR &= ~(PWR_EXTI_LINE_VDDIO2); \
EXTI->RTSR &= ~(PWR_EXTI_LINE_VDDIO2); \
} while(0)
/** /**
* @brief Vddio2 Monitor EXTI line configuration: set falling edge trigger. * @brief Vddio2 Monitor EXTI line configuration: set falling edge trigger.

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_rcc.c * @file stm32f0xx_hal_rcc.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief RCC HAL module driver. * @brief RCC HAL module driver.
* This file provides firmware functions to manage the following * This file provides firmware functions to manage the following
* functionalities of the Reset and Clock Control (RCC) peripheral: * functionalities of the Reset and Clock Control (RCC) peripheral:
@ -18,8 +18,8 @@
After reset the device is running from Internal High Speed oscillator After reset the device is running from Internal High Speed oscillator
(HSI 8MHz) with Flash 0 wait state, Flash prefetch buffer is enabled, (HSI 8MHz) with Flash 0 wait state, Flash prefetch buffer is enabled,
and all peripherals are off except internal SRAM, Flash and JTAG. and all peripherals are off except internal SRAM, Flash and JTAG.
(+) There is no prescaler on High speed (AHB) and Low speed (APB) busses; (+) There is no prescaler on High speed (AHB) and Low speed (APB) buses;
all peripherals mapped on these busses are running at HSI speed. all peripherals mapped on these buses are running at HSI speed.
(+) The clock for all peripherals is switched off, except the SRAM and FLASH. (+) The clock for all peripherals is switched off, except the SRAM and FLASH.
(+) All GPIOs are in input floating state, except the JTAG pins which (+) All GPIOs are in input floating state, except the JTAG pins which
are assigned to be used for debug purpose. are assigned to be used for debug purpose.
@ -27,7 +27,7 @@
(+) Configure the clock source to be used to drive the System clock (+) Configure the clock source to be used to drive the System clock
(if the application needs higher frequency/performance) (if the application needs higher frequency/performance)
(+) Configure the System clock frequency and Flash settings (+) Configure the System clock frequency and Flash settings
(+) Configure the AHB and APB busses prescalers (+) Configure the AHB and APB buses prescalers
(+) Enable the clock for the peripheral(s) to be used (+) Enable the clock for the peripheral(s) to be used
(+) Configure the clock source(s) for peripherals whose clocks are not (+) Configure the clock source(s) for peripherals whose clocks are not
derived from the System clock (RTC, ADC, I2C, USART, TIM, USB FS, etc..) derived from the System clock (RTC, ADC, I2C, USART, TIM, USB FS, etc..)
@ -50,7 +50,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -122,7 +122,7 @@ const uint8_t aAPBAHBPrescTable[16] = {0, 0, 0, 0, 1, 2, 3, 4, 1, 2, 3, 4,
*/ */
/* Private function prototypes -----------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/ /* Exported functions ---------------------------------------------------------*/
/** @defgroup RCC_Exported_Functions RCC Exported Functions /** @defgroup RCC_Exported_Functions RCC Exported Functions
* @{ * @{
@ -133,11 +133,11 @@ const uint8_t aAPBAHBPrescTable[16] = {0, 0, 0, 0, 1, 2, 3, 4, 1, 2, 3, 4,
* *
@verbatim @verbatim
=============================================================================== ===============================================================================
##### Initialization and de-initialization function ##### ##### Initialization and de-initialization functions #####
=============================================================================== ===============================================================================
[..] [..]
This section provides functions allowing to configure the internal/external oscillators This section provides functions allowing to configure the internal/external oscillators
(HSE, HSI, HSI14, HSI48, LSE, LSI, PLL, CSS and MCO) and the System busses clocks (SYSCLK, (HSE, HSI, HSI14, HSI48, LSE, LSI, PLL, CSS and MCO) and the System buses clocks (SYSCLK,
AHB and APB1). AHB and APB1).
[..] Internal/external clock and PLL configuration [..] Internal/external clock and PLL configuration
@ -164,22 +164,22 @@ const uint8_t aAPBAHBPrescTable[16] = {0, 0, 0, 0, 1, 2, 3, 4, 1, 2, 3, 4,
(#) CSS (Clock security system), once enable using the macro __HAL_RCC_CSS_ENABLE() (#) CSS (Clock security system), once enable using the macro __HAL_RCC_CSS_ENABLE()
and if a HSE clock failure occurs(HSE used directly or through PLL as System and if a HSE clock failure occurs(HSE used directly or through PLL as System
clock source), the System clockis automatically switched to HSI and an interrupt clock source), the System clocks automatically switched to HSI and an interrupt
is generated if enabled. The interrupt is linked to the Cortex-M0 NMI is generated if enabled. The interrupt is linked to the Cortex-M0 NMI
(Non-Maskable Interrupt) exception vector. (Non-Maskable Interrupt) exception vector.
(#) MCO (microcontroller clock output), used to output SYSCLK, HSI, HSE, LSI, LSE or PLL (#) MCO (microcontroller clock output), used to output SYSCLK, HSI, HSE, LSI, LSE or PLL
clock (divided by 2) output on pin (such as PA8 pin). clock (divided by 2) output on pin (such as PA8 pin).
[..] System, AHB and APB busses clocks configuration [..] System, AHB and APB buses clocks configuration
(#) Several clock sources can be used to drive the System clock (SYSCLK): HSI, (#) Several clock sources can be used to drive the System clock (SYSCLK): HSI,
HSE and PLL. HSE and PLL.
The AHB clock (HCLK) is derived from System clock through configurable The AHB clock (HCLK) is derived from System clock through configurable
prescaler and used to clock the CPU, memory and peripherals mapped prescaler and used to clock the CPU, memory and peripherals mapped
on AHB bus (DMA, GPIO...). APB1 (PCLK1) clock is derived on AHB bus (DMA, GPIO...). APB1 (PCLK1) clock is derived
from AHB clock through configurable prescalers and used to clock from AHB clock through configurable prescalers and used to clock
the peripherals mapped on these busses. You can use the peripherals mapped on these buses. You can use
"HAL_RCC_GetSysClockFreq()" function to retrieve the frequencies of these clocks. "@ref HAL_RCC_GetSysClockFreq()" function to retrieve the frequencies of these clocks.
(#) All the peripheral clocks are derived from the System clock (SYSCLK) except: (#) All the peripheral clocks are derived from the System clock (SYSCLK) except:
(++) The FLASH program/erase clock which is always HSI 8MHz clock. (++) The FLASH program/erase clock which is always HSI 8MHz clock.
@ -251,7 +251,7 @@ void HAL_RCC_DeInit(void)
/** /**
* @brief Initializes the RCC Oscillators according to the specified parameters in the * @brief Initializes the RCC Oscillators according to the specified parameters in the
* RCC_OscInitTypeDef. * RCC_OscInitTypeDef.
* @param RCC_OscInitStruct: pointer to an RCC_OscInitTypeDef structure that * @param RCC_OscInitStruct pointer to an RCC_OscInitTypeDef structure that
* contains the configuration information for the RCC Oscillators. * contains the configuration information for the RCC Oscillators.
* @note The PLL is not disabled when used as system clock. * @note The PLL is not disabled when used as system clock.
* @retval HAL status * @retval HAL status
@ -284,7 +284,7 @@ HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct)
/* Reset HSEON and HSEBYP bits before configuring the HSE --------------*/ /* Reset HSEON and HSEBYP bits before configuring the HSE --------------*/
__HAL_RCC_HSE_CONFIG(RCC_HSE_OFF); __HAL_RCC_HSE_CONFIG(RCC_HSE_OFF);
/* Get Start Tick*/ /* Get Start Tick */
tickstart = HAL_GetTick(); tickstart = HAL_GetTick();
/* Wait till HSE is disabled */ /* Wait till HSE is disabled */
@ -299,10 +299,11 @@ HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct)
/* Set the new HSE configuration ---------------------------------------*/ /* Set the new HSE configuration ---------------------------------------*/
__HAL_RCC_HSE_CONFIG(RCC_OscInitStruct->HSEState); __HAL_RCC_HSE_CONFIG(RCC_OscInitStruct->HSEState);
/* Check the HSE State */ /* Check the HSE State */
if(RCC_OscInitStruct->HSEState != RCC_HSE_OFF) if(RCC_OscInitStruct->HSEState != RCC_HSE_OFF)
{ {
/* Get Start Tick*/ /* Get Start Tick */
tickstart = HAL_GetTick(); tickstart = HAL_GetTick();
/* Wait till HSE is ready */ /* Wait till HSE is ready */
@ -316,7 +317,7 @@ HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct)
} }
else else
{ {
/* Get Start Tick*/ /* Get Start Tick */
tickstart = HAL_GetTick(); tickstart = HAL_GetTick();
/* Wait till HSE is bypassed or disabled */ /* Wait till HSE is bypassed or disabled */
@ -361,7 +362,7 @@ HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct)
/* Enable the Internal High Speed oscillator (HSI). */ /* Enable the Internal High Speed oscillator (HSI). */
__HAL_RCC_HSI_ENABLE(); __HAL_RCC_HSI_ENABLE();
/* Get Start Tick*/ /* Get Start Tick */
tickstart = HAL_GetTick(); tickstart = HAL_GetTick();
/* Wait till HSI is ready */ /* Wait till HSI is ready */
@ -381,7 +382,7 @@ HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct)
/* Disable the Internal High Speed oscillator (HSI). */ /* Disable the Internal High Speed oscillator (HSI). */
__HAL_RCC_HSI_DISABLE(); __HAL_RCC_HSI_DISABLE();
/* Get Start Tick*/ /* Get Start Tick */
tickstart = HAL_GetTick(); tickstart = HAL_GetTick();
/* Wait till HSI is disabled */ /* Wait till HSI is disabled */
@ -407,7 +408,7 @@ HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct)
/* Enable the Internal Low Speed oscillator (LSI). */ /* Enable the Internal Low Speed oscillator (LSI). */
__HAL_RCC_LSI_ENABLE(); __HAL_RCC_LSI_ENABLE();
/* Get Start Tick*/ /* Get Start Tick */
tickstart = HAL_GetTick(); tickstart = HAL_GetTick();
/* Wait till LSI is ready */ /* Wait till LSI is ready */
@ -424,7 +425,7 @@ HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct)
/* Disable the Internal Low Speed oscillator (LSI). */ /* Disable the Internal Low Speed oscillator (LSI). */
__HAL_RCC_LSI_DISABLE(); __HAL_RCC_LSI_DISABLE();
/* Get Start Tick*/ /* Get Start Tick */
tickstart = HAL_GetTick(); tickstart = HAL_GetTick();
/* Wait till LSI is disabled */ /* Wait till LSI is disabled */
@ -463,7 +464,7 @@ HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct)
/* Reset LSEON and LSEBYP bits before configuring the LSE ----------------*/ /* Reset LSEON and LSEBYP bits before configuring the LSE ----------------*/
__HAL_RCC_LSE_CONFIG(RCC_LSE_OFF); __HAL_RCC_LSE_CONFIG(RCC_LSE_OFF);
/* Get Start Tick*/ /* Get Start Tick */
tickstart = HAL_GetTick(); tickstart = HAL_GetTick();
/* Wait till LSE is disabled */ /* Wait till LSE is disabled */
@ -480,7 +481,7 @@ HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct)
/* Check the LSE State */ /* Check the LSE State */
if(RCC_OscInitStruct->LSEState != RCC_LSE_OFF) if(RCC_OscInitStruct->LSEState != RCC_LSE_OFF)
{ {
/* Get Start Tick*/ /* Get Start Tick */
tickstart = HAL_GetTick(); tickstart = HAL_GetTick();
/* Wait till LSE is ready */ /* Wait till LSE is ready */
@ -494,7 +495,7 @@ HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct)
} }
else else
{ {
/* Get Start Tick*/ /* Get Start Tick */
tickstart = HAL_GetTick(); tickstart = HAL_GetTick();
/* Wait till LSE is disabled */ /* Wait till LSE is disabled */
@ -524,7 +525,7 @@ HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct)
/* Enable the Internal High Speed oscillator (HSI). */ /* Enable the Internal High Speed oscillator (HSI). */
__HAL_RCC_HSI14_ENABLE(); __HAL_RCC_HSI14_ENABLE();
/* Get timeout */ /* Get Start Tick */
tickstart = HAL_GetTick(); tickstart = HAL_GetTick();
/* Wait till HSI is ready */ /* Wait till HSI is ready */
@ -555,7 +556,7 @@ HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct)
/* Disable the Internal High Speed oscillator (HSI). */ /* Disable the Internal High Speed oscillator (HSI). */
__HAL_RCC_HSI14_DISABLE(); __HAL_RCC_HSI14_DISABLE();
/* Get timeout */ /* Get Start Tick */
tickstart = HAL_GetTick(); tickstart = HAL_GetTick();
/* Wait till HSI is ready */ /* Wait till HSI is ready */
@ -593,7 +594,7 @@ HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct)
/* Enable the Internal High Speed oscillator (HSI48). */ /* Enable the Internal High Speed oscillator (HSI48). */
__HAL_RCC_HSI48_ENABLE(); __HAL_RCC_HSI48_ENABLE();
/* Get timeout */ /* Get Start Tick */
tickstart = HAL_GetTick(); tickstart = HAL_GetTick();
/* Wait till HSI is ready */ /* Wait till HSI is ready */
@ -610,7 +611,7 @@ HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct)
/* Disable the Internal High Speed oscillator (HSI48). */ /* Disable the Internal High Speed oscillator (HSI48). */
__HAL_RCC_HSI48_DISABLE(); __HAL_RCC_HSI48_DISABLE();
/* Get timeout */ /* Get Start Tick */
tickstart = HAL_GetTick(); tickstart = HAL_GetTick();
/* Wait till HSI is ready */ /* Wait till HSI is ready */
@ -644,7 +645,7 @@ HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct)
/* Disable the main PLL. */ /* Disable the main PLL. */
__HAL_RCC_PLL_DISABLE(); __HAL_RCC_PLL_DISABLE();
/* Get Start Tick*/ /* Get Start Tick */
tickstart = HAL_GetTick(); tickstart = HAL_GetTick();
/* Wait till PLL is disabled */ /* Wait till PLL is disabled */
@ -663,7 +664,7 @@ HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct)
/* Enable the main PLL. */ /* Enable the main PLL. */
__HAL_RCC_PLL_ENABLE(); __HAL_RCC_PLL_ENABLE();
/* Get Start Tick*/ /* Get Start Tick */
tickstart = HAL_GetTick(); tickstart = HAL_GetTick();
/* Wait till PLL is ready */ /* Wait till PLL is ready */
@ -680,7 +681,7 @@ HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct)
/* Disable the main PLL. */ /* Disable the main PLL. */
__HAL_RCC_PLL_DISABLE(); __HAL_RCC_PLL_DISABLE();
/* Get Start Tick*/ /* Get Start Tick */
tickstart = HAL_GetTick(); tickstart = HAL_GetTick();
/* Wait till PLL is disabled */ /* Wait till PLL is disabled */
@ -703,27 +704,25 @@ HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct)
} }
/** /**
* @brief Initializes the CPU, AHB and APB busses clocks according to the specified * @brief Initializes the CPU, AHB and APB buses clocks according to the specified
* parameters in the RCC_ClkInitStruct. * parameters in the RCC_ClkInitStruct.
* @param RCC_ClkInitStruct: pointer to an RCC_OscInitTypeDef structure that * @param RCC_ClkInitStruct pointer to an RCC_OscInitTypeDef structure that
* contains the configuration information for the RCC peripheral. * contains the configuration information for the RCC peripheral.
* @param FLatency: FLASH Latency * @param FLatency FLASH Latency
* This parameter can be one of the following values: * The value of this parameter depend on device used within the same series
* @arg FLASH_LATENCY_0: FLASH 0 Latency cycle
* @arg FLASH_LATENCY_1: FLASH 1 Latency cycle
* @note The SystemCoreClock CMSIS variable is used to store System Clock Frequency * @note The SystemCoreClock CMSIS variable is used to store System Clock Frequency
* and updated by HAL_RCC_GetHCLKFreq() function called within this function * and updated by @ref HAL_RCC_GetHCLKFreq() function called within this function
* *
* @note The HSI is used (enabled by hardware) as system clock source after * @note The HSI is used (enabled by hardware) as system clock source after
* startup from Reset, wake-up from STOP and STANDBY mode, or in case * start-up from Reset, wake-up from STOP and STANDBY mode, or in case
* of failure of the HSE used directly or indirectly as system clock * of failure of the HSE used directly or indirectly as system clock
* (if the Clock Security System CSS is enabled). * (if the Clock Security System CSS is enabled).
* *
* @note A switch from one clock source to another occurs only if the target * @note A switch from one clock source to another occurs only if the target
* clock source is ready (clock stable after startup delay or PLL locked). * clock source is ready (clock stable after start-up delay or PLL locked).
* If a clock source which is not yet ready is selected, the switch will * If a clock source which is not yet ready is selected, the switch will
* occur when the clock source will be ready. * occur when the clock source will be ready.
* You can use HAL_RCC_GetClockConfig() function to know which clock is * You can use @ref HAL_RCC_GetClockConfig() function to know which clock is
* currently used as system clock source. * currently used as system clock source.
* @retval HAL status * @retval HAL status
*/ */
@ -740,7 +739,7 @@ HAL_StatusTypeDef HAL_RCC_ClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, ui
must be correctly programmed according to the frequency of the CPU clock must be correctly programmed according to the frequency of the CPU clock
(HCLK) of the device. */ (HCLK) of the device. */
/* Increasing the CPU frequency */ /* Increasing the number of wait states because of higher CPU frequency */
if(FLatency > (FLASH->ACR & FLASH_ACR_LATENCY)) if(FLatency > (FLASH->ACR & FLASH_ACR_LATENCY))
{ {
/* Program the new number of wait states to the LATENCY bits in the FLASH_ACR register */ /* Program the new number of wait states to the LATENCY bits in the FLASH_ACR register */
@ -752,6 +751,7 @@ HAL_StatusTypeDef HAL_RCC_ClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, ui
{ {
return HAL_ERROR; return HAL_ERROR;
} }
}
/*-------------------------- HCLK Configuration --------------------------*/ /*-------------------------- HCLK Configuration --------------------------*/
if(((RCC_ClkInitStruct->ClockType) & RCC_CLOCKTYPE_HCLK) == RCC_CLOCKTYPE_HCLK) if(((RCC_ClkInitStruct->ClockType) & RCC_CLOCKTYPE_HCLK) == RCC_CLOCKTYPE_HCLK)
@ -803,9 +803,9 @@ HAL_StatusTypeDef HAL_RCC_ClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, ui
return HAL_ERROR; return HAL_ERROR;
} }
} }
MODIFY_REG(RCC->CFGR, RCC_CFGR_SW, RCC_ClkInitStruct->SYSCLKSource); __HAL_RCC_SYSCLK_CONFIG(RCC_ClkInitStruct->SYSCLKSource);
/* Get Start Tick*/ /* Get Start Tick */
tickstart = HAL_GetTick(); tickstart = HAL_GetTick();
if(RCC_ClkInitStruct->SYSCLKSource == RCC_SYSCLKSOURCE_HSE) if(RCC_ClkInitStruct->SYSCLKSource == RCC_SYSCLKSOURCE_HSE)
@ -851,109 +851,9 @@ HAL_StatusTypeDef HAL_RCC_ClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, ui
} }
} }
} }
} /* Decreasing the number of wait states because of lower CPU frequency */
/* Decreasing the CPU frequency */ if(FLatency < (FLASH->ACR & FLASH_ACR_LATENCY))
else
{ {
/*-------------------------- HCLK Configuration --------------------------*/
if(((RCC_ClkInitStruct->ClockType) & RCC_CLOCKTYPE_HCLK) == RCC_CLOCKTYPE_HCLK)
{
assert_param(IS_RCC_HCLK(RCC_ClkInitStruct->AHBCLKDivider));
MODIFY_REG(RCC->CFGR, RCC_CFGR_HPRE, RCC_ClkInitStruct->AHBCLKDivider);
}
/*------------------------- SYSCLK Configuration -------------------------*/
if(((RCC_ClkInitStruct->ClockType) & RCC_CLOCKTYPE_SYSCLK) == RCC_CLOCKTYPE_SYSCLK)
{
assert_param(IS_RCC_SYSCLKSOURCE(RCC_ClkInitStruct->SYSCLKSource));
/* HSE is selected as System Clock Source */
if(RCC_ClkInitStruct->SYSCLKSource == RCC_SYSCLKSOURCE_HSE)
{
/* Check the HSE ready flag */
if(__HAL_RCC_GET_FLAG(RCC_FLAG_HSERDY) == RESET)
{
return HAL_ERROR;
}
}
/* PLL is selected as System Clock Source */
else if(RCC_ClkInitStruct->SYSCLKSource == RCC_SYSCLKSOURCE_PLLCLK)
{
/* Check the PLL ready flag */
if(__HAL_RCC_GET_FLAG(RCC_FLAG_PLLRDY) == RESET)
{
return HAL_ERROR;
}
}
#if defined(RCC_CR2_HSI48ON)
/* HSI48 is selected as System Clock Source */
else if(RCC_ClkInitStruct->SYSCLKSource == RCC_SYSCLKSOURCE_HSI48)
{
/* Check the HSI48 ready flag */
if(__HAL_RCC_GET_FLAG(RCC_FLAG_HSI48RDY) == RESET)
{
return HAL_ERROR;
}
}
#endif /* RCC_CR2_HSI48ON */
/* HSI is selected as System Clock Source */
else
{
/* Check the HSI ready flag */
if(__HAL_RCC_GET_FLAG(RCC_FLAG_HSIRDY) == RESET)
{
return HAL_ERROR;
}
}
MODIFY_REG(RCC->CFGR, RCC_CFGR_SW, RCC_ClkInitStruct->SYSCLKSource);
/* Get Start Tick*/
tickstart = HAL_GetTick();
if(RCC_ClkInitStruct->SYSCLKSource == RCC_SYSCLKSOURCE_HSE)
{
while (__HAL_RCC_GET_SYSCLK_SOURCE() != RCC_SYSCLKSOURCE_STATUS_HSE)
{
if((HAL_GetTick() - tickstart ) > CLOCKSWITCH_TIMEOUT_VALUE)
{
return HAL_TIMEOUT;
}
}
}
else if(RCC_ClkInitStruct->SYSCLKSource == RCC_SYSCLKSOURCE_PLLCLK)
{
while (__HAL_RCC_GET_SYSCLK_SOURCE() != RCC_SYSCLKSOURCE_STATUS_PLLCLK)
{
if((HAL_GetTick() - tickstart ) > CLOCKSWITCH_TIMEOUT_VALUE)
{
return HAL_TIMEOUT;
}
}
}
#if defined(RCC_CR2_HSI48ON)
else if(RCC_ClkInitStruct->SYSCLKSource == RCC_SYSCLKSOURCE_HSI48)
{
while (__HAL_RCC_GET_SYSCLK_SOURCE() != RCC_SYSCLKSOURCE_STATUS_HSI48)
{
if((HAL_GetTick() - tickstart) > CLOCKSWITCH_TIMEOUT_VALUE)
{
return HAL_TIMEOUT;
}
}
}
#endif /* RCC_CR2_HSI48ON */
else
{
while (__HAL_RCC_GET_SYSCLK_SOURCE() != RCC_SYSCLKSOURCE_STATUS_HSI)
{
if((HAL_GetTick() - tickstart ) > CLOCKSWITCH_TIMEOUT_VALUE)
{
return HAL_TIMEOUT;
}
}
}
}
/* Program the new number of wait states to the LATENCY bits in the FLASH_ACR register */ /* Program the new number of wait states to the LATENCY bits in the FLASH_ACR register */
__HAL_FLASH_SET_LATENCY(FLatency); __HAL_FLASH_SET_LATENCY(FLatency);
@ -965,6 +865,7 @@ HAL_StatusTypeDef HAL_RCC_ClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, ui
} }
} }
/*-------------------------- PCLK1 Configuration ---------------------------*/ /*-------------------------- PCLK1 Configuration ---------------------------*/
if(((RCC_ClkInitStruct->ClockType) & RCC_CLOCKTYPE_PCLK1) == RCC_CLOCKTYPE_PCLK1) if(((RCC_ClkInitStruct->ClockType) & RCC_CLOCKTYPE_PCLK1) == RCC_CLOCKTYPE_PCLK1)
{ {
@ -997,31 +898,77 @@ HAL_StatusTypeDef HAL_RCC_ClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, ui
* @{ * @{
*/ */
#if defined(RCC_CFGR_MCOPRE)
/** /**
* @brief Selects the clock source to output on MCO pin. * @brief Selects the clock source to output on MCO pin.
* @note MCO pin should be configured in alternate function mode. * @note MCO pin should be configured in alternate function mode.
* @param RCC_MCOx: specifies the output direction for the clock source. * @param RCC_MCOx specifies the output direction for the clock source.
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg RCC_MCO: Clock source to output on MCO1 pin(PA8). * @arg @ref RCC_MCO Clock source to output on MCO1 pin(PA8).
* @param RCC_MCOSource: specifies the clock source to output. * @param RCC_MCOSource specifies the clock source to output.
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg RCC_MCOSOURCE_HSI: HSI selected as MCO clock * @arg @ref RCC_MCO1SOURCE_NOCLOCK No clock selected
* @arg RCC_MCOSOURCE_HSE: HSE selected as MCO clock * @arg @ref RCC_MCO1SOURCE_SYSCLK System Clock selected as MCO clock
* @arg RCC_MCOSOURCE_LSI: LSI selected as MCO clock * @arg @ref RCC_MCO1SOURCE_HSI HSI selected as MCO clock
* @arg RCC_MCOSOURCE_LSE: LSE selected as MCO clock * @arg @ref RCC_MCO1SOURCE_HSE HSE selected as MCO clock
* @arg RCC_MCOSOURCE_PLLCLK_NODIV: PLLCLK selected as MCO clock (not applicable to STM32F05x devices) * @arg @ref RCC_MCO1SOURCE_LSI LSI selected as MCO clock
* @arg RCC_MCOSOURCE_PLLCLK_DIV2: PLLCLK Divided by 2 selected as MCO clock * @arg @ref RCC_MCO1SOURCE_LSE LSE selected as MCO clock
* @arg RCC_MCOSOURCE_SYSCLK: System Clock selected as MCO clock * @arg @ref RCC_MCO1SOURCE_HSI14 HSI14 selected as MCO clock
* @arg RCC_MCOSOURCE_HSI14: HSI14 selected as MCO clock @if STM32F042x6
* @arg RCC_MCOSOURCE_HSI48: HSI48 selected as MCO clock * @arg @ref RCC_MCO1SOURCE_HSI48 HSI48 selected as MCO clock
* @param RCC_MCODiv: specifies the MCO DIV. @elseif STM32F048xx
* @arg @ref RCC_MCO1SOURCE_HSI48 HSI48 selected as MCO clock
@elseif STM32F071xB
* @arg @ref RCC_MCO1SOURCE_HSI48 HSI48 selected as MCO clock
@elseif STM32F072xB
* @arg @ref RCC_MCO1SOURCE_HSI48 HSI48 selected as MCO clock
@elseif STM32F078xx
* @arg @ref RCC_MCO1SOURCE_HSI48 HSI48 selected as MCO clock
@elseif STM32F091xC
* @arg @ref RCC_MCO1SOURCE_HSI48 HSI48 selected as MCO clock
@elseif STM32F098xx
* @arg @ref RCC_MCO1SOURCE_HSI48 HSI48 selected as MCO clock
@endif
* @arg @ref RCC_MCO1SOURCE_PLLCLK PLLCLK selected as MCO clock (not applicable to STM32F05x devices)
* @arg @ref RCC_MCO1SOURCE_PLLCLK_DIV2 PLLCLK Divided by 2 selected as MCO clock
* @param RCC_MCODiv specifies the MCO DIV.
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg RCC_MCODIV_1: no division applied to MCO clock * @arg @ref RCC_MCODIV_1 no division applied to MCO clock
* @arg @ref RCC_MCODIV_2 division by 2 applied to MCO clock
* @arg @ref RCC_MCODIV_4 division by 4 applied to MCO clock
* @arg @ref RCC_MCODIV_8 division by 8 applied to MCO clock
* @arg @ref RCC_MCODIV_16 division by 16 applied to MCO clock
* @arg @ref RCC_MCODIV_32 division by 32 applied to MCO clock
* @arg @ref RCC_MCODIV_64 division by 64 applied to MCO clock
* @arg @ref RCC_MCODIV_128 division by 128 applied to MCO clock
* @retval None * @retval None
*/ */
#else
/**
* @brief Selects the clock source to output on MCO pin.
* @note MCO pin should be configured in alternate function mode.
* @param RCC_MCOx specifies the output direction for the clock source.
* This parameter can be one of the following values:
* @arg @ref RCC_MCO Clock source to output on MCO1 pin(PA8).
* @param RCC_MCOSource specifies the clock source to output.
* This parameter can be one of the following values:
* @arg @ref RCC_MCO1SOURCE_NOCLOCK No clock selected as MCO clock
* @arg @ref RCC_MCO1SOURCE_SYSCLK System clock selected as MCO clock
* @arg @ref RCC_MCO1SOURCE_HSI HSI selected as MCO clock
* @arg @ref RCC_MCO1SOURCE_HSE HSE selected as MCO clock
* @arg @ref RCC_MCO1SOURCE_LSI LSI selected as MCO clock
* @arg @ref RCC_MCO1SOURCE_LSE LSE selected as MCO clock
* @arg @ref RCC_MCO1SOURCE_HSI14 HSI14 selected as MCO clock
* @arg @ref RCC_MCO1SOURCE_PLLCLK_DIV2 PLLCLK Divided by 2 selected as MCO clock
* @param RCC_MCODiv specifies the MCO DIV.
* This parameter can be one of the following values:
* @arg @ref RCC_MCODIV_1 no division applied to MCO clock
* @retval None
*/
#endif
void HAL_RCC_MCOConfig(uint32_t RCC_MCOx, uint32_t RCC_MCOSource, uint32_t RCC_MCODiv) void HAL_RCC_MCOConfig(uint32_t RCC_MCOx, uint32_t RCC_MCOSource, uint32_t RCC_MCODiv)
{ {
GPIO_InitTypeDef gpio; GPIO_InitTypeDef gpio = {0};
/* Check the parameters */ /* Check the parameters */
assert_param(IS_RCC_MCO(RCC_MCOx)); assert_param(IS_RCC_MCO(RCC_MCOx));
@ -1034,13 +981,13 @@ void HAL_RCC_MCOConfig(uint32_t RCC_MCOx, uint32_t RCC_MCOSource, uint32_t RCC_M
/* Configure the MCO1 pin in alternate function mode */ /* Configure the MCO1 pin in alternate function mode */
gpio.Pin = MCO1_PIN; gpio.Pin = MCO1_PIN;
gpio.Mode = GPIO_MODE_AF_PP; gpio.Mode = GPIO_MODE_AF_PP;
gpio.Speed = GPIO_SPEED_HIGH; gpio.Speed = GPIO_SPEED_FREQ_HIGH;
gpio.Pull = GPIO_NOPULL; gpio.Pull = GPIO_NOPULL;
gpio.Alternate = GPIO_AF0_MCO; gpio.Alternate = GPIO_AF0_MCO;
HAL_GPIO_Init(MCO1_GPIO_PORT, &gpio); HAL_GPIO_Init(MCO1_GPIO_PORT, &gpio);
/* Configure the MCO clock source */ /* Configure the MCO clock source */
__HAL_RCC_MCO_CONFIG(RCC_MCOSource, RCC_MCODiv); __HAL_RCC_MCO1_CONFIG(RCC_MCOSource, RCC_MCODiv);
} }
/** /**
@ -1068,7 +1015,6 @@ void HAL_RCC_DisableCSS(void)
/** /**
* @brief Returns the SYSCLK frequency * @brief Returns the SYSCLK frequency
*
* @note The system frequency computed by this function is not the real * @note The system frequency computed by this function is not the real
* frequency in the chip. It is calculated based on the predefined * frequency in the chip. It is calculated based on the predefined
* constant and the selected clock source: * constant and the selected clock source:
@ -1076,9 +1022,9 @@ void HAL_RCC_DisableCSS(void)
* @note If SYSCLK source is HSE, function returns a value based on HSE_VALUE * @note If SYSCLK source is HSE, function returns a value based on HSE_VALUE
* divided by PREDIV factor(**) * divided by PREDIV factor(**)
* @note If SYSCLK source is PLL, function returns a value based on HSE_VALUE * @note If SYSCLK source is PLL, function returns a value based on HSE_VALUE
* divided by PREDIV factor(**) or depending on STM32F0xx devices either a value based * divided by PREDIV factor(**) or depending on STM32F0xxxx devices either a value based
* on HSI_VALUE divided by 2 or HSI_VALUE divided by PREDIV factor(*) multiplied by the * on HSI_VALUE divided by 2 or HSI_VALUE divided by PREDIV factor(*) multiplied by the
* PLL factor . * PLL factor.
* @note (*) HSI_VALUE is a constant defined in stm32f0xx_hal_conf.h file (default value * @note (*) HSI_VALUE is a constant defined in stm32f0xx_hal_conf.h file (default value
* 8 MHz) but the real value may vary depending on the variations * 8 MHz) but the real value may vary depending on the variations
* in voltage and temperature. * in voltage and temperature.
@ -1091,12 +1037,11 @@ void HAL_RCC_DisableCSS(void)
* value for HSE crystal. * value for HSE crystal.
* *
* @note This function can be used by the user application to compute the * @note This function can be used by the user application to compute the
* baudrate for the communication peripherals or configure other parameters. * baud-rate for the communication peripherals or configure other parameters.
* *
* @note Each time SYSCLK changes, this function must be called to update the * @note Each time SYSCLK changes, this function must be called to update the
* right SYSCLK value. Otherwise, any configuration based on this function will be incorrect. * right SYSCLK value. Otherwise, any configuration based on this function will be incorrect.
* *
*
* @retval SYSCLK frequency * @retval SYSCLK frequency
*/ */
uint32_t HAL_RCC_GetSysClockFreq(void) uint32_t HAL_RCC_GetSysClockFreq(void)
@ -1126,20 +1071,20 @@ uint32_t HAL_RCC_GetSysClockFreq(void)
if ((tmpreg & RCC_CFGR_PLLSRC) == RCC_PLLSOURCE_HSE) if ((tmpreg & RCC_CFGR_PLLSRC) == RCC_PLLSOURCE_HSE)
{ {
/* HSE used as PLL clock source : PLLCLK = HSE/PREDIV * PLLMUL */ /* HSE used as PLL clock source : PLLCLK = HSE/PREDIV * PLLMUL */
pllclk = (HSE_VALUE/prediv) * pllmul; pllclk = (HSE_VALUE / prediv) * pllmul;
} }
#if defined(RCC_CR2_HSI48ON) #if defined(RCC_CR2_HSI48ON)
else if ((tmpreg & RCC_CFGR_PLLSRC) == RCC_PLLSOURCE_HSI48) else if ((tmpreg & RCC_CFGR_PLLSRC) == RCC_PLLSOURCE_HSI48)
{ {
/* HSI48 used as PLL clock source : PLLCLK = HSI48/PREDIV * PLLMUL */ /* HSI48 used as PLL clock source : PLLCLK = HSI48/PREDIV * PLLMUL */
pllclk = (HSI48_VALUE/prediv) * pllmul; pllclk = (HSI48_VALUE / prediv) * pllmul;
} }
#endif /* RCC_CR2_HSI48ON */ #endif /* RCC_CR2_HSI48ON */
else else
{ {
#if (defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F070x6) || defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)) #if (defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F070x6) || defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC))
/* HSI used as PLL clock source : PLLCLK = HSI/PREDIV * PLLMUL */ /* HSI used as PLL clock source : PLLCLK = HSI/PREDIV * PLLMUL */
pllclk = (HSI_VALUE/prediv) * pllmul; pllclk = (HSI_VALUE / prediv) * pllmul;
#else #else
/* HSI used as PLL clock source : PLLCLK = HSI/2 * PLLMUL */ /* HSI used as PLL clock source : PLLCLK = HSI/2 * PLLMUL */
pllclk = (uint32_t)((HSI_VALUE >> 1) * pllmul); pllclk = (uint32_t)((HSI_VALUE >> 1) * pllmul);
@ -1195,7 +1140,7 @@ uint32_t HAL_RCC_GetPCLK1Freq(void)
/** /**
* @brief Configures the RCC_OscInitStruct according to the internal * @brief Configures the RCC_OscInitStruct according to the internal
* RCC configuration registers. * RCC configuration registers.
* @param RCC_OscInitStruct: pointer to an RCC_OscInitTypeDef structure that * @param RCC_OscInitStruct pointer to an RCC_OscInitTypeDef structure that
* will be configured. * will be configured.
* @retval None * @retval None
*/ */
@ -1211,6 +1156,7 @@ void HAL_RCC_GetOscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct)
RCC_OscInitStruct->OscillatorType |= RCC_OSCILLATORTYPE_HSI48; RCC_OscInitStruct->OscillatorType |= RCC_OSCILLATORTYPE_HSI48;
#endif /* RCC_CR2_HSI48ON */ #endif /* RCC_CR2_HSI48ON */
/* Get the HSE configuration -----------------------------------------------*/ /* Get the HSE configuration -----------------------------------------------*/
if((RCC->CR &RCC_CR_HSEBYP) == RCC_CR_HSEBYP) if((RCC->CR &RCC_CR_HSEBYP) == RCC_CR_HSEBYP)
{ {
@ -1284,7 +1230,7 @@ void HAL_RCC_GetOscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct)
RCC_OscInitStruct->HSI14State = RCC_HSI_OFF; RCC_OscInitStruct->HSI14State = RCC_HSI_OFF;
} }
RCC_OscInitStruct->HSI14CalibrationValue = (uint32_t)((RCC->CR2 & RCC_CR2_HSI14TRIM) >> RCC_CR2_HSI14TRIM_BitNumber); RCC_OscInitStruct->HSI14CalibrationValue = (uint32_t)((RCC->CR2 & RCC_CR2_HSI14TRIM) >> RCC_HSI14TRIM_BIT_NUMBER);
#if defined(RCC_CR2_HSI48ON) #if defined(RCC_CR2_HSI48ON)
/* Get the HSI48 configuration if any-----------------------------------------*/ /* Get the HSI48 configuration if any-----------------------------------------*/
@ -1295,9 +1241,9 @@ void HAL_RCC_GetOscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct)
/** /**
* @brief Get the RCC_ClkInitStruct according to the internal * @brief Get the RCC_ClkInitStruct according to the internal
* RCC configuration registers. * RCC configuration registers.
* @param RCC_ClkInitStruct: pointer to an RCC_ClkInitTypeDef structure that * @param RCC_ClkInitStruct pointer to an RCC_ClkInitTypeDef structure that
* contains the current clock configuration. * contains the current clock configuration.
* @param pFLatency: Pointer on the Flash Latency. * @param pFLatency Pointer on the Flash Latency.
* @retval None * @retval None
*/ */
void HAL_RCC_GetClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, uint32_t *pFLatency) void HAL_RCC_GetClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, uint32_t *pFLatency)

View File

@ -2,18 +2,18 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_rcc_ex.c * @file stm32f0xx_hal_rcc_ex.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Extended RCC HAL module driver * @brief Extended RCC HAL module driver
* This file provides firmware functions to manage the following * This file provides firmware functions to manage the following
* functionalities RCC extension peripheral: * functionalities RCC extension peripheral:
* + Extended Clock Source configuration functions * + Extended Peripheral Control functions
* *
@verbatim @verbatim
============================================================================== ==============================================================================
##### How to use this driver ##### ##### How to use this driver #####
============================================================================== ==============================================================================
[..]
For CRS, RCC Extention HAL driver can be used as follows: For CRS, RCC Extention HAL driver can be used as follows:
(#) In System clock config, HSI48 need to be enabled (#) In System clock config, HSI48 need to be enabled
@ -24,20 +24,20 @@
(##) Prepare synchronization configuration necessary for HSI48 calibration (##) Prepare synchronization configuration necessary for HSI48 calibration
(+++) Default values can be set for frequency Error Measurement (reload and error limit) (+++) Default values can be set for frequency Error Measurement (reload and error limit)
and also HSI48 oscillator smooth trimming. and also HSI48 oscillator smooth trimming.
(+++) Macro __HAL_RCC_CRS_CALCULATE_RELOADVALUE can be also used to calculate (+++) Macro @ref __HAL_RCC_CRS_RELOADVALUE_CALCULATE can be also used to calculate
directly reload value with target and sychronization frequencies values directly reload value with target and synchronization frequencies values
(##) Call function HAL_RCCEx_CRSConfig which (##) Call function @ref HAL_RCCEx_CRSConfig which
(+++) Reset CRS registers to their default values. (+++) Reset CRS registers to their default values.
(+++) Configure CRS registers with synchronization configuration (+++) Configure CRS registers with synchronization configuration
(+++) Enable automatic calibration and frequency error counter feature (+++) Enable automatic calibration and frequency error counter feature
(##) A polling function is provided to wait for complete Synchronization (##) A polling function is provided to wait for complete Synchronization
(+++) Call function HAL_RCCEx_CRSWaitSynchronization() (+++) Call function @ref HAL_RCCEx_CRSWaitSynchronization()
(+++) According to CRS status, user can decide to adjust again the calibration or continue (+++) According to CRS status, user can decide to adjust again the calibration or continue
application if synchronization is OK application if synchronization is OK
(#) User can retrieve information related to synchronization in calling function (#) User can retrieve information related to synchronization in calling function
HAL_RCCEx_CRSGetSynchronizationInfo() @ref HAL_RCCEx_CRSGetSynchronizationInfo()
(#) Regarding synchronization status and synchronization information, user can try a new calibration (#) Regarding synchronization status and synchronization information, user can try a new calibration
in changing synchronization configuration and call again HAL_RCCEx_CRSConfig. in changing synchronization configuration and call again HAL_RCCEx_CRSConfig.
@ -48,19 +48,19 @@
(#) To use IT mode, user needs to handle it in calling different macros available to do it (#) To use IT mode, user needs to handle it in calling different macros available to do it
(__HAL_RCC_CRS_XXX_IT). Interuptions will go through RCC Handler (RCC_IRQn/RCC_CRS_IRQHandler) (__HAL_RCC_CRS_XXX_IT). Interuptions will go through RCC Handler (RCC_IRQn/RCC_CRS_IRQHandler)
(++) Call function HAL_RCCEx_CRSConfig() (++) Call function @ref HAL_RCCEx_CRSConfig()
(++) Enable RCC_IRQn (thnaks to NVIC functions) (++) Enable RCC_IRQn (thnaks to NVIC functions)
(++) Enable CRS IT (__HAL_RCC_CRS_ENABLE_IT) (++) Enable CRS IT (@ref __HAL_RCC_CRS_ENABLE_IT)
(++) Implement CRS status management in RCC_CRS_IRQHandler (++) Implement CRS status management in @ref RCC_CRS_IRQHandler
(#) To force a SYNC EVENT, user can use function HAL_RCCEx_CRSSoftwareSynchronizationGenerate(). Function can be (#) To force a SYNC EVENT, user can use function @ref HAL_RCCEx_CRSSoftwareSynchronizationGenerate(). Function can be
called before calling HAL_RCCEx_CRSConfig (for instance in Systick handler) called before calling @ref HAL_RCCEx_CRSConfig (for instance in Systick handler)
@endverbatim @endverbatim
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -103,6 +103,7 @@
/* Private typedef -----------------------------------------------------------*/ /* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/
#if defined(CRS)
/** @defgroup RCCEx_Private_Constants RCCEx Private Constants /** @defgroup RCCEx_Private_Constants RCCEx Private Constants
* @{ * @{
*/ */
@ -113,6 +114,7 @@
/** /**
* @} * @}
*/ */
#endif /* CRS */
/* Private macro -------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/
/** @defgroup RCCEx_Private_Macros RCCEx Private Macros /** @defgroup RCCEx_Private_Macros RCCEx Private Macros
@ -121,16 +123,17 @@
/** /**
* @} * @}
*/ */
/* Private variables ---------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/
/* Exported functions ---------------------------------------------------------*/ /* Private functions ---------------------------------------------------------*/
/** @defgroup RCCEx_Exported_Functions RCCEx Exported Functions /** @defgroup RCCEx_Exported_Functions RCCEx Exported Functions
* @{ * @{
*/ */
/** @defgroup RCCEx_Exported_Functions_Group1 Extended Peripheral Control functions /** @defgroup RCCEx_Exported_Functions_Group1 Extended Peripheral Control functions
* @brief Extended RCC clocks control functions * @brief Extended Peripheral Control functions
* *
@verbatim @verbatim
=============================================================================== ===============================================================================
@ -152,16 +155,16 @@
/** /**
* @brief Initializes the RCC extended peripherals clocks according to the specified * @brief Initializes the RCC extended peripherals clocks according to the specified
* parameters in the RCC_PeriphCLKInitTypeDef. * parameters in the RCC_PeriphCLKInitTypeDef.
* @param PeriphClkInit: pointer to an RCC_PeriphCLKInitTypeDef structure that * @param PeriphClkInit pointer to an RCC_PeriphCLKInitTypeDef structure that
* contains the configuration information for the Extended Peripherals clocks * contains the configuration information for the Extended Peripherals clocks
* (USART, RTC, I2C, CEC and USB). * (USART, RTC, I2C, CEC and USB).
* *
* @note Care must be taken when HAL_RCCEx_PeriphCLKConfig() is used to select * @note Care must be taken when @ref HAL_RCCEx_PeriphCLKConfig() is used to select
* the RTC clock source; in this case the Backup domain will be reset in * the RTC clock source; in this case the Backup domain will be reset in
* order to modify the RTC Clock source, as consequence RTC registers (including * order to modify the RTC Clock source, as consequence RTC registers (including
* the backup registers) and RCC_BDCR register are set to their reset values. * the backup registers) and RCC_BDCR register are set to their reset values.
* *
* @retval None * @retval HAL status
*/ */
HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit) HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit)
{ {
@ -169,14 +172,14 @@ HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClk
uint32_t temp_reg = 0; uint32_t temp_reg = 0;
/* Check the parameters */ /* Check the parameters */
assert_param(IS_RCC_PERIPHCLK(PeriphClkInit->PeriphClockSelection)); assert_param(IS_RCC_PERIPHCLOCK(PeriphClkInit->PeriphClockSelection));
/*---------------------------- RTC configuration -------------------------------*/ /*---------------------------- RTC configuration -------------------------------*/
if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_RTC) == (RCC_PERIPHCLK_RTC)) if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_RTC) == (RCC_PERIPHCLK_RTC))
{ {
/* Reset the Backup domain only if the RTC Clock source selction is modified */ /* check for RTC Parameters used to output RTCCLK */
if((RCC->BDCR & RCC_BDCR_RTCSEL) != (PeriphClkInit->RTCClockSelection & RCC_BDCR_RTCSEL)) assert_param(IS_RCC_RTCCLKSOURCE(PeriphClkInit->RTCClockSelection));
{
/* Enable Power Clock*/ /* Enable Power Clock*/
__HAL_RCC_PWR_CLK_ENABLE(); __HAL_RCC_PWR_CLK_ENABLE();
@ -194,6 +197,9 @@ HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClk
} }
} }
/* Reset the Backup domain only if the RTC Clock source selection is modified */
if((RCC->BDCR & RCC_BDCR_RTCSEL) != (PeriphClkInit->RTCClockSelection & RCC_BDCR_RTCSEL))
{
/* Store the content of BDCR register before the reset of Backup Domain */ /* Store the content of BDCR register before the reset of Backup Domain */
temp_reg = (RCC->BDCR & ~(RCC_BDCR_RTCSEL)); temp_reg = (RCC->BDCR & ~(RCC_BDCR_RTCSEL));
/* RTC Clock selection can be changed only if the Backup Domain is reset */ /* RTC Clock selection can be changed only if the Backup Domain is reset */
@ -205,7 +211,7 @@ HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClk
/* Wait for LSERDY if LSE was enabled */ /* Wait for LSERDY if LSE was enabled */
if (HAL_IS_BIT_SET(temp_reg, RCC_BDCR_LSERDY)) if (HAL_IS_BIT_SET(temp_reg, RCC_BDCR_LSERDY))
{ {
/* Get timeout */ /* Get Start Tick */
tickstart = HAL_GetTick(); tickstart = HAL_GetTick();
/* Wait till LSE is ready */ /* Wait till LSE is ready */
@ -303,7 +309,7 @@ HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClk
/** /**
* @brief Get the RCC_ClkInitStruct according to the internal * @brief Get the RCC_ClkInitStruct according to the internal
* RCC configuration registers. * RCC configuration registers.
* @param PeriphClkInit: pointer to an RCC_PeriphCLKInitTypeDef structure that * @param PeriphClkInit pointer to an RCC_PeriphCLKInitTypeDef structure that
* returns the configuration information for the Extended Peripherals clocks * returns the configuration information for the Extended Peripherals clocks
* (USART, RTC, I2C, CEC and USB). * (USART, RTC, I2C, CEC and USB).
* @retval None * @retval None
@ -315,7 +321,7 @@ void HAL_RCCEx_GetPeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit)
PeriphClkInit->PeriphClockSelection = RCC_PERIPHCLK_USART1 | RCC_PERIPHCLK_I2C1 | RCC_PERIPHCLK_RTC; PeriphClkInit->PeriphClockSelection = RCC_PERIPHCLK_USART1 | RCC_PERIPHCLK_I2C1 | RCC_PERIPHCLK_RTC;
/* Get the RTC configuration --------------------------------------------*/ /* Get the RTC configuration --------------------------------------------*/
PeriphClkInit->RTCClockSelection = __HAL_RCC_GET_RTC_SOURCE(); PeriphClkInit->RTCClockSelection = __HAL_RCC_GET_RTC_SOURCE();
/* Get the USART1 configuration --------------------------------------------*/ /* Get the USART1 clock configuration --------------------------------------------*/
PeriphClkInit->Usart1ClockSelection = __HAL_RCC_GET_USART1_SOURCE(); PeriphClkInit->Usart1ClockSelection = __HAL_RCC_GET_USART1_SOURCE();
/* Get the I2C1 clock source -----------------------------------------------*/ /* Get the I2C1 clock source -----------------------------------------------*/
PeriphClkInit->I2c1ClockSelection = __HAL_RCC_GET_I2C1_SOURCE(); PeriphClkInit->I2c1ClockSelection = __HAL_RCC_GET_I2C1_SOURCE();
@ -357,16 +363,55 @@ void HAL_RCCEx_GetPeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit)
/** /**
* @brief Returns the peripheral clock frequency * @brief Returns the peripheral clock frequency
* @note Returns 0 if peripheral clock is unknown * @note Returns 0 if peripheral clock is unknown
* @param PeriphClk: Peripheral clock identifier * @param PeriphClk Peripheral clock identifier
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg RCC_PERIPHCLK_RTC RTC peripheral clock * @arg @ref RCC_PERIPHCLK_RTC RTC peripheral clock
* @arg RCC_PERIPHCLK_USART1 USART1 peripheral clock * @arg @ref RCC_PERIPHCLK_USART1 USART1 peripheral clock
* @arg RCC_PERIPHCLK_USART2 USART2 peripheral clock (*) * @arg @ref RCC_PERIPHCLK_I2C1 I2C1 peripheral clock
* @arg RCC_PERIPHCLK_USART3 USART3 peripheral clock (*) @if STM32F042x6
* @arg RCC_PERIPHCLK_I2C1 I2C1 peripheral clock * @arg @ref RCC_PERIPHCLK_USB USB peripheral clock
* @arg RCC_PERIPHCLK_USB USB peripheral clock (*) * @arg @ref RCC_PERIPHCLK_CEC CEC peripheral clock
* @arg RCC_PERIPHCLK_CEC CEC peripheral clock (*) @endif
* @note (*) means that this peripheral is not present on all the STM32F0xx devices @if STM32F048xx
* @arg @ref RCC_PERIPHCLK_USB USB peripheral clock
* @arg @ref RCC_PERIPHCLK_CEC CEC peripheral clock
@endif
@if STM32F051x8
* @arg @ref RCC_PERIPHCLK_CEC CEC peripheral clock
@endif
@if STM32F058xx
* @arg @ref RCC_PERIPHCLK_CEC CEC peripheral clock
@endif
@if STM32F070x6
* @arg @ref RCC_PERIPHCLK_USB USB peripheral clock
@endif
@if STM32F070xB
* @arg @ref RCC_PERIPHCLK_USB USB peripheral clock
@endif
@if STM32F071xB
* @arg @ref RCC_PERIPHCLK_USART2 USART2 peripheral clock
* @arg @ref RCC_PERIPHCLK_CEC CEC peripheral clock
@endif
@if STM32F072xB
* @arg @ref RCC_PERIPHCLK_USART2 USART2 peripheral clock
* @arg @ref RCC_PERIPHCLK_USB USB peripheral clock
* @arg @ref RCC_PERIPHCLK_CEC CEC peripheral clock
@endif
@if STM32F078xx
* @arg @ref RCC_PERIPHCLK_USART2 USART2 peripheral clock
* @arg @ref RCC_PERIPHCLK_USB USB peripheral clock
* @arg @ref RCC_PERIPHCLK_CEC CEC peripheral clock
@endif
@if STM32F091xC
* @arg @ref RCC_PERIPHCLK_USART2 USART2 peripheral clock
* @arg @ref RCC_PERIPHCLK_USART3 USART2 peripheral clock
* @arg @ref RCC_PERIPHCLK_CEC CEC peripheral clock
@endif
@if STM32F098xx
* @arg @ref RCC_PERIPHCLK_USART2 USART2 peripheral clock
* @arg @ref RCC_PERIPHCLK_USART3 USART2 peripheral clock
* @arg @ref RCC_PERIPHCLK_CEC CEC peripheral clock
@endif
* @retval Frequency in Hz (0: means that no available frequency for the peripheral) * @retval Frequency in Hz (0: means that no available frequency for the peripheral)
*/ */
uint32_t HAL_RCCEx_GetPeriphCLKFreq(uint32_t PeriphClk) uint32_t HAL_RCCEx_GetPeriphCLKFreq(uint32_t PeriphClk)
@ -378,7 +423,7 @@ uint32_t HAL_RCCEx_GetPeriphCLKFreq(uint32_t PeriphClk)
#endif /* USB */ #endif /* USB */
/* Check the parameters */ /* Check the parameters */
assert_param(IS_RCC_PERIPHCLK(PeriphClk)); assert_param(IS_RCC_PERIPHCLOCK(PeriphClk));
switch (PeriphClk) switch (PeriphClk)
{ {
@ -538,7 +583,7 @@ uint32_t HAL_RCCEx_GetPeriphCLKFreq(uint32_t PeriphClk)
srcclk = __HAL_RCC_GET_USB_SOURCE(); srcclk = __HAL_RCC_GET_USB_SOURCE();
/* Check if PLL is ready and if USB clock selection is PLL */ /* Check if PLL is ready and if USB clock selection is PLL */
if ((srcclk == RCC_USBCLKSOURCE_PLLCLK) && (HAL_IS_BIT_SET(RCC->CR, RCC_CR_PLLRDY))) if ((srcclk == RCC_USBCLKSOURCE_PLL) && (HAL_IS_BIT_SET(RCC->CR, RCC_CR_PLLRDY)))
{ {
/* Get PLL clock source and multiplication factor ----------------------*/ /* Get PLL clock source and multiplication factor ----------------------*/
pllmull = RCC->CFGR & RCC_CFGR_PLLMUL; pllmull = RCC->CFGR & RCC_CFGR_PLLMUL;
@ -616,9 +661,7 @@ uint32_t HAL_RCCEx_GetPeriphCLKFreq(uint32_t PeriphClk)
return(frequency); return(frequency);
} }
#if defined(STM32F042x6) || defined(STM32F048xx)\ #if defined(CRS)
|| defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)\
|| defined(STM32F091xC) || defined(STM32F098xx)
/** /**
* @brief Start automatic synchronization using polling mode * @brief Start automatic synchronization using polling mode
* @param pInit Pointer on RCC_CRSInitTypeDef structure * @param pInit Pointer on RCC_CRSInitTypeDef structure
@ -675,10 +718,10 @@ void HAL_RCCEx_CRSConfig(RCC_CRSInitTypeDef *pInit)
/* START AUTOMATIC SYNCHRONIZATION*/ /* START AUTOMATIC SYNCHRONIZATION*/
/* Enable Automatic trimming */ /* Enable Automatic trimming */
__HAL_RCC_CRS_ENABLE_AUTOMATIC_CALIB(); __HAL_RCC_CRS_AUTOMATIC_CALIB_ENABLE();
/* Enable Frequency error counter */ /* Enable Frequency error counter */
__HAL_RCC_CRS_ENABLE_FREQ_ERROR_COUNTER(); __HAL_RCC_CRS_FREQ_ERROR_COUNTER_ENABLE();
} }
@ -719,18 +762,18 @@ void HAL_RCCEx_CRSGetSynchronizationInfo(RCC_CRSSynchroInfoTypeDef *pSynchroInfo
/** /**
* @brief This function handles CRS Synchronization Timeout. * @brief This function handles CRS Synchronization Timeout.
* @param Timeout: Duration of the timeout * @param Timeout Duration of the timeout
* @note Timeout is based on the maximum time to receive a SYNC event based on synchronization * @note Timeout is based on the maximum time to receive a SYNC event based on synchronization
* frequency. * frequency.
* @note If Timeout set to HAL_MAX_DELAY, HAL_TIMEOUT will be never returned. * @note If Timeout set to HAL_MAX_DELAY, HAL_TIMEOUT will be never returned.
* @retval Combination of Synchronization status * @retval Combination of Synchronization status
* This parameter can be a combination of the following values: * This parameter can be a combination of the following values:
* @arg RCC_CRS_TIMEOUT * @arg @ref RCC_CRS_TIMEOUT
* @arg RCC_CRS_SYNCOK * @arg @ref RCC_CRS_SYNCOK
* @arg RCC_CRS_SYNCWARM * @arg @ref RCC_CRS_SYNCWARM
* @arg RCC_CRS_SYNCERR * @arg @ref RCC_CRS_SYNCERR
* @arg RCC_CRS_SYNCMISS * @arg @ref RCC_CRS_SYNCMISS
* @arg RCC_CRS_TRIMOV * @arg @ref RCC_CRS_TRIMOV
*/ */
uint32_t HAL_RCCEx_CRSWaitSynchronization(uint32_t Timeout) uint32_t HAL_RCCEx_CRSWaitSynchronization(uint32_t Timeout)
{ {
@ -811,9 +854,7 @@ uint32_t HAL_RCCEx_CRSWaitSynchronization(uint32_t Timeout)
return crsstatus; return crsstatus;
} }
#endif /* STM32F042x6 || STM32F048xx || */ #endif /* CRS */
/* STM32F071xB || STM32F072xB || STM32F078xx || */
/* STM32F091xC || STM32F098xx */
/** /**
* @} * @}

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_rcc_ex.h * @file stm32f0xx_hal_rcc_ex.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of RCC HAL Extension module. * @brief Header file of RCC HAL Extension module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -37,7 +37,7 @@
/* Define to prevent recursive inclusion -------------------------------------*/ /* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F0xx_HAL_RCC_EX_H #ifndef __STM32F0xx_HAL_RCC_EX_H
#define __HAL_RCC_STM32F0xx_HAL_RCC_EX_H #define __STM32F0xx_HAL_RCC_EX_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -101,31 +101,31 @@
/* STM32F071xB || STM32F072xB || STM32F078xx || */ /* STM32F071xB || STM32F072xB || STM32F078xx || */
/* STM32F091xC || STM32F098xx */ /* STM32F091xC || STM32F098xx */
#if defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F038xx) || defined(STM32F070x6)\ #if defined(STM32F031x6) || defined(STM32F038xx) || defined(STM32F070x6) || defined(STM32F070xB) \
|| defined(STM32F070xB) || defined(STM32F030xC) || defined(STM32F030xC)
#define IS_RCC_MCO1SOURCE(SOURCE) (((SOURCE) == RCC_MCOSOURCE_NONE) || \ #define IS_RCC_MCO1SOURCE(SOURCE) (((SOURCE) == RCC_MCO1SOURCE_NOCLOCK) || \
((SOURCE) == RCC_MCOSOURCE_LSI) || \ ((SOURCE) == RCC_MCO1SOURCE_LSI) || \
((SOURCE) == RCC_MCOSOURCE_LSE) || \ ((SOURCE) == RCC_MCO1SOURCE_LSE) || \
((SOURCE) == RCC_MCOSOURCE_SYSCLK) || \ ((SOURCE) == RCC_MCO1SOURCE_SYSCLK) || \
((SOURCE) == RCC_MCOSOURCE_HSI) || \ ((SOURCE) == RCC_MCO1SOURCE_HSI) || \
((SOURCE) == RCC_MCOSOURCE_HSE) || \ ((SOURCE) == RCC_MCO1SOURCE_HSE) || \
((SOURCE) == RCC_MCOSOURCE_PLLCLK_NODIV) || \ ((SOURCE) == RCC_MCO1SOURCE_PLLCLK) || \
((SOURCE) == RCC_MCOSOURCE_PLLCLK_DIV2) || \ ((SOURCE) == RCC_MCO1SOURCE_PLLCLK_DIV2) || \
((SOURCE) == RCC_MCOSOURCE_HSI14)) ((SOURCE) == RCC_MCO1SOURCE_HSI14))
#endif /* STM32F030x6 || STM32F031x6 || STM32F038xx || STM32F070x6 || STM32F070xB || STM32F030xC */ #endif /* STM32F030x6 || STM32F031x6 || STM32F038xx || STM32F070x6 || STM32F070xB || STM32F030xC */
#if defined(STM32F030x8) || defined(STM32F051x8) || defined(STM32F058xx) #if defined(STM32F030x6) || defined(STM32F030x8) || defined(STM32F051x8) || defined(STM32F058xx)
#define IS_RCC_MCO1SOURCE(SOURCE) (((SOURCE) == RCC_MCOSOURCE_NONE) || \ #define IS_RCC_MCO1SOURCE(SOURCE) (((SOURCE) == RCC_MCO1SOURCE_NOCLOCK) || \
((SOURCE) == RCC_MCOSOURCE_LSI) || \ ((SOURCE) == RCC_MCO1SOURCE_LSI) || \
((SOURCE) == RCC_MCOSOURCE_LSE) || \ ((SOURCE) == RCC_MCO1SOURCE_LSE) || \
((SOURCE) == RCC_MCOSOURCE_SYSCLK) || \ ((SOURCE) == RCC_MCO1SOURCE_SYSCLK) || \
((SOURCE) == RCC_MCOSOURCE_HSI) || \ ((SOURCE) == RCC_MCO1SOURCE_HSI) || \
((SOURCE) == RCC_MCOSOURCE_HSE) || \ ((SOURCE) == RCC_MCO1SOURCE_HSE) || \
((SOURCE) == RCC_MCOSOURCE_PLLCLK_DIV2) || \ ((SOURCE) == RCC_MCO1SOURCE_PLLCLK_DIV2) || \
((SOURCE) == RCC_MCOSOURCE_HSI14)) ((SOURCE) == RCC_MCO1SOURCE_HSI14))
#endif /* STM32F030x8 || STM32F051x8 || STM32F058xx */ #endif /* STM32F030x8 || STM32F051x8 || STM32F058xx */
@ -133,16 +133,16 @@
|| defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)\ || defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)\
|| defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F091xC) || defined(STM32F098xx)
#define IS_RCC_MCO1SOURCE(SOURCE) (((SOURCE) == RCC_MCOSOURCE_NONE) || \ #define IS_RCC_MCO1SOURCE(SOURCE) (((SOURCE) == RCC_MCO1SOURCE_NOCLOCK) || \
((SOURCE) == RCC_MCOSOURCE_LSI) || \ ((SOURCE) == RCC_MCO1SOURCE_LSI) || \
((SOURCE) == RCC_MCOSOURCE_LSE) || \ ((SOURCE) == RCC_MCO1SOURCE_LSE) || \
((SOURCE) == RCC_MCOSOURCE_SYSCLK) || \ ((SOURCE) == RCC_MCO1SOURCE_SYSCLK) || \
((SOURCE) == RCC_MCOSOURCE_HSI) || \ ((SOURCE) == RCC_MCO1SOURCE_HSI) || \
((SOURCE) == RCC_MCOSOURCE_HSE) || \ ((SOURCE) == RCC_MCO1SOURCE_HSE) || \
((SOURCE) == RCC_MCOSOURCE_PLLCLK_NODIV) || \ ((SOURCE) == RCC_MCO1SOURCE_PLLCLK) || \
((SOURCE) == RCC_MCOSOURCE_PLLCLK_DIV2) || \ ((SOURCE) == RCC_MCO1SOURCE_PLLCLK_DIV2) || \
((SOURCE) == RCC_MCOSOURCE_HSI14) || \ ((SOURCE) == RCC_MCO1SOURCE_HSI14) || \
((SOURCE) == RCC_MCOSOURCE_HSI48)) ((SOURCE) == RCC_MCO1SOURCE_HSI48))
#endif /* STM32F042x6 || STM32F048xx || */ #endif /* STM32F042x6 || STM32F048xx || */
/* STM32F071xB || STM32F072xB || STM32F078xx || */ /* STM32F071xB || STM32F072xB || STM32F078xx || */
@ -232,10 +232,10 @@
* @{ * @{
*/ */
#if defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F038xx) || defined(STM32F070x6)\ #if defined(STM32F031x6) || defined(STM32F038xx) || defined(STM32F070x6) || defined(STM32F070xB) \
|| defined(STM32F070xB) || defined(STM32F030xC) || defined(STM32F030xC)
#define RCC_MCOSOURCE_PLLCLK_NODIV (RCC_CFGR_MCO_PLL | RCC_CFGR_PLLNODIV) #define RCC_MCO1SOURCE_PLLCLK (RCC_CFGR_MCO_PLL | RCC_CFGR_PLLNODIV)
#endif /* STM32F030x6 || STM32F031x6 || STM32F038xx || STM32F070x6 || STM32F070xB || STM32F030xC */ #endif /* STM32F030x6 || STM32F031x6 || STM32F038xx || STM32F070x6 || STM32F070xB || STM32F030xC */
@ -243,8 +243,8 @@
|| defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)\ || defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)\
|| defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F091xC) || defined(STM32F098xx)
#define RCC_MCOSOURCE_HSI48 RCC_CFGR_MCO_HSI48 #define RCC_MCO1SOURCE_HSI48 RCC_CFGR_MCO_HSI48
#define RCC_MCOSOURCE_PLLCLK_NODIV (RCC_CFGR_MCO_PLL | RCC_CFGR_PLLNODIV) #define RCC_MCO1SOURCE_PLLCLK (RCC_CFGR_MCO_PLL | RCC_CFGR_PLLNODIV)
#endif /* STM32F042x6 || STM32F048xx || */ #endif /* STM32F042x6 || STM32F048xx || */
/* STM32F071xB || STM32F072xB || STM32F078xx || */ /* STM32F071xB || STM32F072xB || STM32F078xx || */
@ -265,6 +265,23 @@
* @{ * @{
*/ */
/* Private Constants -------------------------------------------------------------*/
#if defined(CRS)
/** @addtogroup RCCEx_Private_Constants
* @{
*/
/* CRS IT Error Mask */
#define RCC_CRS_IT_ERROR_MASK ((uint32_t)(RCC_CRS_IT_TRIMOVF | RCC_CRS_IT_SYNCERR | RCC_CRS_IT_SYNCMISS))
/* CRS Flag Error Mask */
#define RCC_CRS_FLAG_ERROR_MASK ((uint32_t)(RCC_CRS_FLAG_TRIMOVF | RCC_CRS_FLAG_SYNCERR | RCC_CRS_FLAG_SYNCMISS))
/**
* @}
*/
#endif /* CRS */
/* Private macro -------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/
/** @defgroup RCCEx_Private_Macros RCCEx Private Macros /** @defgroup RCCEx_Private_Macros RCCEx Private Macros
* @{ * @{
@ -272,47 +289,47 @@
#if defined(STM32F030x6) || defined(STM32F030x8) || defined(STM32F031x6) || defined(STM32F038xx)\ #if defined(STM32F030x6) || defined(STM32F030x8) || defined(STM32F031x6) || defined(STM32F038xx)\
|| defined(STM32F030xC) || defined(STM32F030xC)
#define IS_RCC_PERIPHCLK(SELECTION) ((SELECTION) <= (RCC_PERIPHCLK_USART1 | RCC_PERIPHCLK_I2C1 | \ #define IS_RCC_PERIPHCLOCK(SELECTION) ((SELECTION) <= (RCC_PERIPHCLK_USART1 | RCC_PERIPHCLK_I2C1 | \
RCC_PERIPHCLK_RTC)) RCC_PERIPHCLK_RTC))
#endif /* STM32F030x6 || STM32F030x8 || STM32F031x6 || STM32F038xx || #endif /* STM32F030x6 || STM32F030x8 || STM32F031x6 || STM32F038xx ||
STM32F030xC */ STM32F030xC */
#if defined(STM32F070x6) || defined(STM32F070xB) #if defined(STM32F070x6) || defined(STM32F070xB)
#define IS_RCC_PERIPHCLK(SELECTION) ((SELECTION) <= (RCC_PERIPHCLK_USART1 | RCC_PERIPHCLK_I2C1 | \ #define IS_RCC_PERIPHCLOCK(SELECTION) ((SELECTION) <= (RCC_PERIPHCLK_USART1 | RCC_PERIPHCLK_I2C1 | \
RCC_PERIPHCLK_RTC | RCC_PERIPHCLK_USB)) RCC_PERIPHCLK_RTC | RCC_PERIPHCLK_USB))
#endif /* STM32F070x6 || STM32F070xB */ #endif /* STM32F070x6 || STM32F070xB */
#if defined(STM32F042x6) || defined(STM32F048xx) #if defined(STM32F042x6) || defined(STM32F048xx)
#define IS_RCC_PERIPHCLK(SELECTION) ((SELECTION) <= (RCC_PERIPHCLK_USART1 | RCC_PERIPHCLK_I2C1 | \ #define IS_RCC_PERIPHCLOCK(SELECTION) ((SELECTION) <= (RCC_PERIPHCLK_USART1 | RCC_PERIPHCLK_I2C1 | \
RCC_PERIPHCLK_CEC | RCC_PERIPHCLK_RTC | \ RCC_PERIPHCLK_CEC | RCC_PERIPHCLK_RTC | \
RCC_PERIPHCLK_USB)) RCC_PERIPHCLK_USB))
#endif /* STM32F042x6 || STM32F048xx */ #endif /* STM32F042x6 || STM32F048xx */
#if defined(STM32F051x8) || defined(STM32F058xx) #if defined(STM32F051x8) || defined(STM32F058xx)
#define IS_RCC_PERIPHCLK(SELECTION) ((SELECTION) <= (RCC_PERIPHCLK_USART1 | RCC_PERIPHCLK_I2C1 | \ #define IS_RCC_PERIPHCLOCK(SELECTION) ((SELECTION) <= (RCC_PERIPHCLK_USART1 | RCC_PERIPHCLK_I2C1 | \
RCC_PERIPHCLK_CEC | RCC_PERIPHCLK_RTC)) RCC_PERIPHCLK_CEC | RCC_PERIPHCLK_RTC))
#endif /* STM32F051x8 || STM32F058xx */ #endif /* STM32F051x8 || STM32F058xx */
#if defined(STM32F071xB) #if defined(STM32F071xB)
#define IS_RCC_PERIPHCLK(SELECTION) ((SELECTION) <= (RCC_PERIPHCLK_USART1 | RCC_PERIPHCLK_USART2 | \ #define IS_RCC_PERIPHCLOCK(SELECTION) ((SELECTION) <= (RCC_PERIPHCLK_USART1 | RCC_PERIPHCLK_USART2 | \
RCC_PERIPHCLK_I2C1 | RCC_PERIPHCLK_CEC | \ RCC_PERIPHCLK_I2C1 | RCC_PERIPHCLK_CEC | \
RCC_PERIPHCLK_RTC)) RCC_PERIPHCLK_RTC))
#endif /* STM32F071xB */ #endif /* STM32F071xB */
#if defined(STM32F072xB) || defined(STM32F078xx) #if defined(STM32F072xB) || defined(STM32F078xx)
#define IS_RCC_PERIPHCLK(SELECTION) ((SELECTION) <= (RCC_PERIPHCLK_USART1 | RCC_PERIPHCLK_USART2 | \ #define IS_RCC_PERIPHCLOCK(SELECTION) ((SELECTION) <= (RCC_PERIPHCLK_USART1 | RCC_PERIPHCLK_USART2 | \
RCC_PERIPHCLK_I2C1 | RCC_PERIPHCLK_CEC | \ RCC_PERIPHCLK_I2C1 | RCC_PERIPHCLK_CEC | \
RCC_PERIPHCLK_RTC | RCC_PERIPHCLK_USB)) RCC_PERIPHCLK_RTC | RCC_PERIPHCLK_USB))
#endif /* STM32F072xB || STM32F078xx */ #endif /* STM32F072xB || STM32F078xx */
#if defined(STM32F091xC) || defined(STM32F098xx) #if defined(STM32F091xC) || defined(STM32F098xx)
#define IS_RCC_PERIPHCLK(SELECTION) ((SELECTION) <= (RCC_PERIPHCLK_USART1 | RCC_PERIPHCLK_USART2 | \ #define IS_RCC_PERIPHCLOCK(SELECTION) ((SELECTION) <= (RCC_PERIPHCLK_USART1 | RCC_PERIPHCLK_USART2 | \
RCC_PERIPHCLK_I2C1 | RCC_PERIPHCLK_CEC | \ RCC_PERIPHCLK_I2C1 | RCC_PERIPHCLK_CEC | \
RCC_PERIPHCLK_RTC | RCC_PERIPHCLK_USART3 )) RCC_PERIPHCLK_RTC | RCC_PERIPHCLK_USART3 ))
#endif /* STM32F091xC || STM32F098xx */ #endif /* STM32F091xC || STM32F098xx */
@ -320,13 +337,14 @@
#if defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F072xB) || defined(STM32F078xx) #if defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F072xB) || defined(STM32F078xx)
#define IS_RCC_USBCLKSOURCE(SOURCE) (((SOURCE) == RCC_USBCLKSOURCE_HSI48) || \ #define IS_RCC_USBCLKSOURCE(SOURCE) (((SOURCE) == RCC_USBCLKSOURCE_HSI48) || \
((SOURCE) == RCC_USBCLKSOURCE_PLLCLK)) ((SOURCE) == RCC_USBCLKSOURCE_PLL))
#endif /* STM32F042x6 || STM32F048xx || STM32F072xB || STM32F078xx */ #endif /* STM32F042x6 || STM32F048xx || STM32F072xB || STM32F078xx */
#if defined(STM32F070x6) || defined(STM32F070xB) #if defined(STM32F070x6) || defined(STM32F070xB)
#define IS_RCC_USBCLKSOURCE(SOURCE) (((SOURCE) == RCC_USBCLKSOURCE_PLLCLK)) #define IS_RCC_USBCLKSOURCE(SOURCE) (((SOURCE) == RCC_USBCLKSOURCE_NONE) || \
((SOURCE) == RCC_USBCLKSOURCE_PLL))
#endif /* STM32F070x6 || STM32F070xB */ #endif /* STM32F070x6 || STM32F070xB */
@ -362,29 +380,24 @@
/* STM32F071xB || STM32F072xB || STM32F078xx || */ /* STM32F071xB || STM32F072xB || STM32F078xx || */
/* STM32F091xC || STM32F098xx */ /* STM32F091xC || STM32F098xx */
#if defined(STM32F030x8) || defined(STM32F051x8) || defined(STM32F058xx) #if defined(RCC_CFGR_MCOPRE)
#define IS_RCC_MCODIV(DIV) (((DIV) == RCC_MCODIV_1) || ((DIV) == RCC_MCODIV_2) || \
((DIV) == RCC_MCODIV_4) || ((DIV) == RCC_MCODIV_8) || \
((DIV) == RCC_MCODIV_16) || ((DIV) == RCC_MCODIV_32) || \
((DIV) == RCC_MCODIV_64) || ((DIV) == RCC_MCODIV_128))
#else
#define IS_RCC_MCODIV(DIV) (((DIV) == RCC_MCODIV_1)) #define IS_RCC_MCODIV(DIV) (((DIV) == RCC_MCODIV_1))
#endif /* STM32F030x8 || STM32F051x8 || STM32F058xx */ #endif /* RCC_CFGR_MCOPRE */
#if defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F038xx) || defined(STM32F070x6)\ #define IS_RCC_LSE_DRIVE(__DRIVE__) (((__DRIVE__) == RCC_LSEDRIVE_LOW) || \
|| defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F071xB) || defined(STM32F070xB)\ ((__DRIVE__) == RCC_LSEDRIVE_MEDIUMLOW) || \
|| defined(STM32F072xB) || defined(STM32F078xx)\ ((__DRIVE__) == RCC_LSEDRIVE_MEDIUMHIGH) || \
|| defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC) ((__DRIVE__) == RCC_LSEDRIVE_HIGH))
#define IS_RCC_MCODIV(DIV) (((DIV) == RCC_MCO_DIV1) || ((DIV) == RCC_MCO_DIV2) || \ #if defined(CRS)
((DIV) == RCC_MCO_DIV4) || ((DIV) == RCC_MCO_DIV8) || \
((DIV) == RCC_MCO_DIV16) || ((DIV) == RCC_MCO_DIV32) || \
((DIV) == RCC_MCO_DIV64) || ((DIV) == RCC_MCO_DIV128))
#endif /* STM32F030x6 || STM32F031x6 || STM32F038xx || STM32F042x6 || STM32F048xx || */
/* STM32F071xB || STM32F072xB || STM32F078xx || STM32F070x6 || STM32F070xB */
/* STM32F091xC || STM32F098xx || STM32F030xC */
#if defined(STM32F042x6) || defined(STM32F048xx)\
|| defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)\
|| defined(STM32F091xC) || defined(STM32F098xx)
#define IS_RCC_CRS_SYNC_SOURCE(_SOURCE_) (((_SOURCE_) == RCC_CRS_SYNC_SOURCE_GPIO) || \ #define IS_RCC_CRS_SYNC_SOURCE(_SOURCE_) (((_SOURCE_) == RCC_CRS_SYNC_SOURCE_GPIO) || \
((_SOURCE_) == RCC_CRS_SYNC_SOURCE_LSE) || \ ((_SOURCE_) == RCC_CRS_SYNC_SOURCE_LSE) || \
@ -400,9 +413,7 @@
#define IS_RCC_CRS_HSI48CALIBRATION(_VALUE_) (((_VALUE_) <= 0x3F)) #define IS_RCC_CRS_HSI48CALIBRATION(_VALUE_) (((_VALUE_) <= 0x3F))
#define IS_RCC_CRS_FREQERRORDIR(_DIR_) (((_DIR_) == RCC_CRS_FREQERRORDIR_UP) || \ #define IS_RCC_CRS_FREQERRORDIR(_DIR_) (((_DIR_) == RCC_CRS_FREQERRORDIR_UP) || \
((_DIR_) == RCC_CRS_FREQERRORDIR_DOWN)) ((_DIR_) == RCC_CRS_FREQERRORDIR_DOWN))
#endif /* STM32F042x6 || STM32F048xx || */ #endif /* CRS */
/* STM32F071xB || STM32F072xB || STM32F078xx || */
/* STM32F091xC || STM32F098xx */
/** /**
* @} * @}
*/ */
@ -581,9 +592,7 @@ typedef struct
}RCC_PeriphCLKInitTypeDef; }RCC_PeriphCLKInitTypeDef;
#endif /* STM32F091xC || STM32F098xx */ #endif /* STM32F091xC || STM32F098xx */
#if defined(STM32F042x6) || defined(STM32F048xx)\ #if defined(CRS)
|| defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)\
|| defined(STM32F091xC) || defined(STM32F098xx)
/** /**
* @brief RCC_CRS Init structure definition * @brief RCC_CRS Init structure definition
@ -600,7 +609,7 @@ typedef struct
This parameter can be a value of @ref RCCEx_CRS_SynchroPolarity */ This parameter can be a value of @ref RCCEx_CRS_SynchroPolarity */
uint32_t ReloadValue; /*!< Specifies the value to be loaded in the frequency error counter with each SYNC event. uint32_t ReloadValue; /*!< Specifies the value to be loaded in the frequency error counter with each SYNC event.
It can be calculated in using macro __HAL_RCC_CRS_CALCULATE_RELOADVALUE(_FTARGET_, _FSYNC_) It can be calculated in using macro @ref __HAL_RCC_CRS_RELOADVALUE_CALCULATE(_FTARGET_, _FSYNC_)
This parameter must be a number between 0 and 0xFFFF or a value of @ref RCCEx_CRS_ReloadValueDefault .*/ This parameter must be a number between 0 and 0xFFFF or a value of @ref RCCEx_CRS_ReloadValueDefault .*/
uint32_t ErrorLimitValue; /*!< Specifies the value to be used to evaluate the captured frequency error value. uint32_t ErrorLimitValue; /*!< Specifies the value to be used to evaluate the captured frequency error value.
@ -633,9 +642,7 @@ typedef struct
}RCC_CRSSynchroInfoTypeDef; }RCC_CRSSynchroInfoTypeDef;
#endif /* STM32F042x6 || STM32F048xx */ #endif /* CRS */
/* STM32F071xB || STM32F072xB || STM32F078xx || */
/* STM32F091xC || STM32F098xx */
/** /**
* @} * @}
@ -764,8 +771,8 @@ typedef struct
/** @defgroup RCCEx_USB_Clock_Source RCCEx USB Clock Source /** @defgroup RCCEx_USB_Clock_Source RCCEx USB Clock Source
* @{ * @{
*/ */
#define RCC_USBCLKSOURCE_HSI48 RCC_CFGR3_USBSW_HSI48 #define RCC_USBCLKSOURCE_HSI48 RCC_CFGR3_USBSW_HSI48 /*!< HSI48 clock selected as USB clock source */
#define RCC_USBCLKSOURCE_PLLCLK RCC_CFGR3_USBSW_PLLCLK #define RCC_USBCLKSOURCE_PLL RCC_CFGR3_USBSW_PLLCLK /*!< PLL clock (PLLCLK) selected as USB clock */
/** /**
* @} * @}
@ -778,7 +785,8 @@ typedef struct
/** @defgroup RCCEx_USB_Clock_Source RCCEx USB Clock Source /** @defgroup RCCEx_USB_Clock_Source RCCEx USB Clock Source
* @{ * @{
*/ */
#define RCC_USBCLKSOURCE_PLLCLK RCC_CFGR3_USBSW_PLLCLK #define RCC_USBCLKSOURCE_NONE ((uint32_t)0x00000000) /*!< USB clock disabled */
#define RCC_USBCLKSOURCE_PLL RCC_CFGR3_USBSW_PLLCLK /*!< PLL clock (PLLCLK) selected as USB clock */
/** /**
* @} * @}
@ -845,37 +853,41 @@ typedef struct
* @{ * @{
*/ */
#if defined(STM32F030x8) || defined(STM32F051x8) || defined(STM32F058xx) #if defined(RCC_CFGR_MCOPRE)
#define RCC_MCODIV_1 ((uint32_t)0x00000000)
#define RCC_MCODIV_2 ((uint32_t)0x10000000)
#define RCC_MCODIV_4 ((uint32_t)0x20000000)
#define RCC_MCODIV_8 ((uint32_t)0x30000000)
#define RCC_MCODIV_16 ((uint32_t)0x40000000)
#define RCC_MCODIV_32 ((uint32_t)0x50000000)
#define RCC_MCODIV_64 ((uint32_t)0x60000000)
#define RCC_MCODIV_128 ((uint32_t)0x70000000)
#else
#define RCC_MCODIV_1 ((uint32_t)0x00000000) #define RCC_MCODIV_1 ((uint32_t)0x00000000)
#endif /* STM32F030x8 || STM32F051x8 || STM32F058xx */ #endif /* RCC_CFGR_MCOPRE */
#if defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F038xx) || defined(STM32F070x6)\
|| defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F071xB) || defined(STM32F070xB)\
|| defined(STM32F072xB) || defined(STM32F078xx)\
|| defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
#define RCC_MCO_DIV1 ((uint32_t)0x00000000)
#define RCC_MCO_DIV2 ((uint32_t)0x10000000)
#define RCC_MCO_DIV4 ((uint32_t)0x20000000)
#define RCC_MCO_DIV8 ((uint32_t)0x30000000)
#define RCC_MCO_DIV16 ((uint32_t)0x40000000)
#define RCC_MCO_DIV32 ((uint32_t)0x50000000)
#define RCC_MCO_DIV64 ((uint32_t)0x60000000)
#define RCC_MCO_DIV128 ((uint32_t)0x70000000)
#endif /* STM32F030x6 || STM32F031x6 || STM32F038xx || STM32F042x6 || STM32F048xx || */
/* STM32F071xB || STM32F072xB || STM32F078xx || STM32F070x6 || STM32F070xB */
/* STM32F091xC || STM32F098xx || STM32F030xC */
/** /**
* @} * @}
*/ */
#if defined(STM32F042x6) || defined(STM32F048xx)\ /** @defgroup RCCEx_LSEDrive_Configuration RCC LSE Drive Configuration
|| defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)\ * @{
|| defined(STM32F091xC) || defined(STM32F098xx) */
#define RCC_LSEDRIVE_LOW ((uint32_t)0x00000000) /*!< Xtal mode lower driving capability */
#define RCC_LSEDRIVE_MEDIUMLOW RCC_BDCR_LSEDRV_1 /*!< Xtal mode medium low driving capability */
#define RCC_LSEDRIVE_MEDIUMHIGH RCC_BDCR_LSEDRV_0 /*!< Xtal mode medium high driving capability */
#define RCC_LSEDRIVE_HIGH RCC_BDCR_LSEDRV /*!< Xtal mode higher driving capability */
/**
* @}
*/
#if defined(CRS)
/** @defgroup RCCEx_CRS_SynchroSource RCCEx CRS SynchroSource /** @defgroup RCCEx_CRS_SynchroSource RCCEx CRS SynchroSource
* @{ * @{
@ -984,9 +996,7 @@ typedef struct
* @} * @}
*/ */
#endif /* STM32F042x6 || STM32F048xx || */ #endif /* CRS */
/* STM32F071xB || STM32F072xB || STM32F078xx || */
/* STM32F091xC || STM32F098xx */
/** /**
* @} * @}
@ -1004,10 +1014,7 @@ typedef struct
* using it. * using it.
* @{ * @{
*/ */
#if defined(STM32F030x6) || defined(STM32F030x8)\ #if defined(GPIOD)
|| defined(STM32F051x8) || defined(STM32F058xx) || defined(STM32F070xB)\
|| defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)\
|| defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
#define __HAL_RCC_GPIOD_CLK_ENABLE() do { \ #define __HAL_RCC_GPIOD_CLK_ENABLE() do { \
__IO uint32_t tmpreg; \ __IO uint32_t tmpreg; \
@ -1019,13 +1026,9 @@ typedef struct
#define __HAL_RCC_GPIOD_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_GPIODEN)) #define __HAL_RCC_GPIOD_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_GPIODEN))
#endif /* STM32F030x6 || STM32F030x8 || */ #endif /* GPIOD */
/* STM32F051x8 || STM32F058xx || STM32F070xB || */
/* STM32F071xB || STM32F072xB || STM32F078xx || */
/* STM32F091xC || STM32F098xx || STM32F030xC */
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB)\ #if defined(GPIOE)
|| defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
#define __HAL_RCC_GPIOE_CLK_ENABLE() do { \ #define __HAL_RCC_GPIOE_CLK_ENABLE() do { \
__IO uint32_t tmpreg; \ __IO uint32_t tmpreg; \
@ -1037,8 +1040,7 @@ typedef struct
#define __HAL_RCC_GPIOE_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_GPIOEEN)) #define __HAL_RCC_GPIOE_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_GPIOEEN))
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F070xB || */ #endif /* GPIOE */
/* STM32F091xC || STM32F098xx || STM32F030xC */
#if defined(STM32F042x6) || defined(STM32F048xx)\ #if defined(STM32F042x6) || defined(STM32F048xx)\
|| defined(STM32F051x8) || defined(STM32F058xx)\ || defined(STM32F051x8) || defined(STM32F058xx)\
@ -1272,9 +1274,7 @@ typedef struct
#endif /* STM32F042x6 || STM32F048xx || STM32F072xB || */ #endif /* STM32F042x6 || STM32F048xx || STM32F072xB || */
/* STM32F091xC || STM32F098xx */ /* STM32F091xC || STM32F098xx */
#if defined(STM32F042x6) || defined(STM32F048xx)\ #if defined(CRS)
|| defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)\
|| defined(STM32F091xC) || defined(STM32F098xx)
#define __HAL_RCC_CRS_CLK_ENABLE() do { \ #define __HAL_RCC_CRS_CLK_ENABLE() do { \
__IO uint32_t tmpreg; \ __IO uint32_t tmpreg; \
@ -1286,9 +1286,7 @@ typedef struct
#define __HAL_RCC_CRS_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CRSEN)) #define __HAL_RCC_CRS_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CRSEN))
#endif /* STM32F042x6 || STM32F048xx || */ #endif /* CRS */
/* STM32F071xB || STM32F072xB || STM32F078xx || */
/* STM32F091xC || STM32F098xx */
#if defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC) #if defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
@ -1377,29 +1375,21 @@ typedef struct
/** @brief Force or release AHB peripheral reset. /** @brief Force or release AHB peripheral reset.
*/ */
#if defined(STM32F030x6) || defined(STM32F030x8)\ #if defined(GPIOD)
|| defined(STM32F051x8) || defined(STM32F058xx)\
|| defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB)\
|| defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
#define __HAL_RCC_GPIOD_FORCE_RESET() (RCC->AHBRSTR |= (RCC_AHBRSTR_GPIODRST)) #define __HAL_RCC_GPIOD_FORCE_RESET() (RCC->AHBRSTR |= (RCC_AHBRSTR_GPIODRST))
#define __HAL_RCC_GPIOD_RELEASE_RESET() (RCC->AHBRSTR &= ~(RCC_AHBRSTR_GPIODRST)) #define __HAL_RCC_GPIOD_RELEASE_RESET() (RCC->AHBRSTR &= ~(RCC_AHBRSTR_GPIODRST))
#endif /* STM32F030x6 || STM32F030x8 || */ #endif /* GPIOD */
/* STM32F051x8 || STM32F058xx || */
/* STM32F071xB || STM32F072xB || STM32F078xx || STM32F070xB || */
/* STM32F091xC || STM32F098xx || STM32F030xC */
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB)\ #if defined(GPIOE)
|| defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
#define __HAL_RCC_GPIOE_FORCE_RESET() (RCC->AHBRSTR |= (RCC_AHBRSTR_GPIOERST)) #define __HAL_RCC_GPIOE_FORCE_RESET() (RCC->AHBRSTR |= (RCC_AHBRSTR_GPIOERST))
#define __HAL_RCC_GPIOE_RELEASE_RESET() (RCC->AHBRSTR &= ~(RCC_AHBRSTR_GPIOERST)) #define __HAL_RCC_GPIOE_RELEASE_RESET() (RCC->AHBRSTR &= ~(RCC_AHBRSTR_GPIOERST))
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F070xB || */ #endif /* GPIOE */
/* STM32F091xC || STM32F098xx || STM32F030xC */
#if defined(STM32F042x6) || defined(STM32F048xx)\ #if defined(STM32F042x6) || defined(STM32F048xx)\
|| defined(STM32F051x8) || defined(STM32F058xx)\ || defined(STM32F051x8) || defined(STM32F058xx)\
@ -1526,17 +1516,13 @@ typedef struct
#endif /* STM32F042x6 || STM32F048xx || STM32F072xB || */ #endif /* STM32F042x6 || STM32F048xx || STM32F072xB || */
/* STM32F091xC || STM32F098xx */ /* STM32F091xC || STM32F098xx */
#if defined(STM32F042x6) || defined(STM32F048xx)\ #if defined(CRS)
|| defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)\
|| defined(STM32F091xC) || defined(STM32F098xx)
#define __HAL_RCC_CRS_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CRSRST)) #define __HAL_RCC_CRS_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CRSRST))
#define __HAL_RCC_CRS_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CRSRST)) #define __HAL_RCC_CRS_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CRSRST))
#endif /* STM32F042x6 || STM32F048xx || */ #endif /* CRS */
/* STM32F071xB || STM32F072xB || STM32F078xx || */
/* STM32F091xC || STM32F098xx */
#if defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC) #if defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
@ -1594,27 +1580,19 @@ typedef struct
*/ */
/** @brief AHB Peripheral Clock Enable Disable Status /** @brief AHB Peripheral Clock Enable Disable Status
*/ */
#if defined(STM32F030x6) || defined(STM32F030x8)\ #if defined(GPIOD)
|| defined(STM32F051x8) || defined(STM32F058xx) || defined(STM32F070xB)\
|| defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)\
|| defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
#define __HAL_RCC_GPIOD_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_GPIODEN)) != RESET) #define __HAL_RCC_GPIOD_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_GPIODEN)) != RESET)
#define __HAL_RCC_GPIOD_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_GPIODEN)) == RESET) #define __HAL_RCC_GPIOD_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_GPIODEN)) == RESET)
#endif /* STM32F030x6 || STM32F030x8 || */ #endif /* GPIOD */
/* STM32F051x8 || STM32F058xx || STM32F070xB || */
/* STM32F071xB || STM32F072xB || STM32F078xx || */
/* STM32F091xC || STM32F098xx || STM32F030xC */
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB)\ #if defined(GPIOE)
|| defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
#define __HAL_RCC_GPIOE_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_GPIOEEN)) != RESET) #define __HAL_RCC_GPIOE_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_GPIOEEN)) != RESET)
#define __HAL_RCC_GPIOE_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_GPIOEEN)) == RESET) #define __HAL_RCC_GPIOE_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_GPIOEEN)) == RESET)
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F070xB || */ #endif /* GPIOE */
/* STM32F091xC || STM32F098xx || STM32F030xC */
#if defined(STM32F042x6) || defined(STM32F048xx)\ #if defined(STM32F042x6) || defined(STM32F048xx)\
|| defined(STM32F051x8) || defined(STM32F058xx)\ || defined(STM32F051x8) || defined(STM32F058xx)\
@ -1751,16 +1729,12 @@ typedef struct
#endif /* STM32F042x6 || STM32F048xx || STM32F072xB || */ #endif /* STM32F042x6 || STM32F048xx || STM32F072xB || */
/* STM32F091xC || STM32F098xx */ /* STM32F091xC || STM32F098xx */
#if defined(STM32F042x6) || defined(STM32F048xx)\ #if defined(CRS)
|| defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)\
|| defined(STM32F091xC) || defined(STM32F098xx)
#define __HAL_RCC_CRS_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CRSEN)) != RESET) #define __HAL_RCC_CRS_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CRSEN)) != RESET)
#define __HAL_RCC_CRS_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CRSEN)) == RESET) #define __HAL_RCC_CRS_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CRSEN)) == RESET)
#endif /* STM32F042x6 || STM32F048xx || */ #endif /* CRS */
/* STM32F071xB || STM32F072xB || STM32F078xx || */
/* STM32F091xC || STM32F098xx */
#if defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC) #if defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
@ -1825,8 +1799,8 @@ typedef struct
/** @brief Macro to get the Internal 48Mhz High Speed oscillator (HSI48) state. /** @brief Macro to get the Internal 48Mhz High Speed oscillator (HSI48) state.
* @retval The clock source can be one of the following values: * @retval The clock source can be one of the following values:
* @arg RCC_HSI48_ON: HSI48 enabled * @arg @ref RCC_HSI48_ON HSI48 enabled
* @arg RCC_HSI48_OFF: HSI48 disabled * @arg @ref RCC_HSI48_OFF HSI48 disabled
*/ */
#define __HAL_RCC_GET_HSI48_STATE() \ #define __HAL_RCC_GET_HSI48_STATE() \
(((uint32_t)(READ_BIT(RCC->CFGR3, RCC_CR2_HSI48ON)) != RESET) ? RCC_HSI48_ON : RCC_HSI48_OFF) (((uint32_t)(READ_BIT(RCC->CFGR3, RCC_CR2_HSI48ON)) != RESET) ? RCC_HSI48_ON : RCC_HSI48_OFF)
@ -1835,7 +1809,7 @@ typedef struct
/** @brief Macro to get the Internal 48Mhz High Speed oscillator (HSI48) state. /** @brief Macro to get the Internal 48Mhz High Speed oscillator (HSI48) state.
* @retval The clock source can be one of the following values: * @retval The clock source can be one of the following values:
* @arg RCC_HSI_OFF: HSI48 disabled * @arg @ref RCC_HSI_OFF HSI48 disabled
*/ */
#define __HAL_RCC_GET_HSI48_STATE() RCC_HSI_OFF #define __HAL_RCC_GET_HSI48_STATE() RCC_HSI_OFF
@ -1855,18 +1829,18 @@ typedef struct
|| defined(STM32F070x6) || defined(STM32F070xB) || defined(STM32F070x6) || defined(STM32F070xB)
/** @brief Macro to configure the USB clock (USBCLK). /** @brief Macro to configure the USB clock (USBCLK).
* @param __USBCLKSource__: specifies the USB clock source. * @param __USBCLKSOURCE__ specifies the USB clock source.
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg RCC_USBCLKSOURCE_HSI48: HSI48 selected as USB clock (not available for STM32F070x6 & STM32F070xB) * @arg @ref RCC_USBCLKSOURCE_HSI48 HSI48 selected as USB clock (not available for STM32F070x6 & STM32F070xB)
* @arg RCC_USBCLKSOURCE_PLLCLK: PLL Clock selected as USB clock * @arg @ref RCC_USBCLKSOURCE_PLL PLL Clock selected as USB clock
*/ */
#define __HAL_RCC_USB_CONFIG(__USBCLKSource__) \ #define __HAL_RCC_USB_CONFIG(__USBCLKSOURCE__) \
MODIFY_REG(RCC->CFGR3, RCC_CFGR3_USBSW, (uint32_t)(__USBCLKSource__)) MODIFY_REG(RCC->CFGR3, RCC_CFGR3_USBSW, (uint32_t)(__USBCLKSOURCE__))
/** @brief Macro to get the USB clock source. /** @brief Macro to get the USB clock source.
* @retval The clock source can be one of the following values: * @retval The clock source can be one of the following values:
* @arg RCC_USBCLKSOURCE_HSI48: HSI48 selected as USB clock * @arg @ref RCC_USBCLKSOURCE_HSI48 HSI48 selected as USB clock
* @arg RCC_USBCLKSOURCE_PLLCLK: PLL Clock selected as USB clock * @arg @ref RCC_USBCLKSOURCE_PLL PLL Clock selected as USB clock
*/ */
#define __HAL_RCC_GET_USB_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR3, RCC_CFGR3_USBSW))) #define __HAL_RCC_GET_USB_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR3, RCC_CFGR3_USBSW)))
@ -1880,18 +1854,18 @@ typedef struct
|| defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F091xC) || defined(STM32F098xx)
/** @brief Macro to configure the CEC clock. /** @brief Macro to configure the CEC clock.
* @param __CECCLKSource__: specifies the CEC clock source. * @param __CECCLKSOURCE__ specifies the CEC clock source.
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg RCC_CECCLKSOURCE_HSI: HSI selected as CEC clock * @arg @ref RCC_CECCLKSOURCE_HSI HSI selected as CEC clock
* @arg RCC_CECCLKSOURCE_LSE: LSE selected as CEC clock * @arg @ref RCC_CECCLKSOURCE_LSE LSE selected as CEC clock
*/ */
#define __HAL_RCC_CEC_CONFIG(__CECCLKSource__) \ #define __HAL_RCC_CEC_CONFIG(__CECCLKSOURCE__) \
MODIFY_REG(RCC->CFGR3, RCC_CFGR3_CECSW, (uint32_t)(__CECCLKSource__)) MODIFY_REG(RCC->CFGR3, RCC_CFGR3_CECSW, (uint32_t)(__CECCLKSOURCE__))
/** @brief Macro to get the HDMI CEC clock source. /** @brief Macro to get the HDMI CEC clock source.
* @retval The clock source can be one of the following values: * @retval The clock source can be one of the following values:
* @arg RCC_CECCLKSOURCE_HSI: HSI selected as CEC clock * @arg @ref RCC_CECCLKSOURCE_HSI HSI selected as CEC clock
* @arg RCC_CECCLKSOURCE_LSE: LSE selected as CEC clock * @arg @ref RCC_CECCLKSOURCE_LSE LSE selected as CEC clock
*/ */
#define __HAL_RCC_GET_CEC_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR3, RCC_CFGR3_CECSW))) #define __HAL_RCC_GET_CEC_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR3, RCC_CFGR3_CECSW)))
@ -1900,102 +1874,47 @@ typedef struct
/* STM32F071xB || STM32F072xB || STM32F078xx || */ /* STM32F071xB || STM32F072xB || STM32F078xx || */
/* STM32F091xC || defined(STM32F098xx) */ /* STM32F091xC || defined(STM32F098xx) */
#if defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F038xx)\
|| defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F070x6)\
|| defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB)\
|| defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
/** @brief Macro to configure the MCO clock.
* @param __MCOCLKSource__: specifies the MCO clock source.
* This parameter can be one of the following values:
* @arg RCC_MCOSOURCE_HSI: HSI selected as MCO clock
* @arg RCC_MCOSOURCE_HSE: HSE selected as MCO clock
* @arg RCC_MCOSOURCE_LSI: LSI selected as MCO clock
* @arg RCC_MCOSOURCE_LSE: LSE selected as MCO clock
* @arg RCC_MCOSOURCE_PLLCLK_NODIV: PLLCLK selected as MCO clock
* @arg RCC_MCOSOURCE_PLLCLK_DIV2: PLLCLK Divided by 2 selected as MCO clock
* @arg RCC_MCOSOURCE_SYSCLK: System Clock selected as MCO clock
* @arg RCC_MCOSOURCE_HSI14: HSI14 selected as MCO clock
* @arg RCC_MCOSOURCE_HSI48: HSI48 selected as MCO clock
* @param __MCODiv__: specifies the MCO clock prescaler.
* This parameter can be one of the following values:
* @arg RCC_MCO_DIV1: MCO clock source is divided by 1
* @arg RCC_MCO_DIV2: MCO clock source is divided by 2
* @arg RCC_MCO_DIV4: MCO clock source is divided by 4
* @arg RCC_MCO_DIV8: MCO clock source is divided by 8
* @arg RCC_MCO_DIV16: MCO clock source is divided by 16
* @arg RCC_MCO_DIV32: MCO clock source is divided by 32
* @arg RCC_MCO_DIV64: MCO clock source is divided by 64
* @arg RCC_MCO_DIV128: MCO clock source is divided by 128
*/
#define __HAL_RCC_MCO_CONFIG(__MCOCLKSource__, __MCODiv__) \
MODIFY_REG(RCC->CFGR, (RCC_CFGR_MCO | RCC_CFGR_MCOPRE), ((__MCOCLKSource__) | (__MCODiv__)))
#else
/** @brief Macro to configure the MCO clock.
* @param __MCOCLKSource__: specifies the MCO clock source.
* This parameter can be one of the following values:
* @arg RCC_MCOSOURCE_HSI: HSI selected as MCO clock
* @arg RCC_MCOSOURCE_HSE: HSE selected as MCO clock
* @arg RCC_MCOSOURCE_LSI: LSI selected as MCO clock
* @arg RCC_MCOSOURCE_LSE: LSE selected as MCO clock
* @arg RCC_MCOSOURCE_PLLCLK_DIV2: PLLCLK Divided by 2 selected as MCO clock
* @arg RCC_MCOSOURCE_SYSCLK: System Clock selected as MCO clock
* @arg RCC_MCOSOURCE_HSI14: HSI14 selected as MCO clock
* @arg RCC_MCOSOURCE_HSI48: HSI48 selected as MCO clock
* @param __MCODiv__: specifies the MCO clock prescaler.
* This parameter can be one of the following values:
* @arg RCC_MCODIV_1: No division applied on MCO clock source
*/
#define __HAL_RCC_MCO_CONFIG(__MCOCLKSource__, __MCODiv__) \
MODIFY_REG(RCC->CFGR, RCC_CFGR_MCO, __MCOCLKSource__)
#endif /* STM32F030x6 || STM32F031x6 || STM32F038xx || STM32F070x6 || */
/* STM32F042x6 || STM32F048xx || */
/* STM32F071xB || STM32F072xB || STM32F078xx || STM32F070xB || */
/* STM32F091xC || STM32F098xx || STM32F030xC */
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)\ #if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)\
|| defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F091xC) || defined(STM32F098xx)
/** @brief Macro to configure the USART2 clock (USART2CLK). /** @brief Macro to configure the USART2 clock (USART2CLK).
* @param __USART2CLKSource__: specifies the USART2 clock source. * @param __USART2CLKSOURCE__ specifies the USART2 clock source.
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg RCC_USART2CLKSOURCE_PCLK1: PCLK1 selected as USART2 clock * @arg @ref RCC_USART2CLKSOURCE_PCLK1 PCLK1 selected as USART2 clock
* @arg RCC_USART2CLKSOURCE_HSI: HSI selected as USART2 clock * @arg @ref RCC_USART2CLKSOURCE_HSI HSI selected as USART2 clock
* @arg RCC_USART2CLKSOURCE_SYSCLK: System Clock selected as USART2 clock * @arg @ref RCC_USART2CLKSOURCE_SYSCLK System Clock selected as USART2 clock
* @arg RCC_USART2CLKSOURCE_LSE: LSE selected as USART2 clock * @arg @ref RCC_USART2CLKSOURCE_LSE LSE selected as USART2 clock
*/ */
#define __HAL_RCC_USART2_CONFIG(__USART2CLKSource__) \ #define __HAL_RCC_USART2_CONFIG(__USART2CLKSOURCE__) \
MODIFY_REG(RCC->CFGR3, RCC_CFGR3_USART2SW, (uint32_t)(__USART2CLKSource__)) MODIFY_REG(RCC->CFGR3, RCC_CFGR3_USART2SW, (uint32_t)(__USART2CLKSOURCE__))
/** @brief Macro to get the USART2 clock source. /** @brief Macro to get the USART2 clock source.
* @retval The clock source can be one of the following values: * @retval The clock source can be one of the following values:
* @arg RCC_USART2CLKSOURCE_PCLK1: PCLK1 selected as USART2 clock * @arg @ref RCC_USART2CLKSOURCE_PCLK1 PCLK1 selected as USART2 clock
* @arg RCC_USART2CLKSOURCE_HSI: HSI selected as USART2 clock * @arg @ref RCC_USART2CLKSOURCE_HSI HSI selected as USART2 clock
* @arg RCC_USART2CLKSOURCE_SYSCLK: System Clock selected as USART2 clock * @arg @ref RCC_USART2CLKSOURCE_SYSCLK System Clock selected as USART2 clock
* @arg RCC_USART2CLKSOURCE_LSE: LSE selected as USART2 clock * @arg @ref RCC_USART2CLKSOURCE_LSE LSE selected as USART2 clock
*/ */
#define __HAL_RCC_GET_USART2_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR3, RCC_CFGR3_USART2SW))) #define __HAL_RCC_GET_USART2_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR3, RCC_CFGR3_USART2SW)))
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx*/ #endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx*/
#if defined(STM32F091xC) || defined(STM32F098xx) #if defined(STM32F091xC) || defined(STM32F098xx)
/** @brief Macro to configure the USART3 clock (USART3CLK). /** @brief Macro to configure the USART3 clock (USART3CLK).
* @param __USART3CLKSource__: specifies the USART3 clock source. * @param __USART3CLKSOURCE__ specifies the USART3 clock source.
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg RCC_USART3CLKSOURCE_PCLK1: PCLK1 selected as USART3 clock * @arg @ref RCC_USART3CLKSOURCE_PCLK1 PCLK1 selected as USART3 clock
* @arg RCC_USART3CLKSOURCE_HSI: HSI selected as USART3 clock * @arg @ref RCC_USART3CLKSOURCE_HSI HSI selected as USART3 clock
* @arg RCC_USART3CLKSOURCE_SYSCLK: System Clock selected as USART3 clock * @arg @ref RCC_USART3CLKSOURCE_SYSCLK System Clock selected as USART3 clock
* @arg RCC_USART3CLKSOURCE_LSE: LSE selected as USART3 clock * @arg @ref RCC_USART3CLKSOURCE_LSE LSE selected as USART3 clock
*/ */
#define __HAL_RCC_USART3_CONFIG(__USART3CLKSource__) \ #define __HAL_RCC_USART3_CONFIG(__USART3CLKSOURCE__) \
MODIFY_REG(RCC->CFGR3, RCC_CFGR3_USART3SW, (uint32_t)(__USART3CLKSource__)) MODIFY_REG(RCC->CFGR3, RCC_CFGR3_USART3SW, (uint32_t)(__USART3CLKSOURCE__))
/** @brief Macro to get the USART3 clock source. /** @brief Macro to get the USART3 clock source.
* @retval The clock source can be one of the following values: * @retval The clock source can be one of the following values:
* @arg RCC_USART3CLKSOURCE_PCLK1: PCLK1 selected as USART3 clock * @arg @ref RCC_USART3CLKSOURCE_PCLK1 PCLK1 selected as USART3 clock
* @arg RCC_USART3CLKSOURCE_HSI: HSI selected as USART3 clock * @arg @ref RCC_USART3CLKSOURCE_HSI HSI selected as USART3 clock
* @arg RCC_USART3CLKSOURCE_SYSCLK: System Clock selected as USART3 clock * @arg @ref RCC_USART3CLKSOURCE_SYSCLK System Clock selected as USART3 clock
* @arg RCC_USART3CLKSOURCE_LSE: LSE selected as USART3 clock * @arg @ref RCC_USART3CLKSOURCE_LSE LSE selected as USART3 clock
*/ */
#define __HAL_RCC_GET_USART3_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR3, RCC_CFGR3_USART3SW))) #define __HAL_RCC_GET_USART3_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR3, RCC_CFGR3_USART3SW)))
@ -2004,9 +1923,28 @@ typedef struct
* @} * @}
*/ */
#if defined(STM32F042x6) || defined(STM32F048xx)\ /** @defgroup RCCEx_LSE_Configuration LSE Drive Configuration
|| defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)\ * @{
|| defined(STM32F091xC) || defined(STM32F098xx) */
/**
* @brief Macro to configure the External Low Speed oscillator (LSE) drive capability.
* @param __RCC_LSEDRIVE__ specifies the new state of the LSE drive capability.
* This parameter can be one of the following values:
* @arg @ref RCC_LSEDRIVE_LOW LSE oscillator low drive capability.
* @arg @ref RCC_LSEDRIVE_MEDIUMLOW LSE oscillator medium low drive capability.
* @arg @ref RCC_LSEDRIVE_MEDIUMHIGH LSE oscillator medium high drive capability.
* @arg @ref RCC_LSEDRIVE_HIGH LSE oscillator high drive capability.
* @retval None
*/
#define __HAL_RCC_LSEDRIVE_CONFIG(__RCC_LSEDRIVE__) (MODIFY_REG(RCC->BDCR,\
RCC_BDCR_LSEDRV, (uint32_t)(__RCC_LSEDRIVE__) ))
/**
* @}
*/
#if defined(CRS)
/** @defgroup RCCEx_IT_And_Flag RCCEx IT and Flag /** @defgroup RCCEx_IT_And_Flag RCCEx IT and Flag
* @{ * @{
@ -2015,91 +1953,100 @@ typedef struct
/** /**
* @brief Enables the specified CRS interrupts. * @brief Enables the specified CRS interrupts.
* @param __INTERRUPT__: specifies the CRS interrupt sources to be enabled. * @param __INTERRUPT__ specifies the CRS interrupt sources to be enabled.
* This parameter can be any combination of the following values: * This parameter can be any combination of the following values:
* @arg RCC_CRS_IT_SYNCOK * @arg @ref RCC_CRS_IT_SYNCOK
* @arg RCC_CRS_IT_SYNCWARN * @arg @ref RCC_CRS_IT_SYNCWARN
* @arg RCC_CRS_IT_ERR * @arg @ref RCC_CRS_IT_ERR
* @arg RCC_CRS_IT_ESYNC * @arg @ref RCC_CRS_IT_ESYNC
* @retval None * @retval None
*/ */
#define __HAL_RCC_CRS_ENABLE_IT(__INTERRUPT__) (CRS->CR |= (__INTERRUPT__)) #define __HAL_RCC_CRS_ENABLE_IT(__INTERRUPT__) (CRS->CR |= (__INTERRUPT__))
/** /**
* @brief Disables the specified CRS interrupts. * @brief Disables the specified CRS interrupts.
* @param __INTERRUPT__: specifies the CRS interrupt sources to be disabled. * @param __INTERRUPT__ specifies the CRS interrupt sources to be disabled.
* This parameter can be any combination of the following values: * This parameter can be any combination of the following values:
* @arg RCC_CRS_IT_SYNCOK * @arg @ref RCC_CRS_IT_SYNCOK
* @arg RCC_CRS_IT_SYNCWARN * @arg @ref RCC_CRS_IT_SYNCWARN
* @arg RCC_CRS_IT_ERR * @arg @ref RCC_CRS_IT_ERR
* @arg RCC_CRS_IT_ESYNC * @arg @ref RCC_CRS_IT_ESYNC
* @retval None * @retval None
*/ */
#define __HAL_RCC_CRS_DISABLE_IT(__INTERRUPT__) (CRS->CR &= ~(__INTERRUPT__)) #define __HAL_RCC_CRS_DISABLE_IT(__INTERRUPT__) (CRS->CR &= ~(__INTERRUPT__))
/** @brief Check the CRS's interrupt has occurred or not. /** @brief Check the CRS's interrupt has occurred or not.
* @param __INTERRUPT__: specifies the CRS interrupt source to check. * @param __INTERRUPT__ specifies the CRS interrupt source to check.
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg RCC_CRS_IT_SYNCOK * @arg @ref RCC_CRS_IT_SYNCOK
* @arg RCC_CRS_IT_SYNCWARN * @arg @ref RCC_CRS_IT_SYNCWARN
* @arg RCC_CRS_IT_ERR * @arg @ref RCC_CRS_IT_ERR
* @arg RCC_CRS_IT_ESYNC * @arg @ref RCC_CRS_IT_ESYNC
* @retval The new state of __INTERRUPT__ (SET or RESET). * @retval The new state of __INTERRUPT__ (SET or RESET).
*/ */
#define __HAL_RCC_CRS_GET_IT_SOURCE(__INTERRUPT__) ((CRS->CR & (__INTERRUPT__))? SET : RESET) #define __HAL_RCC_CRS_GET_IT_SOURCE(__INTERRUPT__) ((CRS->CR & (__INTERRUPT__))? SET : RESET)
/** @brief Clear the CRS's interrupt pending bits /** @brief Clear the CRS's interrupt pending bits
* bits to clear the selected interrupt pending bits. * bits to clear the selected interrupt pending bits.
* @param __INTERRUPT__: specifies the interrupt pending bit to clear. * @param __INTERRUPT__ specifies the interrupt pending bit to clear.
* This parameter can be any combination of the following values: * This parameter can be any combination of the following values:
* @arg RCC_CRS_IT_SYNCOK * @arg @ref RCC_CRS_IT_SYNCOK
* @arg RCC_CRS_IT_SYNCWARN * @arg @ref RCC_CRS_IT_SYNCWARN
* @arg RCC_CRS_IT_ERR * @arg @ref RCC_CRS_IT_ERR
* @arg RCC_CRS_IT_ESYNC * @arg @ref RCC_CRS_IT_ESYNC
* @arg RCC_CRS_IT_TRIMOVF * @arg @ref RCC_CRS_IT_TRIMOVF
* @arg RCC_CRS_IT_SYNCERR * @arg @ref RCC_CRS_IT_SYNCERR
* @arg RCC_CRS_IT_SYNCMISS * @arg @ref RCC_CRS_IT_SYNCMISS
*/ */
/* CRS IT Error Mask */ #define __HAL_RCC_CRS_CLEAR_IT(__INTERRUPT__) do { \
#define RCC_CRS_IT_ERROR_MASK ((uint32_t)(RCC_CRS_IT_TRIMOVF | RCC_CRS_IT_SYNCERR | RCC_CRS_IT_SYNCMISS)) if(((__INTERRUPT__) & RCC_CRS_IT_ERROR_MASK) != RESET) \
{ \
#define __HAL_RCC_CRS_CLEAR_IT(__INTERRUPT__) ((((__INTERRUPT__) & RCC_CRS_IT_ERROR_MASK)!= 0) ? (CRS->ICR |= CRS_ICR_ERRC) : \ WRITE_REG(CRS->ICR, CRS_ICR_ERRC | ((__INTERRUPT__) & ~RCC_CRS_IT_ERROR_MASK)); \
(CRS->ICR |= (__INTERRUPT__))) } \
else \
{ \
WRITE_REG(CRS->ICR, (__INTERRUPT__)); \
} \
} while(0)
/** /**
* @brief Checks whether the specified CRS flag is set or not. * @brief Checks whether the specified CRS flag is set or not.
* @param _FLAG_: specifies the flag to check. * @param __FLAG__ specifies the flag to check.
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg RCC_CRS_FLAG_SYNCOK * @arg @ref RCC_CRS_FLAG_SYNCOK
* @arg RCC_CRS_FLAG_SYNCWARN * @arg @ref RCC_CRS_FLAG_SYNCWARN
* @arg RCC_CRS_FLAG_ERR * @arg @ref RCC_CRS_FLAG_ERR
* @arg RCC_CRS_FLAG_ESYNC * @arg @ref RCC_CRS_FLAG_ESYNC
* @arg RCC_CRS_FLAG_TRIMOVF * @arg @ref RCC_CRS_FLAG_TRIMOVF
* @arg RCC_CRS_FLAG_SYNCERR * @arg @ref RCC_CRS_FLAG_SYNCERR
* @arg RCC_CRS_FLAG_SYNCMISS * @arg @ref RCC_CRS_FLAG_SYNCMISS
* @retval The new state of _FLAG_ (TRUE or FALSE). * @retval The new state of _FLAG_ (TRUE or FALSE).
*/ */
#define __HAL_RCC_CRS_GET_FLAG(_FLAG_) ((CRS->ISR & (_FLAG_)) == (_FLAG_)) #define __HAL_RCC_CRS_GET_FLAG(__FLAG__) ((CRS->ISR & (__FLAG__)) == (__FLAG__))
/** /**
* @brief Clears the CRS specified FLAG. * @brief Clears the CRS specified FLAG.
* @param _FLAG_: specifies the flag to clear. * @param __FLAG__ specifies the flag to clear.
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg RCC_CRS_FLAG_SYNCOK * @arg @ref RCC_CRS_FLAG_SYNCOK
* @arg RCC_CRS_FLAG_SYNCWARN * @arg @ref RCC_CRS_FLAG_SYNCWARN
* @arg RCC_CRS_FLAG_ERR * @arg @ref RCC_CRS_FLAG_ERR
* @arg RCC_CRS_FLAG_ESYNC * @arg @ref RCC_CRS_FLAG_ESYNC
* @arg RCC_CRS_FLAG_TRIMOVF * @arg @ref RCC_CRS_FLAG_TRIMOVF
* @arg RCC_CRS_FLAG_SYNCERR * @arg @ref RCC_CRS_FLAG_SYNCERR
* @arg RCC_CRS_FLAG_SYNCMISS * @arg @ref RCC_CRS_FLAG_SYNCMISS
* @retval None * @retval None
*/ */
#define __HAL_RCC_CRS_CLEAR_FLAG(__FLAG__) do { \
/* CRS Flag Error Mask */ if(((__FLAG__) & RCC_CRS_FLAG_ERROR_MASK) != RESET) \
#define RCC_CRS_FLAG_ERROR_MASK ((uint32_t)(RCC_CRS_FLAG_TRIMOVF | RCC_CRS_FLAG_SYNCERR | RCC_CRS_FLAG_SYNCMISS)) { \
WRITE_REG(CRS->ICR, CRS_ICR_ERRC | ((__FLAG__) & ~RCC_CRS_FLAG_ERROR_MASK)); \
#define __HAL_RCC_CRS_CLEAR_FLAG(__FLAG__) ((((__FLAG__) & RCC_CRS_FLAG_ERROR_MASK)!= 0) ? (CRS->ICR |= CRS_ICR_ERRC) : \ } \
(CRS->ICR |= (__FLAG__))) else \
{ \
WRITE_REG(CRS->ICR, (__FLAG__)); \
} \
} while(0)
/** /**
* @} * @}
@ -2113,26 +2060,26 @@ typedef struct
* @note when the CEN bit is set the CRS_CFGR register becomes write-protected. * @note when the CEN bit is set the CRS_CFGR register becomes write-protected.
* @retval None * @retval None
*/ */
#define __HAL_RCC_CRS_ENABLE_FREQ_ERROR_COUNTER() (CRS->CR |= CRS_CR_CEN) #define __HAL_RCC_CRS_FREQ_ERROR_COUNTER_ENABLE() (CRS->CR |= CRS_CR_CEN)
/** /**
* @brief Disables the oscillator clock for frequency error counter. * @brief Disables the oscillator clock for frequency error counter.
* @retval None * @retval None
*/ */
#define __HAL_RCC_CRS_DISABLE_FREQ_ERROR_COUNTER() (CRS->CR &= ~CRS_CR_CEN) #define __HAL_RCC_CRS_FREQ_ERROR_COUNTER_DISABLE() (CRS->CR &= ~CRS_CR_CEN)
/** /**
* @brief Enables the automatic hardware adjustement of TRIM bits. * @brief Enables the automatic hardware adjustement of TRIM bits.
* @note When the AUTOTRIMEN bit is set the CRS_CFGR register becomes write-protected. * @note When the AUTOTRIMEN bit is set the CRS_CFGR register becomes write-protected.
* @retval None * @retval None
*/ */
#define __HAL_RCC_CRS_ENABLE_AUTOMATIC_CALIB() (CRS->CR |= CRS_CR_AUTOTRIMEN) #define __HAL_RCC_CRS_AUTOMATIC_CALIB_ENABLE() (CRS->CR |= CRS_CR_AUTOTRIMEN)
/** /**
* @brief Enables or disables the automatic hardware adjustement of TRIM bits. * @brief Enables or disables the automatic hardware adjustement of TRIM bits.
* @retval None * @retval None
*/ */
#define __HAL_RCC_CRS_DISABLE_AUTOMATIC_CALIB() (CRS->CR &= ~CRS_CR_AUTOTRIMEN) #define __HAL_RCC_CRS_AUTOMATIC_CALIB_DISABLE() (CRS->CR &= ~CRS_CR_AUTOTRIMEN)
/** /**
* @brief Macro to calculate reload value to be set in CRS register according to target and sync frequencies * @brief Macro to calculate reload value to be set in CRS register according to target and sync frequencies
@ -2144,15 +2091,13 @@ typedef struct
* @param _FSYNC_ Synchronization signal frequency (value in Hz) * @param _FSYNC_ Synchronization signal frequency (value in Hz)
* @retval None * @retval None
*/ */
#define __HAL_RCC_CRS_CALCULATE_RELOADVALUE(_FTARGET_, _FSYNC_) (((_FTARGET_) / (_FSYNC_)) - 1) #define __HAL_RCC_CRS_RELOADVALUE_CALCULATE(_FTARGET_, _FSYNC_) (((_FTARGET_) / (_FSYNC_)) - 1)
/** /**
* @} * @}
*/ */
#endif /* STM32F042x6 || STM32F048xx || */ #endif /* CRS */
/* STM32F071xB || STM32F072xB || STM32F078xx || */
/* STM32F091xC || STM32F098xx */
/** /**
* @} * @}
@ -2171,16 +2116,12 @@ HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *Perip
void HAL_RCCEx_GetPeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit); void HAL_RCCEx_GetPeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit);
uint32_t HAL_RCCEx_GetPeriphCLKFreq(uint32_t PeriphClk); uint32_t HAL_RCCEx_GetPeriphCLKFreq(uint32_t PeriphClk);
#if defined(STM32F042x6) || defined(STM32F048xx)\ #if defined(CRS)
|| defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)\
|| defined(STM32F091xC) || defined(STM32F098xx)
void HAL_RCCEx_CRSConfig(RCC_CRSInitTypeDef *pInit); void HAL_RCCEx_CRSConfig(RCC_CRSInitTypeDef *pInit);
void HAL_RCCEx_CRSSoftwareSynchronizationGenerate(void); void HAL_RCCEx_CRSSoftwareSynchronizationGenerate(void);
void HAL_RCCEx_CRSGetSynchronizationInfo(RCC_CRSSynchroInfoTypeDef *pSynchroInfo); void HAL_RCCEx_CRSGetSynchronizationInfo(RCC_CRSSynchroInfoTypeDef *pSynchroInfo);
uint32_t HAL_RCCEx_CRSWaitSynchronization(uint32_t Timeout); uint32_t HAL_RCCEx_CRSWaitSynchronization(uint32_t Timeout);
#endif /* STM32F042x6 || STM32F048xx || */ #endif /* CRS */
/* STM32F071xB || STM32F072xB || STM32F078xx || */
/* STM32F091xC || STM32F098xx */
/** /**

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_rtc.c * @file stm32f0xx_hal_rtc.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief RTC HAL module driver. * @brief RTC HAL module driver.
* This file provides firmware functions to manage the following * This file provides firmware functions to manage the following
* functionalities of the Real Time Clock (RTC) peripheral: * functionalities of the Real Time Clock (RTC) peripheral:
@ -57,7 +57,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -344,6 +344,9 @@ HAL_StatusTypeDef HAL_RTC_DeInit(RTC_HandleTypeDef *hrtc)
*/ */
__weak void HAL_RTC_MspInit(RTC_HandleTypeDef* hrtc) __weak void HAL_RTC_MspInit(RTC_HandleTypeDef* hrtc)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hrtc);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_RTC_MspInit could be implemented in the user file the HAL_RTC_MspInit could be implemented in the user file
*/ */
@ -356,6 +359,9 @@ __weak void HAL_RTC_MspInit(RTC_HandleTypeDef* hrtc)
*/ */
__weak void HAL_RTC_MspDeInit(RTC_HandleTypeDef* hrtc) __weak void HAL_RTC_MspDeInit(RTC_HandleTypeDef* hrtc)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hrtc);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_RTC_MspDeInit could be implemented in the user file the HAL_RTC_MspDeInit could be implemented in the user file
*/ */
@ -506,11 +512,18 @@ HAL_StatusTypeDef HAL_RTC_SetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTim
/** /**
* @brief Get RTC current time. * @brief Get RTC current time.
* @param hrtc: RTC handle * @param hrtc: RTC handle
* @param sTime: Pointer to Time structure * @param sTime: Pointer to Time structure with Hours, Minutes and Seconds fields returned
* with input format (BIN or BCD), also SubSeconds field returning the
* RTC_SSR register content and SecondFraction field the Synchronous pre-scaler
* factor to be used for second fraction ratio computation.
* @param Format: Specifies the format of the entered parameters. * @param Format: Specifies the format of the entered parameters.
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg RTC_FORMAT_BIN: Binary data format * @arg RTC_FORMAT_BIN: Binary data format
* @arg RTC_FORMAT_BCD: BCD data format * @arg RTC_FORMAT_BCD: BCD data format
* @note You can use SubSeconds and SecondFraction (sTime structure fields returned) to convert SubSeconds
* value in second fraction ratio with time unit following generic formula:
* Second fraction ratio * time_unit= [(SecondFraction-SubSeconds)/(SecondFraction+1)] * time_unit
* This conversion can be performed only if no shift operation is pending (ie. SHFP=0) when PREDIV_S >= SS
* @note You must call HAL_RTC_GetDate() after HAL_RTC_GetTime() to unlock the values * @note You must call HAL_RTC_GetDate() after HAL_RTC_GetTime() to unlock the values
* in the higher-order calendar shadow registers to ensure consistency between the time and date values. * in the higher-order calendar shadow registers to ensure consistency between the time and date values.
* Reading RTC current time locks the values in calendar shadow registers until Current date is read * Reading RTC current time locks the values in calendar shadow registers until Current date is read
@ -524,9 +537,12 @@ HAL_StatusTypeDef HAL_RTC_GetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTim
/* Check the parameters */ /* Check the parameters */
assert_param(IS_RTC_FORMAT(Format)); assert_param(IS_RTC_FORMAT(Format));
/* Get subseconds values from the correspondent registers*/ /* Get subseconds structure field from the corresponding register*/
sTime->SubSeconds = (uint32_t)(hrtc->Instance->SSR); sTime->SubSeconds = (uint32_t)(hrtc->Instance->SSR);
/* Get SecondFraction structure field from the corresponding register field*/
sTime->SecondFraction = (uint32_t)(hrtc->Instance->PRER & RTC_PRER_PREDIV_S);
/* Get the TR register */ /* Get the TR register */
tmpreg = (uint32_t)(hrtc->Instance->TR & RTC_TR_RESERVED_MASK); tmpreg = (uint32_t)(hrtc->Instance->TR & RTC_TR_RESERVED_MASK);
@ -1121,10 +1137,11 @@ HAL_StatusTypeDef HAL_RTC_GetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sA
*/ */
void HAL_RTC_AlarmIRQHandler(RTC_HandleTypeDef* hrtc) void HAL_RTC_AlarmIRQHandler(RTC_HandleTypeDef* hrtc)
{ {
if(__HAL_RTC_ALARM_GET_IT(hrtc, RTC_IT_ALRA)) /* Get the AlarmA interrupt source enable status */
if(__HAL_RTC_ALARM_GET_IT_SOURCE(hrtc, RTC_IT_ALRA) != RESET)
{ {
/* Get the status of the Interrupt */ /* Get the pending status of the AlarmA Interrupt */
if((uint32_t)(hrtc->Instance->CR & RTC_IT_ALRA) != (uint32_t)RESET) if(__HAL_RTC_ALARM_GET_FLAG(hrtc, RTC_FLAG_ALRAF) != RESET)
{ {
/* AlarmA callback */ /* AlarmA callback */
HAL_RTC_AlarmAEventCallback(hrtc); HAL_RTC_AlarmAEventCallback(hrtc);
@ -1148,6 +1165,9 @@ void HAL_RTC_AlarmIRQHandler(RTC_HandleTypeDef* hrtc)
*/ */
__weak void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc) __weak void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hrtc);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_RTC_AlarmAEventCallback could be implemented in the user file the HAL_RTC_AlarmAEventCallback could be implemented in the user file
*/ */

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_rtc.h * @file stm32f0xx_hal_rtc.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of RTC HAL module. * @brief Header file of RTC HAL module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -111,12 +111,19 @@ typedef struct
uint8_t Seconds; /*!< Specifies the RTC Time Seconds. uint8_t Seconds; /*!< Specifies the RTC Time Seconds.
This parameter must be a number between Min_Data = 0 and Max_Data = 59 */ This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
uint32_t SubSeconds; /*!< Specifies the RTC Time SubSeconds.
This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
uint8_t TimeFormat; /*!< Specifies the RTC AM/PM Time. uint8_t TimeFormat; /*!< Specifies the RTC AM/PM Time.
This parameter can be a value of @ref RTC_AM_PM_Definitions */ This parameter can be a value of @ref RTC_AM_PM_Definitions */
uint32_t SubSeconds; /*!< Specifies the RTC_SSR RTC Sub Second register content.
This parameter corresponds to a time unit range between [0-1] Second
with [1 Sec / SecondFraction +1] granularity */
uint32_t SecondFraction; /*!< Specifies the range or granularity of Sub Second register content
corresponding to Synchronous pre-scaler factor value (PREDIV_S)
This parameter corresponds to a time unit range between [0-1] Second
with [1 Sec / SecondFraction +1] granularity.
This field will be used only by HAL_RTC_GetTime function */
uint32_t DayLightSaving; /*!< Specifies RTC_DayLightSaveOperation: the value of hour adjustment. uint32_t DayLightSaving; /*!< Specifies RTC_DayLightSaveOperation: the value of hour adjustment.
This parameter can be a value of @ref RTC_DayLightSaving_Definitions */ This parameter can be a value of @ref RTC_DayLightSaving_Definitions */
@ -308,7 +315,7 @@ typedef struct
#define RTC_ALARMMASK_HOURS RTC_ALRMAR_MSK3 #define RTC_ALARMMASK_HOURS RTC_ALRMAR_MSK3
#define RTC_ALARMMASK_MINUTES RTC_ALRMAR_MSK2 #define RTC_ALARMMASK_MINUTES RTC_ALRMAR_MSK2
#define RTC_ALARMMASK_SECONDS RTC_ALRMAR_MSK1 #define RTC_ALARMMASK_SECONDS RTC_ALRMAR_MSK1
#define RTC_ALARMMASK_ALL ((uint32_t)0x80808080) #define RTC_ALARMMASK_ALL ((uint32_t)0x80808080U)
/** /**
* @} * @}
*/ */
@ -475,7 +482,7 @@ typedef struct
* @arg RTC_IT_ALRA: Alarm A interrupt * @arg RTC_IT_ALRA: Alarm A interrupt
* @retval None * @retval None
*/ */
#define __HAL_RTC_ALARM_GET_IT(__HANDLE__, __INTERRUPT__) ((((((__HANDLE__)->Instance->ISR)& ((__INTERRUPT__)>> 4)) & 0x0000FFFF) != RESET)? SET : RESET) #define __HAL_RTC_ALARM_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR)& ((__INTERRUPT__)>> 4)) != RESET)? SET : RESET)
/** /**
* @brief Check whether the specified RTC Alarm interrupt has been enabled or not. * @brief Check whether the specified RTC Alarm interrupt has been enabled or not.
@ -506,7 +513,7 @@ typedef struct
* @arg RTC_FLAG_ALRAF * @arg RTC_FLAG_ALRAF
* @retval None * @retval None
*/ */
#define __HAL_RTC_ALARM_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~(((__FLAG__) | RTC_ISR_INIT)& 0x0000FFFF)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT)) #define __HAL_RTC_ALARM_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT) | ((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
/** /**
* @brief Enable interrupt on the RTC Alarm associated Exti line. * @brief Enable interrupt on the RTC Alarm associated Exti line.
@ -667,15 +674,15 @@ HAL_RTCStateTypeDef HAL_RTC_GetState(RTC_HandleTypeDef *hrtc);
* @{ * @{
*/ */
/* Masks Definition */ /* Masks Definition */
#define RTC_TR_RESERVED_MASK ((uint32_t)0x007F7F7F) #define RTC_TR_RESERVED_MASK ((uint32_t)0x007F7F7FU)
#define RTC_DR_RESERVED_MASK ((uint32_t)0x00FFFF3F) #define RTC_DR_RESERVED_MASK ((uint32_t)0x00FFFF3FU)
#define RTC_INIT_MASK ((uint32_t)0xFFFFFFFF) #define RTC_INIT_MASK ((uint32_t)0xFFFFFFFFU)
#define RTC_RSF_MASK ((uint32_t)0xFFFFFF5F) #define RTC_RSF_MASK ((uint32_t)0xFFFFFF5FU)
#define RTC_FLAGS_MASK ((uint32_t)(RTC_FLAG_TSOVF | RTC_FLAG_TSF | RTC_FLAG_WUTF | \ #define RTC_FLAGS_MASK ((uint32_t) (RTC_FLAG_RECALPF | RTC_FLAG_TAMP3F | RTC_FLAG_TAMP2F | \
RTC_FLAG_ALRBF | RTC_FLAG_ALRAF | RTC_FLAG_INITF | \ RTC_FLAG_TAMP1F| RTC_FLAG_TSOVF | RTC_FLAG_TSF | \
RTC_FLAG_RSF | RTC_FLAG_INITS | RTC_FLAG_WUTWF | \ RTC_FLAG_WUTF | RTC_FLAG_ALRAF | \
RTC_FLAG_ALRBWF | RTC_FLAG_ALRAWF | RTC_FLAG_TAMP1F | \ RTC_FLAG_INITF | RTC_FLAG_RSF | RTC_FLAG_INITS | \
RTC_FLAG_RECALPF | RTC_FLAG_SHPF)) RTC_FLAG_SHPF | RTC_FLAG_WUTWF | RTC_FLAG_ALRAWF))
#define RTC_TIMEOUT_VALUE 1000 #define RTC_TIMEOUT_VALUE 1000
@ -706,7 +713,9 @@ HAL_RTCStateTypeDef HAL_RTC_GetState(RTC_HandleTypeDef *hrtc);
#define IS_RTC_MINUTES(MINUTES) ((MINUTES) <= (uint32_t)59) #define IS_RTC_MINUTES(MINUTES) ((MINUTES) <= (uint32_t)59)
#define IS_RTC_SECONDS(SECONDS) ((SECONDS) <= (uint32_t)59) #define IS_RTC_SECONDS(SECONDS) ((SECONDS) <= (uint32_t)59)
#define IS_RTC_HOURFORMAT12(PM) (((PM) == RTC_HOURFORMAT12_AM) || ((PM) == RTC_HOURFORMAT12_PM)) #define IS_RTC_HOURFORMAT12(PM) (((PM) == RTC_HOURFORMAT12_AM) || \
((PM) == RTC_HOURFORMAT12_PM))
#define IS_RTC_DAYLIGHT_SAVING(SAVE) (((SAVE) == RTC_DAYLIGHTSAVING_SUB1H) || \ #define IS_RTC_DAYLIGHT_SAVING(SAVE) (((SAVE) == RTC_DAYLIGHTSAVING_SUB1H) || \
((SAVE) == RTC_DAYLIGHTSAVING_ADD1H) || \ ((SAVE) == RTC_DAYLIGHTSAVING_ADD1H) || \
((SAVE) == RTC_DAYLIGHTSAVING_NONE)) ((SAVE) == RTC_DAYLIGHTSAVING_NONE))

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_rtc_ex.c * @file stm32f0xx_hal_rtc_ex.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Extended RTC HAL module driver. * @brief Extended RTC HAL module driver.
* This file provides firmware functions to manage the following * This file provides firmware functions to manage the following
* functionalities of the Real Time Clock (RTC) Extended peripheral: * functionalities of the Real Time Clock (RTC) Extended peripheral:
@ -64,7 +64,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -481,10 +481,11 @@ HAL_StatusTypeDef HAL_RTCEx_DeactivateTamper(RTC_HandleTypeDef *hrtc, uint32_t T
*/ */
void HAL_RTCEx_TamperTimeStampIRQHandler(RTC_HandleTypeDef *hrtc) void HAL_RTCEx_TamperTimeStampIRQHandler(RTC_HandleTypeDef *hrtc)
{ {
if(__HAL_RTC_TIMESTAMP_GET_IT(hrtc, RTC_IT_TS)) /* Get the TimeStamp interrupt source enable status */
if(__HAL_RTC_TIMESTAMP_GET_IT_SOURCE(hrtc, RTC_IT_TS) != RESET)
{ {
/* Get the status of the Interrupt */ /* Get the pending status of the TIMESTAMP Interrupt */
if((uint32_t)(hrtc->Instance->CR & RTC_IT_TS) != (uint32_t)RESET) if(__HAL_RTC_TIMESTAMP_GET_FLAG(hrtc, RTC_FLAG_TSF) != RESET)
{ {
/* TIMESTAMP callback */ /* TIMESTAMP callback */
HAL_RTCEx_TimeStampEventCallback(hrtc); HAL_RTCEx_TimeStampEventCallback(hrtc);
@ -494,11 +495,11 @@ void HAL_RTCEx_TamperTimeStampIRQHandler(RTC_HandleTypeDef *hrtc)
} }
} }
/* Get the status of the Interrupt */ /* Get the Tamper interrupts source enable status */
if(__HAL_RTC_TAMPER_GET_IT(hrtc,RTC_IT_TAMP1)) if(__HAL_RTC_TAMPER_GET_IT_SOURCE(hrtc, RTC_IT_TAMP))
{ {
/* Get the TAMPER Interrupt enable bit and pending bit */ /* Get the pending status of the Tamper1 Interrupt */
if(((hrtc->Instance->TAFCR & (RTC_TAFCR_TAMPIE))) != (uint32_t)RESET) if(__HAL_RTC_TAMPER_GET_FLAG(hrtc, RTC_FLAG_TAMP1F) != RESET)
{ {
/* Tamper1 callback */ /* Tamper1 callback */
HAL_RTCEx_Tamper1EventCallback(hrtc); HAL_RTCEx_Tamper1EventCallback(hrtc);
@ -508,11 +509,11 @@ void HAL_RTCEx_TamperTimeStampIRQHandler(RTC_HandleTypeDef *hrtc)
} }
} }
/* Get the status of the Interrupt */ /* Get the Tamper interrupts source enable status */
if(__HAL_RTC_TAMPER_GET_IT(hrtc, RTC_IT_TAMP2)) if(__HAL_RTC_TAMPER_GET_IT_SOURCE(hrtc, RTC_IT_TAMP))
{ {
/* Get the TAMPER Interrupt enable bit and pending bit */ /* Get the pending status of the Tamper2 Interrupt */
if(((hrtc->Instance->TAFCR & RTC_TAFCR_TAMPIE)) != (uint32_t)RESET) if(__HAL_RTC_TAMPER_GET_FLAG(hrtc, RTC_FLAG_TAMP2F) != RESET)
{ {
/* Tamper2 callback */ /* Tamper2 callback */
HAL_RTCEx_Tamper2EventCallback(hrtc); HAL_RTCEx_Tamper2EventCallback(hrtc);
@ -523,11 +524,11 @@ void HAL_RTCEx_TamperTimeStampIRQHandler(RTC_HandleTypeDef *hrtc)
} }
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) #if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx)
/* Get the status of the Interrupt */ /* Get the Tamper interrupts source enable status */
if(__HAL_RTC_TAMPER_GET_IT(hrtc, RTC_IT_TAMP3)) if(__HAL_RTC_TAMPER_GET_IT_SOURCE(hrtc, RTC_IT_TAMP))
{ {
/* Get the TAMPER Interrupt enable bit and pending bit */ /* Get the pending status of the Tamper3 Interrupt */
if(((hrtc->Instance->TAFCR & RTC_TAFCR_TAMPIE)) != (uint32_t)RESET) if(__HAL_RTC_TAMPER_GET_FLAG(hrtc, RTC_FLAG_TAMP3F) != RESET)
{ {
/* Tamper3 callback */ /* Tamper3 callback */
HAL_RTCEx_Tamper3EventCallback(hrtc); HAL_RTCEx_Tamper3EventCallback(hrtc);
@ -552,6 +553,9 @@ void HAL_RTCEx_TamperTimeStampIRQHandler(RTC_HandleTypeDef *hrtc)
*/ */
__weak void HAL_RTCEx_TimeStampEventCallback(RTC_HandleTypeDef *hrtc) __weak void HAL_RTCEx_TimeStampEventCallback(RTC_HandleTypeDef *hrtc)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hrtc);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_RTCEx_TimeStampEventCallback could be implemented in the user file the HAL_RTCEx_TimeStampEventCallback could be implemented in the user file
*/ */
@ -564,6 +568,9 @@ __weak void HAL_RTCEx_TimeStampEventCallback(RTC_HandleTypeDef *hrtc)
*/ */
__weak void HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc) __weak void HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hrtc);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_RTCEx_Tamper1EventCallback could be implemented in the user file the HAL_RTCEx_Tamper1EventCallback could be implemented in the user file
*/ */
@ -576,6 +583,9 @@ __weak void HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc)
*/ */
__weak void HAL_RTCEx_Tamper2EventCallback(RTC_HandleTypeDef *hrtc) __weak void HAL_RTCEx_Tamper2EventCallback(RTC_HandleTypeDef *hrtc)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hrtc);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_RTCEx_Tamper2EventCallback could be implemented in the user file the HAL_RTCEx_Tamper2EventCallback could be implemented in the user file
*/ */
@ -589,6 +599,9 @@ __weak void HAL_RTCEx_Tamper2EventCallback(RTC_HandleTypeDef *hrtc)
*/ */
__weak void HAL_RTCEx_Tamper3EventCallback(RTC_HandleTypeDef *hrtc) __weak void HAL_RTCEx_Tamper3EventCallback(RTC_HandleTypeDef *hrtc)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hrtc);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_RTCEx_Tamper3EventCallback could be implemented in the user file the HAL_RTCEx_Tamper3EventCallback could be implemented in the user file
*/ */
@ -774,6 +787,28 @@ HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer(RTC_HandleTypeDef *hrtc, uint32_t Wak
/* Disable the write protection for RTC registers */ /* Disable the write protection for RTC registers */
__HAL_RTC_WRITEPROTECTION_DISABLE(hrtc); __HAL_RTC_WRITEPROTECTION_DISABLE(hrtc);
/*Check RTC WUTWF flag is reset only when wake up timer enabled*/
if((hrtc->Instance->CR & RTC_CR_WUTE) != RESET){
tickstart = HAL_GetTick();
/* Wait till RTC WUTWF flag is reset and if Time out is reached exit */
while(__HAL_RTC_WAKEUPTIMER_GET_FLAG(hrtc, RTC_FLAG_WUTWF) == SET)
{
if((HAL_GetTick() - tickstart ) > RTC_TIMEOUT_VALUE)
{
/* Enable the write protection for RTC registers */
__HAL_RTC_WRITEPROTECTION_ENABLE(hrtc);
hrtc->State = HAL_RTC_STATE_TIMEOUT;
/* Process Unlocked */
__HAL_UNLOCK(hrtc);
return HAL_TIMEOUT;
}
}
}
__HAL_RTC_WAKEUPTIMER_DISABLE(hrtc); __HAL_RTC_WAKEUPTIMER_DISABLE(hrtc);
tickstart = HAL_GetTick(); tickstart = HAL_GetTick();
@ -841,6 +876,28 @@ HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t
/* Disable the write protection for RTC registers */ /* Disable the write protection for RTC registers */
__HAL_RTC_WRITEPROTECTION_DISABLE(hrtc); __HAL_RTC_WRITEPROTECTION_DISABLE(hrtc);
/*Check RTC WUTWF flag is reset only when wake up timer enabled*/
if((hrtc->Instance->CR & RTC_CR_WUTE) != RESET){
tickstart = HAL_GetTick();
/* Wait till RTC WUTWF flag is reset and if Time out is reached exit */
while(__HAL_RTC_WAKEUPTIMER_GET_FLAG(hrtc, RTC_FLAG_WUTWF) == SET)
{
if((HAL_GetTick() - tickstart ) > RTC_TIMEOUT_VALUE)
{
/* Enable the write protection for RTC registers */
__HAL_RTC_WRITEPROTECTION_ENABLE(hrtc);
hrtc->State = HAL_RTC_STATE_TIMEOUT;
/* Process Unlocked */
__HAL_UNLOCK(hrtc);
return HAL_TIMEOUT;
}
}
}
__HAL_RTC_WAKEUPTIMER_DISABLE(hrtc); __HAL_RTC_WAKEUPTIMER_DISABLE(hrtc);
tickstart = HAL_GetTick(); tickstart = HAL_GetTick();
@ -963,10 +1020,11 @@ uint32_t HAL_RTCEx_GetWakeUpTimer(RTC_HandleTypeDef *hrtc)
*/ */
void HAL_RTCEx_WakeUpTimerIRQHandler(RTC_HandleTypeDef *hrtc) void HAL_RTCEx_WakeUpTimerIRQHandler(RTC_HandleTypeDef *hrtc)
{ {
if(__HAL_RTC_WAKEUPTIMER_GET_IT(hrtc, RTC_IT_WUT)) /* Get the WAKEUPTIMER interrupt source enable status */
if(__HAL_RTC_WAKEUPTIMER_GET_IT_SOURCE(hrtc, RTC_IT_WUT) != RESET)
{ {
/* Get the status of the Interrupt */ /* Get the pending status of the WAKEUPTIMER Interrupt */
if((uint32_t)(hrtc->Instance->CR & RTC_IT_WUT) != (uint32_t)RESET) if(__HAL_RTC_WAKEUPTIMER_GET_FLAG(hrtc, RTC_FLAG_WUTF) != RESET)
{ {
/* WAKEUPTIMER callback */ /* WAKEUPTIMER callback */
HAL_RTCEx_WakeUpTimerEventCallback(hrtc); HAL_RTCEx_WakeUpTimerEventCallback(hrtc);
@ -990,6 +1048,9 @@ void HAL_RTCEx_WakeUpTimerIRQHandler(RTC_HandleTypeDef *hrtc)
*/ */
__weak void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc) __weak void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hrtc);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_RTCEx_WakeUpTimerEventCallback could be implemented in the user file the HAL_RTCEx_WakeUpTimerEventCallback could be implemented in the user file
*/ */

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_rtc_ex.h * @file stm32f0xx_hal_rtc_ex.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of RTC HAL Extended module. * @brief Header file of RTC HAL Extended module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -240,7 +240,7 @@ typedef struct
* @{ * @{
*/ */
#define RTC_TAMPER_PULLUP_ENABLE ((uint32_t)0x00000000) /*!< Tamper pins are pre-charged before sampling */ #define RTC_TAMPER_PULLUP_ENABLE ((uint32_t)0x00000000) /*!< Tamper pins are pre-charged before sampling */
#define RTC_TAMPER_PULLUP_DISABLE ((uint32_t)RTC_TAFCR_TAMPPUDIS) /*!< TimeStamp on Tamper Detection event is not saved */ #define RTC_TAMPER_PULLUP_DISABLE ((uint32_t)RTC_TAFCR_TAMPPUDIS) /*!< Tamper pins are not pre-charged before sampling */
/** /**
* @} * @}
@ -302,8 +302,8 @@ typedef struct
/** @defgroup RTCEx_Add_1_Second_Parameter_Definition RTCEx Add 1 Second Parameter Definition /** @defgroup RTCEx_Add_1_Second_Parameter_Definition RTCEx Add 1 Second Parameter Definition
* @{ * @{
*/ */
#define RTC_SHIFTADD1S_RESET ((uint32_t)0x00000000) #define RTC_SHIFTADD1S_RESET ((uint32_t)0x00000000U)
#define RTC_SHIFTADD1S_SET ((uint32_t)0x80000000) #define RTC_SHIFTADD1S_SET ((uint32_t)0x80000000U)
/** /**
* @} * @}
@ -396,7 +396,7 @@ typedef struct
* @arg RTC_FLAG_WUTF * @arg RTC_FLAG_WUTF
* @retval None * @retval None
*/ */
#define __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~(((__FLAG__) | RTC_ISR_INIT)& 0x0000FFFF)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT)) #define __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
/* WAKE-UP TIMER EXTI */ /* WAKE-UP TIMER EXTI */
/* ------------------ */ /* ------------------ */
@ -560,7 +560,7 @@ typedef struct
* @arg RTC_FLAG_TSF * @arg RTC_FLAG_TSF
* @retval None * @retval None
*/ */
#define __HAL_RTC_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~(((__FLAG__) | RTC_ISR_INIT)& 0x0000FFFF)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT)) #define __HAL_RTC_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
/** /**
* @} * @}
@ -696,7 +696,8 @@ typedef struct
* @arg RTC_FLAG_TAMP3F * @arg RTC_FLAG_TAMP3F
* @retval None * @retval None
*/ */
#define __HAL_RTC_TAMPER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~(((__FLAG__) | RTC_ISR_INIT)& 0x0000FFFF)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT)) #define __HAL_RTC_TAMPER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
#else #else
/** /**
@ -720,7 +721,7 @@ typedef struct
* @arg RTC_FLAG_TAMP2F * @arg RTC_FLAG_TAMP2F
* @retval None * @retval None
*/ */
#define __HAL_RTC_TAMPER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~(((__FLAG__) | RTC_ISR_INIT)& 0x0000FFFF)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT)) #define __HAL_RTC_TAMPER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
#endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F070xB) || defined(STM32F030xC) */ #endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F070xB) || defined(STM32F030xC) */
/** /**
@ -930,7 +931,7 @@ void HAL_RTCEx_BKUPWrite(RTC_HandleTypeDef *hrtc, uint32_t BackupRe
uint32_t HAL_RTCEx_BKUPRead(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister); uint32_t HAL_RTCEx_BKUPRead(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister);
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F030xC) && !defined(STM32F070x6) && !defined(STM32F070xB) */ #endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F030xC) && !defined(STM32F070x6) && !defined(STM32F070xB) */
HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef *hrtc, uint32_t SmoothCalibPeriod, uint32_t SmoothCalibPlusPulses, uint32_t SmouthCalibMinusPulsesValue); HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef *hrtc, uint32_t SmoothCalibPeriod, uint32_t SmoothCalibPlusPulses, uint32_t SmoothCalibMinusPulsesValue);
HAL_StatusTypeDef HAL_RTCEx_SetSynchroShift(RTC_HandleTypeDef *hrtc, uint32_t ShiftAdd1S, uint32_t ShiftSubFS); HAL_StatusTypeDef HAL_RTCEx_SetSynchroShift(RTC_HandleTypeDef *hrtc, uint32_t ShiftAdd1S, uint32_t ShiftSubFS);
HAL_StatusTypeDef HAL_RTCEx_SetCalibrationOutPut(RTC_HandleTypeDef *hrtc, uint32_t CalibOutput); HAL_StatusTypeDef HAL_RTCEx_SetCalibrationOutPut(RTC_HandleTypeDef *hrtc, uint32_t CalibOutput);
HAL_StatusTypeDef HAL_RTCEx_DeactivateCalibrationOutPut(RTC_HandleTypeDef *hrtc); HAL_StatusTypeDef HAL_RTCEx_DeactivateCalibrationOutPut(RTC_HandleTypeDef *hrtc);
@ -982,10 +983,10 @@ HAL_StatusTypeDef HAL_RTCEx_DisableBypassShadow(RTC_HandleTypeDef *hrtc);
#define IS_TIMESTAMP_EDGE(EDGE) (((EDGE) == RTC_TIMESTAMPEDGE_RISING) || \ #define IS_TIMESTAMP_EDGE(EDGE) (((EDGE) == RTC_TIMESTAMPEDGE_RISING) || \
((EDGE) == RTC_TIMESTAMPEDGE_FALLING)) ((EDGE) == RTC_TIMESTAMPEDGE_FALLING))
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) #if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx)
#define IS_RTC_TAMPER(TAMPER) ((((TAMPER) & (uint32_t)0xFFFFFFD6) == 0x00) && ((TAMPER) != (uint32_t)RESET)) #define IS_RTC_TAMPER(TAMPER) ((((TAMPER) & (uint32_t)0xFFFFFFD6U) == 0x00) && ((TAMPER) != (uint32_t)RESET))
#else #else
#define IS_RTC_TAMPER(TAMPER) ((((TAMPER) & (uint32_t)0xFFFFFFF6) == 0x00) && ((TAMPER) != (uint32_t)RESET)) #define IS_RTC_TAMPER(TAMPER) ((((TAMPER) & (uint32_t)0xFFFFFFF6U) == 0x00) && ((TAMPER) != (uint32_t)RESET))
#endif #endif

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_smartcard.c * @file stm32f0xx_hal_smartcard.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief SMARTCARD HAL module driver. * @brief SMARTCARD HAL module driver.
* This file provides firmware functions to manage the following * This file provides firmware functions to manage the following
* functionalities of the SMARTCARD peripheral: * functionalities of the SMARTCARD peripheral:
@ -107,7 +107,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -360,6 +360,9 @@ HAL_StatusTypeDef HAL_SMARTCARD_DeInit(SMARTCARD_HandleTypeDef *hsmartcard)
*/ */
__weak void HAL_SMARTCARD_MspInit(SMARTCARD_HandleTypeDef *hsmartcard) __weak void HAL_SMARTCARD_MspInit(SMARTCARD_HandleTypeDef *hsmartcard)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hsmartcard);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_SMARTCARD_MspInit can be implemented in the user file the HAL_SMARTCARD_MspInit can be implemented in the user file
*/ */
@ -373,6 +376,9 @@ HAL_StatusTypeDef HAL_SMARTCARD_DeInit(SMARTCARD_HandleTypeDef *hsmartcard)
*/ */
__weak void HAL_SMARTCARD_MspDeInit(SMARTCARD_HandleTypeDef *hsmartcard) __weak void HAL_SMARTCARD_MspDeInit(SMARTCARD_HandleTypeDef *hsmartcard)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hsmartcard);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_SMARTCARD_MspDeInit can be implemented in the user file the HAL_SMARTCARD_MspDeInit can be implemented in the user file
*/ */
@ -903,6 +909,9 @@ void HAL_SMARTCARD_IRQHandler(SMARTCARD_HandleTypeDef *hsmartcard)
*/ */
__weak void HAL_SMARTCARD_TxCpltCallback(SMARTCARD_HandleTypeDef *hsmartcard) __weak void HAL_SMARTCARD_TxCpltCallback(SMARTCARD_HandleTypeDef *hsmartcard)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hsmartcard);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_SMARTCARD_TxCpltCallback can be implemented in the user file. the HAL_SMARTCARD_TxCpltCallback can be implemented in the user file.
*/ */
@ -916,6 +925,9 @@ void HAL_SMARTCARD_IRQHandler(SMARTCARD_HandleTypeDef *hsmartcard)
*/ */
__weak void HAL_SMARTCARD_RxCpltCallback(SMARTCARD_HandleTypeDef *hsmartcard) __weak void HAL_SMARTCARD_RxCpltCallback(SMARTCARD_HandleTypeDef *hsmartcard)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hsmartcard);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_SMARTCARD_RxCpltCallback can be implemented in the user file. the HAL_SMARTCARD_RxCpltCallback can be implemented in the user file.
*/ */
@ -929,6 +941,9 @@ __weak void HAL_SMARTCARD_RxCpltCallback(SMARTCARD_HandleTypeDef *hsmartcard)
*/ */
__weak void HAL_SMARTCARD_ErrorCallback(SMARTCARD_HandleTypeDef *hsmartcard) __weak void HAL_SMARTCARD_ErrorCallback(SMARTCARD_HandleTypeDef *hsmartcard)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hsmartcard);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_SMARTCARD_ErrorCallback can be implemented in the user file. the HAL_SMARTCARD_ErrorCallback can be implemented in the user file.
*/ */

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_smartcard.h * @file stm32f0xx_hal_smartcard.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of SMARTCARD HAL module. * @brief Header file of SMARTCARD HAL module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -245,7 +245,11 @@ typedef struct
/** @defgroup SMARTCARD_Word_Length SMARTCARD Word Length /** @defgroup SMARTCARD_Word_Length SMARTCARD Word Length
* @{ * @{
*/ */
#if defined (USART_CR1_M0)
#define SMARTCARD_WORDLENGTH_9B ((uint32_t)USART_CR1_M0) /*!< SMARTCARD frame length */ #define SMARTCARD_WORDLENGTH_9B ((uint32_t)USART_CR1_M0) /*!< SMARTCARD frame length */
#else
#define SMARTCARD_WORDLENGTH_9B ((uint32_t)USART_CR1_M) /*!< SMARTCARD frame length */
#endif
/** /**
* @} * @}
*/ */
@ -762,7 +766,7 @@ typedef struct
* @param __BAUDRATE__: Baud rate set by the configuration function. * @param __BAUDRATE__: Baud rate set by the configuration function.
* @retval Test result (TRUE or FALSE) * @retval Test result (TRUE or FALSE)
*/ */
#define IS_SMARTCARD_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) < 4500001) #define IS_SMARTCARD_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) < 3000001)
/** @brief Check the block length range. /** @brief Check the block length range.
* @note The maximum SMARTCARD block length is 0xFF. * @note The maximum SMARTCARD block length is 0xFF.

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_smartcard_ex.c * @file stm32f0xx_hal_smartcard_ex.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief SMARTCARD HAL module driver. * @brief SMARTCARD HAL module driver.
* *
* This file provides extended firmware functions to manage the following * This file provides extended firmware functions to manage the following
@ -29,7 +29,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_smartcard_ex.h * @file stm32f0xx_hal_smartcard_ex.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of SMARTCARD HAL Extended module. * @brief Header file of SMARTCARD HAL Extended module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_smbus.c * @file stm32f0xx_hal_smbus.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief SMBUS HAL module driver. * @brief SMBUS HAL module driver.
* This file provides firmware functions to manage the following * This file provides firmware functions to manage the following
* functionalities of the System Management Bus (SMBus) peripheral, * functionalities of the System Management Bus (SMBus) peripheral,
@ -23,15 +23,15 @@
SMBUS_HandleTypeDef hsmbus; SMBUS_HandleTypeDef hsmbus;
(#)Initialize the SMBUS low level resources by implementing the HAL_SMBUS_MspInit() API: (#)Initialize the SMBUS low level resources by implementing the HAL_SMBUS_MspInit() API:
(++) Enable the SMBUSx interface clock with __HAL_RCC_I2Cx_CLK_ENABLE() (##) Enable the SMBUSx interface clock
(++) SMBUS pins configuration (##) SMBUS pins configuration
(+++) Enable the clock for the SMBUS GPIOs (+++) Enable the clock for the SMBUS GPIOs
(+++) Configure SMBUS pins as alternate function open-drain (+++) Configure SMBUS pins as alternate function open-drain
(++) NVIC configuration if you need to use interrupt process (##) NVIC configuration if you need to use interrupt process
(+++) Configure the SMBUSx interrupt priority (+++) Configure the SMBUSx interrupt priority
(+++) Enable the NVIC SMBUS IRQ Channel (+++) Enable the NVIC SMBUS IRQ Channel
(#) Configure the Communication Clock Timing, Bus Timeout, Own Address1, Master Addressing Mode, (#) Configure the Communication Clock Timing, Bus Timeout, Own Address1, Master Addressing mode,
Dual Addressing mode, Own Address2, Own Address2 Mask, General call, Nostretch mode, Dual Addressing mode, Own Address2, Own Address2 Mask, General call, Nostretch mode,
Peripheral mode and Packet Error Check mode in the hsmbus Init structure. Peripheral mode and Packet Error Check mode in the hsmbus Init structure.
@ -41,7 +41,7 @@
(#) To check if target device is ready for communication, use the function HAL_SMBUS_IsDeviceReady() (#) To check if target device is ready for communication, use the function HAL_SMBUS_IsDeviceReady()
(#) For SMBUS IO operations, only one mode of operations is available within this driver : (#) For SMBUS IO operations, only one mode of operations is available within this driver
*** Interrupt mode IO operation *** *** Interrupt mode IO operation ***
=================================== ===================================
@ -84,10 +84,10 @@
(+) __HAL_SMBUS_ENABLE: Enable the SMBUS peripheral (+) __HAL_SMBUS_ENABLE: Enable the SMBUS peripheral
(+) __HAL_SMBUS_DISABLE: Disable the SMBUS peripheral (+) __HAL_SMBUS_DISABLE: Disable the SMBUS peripheral
(+) __HAL_SMBUS_GET_FLAG : Checks whether the specified SMBUS flag is set or not (+) __HAL_SMBUS_GET_FLAG: Check whether the specified SMBUS flag is set or not
(+) __HAL_SMBUS_CLEAR_FLAG : Clears the specified SMBUS pending flag (+) __HAL_SMBUS_CLEAR_FLAG: Clear the specified SMBUS pending flag
(+) __HAL_SMBUS_ENABLE_IT: Enables the specified SMBUS interrupt (+) __HAL_SMBUS_ENABLE_IT: Enable the specified SMBUS interrupt
(+) __HAL_SMBUS_DISABLE_IT: Disables the specified SMBUS interrupt (+) __HAL_SMBUS_DISABLE_IT: Disable the specified SMBUS interrupt
[..] [..]
(@) You can refer to the SMBUS HAL driver header file for more useful macros (@) You can refer to the SMBUS HAL driver header file for more useful macros
@ -97,7 +97,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -143,15 +143,15 @@
/** @defgroup SMBUS_Private_Define SMBUS Private Constants /** @defgroup SMBUS_Private_Define SMBUS Private Constants
* @{ * @{
*/ */
#define TIMING_CLEAR_MASK ((uint32_t)0xF0FFFFFF) /*<! SMBUS TIMING clear register Mask */ #define TIMING_CLEAR_MASK ((uint32_t)0xF0FFFFFFU) /*!< SMBUS TIMING clear register Mask */
#define HAL_TIMEOUT_ADDR ((uint32_t)10000) /* 10 s */ #define HAL_TIMEOUT_ADDR ((uint32_t)10000) /*!< 10 s */
#define HAL_TIMEOUT_BUSY ((uint32_t)25) /* 25 ms */ #define HAL_TIMEOUT_BUSY ((uint32_t)25) /*!< 25 ms */
#define HAL_TIMEOUT_DIR ((uint32_t)25) /* 25 ms */ #define HAL_TIMEOUT_DIR ((uint32_t)25) /*!< 25 ms */
#define HAL_TIMEOUT_RXNE ((uint32_t)25) /* 25 ms */ #define HAL_TIMEOUT_RXNE ((uint32_t)25) /*!< 25 ms */
#define HAL_TIMEOUT_STOPF ((uint32_t)25) /* 25 ms */ #define HAL_TIMEOUT_STOPF ((uint32_t)25) /*!< 25 ms */
#define HAL_TIMEOUT_TC ((uint32_t)25) /* 25 ms */ #define HAL_TIMEOUT_TC ((uint32_t)25) /*!< 25 ms */
#define HAL_TIMEOUT_TCR ((uint32_t)25) /* 25 ms */ #define HAL_TIMEOUT_TCR ((uint32_t)25) /*!< 25 ms */
#define HAL_TIMEOUT_TXIS ((uint32_t)25) /* 25 ms */ #define HAL_TIMEOUT_TXIS ((uint32_t)25) /*!< 25 ms */
#define MAX_NBYTE_SIZE 255 #define MAX_NBYTE_SIZE 255
/** /**
* @} * @}
@ -189,7 +189,7 @@ static void SMBUS_TransferConfig(SMBUS_HandleTypeDef *hsmbus, uint16_t DevAddre
##### Initialization and de-initialization functions ##### ##### Initialization and de-initialization functions #####
=============================================================================== ===============================================================================
[..] This subsection provides a set of functions allowing to initialize and [..] This subsection provides a set of functions allowing to initialize and
de-initialize the SMBUSx peripheral: deinitialize the SMBUSx peripheral:
(+) User must Implement HAL_SMBUS_MspInit() function in which he configures (+) User must Implement HAL_SMBUS_MspInit() function in which he configures
all related peripherals resources (CLOCK, GPIO, IT and NVIC ). all related peripherals resources (CLOCK, GPIO, IT and NVIC ).
@ -220,7 +220,7 @@ static void SMBUS_TransferConfig(SMBUS_HandleTypeDef *hsmbus, uint16_t DevAddre
/** /**
* @brief Initialize the SMBUS according to the specified parameters * @brief Initialize the SMBUS according to the specified parameters
* in the SMBUS_InitTypeDef and initialize the associated handle. * in the SMBUS_InitTypeDef and initialize the associated handle.
* @param hsmbus : Pointer to a SMBUS_HandleTypeDef structure that contains * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
* the configuration information for the specified SMBUS. * the configuration information for the specified SMBUS.
* @retval HAL status * @retval HAL status
*/ */
@ -322,7 +322,7 @@ HAL_StatusTypeDef HAL_SMBUS_Init(SMBUS_HandleTypeDef *hsmbus)
/** /**
* @brief DeInitialize the SMBUS peripheral. * @brief DeInitialize the SMBUS peripheral.
* @param hsmbus : Pointer to a SMBUS_HandleTypeDef structure that contains * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
* the configuration information for the specified SMBUS. * the configuration information for the specified SMBUS.
* @retval HAL status * @retval HAL status
*/ */
@ -357,12 +357,15 @@ HAL_StatusTypeDef HAL_SMBUS_DeInit(SMBUS_HandleTypeDef *hsmbus)
/** /**
* @brief Initialize the SMBUS MSP. * @brief Initialize the SMBUS MSP.
* @param hsmbus : Pointer to a SMBUS_HandleTypeDef structure that contains * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
* the configuration information for the specified SMBUS. * the configuration information for the specified SMBUS.
* @retval None * @retval None
*/ */
__weak void HAL_SMBUS_MspInit(SMBUS_HandleTypeDef *hsmbus) __weak void HAL_SMBUS_MspInit(SMBUS_HandleTypeDef *hsmbus)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hsmbus);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_SMBUS_MspInit could be implemented in the user file the HAL_SMBUS_MspInit could be implemented in the user file
*/ */
@ -370,12 +373,15 @@ HAL_StatusTypeDef HAL_SMBUS_DeInit(SMBUS_HandleTypeDef *hsmbus)
/** /**
* @brief DeInitialize the SMBUS MSP. * @brief DeInitialize the SMBUS MSP.
* @param hsmbus : Pointer to a SMBUS_HandleTypeDef structure that contains * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
* the configuration information for the specified SMBUS. * the configuration information for the specified SMBUS.
* @retval None * @retval None
*/ */
__weak void HAL_SMBUS_MspDeInit(SMBUS_HandleTypeDef *hsmbus) __weak void HAL_SMBUS_MspDeInit(SMBUS_HandleTypeDef *hsmbus)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hsmbus);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_SMBUS_MspDeInit could be implemented in the user file the HAL_SMBUS_MspDeInit could be implemented in the user file
*/ */
@ -400,12 +406,12 @@ HAL_StatusTypeDef HAL_SMBUS_DeInit(SMBUS_HandleTypeDef *hsmbus)
(++) HAL_SMBUS_IsDeviceReady() (++) HAL_SMBUS_IsDeviceReady()
(#) There is only one mode of transfer: (#) There is only one mode of transfer:
(++) No-Blocking mode : The communication is performed using Interrupts. (++) Non-Blocking mode : The communication is performed using Interrupts.
These functions return the status of the transfer startup. These functions return the status of the transfer startup.
The end of the data processing will be indicated through the The end of the data processing will be indicated through the
dedicated SMBUS IRQ when using Interrupt mode. dedicated SMBUS IRQ when using Interrupt mode.
(#) No-Blocking mode functions with Interrupt are : (#) Non-Blocking mode functions with Interrupt are :
(++) HAL_SMBUS_Master_Transmit_IT() (++) HAL_SMBUS_Master_Transmit_IT()
(++) HAL_SMBUS_Master_Receive_IT() (++) HAL_SMBUS_Master_Receive_IT()
(++) HAL_SMBUS_Slave_Transmit_IT() (++) HAL_SMBUS_Slave_Transmit_IT()
@ -415,7 +421,7 @@ HAL_StatusTypeDef HAL_SMBUS_DeInit(SMBUS_HandleTypeDef *hsmbus)
(++) HAL_SMBUS_EnableAlert_IT() (++) HAL_SMBUS_EnableAlert_IT()
(++) HAL_SMBUS_DisableAlert_IT() (++) HAL_SMBUS_DisableAlert_IT()
(#) A set of Transfer Complete Callbacks are provided in No_Blocking mode: (#) A set of Transfer Complete Callbacks are provided in non-Blocking mode:
(++) HAL_SMBUS_MasterTxCpltCallback() (++) HAL_SMBUS_MasterTxCpltCallback()
(++) HAL_SMBUS_MasterRxCpltCallback() (++) HAL_SMBUS_MasterRxCpltCallback()
(++) HAL_SMBUS_SlaveTxCpltCallback() (++) HAL_SMBUS_SlaveTxCpltCallback()
@ -430,12 +436,12 @@ HAL_StatusTypeDef HAL_SMBUS_DeInit(SMBUS_HandleTypeDef *hsmbus)
/** /**
* @brief Transmit in master/host SMBUS mode an amount of data in non-blocking mode with Interrupt. * @brief Transmit in master/host SMBUS mode an amount of data in non-blocking mode with Interrupt.
* @param hsmbus : Pointer to a SMBUS_HandleTypeDef structure that contains * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
* the configuration information for the specified SMBUS. * the configuration information for the specified SMBUS.
* @param DevAddress: Target device address * @param DevAddress Target device address
* @param pData: Pointer to data buffer * @param pData Pointer to data buffer
* @param Size: Amount of data to be sent * @param Size Amount of data to be sent
* @param XferOptions: Options of Transfer, value of @ref SMBUS_XferOptions_definition * @param XferOptions Options of Transfer, value of @ref SMBUS_XferOptions_definition
* @retval HAL status * @retval HAL status
*/ */
HAL_StatusTypeDef HAL_SMBUS_Master_Transmit_IT(SMBUS_HandleTypeDef *hsmbus, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t XferOptions) HAL_StatusTypeDef HAL_SMBUS_Master_Transmit_IT(SMBUS_HandleTypeDef *hsmbus, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t XferOptions)
@ -518,12 +524,12 @@ HAL_StatusTypeDef HAL_SMBUS_Master_Transmit_IT(SMBUS_HandleTypeDef *hsmbus, uint
/** /**
* @brief Receive in master/host SMBUS mode an amount of data in non-blocking mode with Interrupt. * @brief Receive in master/host SMBUS mode an amount of data in non-blocking mode with Interrupt.
* @param hsmbus : Pointer to a SMBUS_HandleTypeDef structure that contains * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
* the configuration information for the specified SMBUS. * the configuration information for the specified SMBUS.
* @param DevAddress: Target device address * @param DevAddress Target device address
* @param pData: Pointer to data buffer * @param pData Pointer to data buffer
* @param Size: Amount of data to be sent * @param Size Amount of data to be sent
* @param XferOptions: Options of Transfer, value of @ref SMBUS_XferOptions_definition * @param XferOptions Options of Transfer, value of @ref SMBUS_XferOptions_definition
* @retval HAL status * @retval HAL status
*/ */
HAL_StatusTypeDef HAL_SMBUS_Master_Receive_IT(SMBUS_HandleTypeDef *hsmbus, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t XferOptions) HAL_StatusTypeDef HAL_SMBUS_Master_Receive_IT(SMBUS_HandleTypeDef *hsmbus, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t XferOptions)
@ -600,9 +606,9 @@ HAL_StatusTypeDef HAL_SMBUS_Master_Receive_IT(SMBUS_HandleTypeDef *hsmbus, uint1
/** /**
* @brief Abort a master/host SMBUS process communication with Interrupt. * @brief Abort a master/host SMBUS process communication with Interrupt.
* @note This abort can be called only if state is ready * @note This abort can be called only if state is ready
* @param hsmbus : Pointer to a SMBUS_HandleTypeDef structure that contains * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
* the configuration information for the specified SMBUS. * the configuration information for the specified SMBUS.
* @param DevAddress: Target device address * @param DevAddress Target device address
* @retval HAL status * @retval HAL status
*/ */
HAL_StatusTypeDef HAL_SMBUS_Master_Abort_IT(SMBUS_HandleTypeDef *hsmbus, uint16_t DevAddress) HAL_StatusTypeDef HAL_SMBUS_Master_Abort_IT(SMBUS_HandleTypeDef *hsmbus, uint16_t DevAddress)
@ -659,11 +665,11 @@ HAL_StatusTypeDef HAL_SMBUS_Master_Abort_IT(SMBUS_HandleTypeDef *hsmbus, uint16_
/** /**
* @brief Transmit in slave/device SMBUS mode an amount of data in non-blocking mode with Interrupt. * @brief Transmit in slave/device SMBUS mode an amount of data in non-blocking mode with Interrupt.
* @param hsmbus : Pointer to a SMBUS_HandleTypeDef structure that contains * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
* the configuration information for the specified SMBUS. * the configuration information for the specified SMBUS.
* @param pData: Pointer to data buffer * @param pData Pointer to data buffer
* @param Size: Amount of data to be sent * @param Size Amount of data to be sent
* @param XferOptions: Options of Transfer, value of @ref SMBUS_XferOptions_definition * @param XferOptions Options of Transfer, value of @ref SMBUS_XferOptions_definition
* @retval HAL status * @retval HAL status
*/ */
HAL_StatusTypeDef HAL_SMBUS_Slave_Transmit_IT(SMBUS_HandleTypeDef *hsmbus, uint8_t *pData, uint16_t Size, uint32_t XferOptions) HAL_StatusTypeDef HAL_SMBUS_Slave_Transmit_IT(SMBUS_HandleTypeDef *hsmbus, uint8_t *pData, uint16_t Size, uint32_t XferOptions)
@ -750,11 +756,11 @@ HAL_StatusTypeDef HAL_SMBUS_Slave_Transmit_IT(SMBUS_HandleTypeDef *hsmbus, uint8
/** /**
* @brief Receive in slave/device SMBUS mode an amount of data in non-blocking mode with Interrupt. * @brief Receive in slave/device SMBUS mode an amount of data in non-blocking mode with Interrupt.
* @param hsmbus : Pointer to a SMBUS_HandleTypeDef structure that contains * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
* the configuration information for the specified SMBUS. * the configuration information for the specified SMBUS.
* @param pData: Pointer to data buffer * @param pData Pointer to data buffer
* @param Size: Amount of data to be sent * @param Size Amount of data to be sent
* @param XferOptions: Options of Transfer, value of @ref SMBUS_XferOptions_definition * @param XferOptions Options of Transfer, value of @ref SMBUS_XferOptions_definition
* @retval HAL status * @retval HAL status
*/ */
HAL_StatusTypeDef HAL_SMBUS_Slave_Receive_IT(SMBUS_HandleTypeDef *hsmbus, uint8_t *pData, uint16_t Size, uint32_t XferOptions) HAL_StatusTypeDef HAL_SMBUS_Slave_Receive_IT(SMBUS_HandleTypeDef *hsmbus, uint8_t *pData, uint16_t Size, uint32_t XferOptions)
@ -827,7 +833,7 @@ HAL_StatusTypeDef HAL_SMBUS_Slave_Receive_IT(SMBUS_HandleTypeDef *hsmbus, uint8_
/** /**
* @brief Enable the Address listen mode with Interrupt. * @brief Enable the Address listen mode with Interrupt.
* @param hsmbus : Pointer to a SMBUS_HandleTypeDef structure that contains * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
* the configuration information for the specified SMBUS. * the configuration information for the specified SMBUS.
* @retval HAL status * @retval HAL status
*/ */
@ -843,7 +849,7 @@ HAL_StatusTypeDef HAL_SMBUS_EnableListen_IT(SMBUS_HandleTypeDef *hsmbus)
/** /**
* @brief Disable the Address listen mode with Interrupt. * @brief Disable the Address listen mode with Interrupt.
* @param hsmbus : Pointer to a SMBUS_HandleTypeDef structure that contains * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
* the configuration information for the specified SMBUS. * the configuration information for the specified SMBUS.
* @retval HAL status * @retval HAL status
*/ */
@ -867,7 +873,7 @@ HAL_StatusTypeDef HAL_SMBUS_DisableListen_IT(SMBUS_HandleTypeDef *hsmbus)
/** /**
* @brief Enable the SMBUS alert mode with Interrupt. * @brief Enable the SMBUS alert mode with Interrupt.
* @param hsmbus : pointer to a SMBUS_HandleTypeDef structure that contains * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
* the configuration information for the specified SMBUSx peripheral. * the configuration information for the specified SMBUSx peripheral.
* @retval HAL status * @retval HAL status
*/ */
@ -886,7 +892,7 @@ HAL_StatusTypeDef HAL_SMBUS_EnableAlert_IT(SMBUS_HandleTypeDef *hsmbus)
} }
/** /**
* @brief Disable the SMBUS alert mode with Interrupt. * @brief Disable the SMBUS alert mode with Interrupt.
* @param hsmbus : pointer to a SMBUS_HandleTypeDef structure that contains * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
* the configuration information for the specified SMBUSx peripheral. * the configuration information for the specified SMBUSx peripheral.
* @retval HAL status * @retval HAL status
*/ */
@ -903,12 +909,11 @@ HAL_StatusTypeDef HAL_SMBUS_DisableAlert_IT(SMBUS_HandleTypeDef *hsmbus)
/** /**
* @brief Check if target device is ready for communication. * @brief Check if target device is ready for communication.
* @note This function is used with Memory devices * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
* @param hsmbus : Pointer to a SMBUS_HandleTypeDef structure that contains
* the configuration information for the specified SMBUS. * the configuration information for the specified SMBUS.
* @param DevAddress: Target device address * @param DevAddress Target device address
* @param Trials: Number of trials * @param Trials Number of trials
* @param Timeout: Timeout duration * @param Timeout Timeout duration
* @retval HAL status * @retval HAL status
*/ */
HAL_StatusTypeDef HAL_SMBUS_IsDeviceReady(SMBUS_HandleTypeDef *hsmbus, uint16_t DevAddress, uint32_t Trials, uint32_t Timeout) HAL_StatusTypeDef HAL_SMBUS_IsDeviceReady(SMBUS_HandleTypeDef *hsmbus, uint16_t DevAddress, uint32_t Trials, uint32_t Timeout)
@ -1028,7 +1033,7 @@ HAL_StatusTypeDef HAL_SMBUS_IsDeviceReady(SMBUS_HandleTypeDef *hsmbus, uint16_t
/** /**
* @brief Handle SMBUS event interrupt request. * @brief Handle SMBUS event interrupt request.
* @param hsmbus : Pointer to a SMBUS_HandleTypeDef structure that contains * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
* the configuration information for the specified SMBUS. * the configuration information for the specified SMBUS.
* @retval None * @retval None
*/ */
@ -1083,7 +1088,7 @@ void HAL_SMBUS_EV_IRQHandler(SMBUS_HandleTypeDef *hsmbus)
/** /**
* @brief Handle SMBUS error interrupt request. * @brief Handle SMBUS error interrupt request.
* @param hsmbus : Pointer to a SMBUS_HandleTypeDef structure that contains * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
* the configuration information for the specified SMBUS. * the configuration information for the specified SMBUS.
* @retval None * @retval None
*/ */
@ -1143,7 +1148,7 @@ void HAL_SMBUS_ER_IRQHandler(SMBUS_HandleTypeDef *hsmbus)
__HAL_SMBUS_CLEAR_FLAG(hsmbus, SMBUS_FLAG_PECERR); __HAL_SMBUS_CLEAR_FLAG(hsmbus, SMBUS_FLAG_PECERR);
} }
/* Call the Error Callback() in case of Error detected */ /* Call the Error Callback in case of Error detected */
if((hsmbus->ErrorCode != HAL_SMBUS_ERROR_NONE)&&(hsmbus->ErrorCode != HAL_SMBUS_ERROR_ACKF)) if((hsmbus->ErrorCode != HAL_SMBUS_ERROR_NONE)&&(hsmbus->ErrorCode != HAL_SMBUS_ERROR_ACKF))
{ {
/* Do not Reset the HAL state in case of ALERT error */ /* Do not Reset the HAL state in case of ALERT error */
@ -1166,12 +1171,15 @@ void HAL_SMBUS_ER_IRQHandler(SMBUS_HandleTypeDef *hsmbus)
/** /**
* @brief Master Tx Transfer completed callback. * @brief Master Tx Transfer completed callback.
* @param hsmbus : Pointer to a SMBUS_HandleTypeDef structure that contains * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
* the configuration information for the specified SMBUS. * the configuration information for the specified SMBUS.
* @retval None * @retval None
*/ */
__weak void HAL_SMBUS_MasterTxCpltCallback(SMBUS_HandleTypeDef *hsmbus) __weak void HAL_SMBUS_MasterTxCpltCallback(SMBUS_HandleTypeDef *hsmbus)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hsmbus);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_SMBUS_TxCpltCallback() could be implemented in the user file the HAL_SMBUS_TxCpltCallback() could be implemented in the user file
*/ */
@ -1179,24 +1187,30 @@ void HAL_SMBUS_ER_IRQHandler(SMBUS_HandleTypeDef *hsmbus)
/** /**
* @brief Master Rx Transfer completed callback. * @brief Master Rx Transfer completed callback.
* @param hsmbus : Pointer to a SMBUS_HandleTypeDef structure that contains * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
* the configuration information for the specified SMBUS. * the configuration information for the specified SMBUS.
* @retval None * @retval None
*/ */
__weak void HAL_SMBUS_MasterRxCpltCallback(SMBUS_HandleTypeDef *hsmbus) __weak void HAL_SMBUS_MasterRxCpltCallback(SMBUS_HandleTypeDef *hsmbus)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hsmbus);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_SMBUS_TxCpltCallback() could be implemented in the user file the HAL_SMBUS_TxCpltCallback() could be implemented in the user file
*/ */
} }
/** @brief Slave Tx Transfer completed callback. /** @brief Slave Tx Transfer completed callback.
* @param hsmbus : Pointer to a SMBUS_HandleTypeDef structure that contains * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
* the configuration information for the specified SMBUS. * the configuration information for the specified SMBUS.
* @retval None * @retval None
*/ */
__weak void HAL_SMBUS_SlaveTxCpltCallback(SMBUS_HandleTypeDef *hsmbus) __weak void HAL_SMBUS_SlaveTxCpltCallback(SMBUS_HandleTypeDef *hsmbus)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hsmbus);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_SMBUS_TxCpltCallback() could be implemented in the user file the HAL_SMBUS_TxCpltCallback() could be implemented in the user file
*/ */
@ -1204,12 +1218,15 @@ __weak void HAL_SMBUS_MasterRxCpltCallback(SMBUS_HandleTypeDef *hsmbus)
/** /**
* @brief Slave Rx Transfer completed callback. * @brief Slave Rx Transfer completed callback.
* @param hsmbus : Pointer to a SMBUS_HandleTypeDef structure that contains * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
* the configuration information for the specified SMBUS. * the configuration information for the specified SMBUS.
* @retval None * @retval None
*/ */
__weak void HAL_SMBUS_SlaveRxCpltCallback(SMBUS_HandleTypeDef *hsmbus) __weak void HAL_SMBUS_SlaveRxCpltCallback(SMBUS_HandleTypeDef *hsmbus)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hsmbus);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_SMBUS_TxCpltCallback() could be implemented in the user file the HAL_SMBUS_TxCpltCallback() could be implemented in the user file
*/ */
@ -1217,7 +1234,7 @@ __weak void HAL_SMBUS_SlaveRxCpltCallback(SMBUS_HandleTypeDef *hsmbus)
/** /**
* @brief Slave Address Match callback. * @brief Slave Address Match callback.
* @param hsmbus : Pointer to a SMBUS_HandleTypeDef structure that contains * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
* the configuration information for the specified SMBUS. * the configuration information for the specified SMBUS.
* @param TransferDirection: Master request Transfer Direction (Write/Read) * @param TransferDirection: Master request Transfer Direction (Write/Read)
* @param AddrMatchCode: Address Match Code * @param AddrMatchCode: Address Match Code
@ -1225,6 +1242,11 @@ __weak void HAL_SMBUS_SlaveRxCpltCallback(SMBUS_HandleTypeDef *hsmbus)
*/ */
__weak void HAL_SMBUS_AddrCallback(SMBUS_HandleTypeDef *hsmbus, uint8_t TransferDirection, uint16_t AddrMatchCode) __weak void HAL_SMBUS_AddrCallback(SMBUS_HandleTypeDef *hsmbus, uint8_t TransferDirection, uint16_t AddrMatchCode)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hsmbus);
UNUSED(TransferDirection);
UNUSED(AddrMatchCode);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_SMBUS_AddrCallback() could be implemented in the user file the HAL_SMBUS_AddrCallback() could be implemented in the user file
*/ */
@ -1232,12 +1254,15 @@ __weak void HAL_SMBUS_AddrCallback(SMBUS_HandleTypeDef *hsmbus, uint8_t Transfer
/** /**
* @brief Listen Complete callback. * @brief Listen Complete callback.
* @param hsmbus : Pointer to a SMBUS_HandleTypeDef structure that contains * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
* the configuration information for the specified SMBUS. * the configuration information for the specified SMBUS.
* @retval None * @retval None
*/ */
__weak void HAL_SMBUS_ListenCpltCallback(SMBUS_HandleTypeDef *hsmbus) __weak void HAL_SMBUS_ListenCpltCallback(SMBUS_HandleTypeDef *hsmbus)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hsmbus);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_SMBUS_ListenCpltCallback() could be implemented in the user file the HAL_SMBUS_ListenCpltCallback() could be implemented in the user file
*/ */
@ -1245,12 +1270,15 @@ __weak void HAL_SMBUS_ListenCpltCallback(SMBUS_HandleTypeDef *hsmbus)
/** /**
* @brief SMBUS error callback. * @brief SMBUS error callback.
* @param hsmbus : Pointer to a SMBUS_HandleTypeDef structure that contains * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
* the configuration information for the specified SMBUS. * the configuration information for the specified SMBUS.
* @retval None * @retval None
*/ */
__weak void HAL_SMBUS_ErrorCallback(SMBUS_HandleTypeDef *hsmbus) __weak void HAL_SMBUS_ErrorCallback(SMBUS_HandleTypeDef *hsmbus)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hsmbus);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_SMBUS_ErrorCallback() could be implemented in the user file the HAL_SMBUS_ErrorCallback() could be implemented in the user file
*/ */
@ -1268,7 +1296,7 @@ __weak void HAL_SMBUS_ListenCpltCallback(SMBUS_HandleTypeDef *hsmbus)
##### Peripheral State and Errors functions ##### ##### Peripheral State and Errors functions #####
=============================================================================== ===============================================================================
[..] [..]
This subsection permits to get in run-time the status of the peripheral This subsection permit to get in run-time the status of the peripheral
and the data flow. and the data flow.
@endverbatim @endverbatim
@ -1277,7 +1305,7 @@ __weak void HAL_SMBUS_ListenCpltCallback(SMBUS_HandleTypeDef *hsmbus)
/** /**
* @brief Return the SMBUS handle state. * @brief Return the SMBUS handle state.
* @param hsmbus : Pointer to a SMBUS_HandleTypeDef structure that contains * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
* the configuration information for the specified SMBUS. * the configuration information for the specified SMBUS.
* @retval HAL state * @retval HAL state
*/ */
@ -1289,7 +1317,7 @@ uint32_t HAL_SMBUS_GetState(SMBUS_HandleTypeDef *hsmbus)
/** /**
* @brief Return the SMBUS error code. * @brief Return the SMBUS error code.
* @param hsmbus : pointer to a SMBUS_HandleTypeDef structure that contains * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
* the configuration information for the specified SMBUS. * the configuration information for the specified SMBUS.
* @retval SMBUS Error Code * @retval SMBUS Error Code
*/ */
@ -1313,7 +1341,7 @@ uint32_t HAL_SMBUS_GetError(SMBUS_HandleTypeDef *hsmbus)
/** /**
* @brief Interrupt Sub-Routine which handle the Interrupt Flags Master Mode. * @brief Interrupt Sub-Routine which handle the Interrupt Flags Master Mode.
* @param hsmbus : Pointer to a SMBUS_HandleTypeDef structure that contains * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
* the configuration information for the specified SMBUS. * the configuration information for the specified SMBUS.
* @retval HAL status * @retval HAL status
*/ */
@ -1510,7 +1538,7 @@ static HAL_StatusTypeDef SMBUS_Master_ISR(SMBUS_HandleTypeDef *hsmbus)
} }
/** /**
* @brief Interrupt Sub-Routine which handle the Interrupt Flags Slave Mode. * @brief Interrupt Sub-Routine which handle the Interrupt Flags Slave Mode.
* @param hsmbus : Pointer to a SMBUS_HandleTypeDef structure that contains * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
* the configuration information for the specified SMBUS. * the configuration information for the specified SMBUS.
* @retval HAL status * @retval HAL status
*/ */
@ -1645,7 +1673,7 @@ static HAL_StatusTypeDef SMBUS_Slave_ISR(SMBUS_HandleTypeDef *hsmbus)
{ {
/* Write data to TXDR only if XferCount not reach "0" */ /* Write data to TXDR only if XferCount not reach "0" */
/* A TXIS flag can be set, during STOP treatment */ /* A TXIS flag can be set, during STOP treatment */
/* Check if all Data have already been sent */ /* Check if all Datas have already been sent */
/* If it is the case, this last write in TXDR is not sent, correspond to a dummy TXIS event */ /* If it is the case, this last write in TXDR is not sent, correspond to a dummy TXIS event */
if(hsmbus->XferCount > 0) if(hsmbus->XferCount > 0)
{ {
@ -1713,9 +1741,9 @@ static HAL_StatusTypeDef SMBUS_Slave_ISR(SMBUS_HandleTypeDef *hsmbus)
} }
/** /**
* @brief Manage the enabling of Interrupts. * @brief Manage the enabling of Interrupts.
* @param hsmbus : Pointer to a SMBUS_HandleTypeDef structure that contains * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
* the configuration information for the specified SMBUS. * the configuration information for the specified SMBUS.
* @param InterruptRequest : Value of @ref SMBUS_Interrupt_configuration_definition. * @param InterruptRequest Value of @ref SMBUS_Interrupt_configuration_definition.
* @retval HAL status * @retval HAL status
*/ */
static HAL_StatusTypeDef SMBUS_Enable_IRQ(SMBUS_HandleTypeDef *hsmbus, uint16_t InterruptRequest) static HAL_StatusTypeDef SMBUS_Enable_IRQ(SMBUS_HandleTypeDef *hsmbus, uint16_t InterruptRequest)
@ -1755,9 +1783,9 @@ static HAL_StatusTypeDef SMBUS_Enable_IRQ(SMBUS_HandleTypeDef *hsmbus, uint16_t
} }
/** /**
* @brief Manage the disabling of Interrupts. * @brief Manage the disabling of Interrupts.
* @param hsmbus : Pointer to a SMBUS_HandleTypeDef structure that contains * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
* the configuration information for the specified SMBUS. * the configuration information for the specified SMBUS.
* @param InterruptRequest : Value of @ref SMBUS_Interrupt_configuration_definition. * @param InterruptRequest Value of @ref SMBUS_Interrupt_configuration_definition.
* @retval HAL status * @retval HAL status
*/ */
static HAL_StatusTypeDef SMBUS_Disable_IRQ(SMBUS_HandleTypeDef *hsmbus, uint16_t InterruptRequest) static HAL_StatusTypeDef SMBUS_Disable_IRQ(SMBUS_HandleTypeDef *hsmbus, uint16_t InterruptRequest)
@ -1829,11 +1857,11 @@ static HAL_StatusTypeDef SMBUS_Disable_IRQ(SMBUS_HandleTypeDef *hsmbus, uint16_t
} }
/** /**
* @brief Handle SMBUS Communication Timeout. * @brief Handle SMBUS Communication Timeout.
* @param hsmbus : Pointer to a SMBUS_HandleTypeDef structure that contains * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
* the configuration information for the specified SMBUS. * the configuration information for the specified SMBUS.
* @param Flag: specifies the SMBUS flag to check. * @param Flag Specifies the SMBUS flag to check.
* @param Status: The new Flag status (SET or RESET). * @param Status The new Flag status (SET or RESET).
* @param Timeout: Timeout duration * @param Timeout Timeout duration
* @retval HAL status * @retval HAL status
*/ */
static HAL_StatusTypeDef SMBUS_WaitOnFlagUntilTimeout(SMBUS_HandleTypeDef *hsmbus, uint32_t Flag, FlagStatus Status, uint32_t Timeout) static HAL_StatusTypeDef SMBUS_WaitOnFlagUntilTimeout(SMBUS_HandleTypeDef *hsmbus, uint32_t Flag, FlagStatus Status, uint32_t Timeout)
@ -1886,22 +1914,22 @@ static HAL_StatusTypeDef SMBUS_WaitOnFlagUntilTimeout(SMBUS_HandleTypeDef *hsmbu
/** /**
* @brief Handle SMBUSx communication when starting transfer or during transfer (TC or TCR flag are set). * @brief Handle SMBUSx communication when starting transfer or during transfer (TC or TCR flag are set).
* @param hsmbus: SMBUS handle. * @param hsmbus SMBUS handle.
* @param DevAddress: specifies the slave address to be programmed. * @param DevAddress specifies the slave address to be programmed.
* @param Size: specifies the number of bytes to be programmed. * @param Size specifies the number of bytes to be programmed.
* This parameter must be a value between 0 and 255. * This parameter must be a value between 0 and 255.
* @param Mode: new state of the SMBUS START condition generation. * @param Mode New state of the SMBUS START condition generation.
* This parameter can be one or a combination of the following values: * This parameter can be one or a combination of the following values:
* @arg SMBUS_NO_MODE: No specific mode enabled. * @arg @ref SMBUS_RELOAD_MODE Enable Reload mode.
* @arg SMBUS_RELOAD_MODE: Enable Reload mode. * @arg @ref SMBUS_AUTOEND_MODE Enable Automatic end mode.
* @arg SMBUS_AUTOEND_MODE: Enable Automatic end mode. * @arg @ref SMBUS_SOFTEND_MODE Enable Software end mode and Reload mode.
* @arg SMBUS_SOFTEND_MODE: Enable Software end mode and Reload mode. * @arg @ref SMBUS_SENDPEC_MODE Enable Packet Error Calculation mode.
* @param Request: new state of the SMBUS START condition generation. * @param Request New state of the SMBUS START condition generation.
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg SMBUS_NO_STARTSTOP: Don't Generate stop and start condition. * @arg @ref SMBUS_NO_STARTSTOP Don't Generate stop and start condition.
* @arg SMBUS_GENERATE_STOP: Generate stop condition (Size should be set to 0). * @arg @ref SMBUS_GENERATE_STOP Generate stop condition (Size should be set to 0).
* @arg SMBUS_GENERATE_START_READ: Generate Restart for read request. * @arg @ref SMBUS_GENERATE_START_READ Generate Restart for read request.
* @arg SMBUS_GENERATE_START_WRITE: Generate Restart for write request. * @arg @ref SMBUS_GENERATE_START_WRITE Generate Restart for write request.
* @retval None * @retval None
*/ */
static void SMBUS_TransferConfig(SMBUS_HandleTypeDef *hsmbus, uint16_t DevAddress, uint8_t Size, uint32_t Mode, uint32_t Request) static void SMBUS_TransferConfig(SMBUS_HandleTypeDef *hsmbus, uint16_t DevAddress, uint8_t Size, uint32_t Mode, uint32_t Request)

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_smbus.h * @file stm32f0xx_hal_smbus.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of SMBUS HAL module. * @brief Header file of SMBUS HAL module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -360,79 +360,79 @@ typedef struct
*/ */
/** @brief Reset SMBUS handle state. /** @brief Reset SMBUS handle state.
* @param __HANDLE__: specifies the SMBUS Handle. * @param __HANDLE__ specifies the SMBUS Handle.
* @retval None * @retval None
*/ */
#define __HAL_SMBUS_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SMBUS_STATE_RESET) #define __HAL_SMBUS_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SMBUS_STATE_RESET)
/** @brief Enable the specified SMBUS interrupts. /** @brief Enable the specified SMBUS interrupts.
* @param __HANDLE__: specifies the SMBUS Handle. * @param __HANDLE__ specifies the SMBUS Handle.
* @param __INTERRUPT__: specifies the interrupt source to enable. * @param __INTERRUPT__ specifies the interrupt source to enable.
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg SMBUS_IT_ERRI: Errors interrupt enable * @arg @ref SMBUS_IT_ERRI Errors interrupt enable
* @arg SMBUS_IT_TCI: Transfer complete interrupt enable * @arg @ref SMBUS_IT_TCI Transfer complete interrupt enable
* @arg SMBUS_IT_STOPI: STOP detection interrupt enable * @arg @ref SMBUS_IT_STOPI STOP detection interrupt enable
* @arg SMBUS_IT_NACKI: NACK received interrupt enable * @arg @ref SMBUS_IT_NACKI NACK received interrupt enable
* @arg SMBUS_IT_ADDRI: Address match interrupt enable * @arg @ref SMBUS_IT_ADDRI Address match interrupt enable
* @arg SMBUS_IT_RXI: RX interrupt enable * @arg @ref SMBUS_IT_RXI RX interrupt enable
* @arg SMBUS_IT_TXI: TX interrupt enable * @arg @ref SMBUS_IT_TXI TX interrupt enable
* *
* @retval None * @retval None
*/ */
#define __HAL_SMBUS_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR1 |= (__INTERRUPT__)) #define __HAL_SMBUS_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR1 |= (__INTERRUPT__))
/** @brief Disable the specified SMBUS interrupts. /** @brief Disable the specified SMBUS interrupts.
* @param __HANDLE__: specifies the SMBUS Handle. * @param __HANDLE__ specifies the SMBUS Handle.
* @param __INTERRUPT__: specifies the interrupt source to disable. * @param __INTERRUPT__ specifies the interrupt source to disable.
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg SMBUS_IT_ERRI: Errors interrupt enable * @arg @ref SMBUS_IT_ERRI Errors interrupt enable
* @arg SMBUS_IT_TCI: Transfer complete interrupt enable * @arg @ref SMBUS_IT_TCI Transfer complete interrupt enable
* @arg SMBUS_IT_STOPI: STOP detection interrupt enable * @arg @ref SMBUS_IT_STOPI STOP detection interrupt enable
* @arg SMBUS_IT_NACKI: NACK received interrupt enable * @arg @ref SMBUS_IT_NACKI NACK received interrupt enable
* @arg SMBUS_IT_ADDRI: Address match interrupt enable * @arg @ref SMBUS_IT_ADDRI Address match interrupt enable
* @arg SMBUS_IT_RXI: RX interrupt enable * @arg @ref SMBUS_IT_RXI RX interrupt enable
* @arg SMBUS_IT_TXI: TX interrupt enable * @arg @ref SMBUS_IT_TXI TX interrupt enable
* *
* @retval None * @retval None
*/ */
#define __HAL_SMBUS_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR1 &= (~(__INTERRUPT__))) #define __HAL_SMBUS_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR1 &= (~(__INTERRUPT__)))
/** @brief Check whether the specified SMBUS interrupt source is enabled or not. /** @brief Check whether the specified SMBUS interrupt source is enabled or not.
* @param __HANDLE__: specifies the SMBUS Handle. * @param __HANDLE__ specifies the SMBUS Handle.
* @param __INTERRUPT__: specifies the SMBUS interrupt source to check. * @param __INTERRUPT__ specifies the SMBUS interrupt source to check.
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg SMBUS_IT_ERRI: Errors interrupt enable * @arg @ref SMBUS_IT_ERRI Errors interrupt enable
* @arg SMBUS_IT_TCI: Transfer complete interrupt enable * @arg @ref SMBUS_IT_TCI Transfer complete interrupt enable
* @arg SMBUS_IT_STOPI: STOP detection interrupt enable * @arg @ref SMBUS_IT_STOPI STOP detection interrupt enable
* @arg SMBUS_IT_NACKI: NACK received interrupt enable * @arg @ref SMBUS_IT_NACKI NACK received interrupt enable
* @arg SMBUS_IT_ADDRI: Address match interrupt enable * @arg @ref SMBUS_IT_ADDRI Address match interrupt enable
* @arg SMBUS_IT_RXI: RX interrupt enable * @arg @ref SMBUS_IT_RXI RX interrupt enable
* @arg SMBUS_IT_TXI: TX interrupt enable * @arg @ref SMBUS_IT_TXI TX interrupt enable
* *
* @retval The new state of __IT__ (TRUE or FALSE). * @retval The new state of __IT__ (TRUE or FALSE).
*/ */
#define __HAL_SMBUS_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->CR1 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET) #define __HAL_SMBUS_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->CR1 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
/** @brief Check whether the specified SMBUS flag is set or not. /** @brief Check whether the specified SMBUS flag is set or not.
* @param __HANDLE__: specifies the SMBUS Handle. * @param __HANDLE__ specifies the SMBUS Handle.
* @param __FLAG__: specifies the flag to check. * @param __FLAG__ specifies the flag to check.
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg SMBUS_FLAG_TXE: Transmit data register empty * @arg @ref SMBUS_FLAG_TXE Transmit data register empty
* @arg SMBUS_FLAG_TXIS: Transmit interrupt status * @arg @ref SMBUS_FLAG_TXIS Transmit interrupt status
* @arg SMBUS_FLAG_RXNE: Receive data register not empty * @arg @ref SMBUS_FLAG_RXNE Receive data register not empty
* @arg SMBUS_FLAG_ADDR: Address matched (slave mode) * @arg @ref SMBUS_FLAG_ADDR Address matched (slave mode)
* @arg SMBUS_FLAG_AF: NACK received flag * @arg @ref SMBUS_FLAG_AF NACK received flag
* @arg SMBUS_FLAG_STOPF: STOP detection flag * @arg @ref SMBUS_FLAG_STOPF STOP detection flag
* @arg SMBUS_FLAG_TC: Transfer complete (master mode) * @arg @ref SMBUS_FLAG_TC Transfer complete (master mode)
* @arg SMBUS_FLAG_TCR: Transfer complete reload * @arg @ref SMBUS_FLAG_TCR Transfer complete reload
* @arg SMBUS_FLAG_BERR: Bus error * @arg @ref SMBUS_FLAG_BERR Bus error
* @arg SMBUS_FLAG_ARLO: Arbitration lost * @arg @ref SMBUS_FLAG_ARLO Arbitration lost
* @arg SMBUS_FLAG_OVR: Overrun/Underrun * @arg @ref SMBUS_FLAG_OVR Overrun/Underrun
* @arg SMBUS_FLAG_PECERR: PEC error in reception * @arg @ref SMBUS_FLAG_PECERR PEC error in reception
* @arg SMBUS_FLAG_TIMEOUT: Timeout or Tlow detection flag * @arg @ref SMBUS_FLAG_TIMEOUT Timeout or Tlow detection flag
* @arg SMBUS_FLAG_ALERT: SMBus alert * @arg @ref SMBUS_FLAG_ALERT SMBus alert
* @arg SMBUS_FLAG_BUSY: Bus busy * @arg @ref SMBUS_FLAG_BUSY Bus busy
* @arg SMBUS_FLAG_DIR: Transfer direction (slave mode) * @arg @ref SMBUS_FLAG_DIR Transfer direction (slave mode)
* *
* @retval The new state of __FLAG__ (TRUE or FALSE). * @retval The new state of __FLAG__ (TRUE or FALSE).
*/ */
@ -440,37 +440,37 @@ typedef struct
#define __HAL_SMBUS_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & ((__FLAG__) & SMBUS_FLAG_MASK)) == ((__FLAG__) & SMBUS_FLAG_MASK))) #define __HAL_SMBUS_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & ((__FLAG__) & SMBUS_FLAG_MASK)) == ((__FLAG__) & SMBUS_FLAG_MASK)))
/** @brief Clear the SMBUS pending flags which are cleared by writing 1 in a specific bit. /** @brief Clear the SMBUS pending flags which are cleared by writing 1 in a specific bit.
* @param __HANDLE__: specifies the SMBUS Handle. * @param __HANDLE__ specifies the SMBUS Handle.
* @param __FLAG__: specifies the flag to clear. * @param __FLAG__ specifies the flag to clear.
* This parameter can be any combination of the following values: * This parameter can be any combination of the following values:
* @arg SMBUS_FLAG_ADDR: Address matched (slave mode) * @arg @ref SMBUS_FLAG_ADDR Address matched (slave mode)
* @arg SMBUS_FLAG_AF: NACK received flag * @arg @ref SMBUS_FLAG_AF NACK received flag
* @arg SMBUS_FLAG_STOPF: STOP detection flag * @arg @ref SMBUS_FLAG_STOPF STOP detection flag
* @arg SMBUS_FLAG_BERR: Bus error * @arg @ref SMBUS_FLAG_BERR Bus error
* @arg SMBUS_FLAG_ARLO: Arbitration lost * @arg @ref SMBUS_FLAG_ARLO Arbitration lost
* @arg SMBUS_FLAG_OVR: Overrun/Underrun * @arg @ref SMBUS_FLAG_OVR Overrun/Underrun
* @arg SMBUS_FLAG_PECERR: PEC error in reception * @arg @ref SMBUS_FLAG_PECERR PEC error in reception
* @arg SMBUS_FLAG_TIMEOUT: Timeout or Tlow detection flag * @arg @ref SMBUS_FLAG_TIMEOUT Timeout or Tlow detection flag
* @arg SMBUS_FLAG_ALERT: SMBus alert * @arg @ref SMBUS_FLAG_ALERT SMBus alert
* *
* @retval None * @retval None
*/ */
#define __HAL_SMBUS_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__)) #define __HAL_SMBUS_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__))
/** @brief Enable the specified SMBUS peripheral. /** @brief Enable the specified SMBUS peripheral.
* @param __HANDLE__: specifies the SMBUS Handle. * @param __HANDLE__ specifies the SMBUS Handle.
* @retval None * @retval None
*/ */
#define __HAL_SMBUS_ENABLE(__HANDLE__) (SET_BIT((__HANDLE__)->Instance->CR1, I2C_CR1_PE)) #define __HAL_SMBUS_ENABLE(__HANDLE__) (SET_BIT((__HANDLE__)->Instance->CR1, I2C_CR1_PE))
/** @brief Disable the specified SMBUS peripheral. /** @brief Disable the specified SMBUS peripheral.
* @param __HANDLE__: specifies the SMBUS Handle. * @param __HANDLE__ specifies the SMBUS Handle.
* @retval None * @retval None
*/ */
#define __HAL_SMBUS_DISABLE(__HANDLE__) (CLEAR_BIT((__HANDLE__)->Instance->CR1, I2C_CR1_PE)) #define __HAL_SMBUS_DISABLE(__HANDLE__) (CLEAR_BIT((__HANDLE__)->Instance->CR1, I2C_CR1_PE))
/** @brief Generate a Non-Acknowledge SMBUS peripheral in Slave mode. /** @brief Generate a Non-Acknowledge SMBUS peripheral in Slave mode.
* @param __HANDLE__: specifies the SMBUS Handle. * @param __HANDLE__ specifies the SMBUS Handle.
* @retval None * @retval None
*/ */
#define __HAL_SMBUS_GENERATE_NACK(__HANDLE__) (SET_BIT((__HANDLE__)->Instance->CR2, I2C_CR2_NACK)) #define __HAL_SMBUS_GENERATE_NACK(__HANDLE__) (SET_BIT((__HANDLE__)->Instance->CR2, I2C_CR2_NACK))
@ -566,7 +566,7 @@ typedef struct
/** @defgroup SMBUS_Private_Functions SMBUS Private Functions /** @defgroup SMBUS_Private_Functions SMBUS Private Functions
* @{ * @{
*/ */
/* Private functions are defined in stm32l4xx_hal_smbus.c file */ /* Private functions are defined in stm32f0xx_hal_smbus.c file */
/** /**
* @} * @}
*/ */

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_spi.c * @file stm32f0xx_hal_spi.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief SPI HAL module driver. * @brief SPI HAL module driver.
* This file provides firmware functions to manage the following * This file provides firmware functions to manage the following
* functionalities of the Serial Peripheral Interface (SPI) peripheral: * functionalities of the Serial Peripheral Interface (SPI) peripheral:
@ -90,7 +90,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
@ -365,6 +365,9 @@ HAL_StatusTypeDef HAL_SPI_DeInit(SPI_HandleTypeDef *hspi)
*/ */
__weak void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi) __weak void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hspi);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_SPI_MspInit should be implemented in the user file the HAL_SPI_MspInit should be implemented in the user file
*/ */
@ -378,6 +381,9 @@ __weak void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi)
*/ */
__weak void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi) __weak void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hspi);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_SPI_MspDeInit should be implemented in the user file the HAL_SPI_MspDeInit should be implemented in the user file
*/ */
@ -1770,6 +1776,9 @@ void HAL_SPI_IRQHandler(SPI_HandleTypeDef *hspi)
*/ */
__weak void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi) __weak void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hspi);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_SPI_TxCpltCallback should be implemented in the user file the HAL_SPI_TxCpltCallback should be implemented in the user file
*/ */
@ -1783,6 +1792,9 @@ __weak void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi)
*/ */
__weak void HAL_SPI_RxCpltCallback(SPI_HandleTypeDef *hspi) __weak void HAL_SPI_RxCpltCallback(SPI_HandleTypeDef *hspi)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hspi);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_SPI_RxCpltCallback should be implemented in the user file the HAL_SPI_RxCpltCallback should be implemented in the user file
*/ */
@ -1796,6 +1808,9 @@ __weak void HAL_SPI_RxCpltCallback(SPI_HandleTypeDef *hspi)
*/ */
__weak void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi) __weak void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hspi);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_SPI_TxRxCpltCallback should be implemented in the user file the HAL_SPI_TxRxCpltCallback should be implemented in the user file
*/ */
@ -1809,6 +1824,9 @@ __weak void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi)
*/ */
__weak void HAL_SPI_TxHalfCpltCallback(SPI_HandleTypeDef *hspi) __weak void HAL_SPI_TxHalfCpltCallback(SPI_HandleTypeDef *hspi)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hspi);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_SPI_TxHalfCpltCallback should be implemented in the user file the HAL_SPI_TxHalfCpltCallback should be implemented in the user file
*/ */
@ -1822,6 +1840,9 @@ __weak void HAL_SPI_TxHalfCpltCallback(SPI_HandleTypeDef *hspi)
*/ */
__weak void HAL_SPI_RxHalfCpltCallback(SPI_HandleTypeDef *hspi) __weak void HAL_SPI_RxHalfCpltCallback(SPI_HandleTypeDef *hspi)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hspi);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_SPI_RxHalfCpltCallback() should be implemented in the user file the HAL_SPI_RxHalfCpltCallback() should be implemented in the user file
*/ */
@ -1835,6 +1856,9 @@ __weak void HAL_SPI_RxHalfCpltCallback(SPI_HandleTypeDef *hspi)
*/ */
__weak void HAL_SPI_TxRxHalfCpltCallback(SPI_HandleTypeDef *hspi) __weak void HAL_SPI_TxRxHalfCpltCallback(SPI_HandleTypeDef *hspi)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hspi);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_SPI_TxRxHalfCpltCallback() should be implemented in the user file the HAL_SPI_TxRxHalfCpltCallback() should be implemented in the user file
*/ */
@ -1848,6 +1872,9 @@ __weak void HAL_SPI_TxRxHalfCpltCallback(SPI_HandleTypeDef *hspi)
*/ */
__weak void HAL_SPI_ErrorCallback(SPI_HandleTypeDef *hspi) __weak void HAL_SPI_ErrorCallback(SPI_HandleTypeDef *hspi)
{ {
/* Prevent unused argument(s) compilation warning */
UNUSED(hspi);
/* NOTE : This function should not be modified, when the callback is needed, /* NOTE : This function should not be modified, when the callback is needed,
the HAL_SPI_ErrorCallback should be implemented in the user file the HAL_SPI_ErrorCallback should be implemented in the user file
*/ */

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_spi.h * @file stm32f0xx_hal_spi.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of SPI HAL module. * @brief Header file of SPI HAL module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:

View File

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_spi_ex.c * @file stm32f0xx_hal_spi_ex.c
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Extended SPI HAL module driver. * @brief Extended SPI HAL module driver.
* This file provides firmware functions to manage the following * This file provides firmware functions to manage the following
* SPI peripheral extended functionalities : * SPI peripheral extended functionalities :
@ -12,7 +12,7 @@
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @file stm32f0xx_hal_spi_ex.h * @file stm32f0xx_hal_spi_ex.h
* @author MCD Application Team * @author MCD Application Team
* @version V1.3.0 * @version V1.3.1
* @date 26-June-2015 * @date 29-January-2016
* @brief Header file of SPI HAL Extended module. * @brief Header file of SPI HAL Extended module.
****************************************************************************** ******************************************************************************
* @attention * @attention
* *
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:

Some files were not shown because too many files have changed in this diff Show More