Licensed by ST under Apache-2.0 license (the "License"). You may not use this package except in compliance with the License. You may obtain a copy of the License at:
Add License.md and Readme.md files required for GitHub publication
-
-
-
-
-
-
-
Main Changes
-
Maintenance release
-
First release supporting L0 Value Lines
-
Contents
-
-
Add the support of STM32L010xx devices
-
-
Add stm32l010xb.h, stm32l010x8.h, stm32l010x6.h and stm32l010x4.h device description files
-
Add startup_stm32l010xb.s, startup_stm32l010x8.s, startup_stm32l010x6.s and startup_stm32l010x4.s startup files for EWARM, MDK-ARM and SW4STM32 toolchains
-
Add EWARM associated linker files for execution from internal RAM or internal FLASH
-
-
stm32l0xx.h
-
-
Add the following device defines:
-
-
“#define STM32L010xB” for all STM32L010xB devices
-
“#define STM32L010x8” for all STM32L010x8 devices
-
“#define STM32L010x6” for all STM32L010x6 devices
-
“#define STM32L010x4” for all STM32L010x4 devices
-
-
Align ErrorStatus typedef to common error handling.
-
-
All stm32l0xxxx.h device description files.h
-
-
[MISRAC2012-Rule-10.6] Use ‘UL’ postfix for _Msk definitions and memory/peripheral base addresses
-
Correct comments in the bit definition of RCC_AHBRST, RCC_APB2RSTR and RCC_APB1RSTR registers.
-
Rename RTC_CR_BCK bit to RTC_CR_BKP to be aligned with reference manual.
-
Add missing definition of IS_TSC_ALL_INSTANCE after TSC driver update.
-
Add back the bit definition of SYSCFG_CFGR3_EN_VREFINT in SYSCFG_CFGR3 register.
-
Rename GPIO_AFRL_AFRLx and GPIO_AFRL_AFRHx bit definitions (from GPIO_AFRL/AFRH registers) to GPIO_AFRL_AFSELx.
-
Align IS_TIM_XXX_INSTANCE definitions with other series.
-
Remove cast (uint8_t) in CRC_IDR_IDR definition.
-
Add missing definition of IS_PCD_ALL_INSTANCE macro after USB driver update.
-
Add definition of IS_UART_DRIVER_ENABLE_INSTANCE macro after UART driver update.
-
Add compatibility definition of USART_ICR_NECF / USART_ICR_NCF with others series.
-
Update IS_UART_INSTANCE macro definition.
-
Add definition of IS_LPTIM_ENCODER_INTERFACE_INSTANCE macro after LPTIM driver update.
-
Move definition of FLASH_BANK2_BASE start address to stm32l0xx_hal_flash.h to be dependant on Memory Size register.
-
Update interrupt definition to use DMA1_Channel4_5_IRQn for STM32L011xx and STM32L021xx devices.
-
Correct PWR_WAKEUP_PIN definitions for L011xx and L021xx devices.
-
-
system_stm32l0xx.c
-
-
Update file to correct comments for VECT_TAB_OFFSET definition.
-
Update default MSI_VALUE reset value set in SystemCoreClock.
-
Update SystemCoreClockUpdate() function to check HSI16DIVF for HSI divided by 4.
-
-
startup_stm32l0xxxx.s
-
-
Update startup files to use DMA1_Channel4_5_IRQn/IRQHandler for STM32L011xx and STM32L01xx devices.
-
-
-
-
-
-
-
-
Main Changes
-
Internal release
-
-
-
-
-
-
Main Changes
-
Maintenance release
-
Contents
-
-
Removed DATE and VERSION fields from header files.
-
-
-
-
-
-
-
Main Changes
-
Maintenance release
-
Contents
-
-
Updated IS_COMP_COMMON_INSTANCE() macro.
-
Corrected ADC_CFGR2_TOVS bit and mask definitions.
-
-
-
-
-
-
-
Main Changes
-
Maintenance release
-
Contents
-
-
Added Pos and Msk macros missing within the CMSIS stm32l083xx.h file.
-
Added LCD_CR_BUFEN bit definition in LCD CR register for stm32l053xx, stm32l063xx, stm32l073xx, stm32l083xx devices.
-
-
-
-
-
-
-
Main Changes
-
Maintenance release
-
Contents
-
-
Add Pos and Msk macros within the CMSIS files.
-
-
For example, on the previous CMSIS version (V1.5.0), the constant ADC_IER_EOCALIE was defined as follow :
-
-
#define ADC_IER_EOCALIE ((uint32_t)0x00000800U)
-
-
On this new CMSIS version (V1.6.0), the constant ADC_IER_EOCALIE is now defined as follow :
-
The same rule applies on all the other constants present inside the CMSIS files.
-
-
MISRA C 2004 rule 10.6 compliancy. (A ‘U’ suffix shall be applied to all constants of unisgned type).
-
Several SYSCFG definition changes :
-
SYSCFG_CFGR3_EN_VREFINT enable bit suppressed. (no more needed and must not be used).
-
SYSCFG_CFGR3_EN_BGAP define suppressed.
-
SYSCFG_CFGR3_REF_HSI48_RDYF, SYSCFG_CFGR3_SENSOR_ADC_RDYF, SYSCFG_CFGR3_VREFINT_ADC_RDYF, SYSCFG_CFGR3_VREFINT_COMP_RDYF flags suppressed, SYSCFG_CFGR3_VREFINT_RDYF must be used instead (this flag is a combination of the 4 suppressed flags).
-
Added SYSCFG_CFGR3_REF_RC48MHz_RDYF, SYSCFG_CFGR3_REF_HSI48_RDYF, SYSCFG_VREFINT_ADC_RDYF, SYSCFG_CFGR3_SENSOR_ADC_RDYF, SYSCFG_CFGR3_VREFINT_ADC_RDYF and SYSCFG_CFGR3_VREFINT_COMP_RDYF defines.
-
Aligned register namings with the different L0 Reference Manual (For STM32L0x1 : RM0377 Rev5, for STM32L0x2 : RM0367 Rev2, for STM32L0x3 : RM0367 Rev4). The list of the modification is listed hereafter :
-
-
Introduced new masks in EXTI bit definitions in order to simplify LL source code.
-
Renamed RCC_CFGR_MCO_x into RCC_CFGR_MCOSEL_x
-
Added FLASHSIZE_BASE, UID_BASE and SRAM_SIZE_MAX defines.
-
Renamed macro IS_DMA_ALL_INSTANCE() to IS_DMA_STREAM_ALL_INSTANCE().
-
Added new macros: IS_I2C_WAKEUP_FROMSTOP_INSTANCE(), IS_ADC_COMMON_INSTANCE() and IS_LPUART_INSTANCE().
-
Added new defines PWR_PVD_SUPPORT to handle the PVD feature.
-
Corrected the value of FLASH_END for STM32L011xx or STM32L021xx devices.
-
-
-
-
-
-
-
-
Main Changes
-
Maintenance release
-
Contents
-
-
MISRA C 2004 rule 5.1 and rule 10.6 compliancy.
-
Several renaming in order to be aligned with the Reference Manual.The list of the modification is listed hereafter :
-
-
Adding of a new COMP_Common_TypeDef structure.
-
Removal of the RCR field inside the TIM_TypeDef structure.
-
Adding of a new define COMP12_COMMON
-
Adding of a new define DAC1 (same as DAC)
-
Adding of a new define ADC1_COMMON
-
Adding of a new define ADC_CHSELR_CHSEL
-
Adding of a new define COMP_CSR_WINMODE
-
Adding of a new define DAC_CHANNEL2_SUPPORT
-
Renaming of EXTI_RTSR_TRx into EXTI_RTSR_RTx with x = {0,..22}
-
Renaming of EXTI_FTSR_TRx into EXTI_FTSR_FTx with x = {0,..22}
-
Renaming of EXTI_SWIER_SWIERx into EXTI_SWIER_SWIx with x = {0,..22}
-
Renaming of EXTI_PR_PRx into EXTI_PR_PIFx with x = {0,..22}
-
Renaming of RCC_IOPRSTR_GPIOxRST into RCC_IOPRSTR_IOPxRST with x = {A,B,C,D,E,H}
-
Add a new define RCC_AHBRSTR_DMA1RST
-
Add a new define RCC_APB2RSTR_ADC1RST
-
Add a new define RCC_APB2RSTR_DBGMCURST
-
Renaming of RCC_IOPENR_GPIOxEN into RCC_IOPENR_IOPxEN with x = {A,B,C,D,E,H}
-
Add a new define RCC_AHBENR_DMA1EN
-
Rename RCC_APB2ENR_MIFIEN into RCC_APB2ENR_FWEN
-
Rename RCC_APB2ENR_ADC1EN into RCC_APB2ENR_ADCEN
-
Rename RCC_APB2ENR_DBGMCUEN into RCC_APB2ENR_DBGEN
-
Rename RCC_IOPSMENR_GPIOxSMEN into RCC_IOPSMENR_IOPxSMEN with x = {A,B,C,D,E,H}
-
Add a new define RCC_AHBSMENR_DMA1SMEN
-
Rename RCC_APB2SMENR_ADC1SMEN into RCC_APB2SMENR_ADCSMEN
-
Rename RCC_APB2SMENR_DBGMCUSMEN into RCC_APB2SMENR_DBGSMEN
-
Add new defines TIM_TIM2_REMAP_HSI_SUPPORT and TIM_TIM2_REMAP_HSI48_SUPPORT
-
Remove the following defines : TIM_CR2_CCPC, TIM_CR2_CCUS, TIM_CR2_OIS1, TIM_CR2_OIS1N, TIM_CR2_OIS2,TIM_CR2_OIS2N, TIM_CR2_OIS3, TIM_CR2_OIS3N, TIM_CR2_OIS4
-
Remove TIM_SR_COMIF and TIM_SR_BIF
-
Remove TIM_EGR_COMG and TIM_EGR_BG
-
Remove TIM_CCER_CC1NE, TIM_CCER_CC2NE and TIM_CCER_CC3NE
-
Remove TIM_RCR_REP
-
Rename USART_ISR_LBD into USART_ISR_LBDF
-
Rename WWDG_CR_Tx into WWDG_CR_T_x with x = {0,..6}
-
Rename WWDG_CFR_WDGTBx into WWDG_CFR_WDGTB_x with x = {0,1}
-
Add several macros to check Timer instances (IS_TIM_CLOCKSOURCE_ETRMODE1_INSTANCE(), IS_TIM_CLOCK_DIVISION_INSTANCE(), …)
-
-
-
-
-
-
-
-
Main Changes
-
Maintenance release
-
-
Update all the files to support STM32L011xx and STM32L021xx.
-
-
Contents
-
-
Remove the Debug Monitor handler from the startup files (not supported on L0).
-
Renamings and usage of some aliases in order to be compliant with the RefManuals.
-
-
-
-
-
-
-
Main Changes
-
Maintenance release
-
-
Update all the files to support STM32L031xx and STM32L041xx.
-
-
Contents
-
-
Several renamings in order to be compliant with the specifications.
-
Adding of new bit definitions (COMP_CSR_COMP2LPTIM1IN1, SYSCFG_CFGR1_UFB, I2C_OAR2_x, LCD_CR_MUX_SEG, RTC_BKP_NUMBER)
-
Update of several registers and structures (CRC_TypeDef, TIM_TypeDef)
-
-
-
-
-
-
-
Main Changes
-
Maintenance release
-
-
Added the set of CMSIS files for the STM32L07xx and STM32L08xx family
-
-
Contents
-
-
Add IAR set of files STM32L073xx - STM32L072xx - STM32L071xx - STM32L083xx - STM32L082xx - STM32L081xx
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- ******************************************************************************
- */
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __STM32_ASSERT_H
-#define __STM32_ASSERT_H
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-/* Exported types ------------------------------------------------------------*/
-/* Exported constants --------------------------------------------------------*/
-/* Includes ------------------------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-#ifdef USE_FULL_ASSERT
-/**
- * @brief The assert_param macro is used for function's parameters check.
- * @param expr If expr is false, it calls assert_failed function
- * which reports the name of the source file and the source
- * line number of the call that failed.
- * If expr is true, it returns no value.
- * @retval None
- */
- #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
-/* Exported functions ------------------------------------------------------- */
- void assert_failed(uint8_t* file, uint32_t line);
-#else
- #define assert_param(expr) ((void)0U)
-#endif /* USE_FULL_ASSERT */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __STM32_ASSERT_H */
-
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal.h b/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal.h
deleted file mode 100644
index 8aa30b1988..0000000000
--- a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal.h
+++ /dev/null
@@ -1,487 +0,0 @@
-/**
- ******************************************************************************
- * @file stm32l0xx_hal.h
- * @author MCD Application Team
- * @brief This file contains all the functions prototypes for the HAL
- * module driver.
- ******************************************************************************
- * @attention
- *
- *
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- ******************************************************************************
- */
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __STM32L0xx_HAL_DEF
-#define __STM32L0xx_HAL_DEF
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-/* Includes ------------------------------------------------------------------*/
-#include "stm32l0xx.h"
-#include "Legacy/stm32_hal_legacy.h"
-#include
-
-/* Exported types ------------------------------------------------------------*/
-
-/**
- * @brief HAL Status structures definition
- */
-typedef enum
-{
- HAL_OK = 0x00U,
- HAL_ERROR = 0x01U,
- HAL_BUSY = 0x02U,
- HAL_TIMEOUT = 0x03U
-} HAL_StatusTypeDef;
-
-/**
- * @brief HAL Lock structures definition
- */
-typedef enum
-{
- HAL_UNLOCKED = 0x00U,
- HAL_LOCKED = 0x01U
-} HAL_LockTypeDef;
-
-/* Exported macro ------------------------------------------------------------*/
-
-#define UNUSED(X) (void)X /* To avoid gcc/g++ warnings */
-
-#define HAL_MAX_DELAY 0xFFFFFFFFU
-
-#define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) == (BIT))
-#define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == 0U)
-
-#define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \
- do{ \
- (__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \
- (__DMA_HANDLE__).Parent = (__HANDLE__); \
- } while(0)
-
-/** @brief Reset the Handle's State field.
- * @param __HANDLE__: specifies the Peripheral Handle.
- * @note This macro can be used for the following purpose:
- * - When the Handle is declared as local variable; before passing it as parameter
- * to HAL_PPP_Init() for the first time, it is mandatory to use this macro
- * to set to 0 the Handle's "State" field.
- * Otherwise, "State" field may have any random value and the first time the function
- * HAL_PPP_Init() is called, the low level hardware initialization will be missed
- * (i.e. HAL_PPP_MspInit() will not be executed).
- * - When there is a need to reconfigure the low level hardware: instead of calling
- * HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init().
- * In this later function, when the Handle's "State" field is set to 0, it will execute the function
- * HAL_PPP_MspInit() which will reconfigure the low level hardware.
- * @retval None
- */
-#define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0U)
-
-#if (USE_RTOS == 1)
-
- /* Reserved for future use */
- #error "USE_RTOS should be 0 in the current HAL release"
-
-#else
- #define __HAL_LOCK(__HANDLE__) \
- do{ \
- if((__HANDLE__)->Lock == HAL_LOCKED) \
- { \
- return HAL_BUSY; \
- } \
- else \
- { \
- (__HANDLE__)->Lock = HAL_LOCKED; \
- } \
- }while (0)
-
- #define __HAL_UNLOCK(__HANDLE__) \
- do{ \
- (__HANDLE__)->Lock = HAL_UNLOCKED; \
- }while (0)
-#endif /* USE_RTOS */
-
-#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* ARM Compiler V6 */
- #ifndef __weak
- #define __weak __attribute__((weak))
- #endif
- #ifndef __packed
- #define __packed __attribute__((packed))
- #endif
-#elif defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */
- #ifndef __weak
- #define __weak __attribute__((weak))
- #endif /* __weak */
- #ifndef __packed
- #define __packed __attribute__((__packed__))
- #endif /* __packed */
-
- #define __NOINLINE __attribute__ ( (noinline) )
-
-#endif /* __GNUC__ */
-
-
-/* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */
-#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* ARM Compiler V6 */
- #ifndef __ALIGN_BEGIN
- #define __ALIGN_BEGIN
- #endif
- #ifndef __ALIGN_END
- #define __ALIGN_END __attribute__ ((aligned (4)))
- #endif
-#elif defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */
- #ifndef __ALIGN_END
- #define __ALIGN_END __attribute__ ((aligned (4)))
- #endif /* __ALIGN_END */
- #ifndef __ALIGN_BEGIN
- #define __ALIGN_BEGIN
- #endif /* __ALIGN_BEGIN */
-#else
- #ifndef __ALIGN_END
- #define __ALIGN_END
- #endif /* __ALIGN_END */
- #ifndef __ALIGN_BEGIN
- #if defined (__CC_ARM) /* ARM Compiler V5*/
- #define __ALIGN_BEGIN __align(4)
- #elif defined (__ICCARM__) /* IAR Compiler */
- #define __ALIGN_BEGIN
- #endif /* __CC_ARM */
- #endif /* __ALIGN_BEGIN */
-#endif /* __GNUC__ */
-
-/**
- * @brief __RAM_FUNC definition
- */
-#if defined ( __CC_ARM ) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
-/* ARM Compiler V4/V5 and V6
- --------------------------
- RAM functions are defined using the toolchain options.
- Functions that are executed in RAM should reside in a separate source module.
- Using the 'Options for File' dialog you can simply change the 'Code / Const'
- area of a module to a memory space in physical RAM.
- Available memory areas are declared in the 'Target' tab of the 'Options for Target'
- dialog.
-*/
-#define __RAM_FUNC
-
-#define __NOINLINE __attribute__ ( (noinline) )
-
-
-#elif defined ( __ICCARM__ )
-/* ICCARM Compiler
- ---------------
- RAM functions are defined using a specific toolchain keyword "__ramfunc".
-*/
-#define __RAM_FUNC __ramfunc
-
-#define __NOINLINE _Pragma("optimize = no_inline")
-
-#elif defined ( __GNUC__ )
-/* GNU Compiler
- ------------
- RAM functions are defined using a specific toolchain attribute
- "__attribute__((section(".RamFunc")))".
-*/
-#define __RAM_FUNC __attribute__((section(".RamFunc")))
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ___STM32L0xx_HAL_DEF */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
-
diff --git a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal_dma.h b/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal_dma.h
deleted file mode 100644
index af5ef58428..0000000000
--- a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal_dma.h
+++ /dev/null
@@ -1,675 +0,0 @@
-/**
- ******************************************************************************
- * @file stm32l0xx_hal_dma.h
- * @author MCD Application Team
- * @brief Header file of DMA HAL module.
- ******************************************************************************
- * @attention
- *
- *
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- ******************************************************************************
- */
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __STM32L0xx_HAL_FIREWALL_H
-#define __STM32L0xx_HAL_FIREWALL_H
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-#if !defined (STM32L010xB) && !defined (STM32L010x8) && !defined (STM32L010x6) && !defined (STM32L010x4) && !defined (STM32L011xx) && !defined (STM32L021xx) && !defined (STM32L031xx) && !defined (STM32L041xx)
-
-/* Includes ------------------------------------------------------------------*/
-#include "stm32l0xx_hal_def.h"
-
-/** @addtogroup STM32L0xx_HAL_Driver
- * @{
- */
-
-/** @defgroup FIREWALL FIREWALL
- * @{
- */
-
-/* Exported types ------------------------------------------------------------*/
-/** @defgroup FIREWALL_Exported_Types FIREWALL Exported Types
- * @{
- */
-
-/**
- * @brief FIREWALL Initialization Structure definition
- */
-typedef struct
-{
- uint32_t CodeSegmentStartAddress; /*!< Protected code segment start address. This value is 24-bit long, the 8 LSB bits are
- reserved and forced to 0 in order to allow a 256-byte granularity. */
-
- uint32_t CodeSegmentLength; /*!< Protected code segment length in bytes. This value is 22-bit long, the 8 LSB bits are
- reserved and forced to 0 for the length to be a multiple of 256 bytes. */
-
- uint32_t NonVDataSegmentStartAddress; /*!< Protected non-volatile data segment start address. This value is 24-bit long, the 8 LSB
- bits are reserved and forced to 0 in order to allow a 256-byte granularity. */
-
- uint32_t NonVDataSegmentLength; /*!< Protected non-volatile data segment length in bytes. This value is 22-bit long, the 8 LSB
- bits are reserved and forced to 0 for the length to be a multiple of 256 bytes. */
-
- uint32_t VDataSegmentStartAddress; /*!< Protected volatile data segment start address. This value is 17-bit long, the 6 LSB bits
- are reserved and forced to 0 in order to allow a 64-byte granularity. */
-
- uint32_t VDataSegmentLength; /*!< Protected volatile data segment length in bytes. This value is 17-bit long, the 6 LSB
- bits are reserved and forced to 0 for the length to be a multiple of 64 bytes. */
-
- uint32_t VolatileDataExecution; /*!< Set VDE bit specifying whether or not the volatile data segment can be executed.
- When VDS = 1 (set by parameter VolatileDataShared), VDE bit has no meaning.
- This parameter can be a value of @ref FIREWALL_VolatileData_Executable */
-
- uint32_t VolatileDataShared; /*!< Set VDS bit in specifying whether or not the volatile data segment can be shared with a
- non-protected application code.
- This parameter can be a value of @ref FIREWALL_VolatileData_Shared */
-
-}FIREWALL_InitTypeDef;
-
-
-/**
- * @}
- */
-
-
-/* Exported constants --------------------------------------------------------*/
-/** @defgroup FIREWALL_Exported_Constants FIREWALL Exported Constants
- * @{
- */
-
-/** @defgroup FIREWALL_VolatileData_Executable FIREWALL volatile data segment execution status
- * @{
- */
-#define FIREWALL_VOLATILEDATA_NOT_EXECUTABLE (0x0000U)
-#define FIREWALL_VOLATILEDATA_EXECUTABLE FW_CR_VDE
-/**
- * @}
- */
-
-/** @defgroup FIREWALL_VolatileData_Shared FIREWALL volatile data segment share status
- * @{
- */
-#define FIREWALL_VOLATILEDATA_NOT_SHARED (0x0000U)
-#define FIREWALL_VOLATILEDATA_SHARED FW_CR_VDS
-/**
- * @}
- */
-
-/** @defgroup FIREWALL_Pre_Arm FIREWALL pre arm status
- * @{
- */
-#define FIREWALL_PRE_ARM_RESET (0x0000U)
-#define FIREWALL_PRE_ARM_SET FW_CR_FPA
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/* Private macros --------------------------------------------------------*/
-/** @addtogroup FIREWALL_Private
- * @{
- */
-#define IS_FIREWALL_CODE_SEGMENT_ADDRESS(ADDRESS) (((ADDRESS) >= FLASH_BASE) && ((ADDRESS) < (FLASH_BASE + FLASH_SIZE)))
-#define IS_FIREWALL_CODE_SEGMENT_LENGTH(ADDRESS, LENGTH) (((ADDRESS) + (LENGTH)) <= (FLASH_BASE + FLASH_SIZE))
-
-#define IS_FIREWALL_NONVOLATILEDATA_SEGMENT_ADDRESS(ADDRESS) (((ADDRESS) >= FLASH_BASE) && ((ADDRESS) < (FLASH_BASE + FLASH_SIZE)))
-#define IS_FIREWALL_NONVOLATILEDATA_SEGMENT_LENGTH(ADDRESS, LENGTH) (((ADDRESS) + (LENGTH)) <= (FLASH_BASE + FLASH_SIZE))
-
-#define IS_FIREWALL_VOLATILEDATA_SEGMENT_ADDRESS(ADDRESS) (((ADDRESS) >= SRAM_BASE) && ((ADDRESS) < (SRAM_BASE + SRAM_SIZE_MAX)))
-#define IS_FIREWALL_VOLATILEDATA_SEGMENT_LENGTH(ADDRESS, LENGTH) (((ADDRESS) + (LENGTH)) <= (SRAM_BASE + SRAM_SIZE_MAX))
-
-
-#define IS_FIREWALL_VOLATILEDATA_SHARE(SHARE) (((SHARE) == FIREWALL_VOLATILEDATA_NOT_SHARED) || \
- ((SHARE) == FIREWALL_VOLATILEDATA_SHARED))
-
-#define IS_FIREWALL_VOLATILEDATA_EXECUTE(EXECUTE) (((EXECUTE) == FIREWALL_VOLATILEDATA_NOT_EXECUTABLE) || \
- ((EXECUTE) == FIREWALL_VOLATILEDATA_EXECUTABLE))
-/**
- * @}
- */
-
-
-/* Exported macros -----------------------------------------------------------*/
-/** @defgroup FIREWALL_Exported_Macros FIREWALL Exported Macros
- * @{
- */
-
-/** @brief Check whether the FIREWALL is enabled or not.
- * @retval FIREWALL enabling status (TRUE or FALSE).
- */
-#define __HAL_FIREWALL_IS_ENABLED() HAL_IS_BIT_CLR(SYSCFG->CFGR2, SYSCFG_CFGR2_FWDISEN)
-
-
-/** @brief Enable FIREWALL pre arm.
- * @note When FPA bit is set, any code executed outside the protected segment
- * closes the Firewall, otherwise it generates a system reset.
- * @note This macro provides the same service as HAL_FIREWALL_EnablePreArmFlag() API
- * but can be executed inside a code area protected by the Firewall.
- * @note This macro can be executed whatever the Firewall state (opened or closed) when
- * NVDSL register is equal to 0. Otherwise (when NVDSL register is different from
- * 0, that is, when the non volatile data segment is defined), the macro can be
- * executed only when the Firewall is opened.
- */
-#define __HAL_FIREWALL_PREARM_ENABLE() \
- do { \
- __IO uint32_t tmpreg; \
- SET_BIT(FIREWALL->CR, FW_CR_FPA) ; \
- /* Read bit back to ensure it is taken into account by Peripheral */ \
- /* (introduce proper delay inside macro execution) */ \
- tmpreg = READ_BIT(FIREWALL->CR, FW_CR_FPA) ; \
- UNUSED(tmpreg); \
- } while(0)
-
-
-
-/** @brief Disable FIREWALL pre arm.
- * @note When FPA bit is set, any code executed outside the protected segment
- * closes the Firewall, otherwise, it generates a system reset.
- * @note This macro provides the same service as HAL_FIREWALL_DisablePreArmFlag() API
- * but can be executed inside a code area protected by the Firewall.
- * @note This macro can be executed whatever the Firewall state (opened or closed) when
- * NVDSL register is equal to 0. Otherwise (when NVDSL register is different from
- * 0, that is, when the non volatile data segment is defined), the macro can be
- * executed only when the Firewall is opened.
- */
-#define __HAL_FIREWALL_PREARM_DISABLE() \
- do { \
- __IO uint32_t tmpreg; \
- CLEAR_BIT(FIREWALL->CR, FW_CR_FPA) ; \
- /* Read bit back to ensure it is taken into account by Peripheral */ \
- /* (introduce proper delay inside macro execution) */ \
- tmpreg = READ_BIT(FIREWALL->CR, FW_CR_FPA) ; \
- UNUSED(tmpreg); \
- } while(0)
-
-/** @brief Enable volatile data sharing in setting VDS bit.
- * @note When VDS bit is set, the volatile data segment is shared with non-protected
- * application code. It can be accessed whatever the Firewall state (opened or closed).
- * @note This macro can be executed inside a code area protected by the Firewall.
- * @note This macro can be executed whatever the Firewall state (opened or closed) when
- * NVDSL register is equal to 0. Otherwise (when NVDSL register is different from
- * 0, that is, when the non volatile data segment is defined), the macro can be
- * executed only when the Firewall is opened.
- */
-#define __HAL_FIREWALL_VOLATILEDATA_SHARED_ENABLE() \
- do { \
- __IO uint32_t tmpreg; \
- SET_BIT(FIREWALL->CR, FW_CR_VDS) ; \
- /* Read bit back to ensure it is taken into account by Peripheral */ \
- /* (introduce proper delay inside macro execution) */ \
- tmpreg = READ_BIT(FIREWALL->CR, FW_CR_VDS) ; \
- UNUSED(tmpreg); \
- } while(0)
-
-/** @brief Disable volatile data sharing in resetting VDS bit.
- * @note When VDS bit is reset, the volatile data segment is not shared and cannot be
- * hit by a non protected executable code when the Firewall is closed. If it is
- * accessed in such a condition, a system reset is generated by the Firewall.
- * @note This macro can be executed inside a code area protected by the Firewall.
- * @note This macro can be executed whatever the Firewall state (opened or closed) when
- * NVDSL register is equal to 0. Otherwise (when NVDSL register is different from
- * 0, that is, when the non volatile data segment is defined), the macro can be
- * executed only when the Firewall is opened.
- */
-#define __HAL_FIREWALL_VOLATILEDATA_SHARED_DISABLE() \
- do { \
- __IO uint32_t tmpreg; \
- CLEAR_BIT(FIREWALL->CR, FW_CR_VDS) ; \
- /* Read bit back to ensure it is taken into account by Peripheral */ \
- /* (introduce proper delay inside macro execution) */ \
- tmpreg = READ_BIT(FIREWALL->CR, FW_CR_VDS) ; \
- UNUSED(tmpreg); \
- } while(0)
-
-/** @brief Enable volatile data execution in setting VDE bit.
- * @note VDE bit is ignored when VDS is set. IF VDS = 1, the Volatile data segment can be
- * executed whatever the VDE bit value.
- * @note When VDE bit is set (with VDS = 0), the volatile data segment is executable. When
- * the Firewall call is closed, a "call gate" entry procedure is required to open
- * first the Firewall.
- * @note This macro can be executed inside a code area protected by the Firewall.
- * @note This macro can be executed whatever the Firewall state (opened or closed) when
- * NVDSL register is equal to 0. Otherwise (when NVDSL register is different from
- * 0, that is, when the non volatile data segment is defined), the macro can be
- * executed only when the Firewall is opened.
- */
-#define __HAL_FIREWALL_VOLATILEDATA_EXECUTION_ENABLE() \
- do { \
- __IO uint32_t tmpreg; \
- SET_BIT(FIREWALL->CR, FW_CR_VDE) ; \
- /* Read bit back to ensure it is taken into account by Peripheral */ \
- /* (introduce proper delay inside macro execution) */ \
- tmpreg = READ_BIT(FIREWALL->CR, FW_CR_VDE) ; \
- UNUSED(tmpreg); \
- } while(0)
-
-/** @brief Disable volatile data execution in resetting VDE bit.
- * @note VDE bit is ignored when VDS is set. IF VDS = 1, the Volatile data segment can be
- * executed whatever the VDE bit value.
- * @note When VDE bit is reset (with VDS = 0), the volatile data segment cannot be executed.
- * @note This macro can be executed inside a code area protected by the Firewall.
- * @note This macro can be executed whatever the Firewall state (opened or closed) when
- * NVDSL register is equal to 0. Otherwise (when NVDSL register is different from
- * 0, that is, when the non volatile data segment is defined), the macro can be
- * executed only when the Firewall is opened.
- */
-#define __HAL_FIREWALL_VOLATILEDATA_EXECUTION_DISABLE() \
- do { \
- __IO uint32_t tmpreg; \
- CLEAR_BIT(FIREWALL->CR, FW_CR_VDE) ; \
- /* Read bit back to ensure it is taken into account by Peripheral */ \
- /* (introduce proper delay inside macro execution) */ \
- tmpreg = READ_BIT(FIREWALL->CR, FW_CR_VDE) ; \
- UNUSED(tmpreg); \
- } while(0)
-
-
-/** @brief Check whether or not the volatile data segment is shared.
- * @note This macro can be executed inside a code area protected by the Firewall.
- * @note This macro can be executed whatever the Firewall state (opened or closed) when
- * NVDSL register is equal to 0. Otherwise (when NVDSL register is different from
- * 0, that is, when the non volatile data segment is defined), the macro can be
- * executed only when the Firewall is opened.
- * @retval VDS bit setting status (TRUE or FALSE).
- */
-#define __HAL_FIREWALL_GET_VOLATILEDATA_SHARED() ((FIREWALL->CR & FW_CR_VDS) == FW_CR_VDS)
-
-/** @brief Check whether or not the volatile data segment is declared executable.
- * @note This macro can be executed inside a code area protected by the Firewall.
- * @note This macro can be executed whatever the Firewall state (opened or closed) when
- * NVDSL register is equal to 0. Otherwise (when NVDSL register is different from
- * 0, that is, when the non volatile data segment is defined), the macro can be
- * executed only when the Firewall is opened.
- * @retval VDE bit setting status (TRUE or FALSE).
- */
-#define __HAL_FIREWALL_GET_VOLATILEDATA_EXECUTION() ((FIREWALL->CR & FW_CR_VDE) == FW_CR_VDE)
-
-/** @brief Check whether or not the Firewall pre arm bit is set.
- * @note This macro can be executed inside a code area protected by the Firewall.
- * @note This macro can be executed whatever the Firewall state (opened or closed) when
- * NVDSL register is equal to 0. Otherwise (when NVDSL register is different from
- * 0, that is, when the non volatile data segment is defined), the macro can be
- * executed only when the Firewall is opened.
- * @retval FPA bit setting status (TRUE or FALSE).
- */
-#define __HAL_FIREWALL_GET_PREARM() ((FIREWALL->CR & FW_CR_FPA) == FW_CR_FPA)
-
-
-/**
- * @}
- */
-
-/* Exported functions --------------------------------------------------------*/
-
-/** @defgroup FIREWALL_Exported_Functions FIREWALL Exported Functions
- * @{
- */
-
-/** @defgroup FIREWALL_Exported_Functions_Group1 Initialization Functions
- * @brief Initialization and Configuration Functions
- * @{
- */
-
-/* Initialization functions ********************************/
-HAL_StatusTypeDef HAL_FIREWALL_Config(FIREWALL_InitTypeDef * fw_init);
-void HAL_FIREWALL_GetConfig(FIREWALL_InitTypeDef * fw_config);
-void HAL_FIREWALL_EnableFirewall(void);
-void HAL_FIREWALL_EnablePreArmFlag(void);
-void HAL_FIREWALL_DisablePreArmFlag(void);
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-/* Define the private group ***********************************/
-/**************************************************************/
-/** @defgroup FIREWALL_Private FIREWALL Private
- * @{
- */
-/**
- * @}
- */
-/**************************************************************/
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-
-#endif /* #if !defined (STM32L010xB) && !defined (STM32L010x8) && !defined (STM32L010x6) && !defined (STM32L010x4) && !defined (STM32L011xx) && !defined (STM32L021xx) && !defined (STM32L031xx) && !defined (STM32L041xx) */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __STM32L0xx_HAL_FIREWALL_H */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal_flash.h b/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal_flash.h
deleted file mode 100644
index 8fa4b9124c..0000000000
--- a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal_flash.h
+++ /dev/null
@@ -1,378 +0,0 @@
-/**
- ******************************************************************************
- * @file stm32l0xx_hal_flash.h
- * @author MCD Application Team
- * @brief Header file of Flash HAL module.
- ******************************************************************************
- * @attention
- *
- *
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- ******************************************************************************
- */
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __STM32L0xx_LL_ADC_H
-#define __STM32L0xx_LL_ADC_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Includes ------------------------------------------------------------------*/
-#include "stm32l0xx.h"
-
-/** @addtogroup STM32L0xx_LL_Driver
- * @{
- */
-
-#if defined (ADC1)
-
-/** @defgroup ADC_LL ADC
- * @{
- */
-
-/* Private types -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-
-/* Private constants ---------------------------------------------------------*/
-/** @defgroup ADC_LL_Private_Constants ADC Private Constants
- * @{
- */
-
-/* Internal mask for ADC group regular trigger: */
-/* To select into literal LL_ADC_REG_TRIG_x the relevant bits for: */
-/* - regular trigger source */
-/* - regular trigger edge */
-#define ADC_REG_TRIG_EXT_EDGE_DEFAULT (ADC_CFGR1_EXTEN_0) /* Trigger edge set to rising edge (default setting for compatibility with some ADC on other STM32 families having this setting set by HW default value) */
-
-/* Mask containing trigger source masks for each of possible */
-/* trigger edge selection duplicated with shifts [0; 4; 8; 12] */
-/* corresponding to {SW start; ext trigger; ext trigger; ext trigger}. */
-#define ADC_REG_TRIG_SOURCE_MASK (((LL_ADC_REG_TRIG_SOFTWARE & ADC_CFGR1_EXTSEL) << (4U * 0U)) | \
- ((ADC_CFGR1_EXTSEL) << (4U * 1U)) | \
- ((ADC_CFGR1_EXTSEL) << (4U * 2U)) | \
- ((ADC_CFGR1_EXTSEL) << (4U * 3U)) )
-
-/* Mask containing trigger edge masks for each of possible */
-/* trigger edge selection duplicated with shifts [0; 4; 8; 12] */
-/* corresponding to {SW start; ext trigger; ext trigger; ext trigger}. */
-#define ADC_REG_TRIG_EDGE_MASK (((LL_ADC_REG_TRIG_SOFTWARE & ADC_CFGR1_EXTEN) << (4U * 0U)) | \
- ((ADC_REG_TRIG_EXT_EDGE_DEFAULT) << (4U * 1U)) | \
- ((ADC_REG_TRIG_EXT_EDGE_DEFAULT) << (4U * 2U)) | \
- ((ADC_REG_TRIG_EXT_EDGE_DEFAULT) << (4U * 3U)) )
-
-/* Definition of ADC group regular trigger bits information. */
-#define ADC_REG_TRIG_EXTSEL_BITOFFSET_POS (6U) /* Value equivalent to POSITION_VAL(ADC_CFGR1_EXTSEL) */
-#define ADC_REG_TRIG_EXTEN_BITOFFSET_POS (10U) /* Value equivalent to POSITION_VAL(ADC_CFGR1_EXTEN) */
-
-
-
-/* Internal mask for ADC channel: */
-/* To select into literal LL_ADC_CHANNEL_x the relevant bits for: */
-/* - channel identifier defined by number */
-/* - channel identifier defined by bitfield */
-/* - channel differentiation between external channels (connected to */
-/* GPIO pins) and internal channels (connected to internal paths) */
-#define ADC_CHANNEL_ID_NUMBER_MASK (ADC_CFGR1_AWDCH)
-#define ADC_CHANNEL_ID_BITFIELD_MASK (ADC_CHSELR_CHSEL)
-#define ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS (26U)/* Value equivalent to POSITION_VAL(ADC_CHANNEL_ID_NUMBER_MASK) */
-#define ADC_CHANNEL_ID_MASK (ADC_CHANNEL_ID_NUMBER_MASK | ADC_CHANNEL_ID_BITFIELD_MASK | ADC_CHANNEL_ID_INTERNAL_CH_MASK)
-/* Equivalent mask of ADC_CHANNEL_NUMBER_MASK aligned on register LSB (bit 0) */
-#define ADC_CHANNEL_ID_NUMBER_MASK_POSBIT0 (0x0000001FU) /* Equivalent to shift: (ADC_CHANNEL_NUMBER_MASK >> POSITION_VAL(ADC_CHANNEL_NUMBER_MASK)) */
-
-/* Channel differentiation between external and internal channels */
-#define ADC_CHANNEL_ID_INTERNAL_CH (0x80000000U) /* Marker of internal channel */
-#define ADC_CHANNEL_ID_INTERNAL_CH_MASK (ADC_CHANNEL_ID_INTERNAL_CH)
-
-/* Definition of channels ID number information to be inserted into */
-/* channels literals definition. */
-#define ADC_CHANNEL_0_NUMBER (0x00000000U)
-#define ADC_CHANNEL_1_NUMBER ( ADC_CFGR1_AWDCH_0)
-#define ADC_CHANNEL_2_NUMBER ( ADC_CFGR1_AWDCH_1 )
-#define ADC_CHANNEL_3_NUMBER ( ADC_CFGR1_AWDCH_1 | ADC_CFGR1_AWDCH_0)
-#define ADC_CHANNEL_4_NUMBER ( ADC_CFGR1_AWDCH_2 )
-#define ADC_CHANNEL_5_NUMBER ( ADC_CFGR1_AWDCH_2 | ADC_CFGR1_AWDCH_0)
-#define ADC_CHANNEL_6_NUMBER ( ADC_CFGR1_AWDCH_2 | ADC_CFGR1_AWDCH_1 )
-#define ADC_CHANNEL_7_NUMBER ( ADC_CFGR1_AWDCH_2 | ADC_CFGR1_AWDCH_1 | ADC_CFGR1_AWDCH_0)
-#define ADC_CHANNEL_8_NUMBER ( ADC_CFGR1_AWDCH_3 )
-#define ADC_CHANNEL_9_NUMBER ( ADC_CFGR1_AWDCH_3 | ADC_CFGR1_AWDCH_0)
-#define ADC_CHANNEL_10_NUMBER ( ADC_CFGR1_AWDCH_3 | ADC_CFGR1_AWDCH_1 )
-#define ADC_CHANNEL_11_NUMBER ( ADC_CFGR1_AWDCH_3 | ADC_CFGR1_AWDCH_1 | ADC_CFGR1_AWDCH_0)
-#define ADC_CHANNEL_12_NUMBER ( ADC_CFGR1_AWDCH_3 | ADC_CFGR1_AWDCH_2 )
-#define ADC_CHANNEL_13_NUMBER ( ADC_CFGR1_AWDCH_3 | ADC_CFGR1_AWDCH_2 | ADC_CFGR1_AWDCH_0)
-#define ADC_CHANNEL_14_NUMBER ( ADC_CFGR1_AWDCH_3 | ADC_CFGR1_AWDCH_2 | ADC_CFGR1_AWDCH_1 )
-#define ADC_CHANNEL_15_NUMBER ( ADC_CFGR1_AWDCH_3 | ADC_CFGR1_AWDCH_2 | ADC_CFGR1_AWDCH_1 | ADC_CFGR1_AWDCH_0)
-#define ADC_CHANNEL_16_NUMBER (ADC_CFGR1_AWDCH_4 )
-#define ADC_CHANNEL_17_NUMBER (ADC_CFGR1_AWDCH_4 | ADC_CFGR1_AWDCH_0)
-#define ADC_CHANNEL_18_NUMBER (ADC_CFGR1_AWDCH_4 | ADC_CFGR1_AWDCH_1 )
-
-/* Definition of channels ID bitfield information to be inserted into */
-/* channels literals definition. */
-#define ADC_CHANNEL_0_BITFIELD (ADC_CHSELR_CHSEL0)
-#define ADC_CHANNEL_1_BITFIELD (ADC_CHSELR_CHSEL1)
-#define ADC_CHANNEL_2_BITFIELD (ADC_CHSELR_CHSEL2)
-#define ADC_CHANNEL_3_BITFIELD (ADC_CHSELR_CHSEL3)
-#define ADC_CHANNEL_4_BITFIELD (ADC_CHSELR_CHSEL4)
-#define ADC_CHANNEL_5_BITFIELD (ADC_CHSELR_CHSEL5)
-#define ADC_CHANNEL_6_BITFIELD (ADC_CHSELR_CHSEL6)
-#define ADC_CHANNEL_7_BITFIELD (ADC_CHSELR_CHSEL7)
-#define ADC_CHANNEL_8_BITFIELD (ADC_CHSELR_CHSEL8)
-#define ADC_CHANNEL_9_BITFIELD (ADC_CHSELR_CHSEL9)
-#define ADC_CHANNEL_10_BITFIELD (ADC_CHSELR_CHSEL10)
-#define ADC_CHANNEL_11_BITFIELD (ADC_CHSELR_CHSEL11)
-#define ADC_CHANNEL_12_BITFIELD (ADC_CHSELR_CHSEL12)
-#define ADC_CHANNEL_13_BITFIELD (ADC_CHSELR_CHSEL13)
-#define ADC_CHANNEL_14_BITFIELD (ADC_CHSELR_CHSEL14)
-#define ADC_CHANNEL_15_BITFIELD (ADC_CHSELR_CHSEL15)
-#if defined(ADC_CCR_VLCDEN)
-#define ADC_CHANNEL_16_BITFIELD (ADC_CHSELR_CHSEL16)
-#endif
-#define ADC_CHANNEL_17_BITFIELD (ADC_CHSELR_CHSEL17)
-#define ADC_CHANNEL_18_BITFIELD (ADC_CHSELR_CHSEL18)
-
-/* Internal mask for ADC analog watchdog: */
-/* To select into literals LL_ADC_AWD_CHANNELx_xxx the relevant bits for: */
-/* (concatenation of multiple bits used in different analog watchdogs, */
-/* (feature of several watchdogs not available on all STM32 families)). */
-/* - analog watchdog 1: monitored channel defined by number, */
-/* selection of ADC group (ADC group regular). */
-
-/* Internal register offset for ADC analog watchdog channel configuration */
-#define ADC_AWD_CR1_REGOFFSET (0x00000000U)
-
-#define ADC_AWD_CRX_REGOFFSET_MASK (ADC_AWD_CR1_REGOFFSET)
-
-#define ADC_AWD_CR1_CHANNEL_MASK (ADC_CFGR1_AWDCH | ADC_CFGR1_AWDEN | ADC_CFGR1_AWDSGL)
-#define ADC_AWD_CR_ALL_CHANNEL_MASK (ADC_AWD_CR1_CHANNEL_MASK)
-
-/* Internal register offset for ADC analog watchdog threshold configuration */
-#define ADC_AWD_TR1_REGOFFSET (ADC_AWD_CR1_REGOFFSET)
-#define ADC_AWD_TRX_REGOFFSET_MASK (ADC_AWD_TR1_REGOFFSET)
-
-
-/* ADC registers bits positions */
-#define ADC_CFGR1_RES_BITOFFSET_POS (3U) /* Value equivalent to POSITION_VAL(ADC_CFGR1_RES) */
-#define ADC_CFGR1_AWDSGL_BITOFFSET_POS (22U) /* Value equivalent to POSITION_VAL(ADC_CFGR1_AWDSGL) */
-#define ADC_TR_HT_BITOFFSET_POS (16U) /* Value equivalent to POSITION_VAL(ADC_TR_HT) */
-#define ADC_CHSELR_CHSEL0_BITOFFSET_POS (0U) /* Value equivalent to POSITION_VAL(ADC_CHSELR_CHSEL0) */
-#define ADC_CHSELR_CHSEL1_BITOFFSET_POS (1U) /* Value equivalent to POSITION_VAL(ADC_CHSELR_CHSEL1) */
-#define ADC_CHSELR_CHSEL2_BITOFFSET_POS (2U) /* Value equivalent to POSITION_VAL(ADC_CHSELR_CHSEL2) */
-#define ADC_CHSELR_CHSEL3_BITOFFSET_POS (3U) /* Value equivalent to POSITION_VAL(ADC_CHSELR_CHSEL3) */
-#define ADC_CHSELR_CHSEL4_BITOFFSET_POS (4U) /* Value equivalent to POSITION_VAL(ADC_CHSELR_CHSEL4) */
-#define ADC_CHSELR_CHSEL5_BITOFFSET_POS (5U) /* Value equivalent to POSITION_VAL(ADC_CHSELR_CHSEL5) */
-#define ADC_CHSELR_CHSEL6_BITOFFSET_POS (6U) /* Value equivalent to POSITION_VAL(ADC_CHSELR_CHSEL6) */
-#define ADC_CHSELR_CHSEL7_BITOFFSET_POS (7U) /* Value equivalent to POSITION_VAL(ADC_CHSELR_CHSEL7) */
-#define ADC_CHSELR_CHSEL8_BITOFFSET_POS (8U) /* Value equivalent to POSITION_VAL(ADC_CHSELR_CHSEL8) */
-#define ADC_CHSELR_CHSEL9_BITOFFSET_POS (9U) /* Value equivalent to POSITION_VAL(ADC_CHSELR_CHSEL9) */
-#define ADC_CHSELR_CHSEL10_BITOFFSET_POS (10U) /* Value equivalent to POSITION_VAL(ADC_CHSELR_CHSEL10) */
-#define ADC_CHSELR_CHSEL11_BITOFFSET_POS (11U) /* Value equivalent to POSITION_VAL(ADC_CHSELR_CHSEL11) */
-#define ADC_CHSELR_CHSEL12_BITOFFSET_POS (12U) /* Value equivalent to POSITION_VAL(ADC_CHSELR_CHSEL12) */
-#define ADC_CHSELR_CHSEL13_BITOFFSET_POS (13U) /* Value equivalent to POSITION_VAL(ADC_CHSELR_CHSEL13) */
-#define ADC_CHSELR_CHSEL14_BITOFFSET_POS (14U) /* Value equivalent to POSITION_VAL(ADC_CHSELR_CHSEL14) */
-#define ADC_CHSELR_CHSEL15_BITOFFSET_POS (15U) /* Value equivalent to POSITION_VAL(ADC_CHSELR_CHSEL15) */
-#if defined(ADC_CCR_VLCDEN)
-#define ADC_CHSELR_CHSEL16_BITOFFSET_POS (16U) /* Value equivalent to POSITION_VAL(ADC_CHSELR_CHSEL16) */
-#endif
-#define ADC_CHSELR_CHSEL17_BITOFFSET_POS (17U) /* Value equivalent to POSITION_VAL(ADC_CHSELR_CHSEL17) */
-#define ADC_CHSELR_CHSEL18_BITOFFSET_POS (18U) /* Value equivalent to POSITION_VAL(ADC_CHSELR_CHSEL18) */
-
-
-/* ADC registers bits groups */
-#define ADC_CR_BITS_PROPERTY_RS (ADC_CR_ADCAL | ADC_CR_ADSTP | ADC_CR_ADSTART | ADC_CR_ADDIS | ADC_CR_ADEN) /* ADC register CR bits with HW property "rs": Software can read as well as set this bit. Writing '0' has no effect on the bit value. */
-
-
-/* ADC internal channels related definitions */
-/* Internal voltage reference VrefInt */
-#define VREFINT_CAL_ADDR ((uint16_t*) (0x1FF80078U)) /* Internal voltage reference, address of parameter VREFINT_CAL: VrefInt ADC raw data acquired at temperature 30 DegC (tolerance: +-5 DegC), Vref+ = 3.0 V (tolerance: +-10 mV). */
-#define VREFINT_CAL_VREF (3000U) /* Analog voltage reference (Vref+) value with which temperature sensor has been calibrated in production (tolerance: +-10 mV) (unit: mV). */
-/* Temperature sensor */
-/* Note: On device STM32L011, calibration parameter TS_CAL1 is not available. */
-#if !defined(STM32L011xx)
-#define TEMPSENSOR_CAL1_ADDR ((uint16_t*) (0x1FF8007AU)) /* Internal temperature sensor, address of parameter TS_CAL1: On STM32L0, temperature sensor ADC raw data acquired at temperature 30 DegC (tolerance: +-5 DegC), Vref+ = 3.0 V (tolerance: +-10 mV). */
-#endif
-#define TEMPSENSOR_CAL2_ADDR ((uint16_t*) (0x1FF8007EU)) /* Internal temperature sensor, address of parameter TS_CAL2: On STM32L0, temperature sensor ADC raw data acquired at temperature 130 DegC (tolerance: +-5 DegC), Vref+ = 3.0 V (tolerance: +-10 mV). */
-#if !defined(STM32L011xx)
-#define TEMPSENSOR_CAL1_TEMP (30U) /* Internal temperature sensor, temperature at which temperature sensor has been calibrated in production for data into TEMPSENSOR_CAL1_ADDR (tolerance: +-5 DegC) (unit: DegC). */
-#endif
-#define TEMPSENSOR_CAL2_TEMP (130U) /* Internal temperature sensor, temperature at which temperature sensor has been calibrated in production for data into TEMPSENSOR_CAL2_ADDR (tolerance: +-5 DegC) (unit: DegC). */
-#define TEMPSENSOR_CAL_VREFANALOG (3000U) /* Analog voltage reference (Vref+) voltage with which temperature sensor has been calibrated in production (+-10 mV) (unit: mV). */
-
-
-/**
- * @}
- */
-
-
-#if defined(USE_FULL_LL_DRIVER)
-/* Private macros ------------------------------------------------------------*/
-/** @defgroup ADC_LL_Private_Macros ADC Private Macros
- * @{
- */
-
-
-/**
- * @}
- */
-
-#endif
-
-/* Exported types ------------------------------------------------------------*/
-#if defined(USE_FULL_LL_DRIVER)
-/** @defgroup ADC_LL_ES_INIT ADC Exported Init structure
- * @{
- */
-
-/**
- * @brief Structure definition of some features of ADC common parameters
- * and multimode
- * (all ADC instances belonging to the same ADC common instance).
- * @note The setting of these parameters by function @ref LL_ADC_CommonInit()
- * is conditioned to ADC instances state (all ADC instances
- * sharing the same ADC common instance):
- * All ADC instances sharing the same ADC common instance must be
- * disabled.
- */
-typedef struct
-{
- uint32_t CommonClock; /*!< Set parameter common to several ADC: Clock source and prescaler.
- This parameter can be a value of @ref ADC_LL_EC_COMMON_CLOCK_SOURCE
-
- This feature can be modified afterwards using unitary function @ref LL_ADC_SetCommonClock(). */
-
-} LL_ADC_CommonInitTypeDef;
-
-/**
- * @brief Structure definition of some features of ADC instance.
- * @note These parameters have an impact on ADC scope: ADC instance.
- * Refer to corresponding unitary functions into
- * @ref ADC_LL_EF_Configuration_ADC_Instance .
- * @note The setting of these parameters by function @ref LL_ADC_Init()
- * is conditioned to ADC state:
- * ADC instance must be disabled.
- * This condition is applied to all ADC features, for efficiency
- * and compatibility over all STM32 families. However, the different
- * features can be set under different ADC state conditions
- * (setting possible with ADC enabled without conversion on going,
- * ADC enabled with conversion on going, ...)
- * Each feature can be updated afterwards with a unitary function
- * and potentially with ADC in a different state than disabled,
- * refer to description of each function for setting
- * conditioned to ADC state.
- */
-typedef struct
-{
- uint32_t Clock; /*!< Set ADC instance clock source and prescaler.
- This parameter can be a value of @ref ADC_LL_EC_CLOCK_SOURCE
- @note On this STM32 serie, this parameter has some clock ratio constraints:
- ADC clock synchronous (from PCLK) with prescaler 1 must be enabled only if PCLK has a 50% duty clock cycle
- (APB prescaler configured inside the RCC must be bypassed and the system clock must by 50% duty cycle).
-
-
- This feature can be modified afterwards using unitary function @ref LL_ADC_SetClock().
- For more details, refer to description of this function. */
-
- uint32_t Resolution; /*!< Set ADC resolution.
- This parameter can be a value of @ref ADC_LL_EC_RESOLUTION
-
- This feature can be modified afterwards using unitary function @ref LL_ADC_SetResolution(). */
-
- uint32_t DataAlignment; /*!< Set ADC conversion data alignment.
- This parameter can be a value of @ref ADC_LL_EC_DATA_ALIGN
-
- This feature can be modified afterwards using unitary function @ref LL_ADC_SetDataAlignment(). */
-
- uint32_t LowPowerMode; /*!< Set ADC low power mode.
- This parameter can be a value of @ref ADC_LL_EC_LP_MODE
-
- This feature can be modified afterwards using unitary function @ref LL_ADC_SetLowPowerMode(). */
-
-} LL_ADC_InitTypeDef;
-
-/**
- * @brief Structure definition of some features of ADC group regular.
- * @note These parameters have an impact on ADC scope: ADC group regular.
- * Refer to corresponding unitary functions into
- * @ref ADC_LL_EF_Configuration_ADC_Group_Regular
- * (functions with prefix "REG").
- * @note The setting of these parameters by function @ref LL_ADC_REG_Init()
- * is conditioned to ADC state:
- * ADC instance must be disabled.
- * This condition is applied to all ADC features, for efficiency
- * and compatibility over all STM32 families. However, the different
- * features can be set under different ADC state conditions
- * (setting possible with ADC enabled without conversion on going,
- * ADC enabled with conversion on going, ...)
- * Each feature can be updated afterwards with a unitary function
- * and potentially with ADC in a different state than disabled,
- * refer to description of each function for setting
- * conditioned to ADC state.
- */
-typedef struct
-{
- uint32_t TriggerSource; /*!< Set ADC group regular conversion trigger source: internal (SW start) or from external peripheral (timer event, external interrupt line).
- This parameter can be a value of @ref ADC_LL_EC_REG_TRIGGER_SOURCE
- @note On this STM32 serie, setting trigger source to external trigger also set trigger polarity to rising edge
- (default setting for compatibility with some ADC on other STM32 families having this setting set by HW default value).
- In case of need to modify trigger edge, use function @ref LL_ADC_REG_SetTriggerEdge().
-
- This feature can be modified afterwards using unitary function @ref LL_ADC_REG_SetTriggerSource(). */
-
- uint32_t SequencerDiscont; /*!< Set ADC group regular sequencer discontinuous mode: sequence subdivided and scan conversions interrupted every selected number of ranks.
- This parameter can be a value of @ref ADC_LL_EC_REG_SEQ_DISCONT_MODE
- @note This parameter has an effect only if group regular sequencer is enabled
- (several ADC channels enabled in group regular sequencer).
-
- This feature can be modified afterwards using unitary function @ref LL_ADC_REG_SetSequencerDiscont(). */
-
- uint32_t ContinuousMode; /*!< Set ADC continuous conversion mode on ADC group regular, whether ADC conversions are performed in single mode (one conversion per trigger) or in continuous mode (after the first trigger, following conversions launched successively automatically).
- This parameter can be a value of @ref ADC_LL_EC_REG_CONTINUOUS_MODE
- Note: It is not possible to enable both ADC group regular continuous mode and discontinuous mode.
-
- This feature can be modified afterwards using unitary function @ref LL_ADC_REG_SetContinuousMode(). */
-
- uint32_t DMATransfer; /*!< Set ADC group regular conversion data transfer: no transfer or transfer by DMA, and DMA requests mode.
- This parameter can be a value of @ref ADC_LL_EC_REG_DMA_TRANSFER
-
- This feature can be modified afterwards using unitary function @ref LL_ADC_REG_SetDMATransfer(). */
-
- uint32_t Overrun; /*!< Set ADC group regular behavior in case of overrun:
- data preserved or overwritten.
- This parameter can be a value of @ref ADC_LL_EC_REG_OVR_DATA_BEHAVIOR
-
- This feature can be modified afterwards using unitary function @ref LL_ADC_REG_SetOverrun(). */
-
-} LL_ADC_REG_InitTypeDef;
-
-/**
- * @}
- */
-#endif /* USE_FULL_LL_DRIVER */
-
-/* Exported constants --------------------------------------------------------*/
-/** @defgroup ADC_LL_Exported_Constants ADC Exported Constants
- * @{
- */
-
-/** @defgroup ADC_LL_EC_FLAG ADC flags
- * @brief Flags defines which can be used with LL_ADC_ReadReg function
- * @{
- */
-#define LL_ADC_FLAG_ADRDY ADC_ISR_ADRDY /*!< ADC flag ADC instance ready */
-#define LL_ADC_FLAG_EOC ADC_ISR_EOC /*!< ADC flag ADC group regular end of unitary conversion */
-#define LL_ADC_FLAG_EOS ADC_ISR_EOS /*!< ADC flag ADC group regular end of sequence conversions */
-#define LL_ADC_FLAG_OVR ADC_ISR_OVR /*!< ADC flag ADC group regular overrun */
-#define LL_ADC_FLAG_EOSMP ADC_ISR_EOSMP /*!< ADC flag ADC group regular end of sampling phase */
-#define LL_ADC_FLAG_AWD1 ADC_ISR_AWD /*!< ADC flag ADC analog watchdog 1 */
-#define LL_ADC_FLAG_EOCAL ADC_ISR_EOCAL /*!< ADC flag end of calibration */
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EC_IT ADC interruptions for configuration (interruption enable or disable)
- * @brief IT defines which can be used with LL_ADC_ReadReg and LL_ADC_WriteReg functions
- * @{
- */
-#define LL_ADC_IT_ADRDY ADC_IER_ADRDYIE /*!< ADC interruption ADC instance ready */
-#define LL_ADC_IT_EOC ADC_IER_EOCIE /*!< ADC interruption ADC group regular end of unitary conversion */
-#define LL_ADC_IT_EOS ADC_IER_EOSIE /*!< ADC interruption ADC group regular end of sequence conversions */
-#define LL_ADC_IT_OVR ADC_IER_OVRIE /*!< ADC interruption ADC group regular overrun */
-#define LL_ADC_IT_EOSMP ADC_IER_EOSMPIE /*!< ADC interruption ADC group regular end of sampling phase */
-#define LL_ADC_IT_AWD1 ADC_IER_AWDIE /*!< ADC interruption ADC analog watchdog 1 */
-#define LL_ADC_IT_EOCAL ADC_IER_EOCALIE /*!< ADC interruption ADC end of calibration */
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EC_REGISTERS ADC registers compliant with specific purpose
- * @{
- */
-/* List of ADC registers intended to be used (most commonly) with */
-/* DMA transfer. */
-/* Refer to function @ref LL_ADC_DMA_GetRegAddr(). */
-#define LL_ADC_DMA_REG_REGULAR_DATA (0x00000000U) /* ADC group regular conversion data register (corresponding to register DR) to be used with ADC configured in independent mode. Without DMA transfer, register accessed by LL function @ref LL_ADC_REG_ReadConversionData32() and other functions @ref LL_ADC_REG_ReadConversionDatax() */
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EC_COMMON_CLOCK_SOURCE ADC common - Clock source
- * @{
- */
-#define LL_ADC_CLOCK_ASYNC_DIV1 (0x00000000U) /*!< ADC asynchronous clock without prescaler */
-#define LL_ADC_CLOCK_ASYNC_DIV2 (ADC_CCR_PRESC_0) /*!< ADC asynchronous clock with prescaler division by 2. ADC common clock asynchronous prescaler is applied to each ADC instance if the corresponding ADC instance clock is set to clock source asynchronous (refer to function @ref LL_ADC_SetClock() ). */
-#define LL_ADC_CLOCK_ASYNC_DIV4 (ADC_CCR_PRESC_1 ) /*!< ADC asynchronous clock with prescaler division by 4. ADC common clock asynchronous prescaler is applied to each ADC instance if the corresponding ADC instance clock is set to clock source asynchronous (refer to function @ref LL_ADC_SetClock() ). */
-#define LL_ADC_CLOCK_ASYNC_DIV6 (ADC_CCR_PRESC_1 | ADC_CCR_PRESC_0) /*!< ADC asynchronous clock with prescaler division by 6. ADC common clock asynchronous prescaler is applied to each ADC instance if the corresponding ADC instance clock is set to clock source asynchronous (refer to function @ref LL_ADC_SetClock() ). */
-#define LL_ADC_CLOCK_ASYNC_DIV8 (ADC_CCR_PRESC_2 ) /*!< ADC asynchronous clock with prescaler division by 8. ADC common clock asynchronous prescaler is applied to each ADC instance if the corresponding ADC instance clock is set to clock source asynchronous (refer to function @ref LL_ADC_SetClock() ). */
-#define LL_ADC_CLOCK_ASYNC_DIV10 (ADC_CCR_PRESC_2 | ADC_CCR_PRESC_0) /*!< ADC asynchronous clock with prescaler division by 10. ADC common clock asynchronous prescaler is applied to each ADC instance if the corresponding ADC instance clock is set to clock source asynchronous (refer to function @ref LL_ADC_SetClock() ). */
-#define LL_ADC_CLOCK_ASYNC_DIV12 (ADC_CCR_PRESC_2 | ADC_CCR_PRESC_1 ) /*!< ADC asynchronous clock with prescaler division by 12. ADC common clock asynchronous prescaler is applied to each ADC instance if the corresponding ADC instance clock is set to clock source asynchronous (refer to function @ref LL_ADC_SetClock() ). */
-#define LL_ADC_CLOCK_ASYNC_DIV16 (ADC_CCR_PRESC_2 | ADC_CCR_PRESC_1 | ADC_CCR_PRESC_0) /*!< ADC asynchronous clock with prescaler division by 16. ADC common clock asynchronous prescaler is applied to each ADC instance if the corresponding ADC instance clock is set to clock source asynchronous (refer to function @ref LL_ADC_SetClock() ). */
-#define LL_ADC_CLOCK_ASYNC_DIV32 (ADC_CCR_PRESC_3) /*!< ADC asynchronous clock with prescaler division by 32. ADC common clock asynchronous prescaler is applied to each ADC instance if the corresponding ADC instance clock is set to clock source asynchronous (refer to function @ref LL_ADC_SetClock() ). */
-#define LL_ADC_CLOCK_ASYNC_DIV64 (ADC_CCR_PRESC_3 | ADC_CCR_PRESC_0) /*!< ADC asynchronous clock with prescaler division by 64. ADC common clock asynchronous prescaler is applied to each ADC instance if the corresponding ADC instance clock is set to clock source asynchronous (refer to function @ref LL_ADC_SetClock() ). */
-#define LL_ADC_CLOCK_ASYNC_DIV128 (ADC_CCR_PRESC_3 | ADC_CCR_PRESC_1) /*!< ADC asynchronous clock with prescaler division by 128. ADC common clock asynchronous prescaler is applied to each ADC instance if the corresponding ADC instance clock is set to clock source asynchronous (refer to function @ref LL_ADC_SetClock() ). */
-#define LL_ADC_CLOCK_ASYNC_DIV256 (ADC_CCR_PRESC_3 | ADC_CCR_PRESC_1 | ADC_CCR_PRESC_0) /*!< ADC asynchronous clock with prescaler division by 256. ADC common clock asynchronous prescaler is applied to each ADC instance if the corresponding ADC instance clock is set to clock source asynchronous (refer to function @ref LL_ADC_SetClock() ). */
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EC_COMMON_CLOCK_FREQ_MODE ADC common - Clock frequency mode
- * @{
- */
-#define LL_ADC_CLOCK_FREQ_MODE_HIGH (0x00000000U)/*!< ADC clock mode to high frequency. On STM32L0, ADC clock frequency above 2.8MHz. */
-#define LL_ADC_CLOCK_FREQ_MODE_LOW (ADC_CCR_LFMEN) /*!< ADC clock mode to low frequency. On STM32L0, ADC clock frequency below 2.8MHz. */
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EC_COMMON_PATH_INTERNAL ADC common - Measurement path to internal channels
- * @{
- */
-/* Note: Other measurement paths to internal channels may be available */
-/* (connections to other peripherals). */
-/* If they are not listed below, they do not require any specific */
-/* path enable. In this case, Access to measurement path is done */
-/* only by selecting the corresponding ADC internal channel. */
-#define LL_ADC_PATH_INTERNAL_NONE (0x00000000U)/*!< ADC measurement pathes all disabled */
-#define LL_ADC_PATH_INTERNAL_VREFINT (ADC_CCR_VREFEN) /*!< ADC measurement path to internal channel VrefInt */
-#if defined(ADC_CCR_TSEN)
-#define LL_ADC_PATH_INTERNAL_TEMPSENSOR (ADC_CCR_TSEN) /*!< ADC measurement path to internal channel temperature sensor */
-#endif
-#if defined(ADC_CCR_VLCDEN)
-#define LL_ADC_PATH_INTERNAL_VLCD (ADC_CCR_VLCDEN) /*!< ADC measurement path to internal channel Vlcd */
-#endif
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EC_CLOCK_SOURCE ADC instance - Clock source
- * @{
- */
-#define LL_ADC_CLOCK_SYNC_PCLK_DIV4 (ADC_CFGR2_CKMODE_1) /*!< ADC synchronous clock derived from AHB clock divided by 4 */
-#define LL_ADC_CLOCK_SYNC_PCLK_DIV2 (ADC_CFGR2_CKMODE_0) /*!< ADC synchronous clock derived from AHB clock divided by 2 */
-#define LL_ADC_CLOCK_SYNC_PCLK_DIV1 (ADC_CFGR2_CKMODE_1 | ADC_CFGR2_CKMODE_0) /*!< ADC synchronous clock derived from AHB clock not divided */
-#define LL_ADC_CLOCK_ASYNC (0x00000000U) /*!< ADC asynchronous clock. Asynchronous clock prescaler can be configured using function @ref LL_ADC_SetCommonClock(). */
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EC_RESOLUTION ADC instance - Resolution
- * @{
- */
-#define LL_ADC_RESOLUTION_12B (0x00000000U) /*!< ADC resolution 12 bits */
-#define LL_ADC_RESOLUTION_10B ( ADC_CFGR1_RES_0) /*!< ADC resolution 10 bits */
-#define LL_ADC_RESOLUTION_8B (ADC_CFGR1_RES_1 ) /*!< ADC resolution 8 bits */
-#define LL_ADC_RESOLUTION_6B (ADC_CFGR1_RES_1 | ADC_CFGR1_RES_0) /*!< ADC resolution 6 bits */
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EC_DATA_ALIGN ADC instance - Data alignment
- * @{
- */
-#define LL_ADC_DATA_ALIGN_RIGHT (0x00000000U)/*!< ADC conversion data alignment: right aligned (alignment on data register LSB bit 0)*/
-#define LL_ADC_DATA_ALIGN_LEFT (ADC_CFGR1_ALIGN) /*!< ADC conversion data alignment: left aligned (aligment on data register MSB bit 15)*/
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EC_LP_MODE ADC instance - Low power mode
- * @{
- */
-#define LL_ADC_LP_MODE_NONE (0x00000000U) /*!< No ADC low power mode activated */
-#define LL_ADC_LP_AUTOWAIT (ADC_CFGR1_WAIT) /*!< ADC low power mode auto delay: Dynamic low power mode, ADC conversions are performed only when necessary (when previous ADC conversion data is read). See description with function @ref LL_ADC_SetLowPowerMode(). */
-#define LL_ADC_LP_AUTOPOWEROFF (ADC_CFGR1_AUTOFF) /*!< ADC low power mode auto power-off: the ADC automatically powers-off after a ADC conversion and automatically wakes up when a new ADC conversion is triggered (with startup time between trigger and start of sampling). See description with function @ref LL_ADC_SetLowPowerMode(). */
-#define LL_ADC_LP_AUTOWAIT_AUTOPOWEROFF (ADC_CFGR1_WAIT | ADC_CFGR1_AUTOFF) /*!< ADC low power modes auto wait and auto power-off combined. See description with function @ref LL_ADC_SetLowPowerMode(). */
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EC_GROUPS ADC instance - Groups
- * @{
- */
-#define LL_ADC_GROUP_REGULAR (0x00000001U) /*!< ADC group regular (available on all STM32 devices) */
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EC_CHANNEL ADC instance - Channel number
- * @{
- */
-#define LL_ADC_CHANNEL_0 (ADC_CHANNEL_0_NUMBER | ADC_CHANNEL_0_BITFIELD ) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN0 */
-#define LL_ADC_CHANNEL_1 (ADC_CHANNEL_1_NUMBER | ADC_CHANNEL_1_BITFIELD ) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN1 */
-#define LL_ADC_CHANNEL_2 (ADC_CHANNEL_2_NUMBER | ADC_CHANNEL_2_BITFIELD ) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN2 */
-#define LL_ADC_CHANNEL_3 (ADC_CHANNEL_3_NUMBER | ADC_CHANNEL_3_BITFIELD ) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN3 */
-#define LL_ADC_CHANNEL_4 (ADC_CHANNEL_4_NUMBER | ADC_CHANNEL_4_BITFIELD ) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN4 */
-#define LL_ADC_CHANNEL_5 (ADC_CHANNEL_5_NUMBER | ADC_CHANNEL_5_BITFIELD ) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN5 */
-#define LL_ADC_CHANNEL_6 (ADC_CHANNEL_6_NUMBER | ADC_CHANNEL_6_BITFIELD ) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN6 */
-#define LL_ADC_CHANNEL_7 (ADC_CHANNEL_7_NUMBER | ADC_CHANNEL_7_BITFIELD ) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN7 */
-#define LL_ADC_CHANNEL_8 (ADC_CHANNEL_8_NUMBER | ADC_CHANNEL_8_BITFIELD ) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN8 */
-#define LL_ADC_CHANNEL_9 (ADC_CHANNEL_9_NUMBER | ADC_CHANNEL_9_BITFIELD ) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN9 */
-#define LL_ADC_CHANNEL_10 (ADC_CHANNEL_10_NUMBER | ADC_CHANNEL_10_BITFIELD) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN10 */
-#define LL_ADC_CHANNEL_11 (ADC_CHANNEL_11_NUMBER | ADC_CHANNEL_11_BITFIELD) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN11 */
-#define LL_ADC_CHANNEL_12 (ADC_CHANNEL_12_NUMBER | ADC_CHANNEL_12_BITFIELD) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN12 */
-#define LL_ADC_CHANNEL_13 (ADC_CHANNEL_13_NUMBER | ADC_CHANNEL_13_BITFIELD) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN13 */
-#define LL_ADC_CHANNEL_14 (ADC_CHANNEL_14_NUMBER | ADC_CHANNEL_14_BITFIELD) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN14 */
-#define LL_ADC_CHANNEL_15 (ADC_CHANNEL_15_NUMBER | ADC_CHANNEL_15_BITFIELD) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN15 */
-#define LL_ADC_CHANNEL_17 (ADC_CHANNEL_17_NUMBER | ADC_CHANNEL_17_BITFIELD) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN17 */
-#define LL_ADC_CHANNEL_18 (ADC_CHANNEL_18_NUMBER | ADC_CHANNEL_18_BITFIELD) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN18 */
-#define LL_ADC_CHANNEL_VREFINT (LL_ADC_CHANNEL_17 | ADC_CHANNEL_ID_INTERNAL_CH) /*!< ADC internal channel connected to VrefInt: Internal voltage reference. */
-#define LL_ADC_CHANNEL_TEMPSENSOR (LL_ADC_CHANNEL_18 | ADC_CHANNEL_ID_INTERNAL_CH) /*!< ADC internal channel connected to Temperature sensor. */
-#if defined(ADC_CCR_VLCDEN)
-#define LL_ADC_CHANNEL_16 (ADC_CHANNEL_16_NUMBER | ADC_CHANNEL_16_BITFIELD) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN16 */
-#define LL_ADC_CHANNEL_VLCD (LL_ADC_CHANNEL_16 | ADC_CHANNEL_ID_INTERNAL_CH) /*!< ADC internal channel connected to Vlcd: Vlcd voltage through a divider ladder of factor 1/4, 1/3 or 1/2 (set by LCD voltage generator biasing), to have Vlcd always below Vdda. */
-#endif
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EC_REG_TRIGGER_SOURCE ADC group regular - Trigger source
- * @{
- */
-#define LL_ADC_REG_TRIG_SOFTWARE (0x00000000U) /*!< ADC group regular conversion trigger internal: SW start. */
-#define LL_ADC_REG_TRIG_EXT_TIM6_TRGO (ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external peripheral: TIM6 TRGO. Trigger edge set to rising edge (default setting). */
-#define LL_ADC_REG_TRIG_EXT_TIM21_CH2 (ADC_CFGR1_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external peripheral: TIM21 channel 2 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
-#define LL_ADC_REG_TRIG_EXT_TIM2_TRGO (ADC_CFGR1_EXTSEL_1 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external peripheral: TIM2 TRGO. Trigger edge set to rising edge (default setting). */
-#define LL_ADC_REG_TRIG_EXT_TIM2_CH4 (ADC_CFGR1_EXTSEL_1 | ADC_CFGR1_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external peripheral: TIM2 channel 4 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
-#define LL_ADC_REG_TRIG_EXT_TIM22_TRGO (ADC_CFGR1_EXTSEL_2 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external peripheral: TIM22 TRGO. Trigger edge set to rising edge (default setting). */
-#define LL_ADC_REG_TRIG_EXT_TIM3_TRGO (ADC_CFGR1_EXTSEL_2 | ADC_CFGR1_EXTSEL_1 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external peripheral: TIM3 TRG0. Trigger edge set to rising edge (default setting). */
-#define LL_ADC_REG_TRIG_EXT_EXTI_LINE11 (ADC_CFGR1_EXTSEL_2 | ADC_CFGR1_EXTSEL_1 | ADC_CFGR1_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external peripheral: external interrupt line 11. Trigger edge set to rising edge (default setting). */
-
-/* ADC group regular external trigger TIM2_CC3 available only on */
-/* STM32L0 devices categories: Cat.1, Cat.2, Cat.5 */
-#if defined (STM32L011xx) || defined (STM32L021xx) || \
- defined (STM32L031xx) || defined (STM32L041xx) || \
- defined (STM32L071xx) || defined (STM32L072xx) || defined (STM32L073xx) || \
- defined (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx) || \
- defined (STM32L010x6) || defined (STM32L010x8) || defined (STM32L010xB)
-#define LL_ADC_REG_TRIG_EXT_TIM2_CH3 (ADC_CFGR1_EXTSEL_2 | ADC_CFGR1_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external peripheral: TIM2 channel 4 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
-#endif
-
-/* ADC group regular external trigger TIM21_TRGO available only on */
-/* STM32L0 devices categories: Cat.2, Cat.3, Cat.5 */
-#if defined (STM32L031xx) || defined (STM32L041xx) || \
- defined (STM32L051xx) || defined (STM32L052xx) || defined (STM32L053xx) || \
- defined (STM32L062xx) || defined (STM32L063xx) || \
- defined (STM32L071xx) || defined (STM32L072xx) || defined (STM32L073xx) || \
- defined (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx) || \
- defined (STM32L010x6) || defined (STM32L010x8) || defined (STM32L010xB)
-#define LL_ADC_REG_TRIG_EXT_TIM21_TRGO (LL_ADC_REG_TRIG_EXT_TIM22_TRGO)
-#endif
-
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EC_REG_TRIGGER_EDGE ADC group regular - Trigger edge
- * @{
- */
-#define LL_ADC_REG_TRIG_EXT_RISING ( ADC_CFGR1_EXTEN_0) /*!< ADC group regular conversion trigger polarity set to rising edge */
-#define LL_ADC_REG_TRIG_EXT_FALLING (ADC_CFGR1_EXTEN_1 ) /*!< ADC group regular conversion trigger polarity set to falling edge */
-#define LL_ADC_REG_TRIG_EXT_RISINGFALLING (ADC_CFGR1_EXTEN_1 | ADC_CFGR1_EXTEN_0) /*!< ADC group regular conversion trigger polarity set to both rising and falling edges */
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EC_REG_CONTINUOUS_MODE ADC group regular - Continuous mode
-* @{
-*/
-#define LL_ADC_REG_CONV_SINGLE (0x00000000U) /*!< ADC conversions are performed in single mode: one conversion per trigger */
-#define LL_ADC_REG_CONV_CONTINUOUS (ADC_CFGR1_CONT) /*!< ADC conversions are performed in continuous mode: after the first trigger, following conversions launched successively automatically */
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EC_REG_DMA_TRANSFER ADC group regular - DMA transfer of ADC conversion data
- * @{
- */
-#define LL_ADC_REG_DMA_TRANSFER_NONE (0x00000000U) /*!< ADC conversions are not transferred by DMA */
-#define LL_ADC_REG_DMA_TRANSFER_LIMITED ( ADC_CFGR1_DMAEN) /*!< ADC conversion data are transferred by DMA, in limited mode (one shot mode): DMA transfer requests are stopped when number of DMA data transfers (number of ADC conversions) is reached. This ADC mode is intended to be used with DMA mode non-circular. */
-#define LL_ADC_REG_DMA_TRANSFER_UNLIMITED (ADC_CFGR1_DMACFG | ADC_CFGR1_DMAEN) /*!< ADC conversion data are transferred by DMA, in unlimited mode: DMA transfer requests are unlimited, whatever number of DMA data transferred (number of ADC conversions). This ADC mode is intended to be used with DMA mode circular. */
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EC_REG_OVR_DATA_BEHAVIOR ADC group regular - Overrun behavior on conversion data
-* @{
-*/
-#define LL_ADC_REG_OVR_DATA_PRESERVED (0x00000000U) /*!< ADC group regular behavior in case of overrun: data preserved */
-#define LL_ADC_REG_OVR_DATA_OVERWRITTEN (ADC_CFGR1_OVRMOD) /*!< ADC group regular behavior in case of overrun: data overwritten */
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EC_REG_SEQ_SCAN_DIRECTION ADC group regular - Sequencer scan direction
- * @{
- */
-#define LL_ADC_REG_SEQ_SCAN_DIR_FORWARD (0x00000000U) /*!< ADC group regular sequencer scan direction forward: from lowest channel number to highest channel number (scan of all ranks, ADC conversion of ranks with channels enabled in sequencer). On some other STM32 families, this setting is not available and the default scan direction is forward. */
-#define LL_ADC_REG_SEQ_SCAN_DIR_BACKWARD (ADC_CFGR1_SCANDIR) /*!< ADC group regular sequencer scan direction backward: from highest channel number to lowest channel number (scan of all ranks, ADC conversion of ranks with channels enabled in sequencer) */
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EC_REG_SEQ_DISCONT_MODE ADC group regular - Sequencer discontinuous mode
- * @{
- */
-#define LL_ADC_REG_SEQ_DISCONT_DISABLE (0x00000000U) /*!< ADC group regular sequencer discontinuous mode disable */
-#define LL_ADC_REG_SEQ_DISCONT_1RANK (ADC_CFGR1_DISCEN) /*!< ADC group regular sequencer discontinuous mode enable with sequence interruption every rank */
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EC_CHANNEL_SAMPLINGTIME Channel - Sampling time
- * @{
- */
-#define LL_ADC_SAMPLINGTIME_1CYCLE_5 (0x00000000U) /*!< Sampling time 1.5 ADC clock cycle */
-#define LL_ADC_SAMPLINGTIME_3CYCLES_5 (ADC_SMPR_SMP_0) /*!< Sampling time 3.5 ADC clock cycles */
-#define LL_ADC_SAMPLINGTIME_7CYCLES_5 (ADC_SMPR_SMP_1) /*!< Sampling time 7.5 ADC clock cycles */
-#define LL_ADC_SAMPLINGTIME_12CYCLES_5 (ADC_SMPR_SMP_1 | ADC_SMPR_SMP_0) /*!< Sampling time 12.5 ADC clock cycles */
-#define LL_ADC_SAMPLINGTIME_19CYCLES_5 (ADC_SMPR_SMP_2) /*!< Sampling time 19.5 ADC clock cycles */
-#define LL_ADC_SAMPLINGTIME_39CYCLES_5 (ADC_SMPR_SMP_2 | ADC_SMPR_SMP_0) /*!< Sampling time 39.5 ADC clock cycles */
-#define LL_ADC_SAMPLINGTIME_79CYCLES_5 (ADC_SMPR_SMP_2 | ADC_SMPR_SMP_1) /*!< Sampling time 79.5 ADC clock cycles */
-#define LL_ADC_SAMPLINGTIME_160CYCLES_5 (ADC_SMPR_SMP_2 | ADC_SMPR_SMP_1 | ADC_SMPR_SMP_0) /*!< Sampling time 160.5 ADC clock cycles */
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EC_AWD_NUMBER Analog watchdog - Analog watchdog number
- * @{
- */
-#define LL_ADC_AWD1 (ADC_AWD_CR1_CHANNEL_MASK | ADC_AWD_CR1_REGOFFSET) /*!< ADC analog watchdog number 1 */
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EC_AWD_CHANNELS Analog watchdog - Monitored channels
- * @{
- */
-#define LL_ADC_AWD_DISABLE (0x00000000U) /*!< ADC analog watchdog monitoring disabled */
-#define LL_ADC_AWD_ALL_CHANNELS_REG ( ADC_CFGR1_AWDEN ) /*!< ADC analog watchdog monitoring of all channels, converted by group regular only */
-#define LL_ADC_AWD_CHANNEL_0_REG ((LL_ADC_CHANNEL_0 & ADC_CHANNEL_ID_MASK) | ADC_CFGR1_AWDEN | ADC_CFGR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN0, converted by group regular only */
-#define LL_ADC_AWD_CHANNEL_1_REG ((LL_ADC_CHANNEL_1 & ADC_CHANNEL_ID_MASK) | ADC_CFGR1_AWDEN | ADC_CFGR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN1, converted by group regular only */
-#define LL_ADC_AWD_CHANNEL_2_REG ((LL_ADC_CHANNEL_2 & ADC_CHANNEL_ID_MASK) | ADC_CFGR1_AWDEN | ADC_CFGR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN2, converted by group regular only */
-#define LL_ADC_AWD_CHANNEL_3_REG ((LL_ADC_CHANNEL_3 & ADC_CHANNEL_ID_MASK) | ADC_CFGR1_AWDEN | ADC_CFGR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN3, converted by group regular only */
-#define LL_ADC_AWD_CHANNEL_4_REG ((LL_ADC_CHANNEL_4 & ADC_CHANNEL_ID_MASK) | ADC_CFGR1_AWDEN | ADC_CFGR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN4, converted by group regular only */
-#define LL_ADC_AWD_CHANNEL_5_REG ((LL_ADC_CHANNEL_5 & ADC_CHANNEL_ID_MASK) | ADC_CFGR1_AWDEN | ADC_CFGR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN5, converted by group regular only */
-#define LL_ADC_AWD_CHANNEL_6_REG ((LL_ADC_CHANNEL_6 & ADC_CHANNEL_ID_MASK) | ADC_CFGR1_AWDEN | ADC_CFGR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN6, converted by group regular only */
-#define LL_ADC_AWD_CHANNEL_7_REG ((LL_ADC_CHANNEL_7 & ADC_CHANNEL_ID_MASK) | ADC_CFGR1_AWDEN | ADC_CFGR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN7, converted by group regular only */
-#define LL_ADC_AWD_CHANNEL_8_REG ((LL_ADC_CHANNEL_8 & ADC_CHANNEL_ID_MASK) | ADC_CFGR1_AWDEN | ADC_CFGR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN8, converted by group regular only */
-#define LL_ADC_AWD_CHANNEL_9_REG ((LL_ADC_CHANNEL_9 & ADC_CHANNEL_ID_MASK) | ADC_CFGR1_AWDEN | ADC_CFGR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN9, converted by group regular only */
-#define LL_ADC_AWD_CHANNEL_10_REG ((LL_ADC_CHANNEL_10 & ADC_CHANNEL_ID_MASK) | ADC_CFGR1_AWDEN | ADC_CFGR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN10, converted by group regular only */
-#define LL_ADC_AWD_CHANNEL_11_REG ((LL_ADC_CHANNEL_11 & ADC_CHANNEL_ID_MASK) | ADC_CFGR1_AWDEN | ADC_CFGR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN11, converted by group regular only */
-#define LL_ADC_AWD_CHANNEL_12_REG ((LL_ADC_CHANNEL_12 & ADC_CHANNEL_ID_MASK) | ADC_CFGR1_AWDEN | ADC_CFGR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN12, converted by group regular only */
-#define LL_ADC_AWD_CHANNEL_13_REG ((LL_ADC_CHANNEL_13 & ADC_CHANNEL_ID_MASK) | ADC_CFGR1_AWDEN | ADC_CFGR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN13, converted by group regular only */
-#define LL_ADC_AWD_CHANNEL_14_REG ((LL_ADC_CHANNEL_14 & ADC_CHANNEL_ID_MASK) | ADC_CFGR1_AWDEN | ADC_CFGR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN14, converted by group regular only */
-#define LL_ADC_AWD_CHANNEL_15_REG ((LL_ADC_CHANNEL_15 & ADC_CHANNEL_ID_MASK) | ADC_CFGR1_AWDEN | ADC_CFGR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN15, converted by group regular only */
-#define LL_ADC_AWD_CHANNEL_17_REG ((LL_ADC_CHANNEL_17 & ADC_CHANNEL_ID_MASK) | ADC_CFGR1_AWDEN | ADC_CFGR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN17, converted by group regular only */
-#define LL_ADC_AWD_CHANNEL_18_REG ((LL_ADC_CHANNEL_18 & ADC_CHANNEL_ID_MASK) | ADC_CFGR1_AWDEN | ADC_CFGR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN18, converted by group regular only */
-#define LL_ADC_AWD_CH_VREFINT_REG ((LL_ADC_CHANNEL_VREFINT & ADC_CHANNEL_ID_MASK) | ADC_CFGR1_AWDEN | ADC_CFGR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to VrefInt: Internal voltage reference, converted by group regular only */
-#define LL_ADC_AWD_CH_TEMPSENSOR_REG ((LL_ADC_CHANNEL_TEMPSENSOR & ADC_CHANNEL_ID_MASK) | ADC_CFGR1_AWDEN | ADC_CFGR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to Temperature sensor, converted by group regular only */
-#if defined(ADC_CCR_VLCDEN)
-#define LL_ADC_AWD_CHANNEL_16_REG ((LL_ADC_CHANNEL_16 & ADC_CHANNEL_ID_MASK) | ADC_CFGR1_AWDEN | ADC_CFGR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN16, converted by group regular only */
-#define LL_ADC_AWD_CH_VLCD_REG ((LL_ADC_CHANNEL_VLCD & ADC_CHANNEL_ID_MASK) | ADC_CFGR1_AWDEN | ADC_CFGR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to Vbat/3: Vbat voltage through a divider ladder of factor 1/3 to have Vbat always below Vdda, converted by group regular only */
-#endif
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EC_AWD_THRESHOLDS Analog watchdog - Thresholds
- * @{
- */
-#define LL_ADC_AWD_THRESHOLD_HIGH (ADC_TR_HT ) /*!< ADC analog watchdog threshold high */
-#define LL_ADC_AWD_THRESHOLD_LOW ( ADC_TR_LT) /*!< ADC analog watchdog threshold low */
-#define LL_ADC_AWD_THRESHOLDS_HIGH_LOW (ADC_TR_HT | ADC_TR_LT) /*!< ADC analog watchdog both thresholds high and low concatenated into the same data */
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EC_OVS_SCOPE Oversampling - Oversampling scope
- * @{
- */
-#define LL_ADC_OVS_DISABLE (0x00000000U) /*!< ADC oversampling disabled. */
-#define LL_ADC_OVS_GRP_REGULAR_CONTINUED ( ADC_CFGR2_OVSE) /*!< ADC oversampling on conversions of ADC group regular. Literal suffix "continued" is kept for compatibility with other STM32 devices featuring ADC group injected, in this case other oversampling scope parameters are available. */
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EC_OVS_DISCONT_MODE Oversampling - Discontinuous mode
- * @{
- */
-#define LL_ADC_OVS_REG_CONT (0x00000000U) /*!< ADC oversampling discontinuous mode: continuous mode (all conversions of oversampling ratio are done from 1 trigger) */
-#define LL_ADC_OVS_REG_DISCONT (ADC_CFGR2_TOVS) /*!< ADC oversampling discontinuous mode: discontinuous mode (each conversion of oversampling ratio needs a trigger) */
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EC_OVS_RATIO Oversampling - Ratio
- * @{
- */
-#define LL_ADC_OVS_RATIO_2 (0x00000000U) /*!< ADC oversampling ratio of 2 (2 ADC conversions are performed, sum of these conversions data is computed to result as the ADC oversampling conversion data (before potential shift) */
-#define LL_ADC_OVS_RATIO_4 ( ADC_CFGR2_OVSR_0) /*!< ADC oversampling ratio of 4 (4 ADC conversions are performed, sum of these conversions data is computed to result as the ADC oversampling conversion data (before potential shift) */
-#define LL_ADC_OVS_RATIO_8 ( ADC_CFGR2_OVSR_1 ) /*!< ADC oversampling ratio of 8 (8 ADC conversions are performed, sum of these conversions data is computed to result as the ADC oversampling conversion data (before potential shift) */
-#define LL_ADC_OVS_RATIO_16 ( ADC_CFGR2_OVSR_1 | ADC_CFGR2_OVSR_0) /*!< ADC oversampling ratio of 16 (16 ADC conversions are performed, sum of these conversions data is computed to result as the ADC oversampling conversion data (before potential shift) */
-#define LL_ADC_OVS_RATIO_32 (ADC_CFGR2_OVSR_2 ) /*!< ADC oversampling ratio of 32 (32 ADC conversions are performed, sum of these conversions data is computed to result as the ADC oversampling conversion data (before potential shift) */
-#define LL_ADC_OVS_RATIO_64 (ADC_CFGR2_OVSR_2 | ADC_CFGR2_OVSR_0) /*!< ADC oversampling ratio of 64 (64 ADC conversions are performed, sum of these conversions data is computed to result as the ADC oversampling conversion data (before potential shift) */
-#define LL_ADC_OVS_RATIO_128 (ADC_CFGR2_OVSR_2 | ADC_CFGR2_OVSR_1 ) /*!< ADC oversampling ratio of 128 (128 ADC conversions are performed, sum of these conversions data is computed to result as the ADC oversampling conversion data (before potential shift) */
-#define LL_ADC_OVS_RATIO_256 (ADC_CFGR2_OVSR_2 | ADC_CFGR2_OVSR_1 | ADC_CFGR2_OVSR_0) /*!< ADC oversampling ratio of 256 (256 ADC conversions are performed, sum of these conversions data is computed to result as the ADC oversampling conversion data (before potential shift) */
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EC_OVS_SHIFT Oversampling - Data shift
- * @{
- */
-#define LL_ADC_OVS_SHIFT_NONE (0x00000000U) /*!< ADC oversampling no shift (sum of the ADC conversions data is not divided to result as the ADC oversampling conversion data) */
-#define LL_ADC_OVS_SHIFT_RIGHT_1 ( ADC_CFGR2_OVSS_0) /*!< ADC oversampling shift of 1 (sum of the ADC conversions data is divided by 2 to result as the ADC oversampling conversion data) */
-#define LL_ADC_OVS_SHIFT_RIGHT_2 ( ADC_CFGR2_OVSS_1 ) /*!< ADC oversampling shift of 2 (sum of the ADC conversions data is divided by 4 to result as the ADC oversampling conversion data) */
-#define LL_ADC_OVS_SHIFT_RIGHT_3 ( ADC_CFGR2_OVSS_1 | ADC_CFGR2_OVSS_0) /*!< ADC oversampling shift of 3 (sum of the ADC conversions data is divided by 8 to result as the ADC oversampling conversion data) */
-#define LL_ADC_OVS_SHIFT_RIGHT_4 ( ADC_CFGR2_OVSS_2 ) /*!< ADC oversampling shift of 4 (sum of the ADC conversions data is divided by 16 to result as the ADC oversampling conversion data) */
-#define LL_ADC_OVS_SHIFT_RIGHT_5 ( ADC_CFGR2_OVSS_2 | ADC_CFGR2_OVSS_0) /*!< ADC oversampling shift of 5 (sum of the ADC conversions data is divided by 32 to result as the ADC oversampling conversion data) */
-#define LL_ADC_OVS_SHIFT_RIGHT_6 ( ADC_CFGR2_OVSS_2 | ADC_CFGR2_OVSS_1 ) /*!< ADC oversampling shift of 6 (sum of the ADC conversions data is divided by 64 to result as the ADC oversampling conversion data) */
-#define LL_ADC_OVS_SHIFT_RIGHT_7 ( ADC_CFGR2_OVSS_2 | ADC_CFGR2_OVSS_1 | ADC_CFGR2_OVSS_0) /*!< ADC oversampling shift of 7 (sum of the ADC conversions data is divided by 128 to result as the ADC oversampling conversion data) */
-#define LL_ADC_OVS_SHIFT_RIGHT_8 (ADC_CFGR2_OVSS_3 ) /*!< ADC oversampling shift of 8 (sum of the ADC conversions data is divided by 256 to result as the ADC oversampling conversion data) */
-/**
- * @}
- */
-
-
-/** @defgroup ADC_LL_EC_HW_DELAYS Definitions of ADC hardware constraints delays
- * @note Only ADC peripheral HW delays are defined in ADC LL driver driver,
- * not timeout values.
- * For details on delays values, refer to descriptions in source code
- * above each literal definition.
- * @{
- */
-
-/* Note: Only ADC peripheral HW delays are defined in ADC LL driver driver, */
-/* not timeout values. */
-/* Timeout values for ADC operations are dependent to device clock */
-/* configuration (system clock versus ADC clock), */
-/* and therefore must be defined in user application. */
-/* Indications for estimation of ADC timeout delays, for this */
-/* STM32 serie: */
-/* - ADC calibration time: maximum delay is 83/fADC. */
-/* (refer to device datasheet, parameter "tCAL") */
-/* - ADC enable time: maximum delay is 1 conversion cycle. */
-/* (refer to device datasheet, parameter "tSTAB") */
-/* - ADC disable time: maximum delay should be a few ADC clock cycles */
-/* - ADC stop conversion time: maximum delay should be a few ADC clock */
-/* cycles */
-/* - ADC conversion time: duration depending on ADC clock and ADC */
-/* configuration. */
-/* (refer to device reference manual, section "Timing") */
-
-/* Delay for ADC stabilization time (ADC voltage regulator start-up time) */
-/* Delay set to maximum value (refer to device datasheet, */
-/* parameter "tUP_LDO"). */
-#define LL_ADC_DELAY_INTERNAL_REGUL_STAB_US (10U) /*!< Delay for ADC stabilization time (ADC voltage regulator start-up time) */
-
-/* Delay for internal voltage reference stabilization time. */
-/* Delay set to maximum value (refer to device datasheet, */
-/* parameter "TADC_BUF"). */
-/* Unit: us */
-#define LL_ADC_DELAY_VREFINT_STAB_US (10U) /*!< Delay for internal voltage reference stabilization time */
-
-/* Delay for temperature sensor stabilization time. */
-/* Literal set to maximum value (refer to device datasheet, */
-/* parameter "tSTART"). */
-/* Unit: us */
-#define LL_ADC_DELAY_TEMPSENSOR_STAB_US (10U) /*!< Delay for temperature sensor stabilization time */
-
-/* Delay required between ADC end of calibration and ADC enable. */
-/* Note: On this STM32 serie, a minimum number of ADC clock cycles */
-/* are required between ADC end of calibration and ADC enable. */
-/* Wait time can be computed in user application by waiting for the */
-/* equivalent number of CPU cycles, by taking into account */
-/* ratio of CPU clock versus ADC clock prescalers. */
-/* Unit: ADC clock cycles. */
-#define LL_ADC_DELAY_CALIB_ENABLE_ADC_CYCLES (2U) /*!< Delay required between ADC end of calibration and ADC enable */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-
-/* Exported macro ------------------------------------------------------------*/
-/** @defgroup ADC_LL_Exported_Macros ADC Exported Macros
- * @{
- */
-
-/** @defgroup ADC_LL_EM_WRITE_READ Common write and read registers Macros
- * @{
- */
-
-/**
- * @brief Write a value in ADC register
- * @param __INSTANCE__ ADC Instance
- * @param __REG__ Register to be written
- * @param __VALUE__ Value to be written in the register
- * @retval None
- */
-#define LL_ADC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
-
-/**
- * @brief Read a value in ADC register
- * @param __INSTANCE__ ADC Instance
- * @param __REG__ Register to be read
- * @retval Register value
- */
-#define LL_ADC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EM_HELPER_MACRO ADC helper macro
- * @{
- */
-
-/**
- * @brief Helper macro to get ADC channel number in decimal format
- * from literals LL_ADC_CHANNEL_x.
- * @note Example:
- * __LL_ADC_CHANNEL_TO_DECIMAL_NB(LL_ADC_CHANNEL_4)
- * will return decimal number "4".
- * @note The input can be a value from functions where a channel
- * number is returned, either defined with number
- * or with bitfield (only one bit must be set).
- * @param __CHANNEL__ This parameter can be one of the following values:
- * @arg @ref LL_ADC_CHANNEL_0
- * @arg @ref LL_ADC_CHANNEL_1
- * @arg @ref LL_ADC_CHANNEL_2
- * @arg @ref LL_ADC_CHANNEL_3
- * @arg @ref LL_ADC_CHANNEL_4
- * @arg @ref LL_ADC_CHANNEL_5
- * @arg @ref LL_ADC_CHANNEL_6
- * @arg @ref LL_ADC_CHANNEL_7
- * @arg @ref LL_ADC_CHANNEL_8
- * @arg @ref LL_ADC_CHANNEL_9
- * @arg @ref LL_ADC_CHANNEL_10
- * @arg @ref LL_ADC_CHANNEL_11
- * @arg @ref LL_ADC_CHANNEL_12
- * @arg @ref LL_ADC_CHANNEL_13
- * @arg @ref LL_ADC_CHANNEL_14
- * @arg @ref LL_ADC_CHANNEL_15
- * @arg @ref LL_ADC_CHANNEL_16 (1)
- * @arg @ref LL_ADC_CHANNEL_17
- * @arg @ref LL_ADC_CHANNEL_18
- * @arg @ref LL_ADC_CHANNEL_VREFINT
- * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR
- * @arg @ref LL_ADC_CHANNEL_VLCD (1)
- *
- * (1) On STM32L0, parameter not available on all devices: only on STM32L053xx, STM32L063xx, STM32L073xx, STM32L083xx.
- * @retval Value between Min_Data=0 and Max_Data=18
- */
-#if defined(ADC_CCR_VLCDEN)
-#define __LL_ADC_CHANNEL_TO_DECIMAL_NB(__CHANNEL__) \
- ((((__CHANNEL__) & ADC_CHANNEL_ID_BITFIELD_MASK) == 0U) \
- ? ( \
- ((__CHANNEL__) & ADC_CHANNEL_ID_NUMBER_MASK) >> ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS \
- ) \
- : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL0) == ADC_CHSELR_CHSEL0) ? (0U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL1) == ADC_CHSELR_CHSEL1) ? (1U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL2) == ADC_CHSELR_CHSEL2) ? (2U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL3) == ADC_CHSELR_CHSEL3) ? (3U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL4) == ADC_CHSELR_CHSEL4) ? (4U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL5) == ADC_CHSELR_CHSEL5) ? (5U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL6) == ADC_CHSELR_CHSEL6) ? (6U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL7) == ADC_CHSELR_CHSEL7) ? (7U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL8) == ADC_CHSELR_CHSEL8) ? (8U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL9) == ADC_CHSELR_CHSEL9) ? (9U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL10) == ADC_CHSELR_CHSEL10) ? (10U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL11) == ADC_CHSELR_CHSEL11) ? (11U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL12) == ADC_CHSELR_CHSEL12) ? (12U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL13) == ADC_CHSELR_CHSEL13) ? (13U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL14) == ADC_CHSELR_CHSEL14) ? (14U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL15) == ADC_CHSELR_CHSEL15) ? (15U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL16) == ADC_CHSELR_CHSEL16) ? (16U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL17) == ADC_CHSELR_CHSEL17) ? (17U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL18) == ADC_CHSELR_CHSEL18) ? (18U) : \
- (0U) \
- ) \
- ) \
- ) \
- ) \
- ) \
- ) \
- ) \
- ) \
- ) \
- ) \
- ) \
- ) \
- ) \
- ) \
- ) \
- ) \
- ) \
- ) \
- ) \
- )
-#else
-#define __LL_ADC_CHANNEL_TO_DECIMAL_NB(__CHANNEL__) \
- ((((__CHANNEL__) & ADC_CHANNEL_ID_BITFIELD_MASK) == 0U) \
- ? ( \
- ((__CHANNEL__) & ADC_CHANNEL_ID_NUMBER_MASK) >> ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS \
- ) \
- : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL0) == ADC_CHSELR_CHSEL0) ? (0U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL1) == ADC_CHSELR_CHSEL1) ? (1U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL2) == ADC_CHSELR_CHSEL2) ? (2U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL3) == ADC_CHSELR_CHSEL3) ? (3U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL4) == ADC_CHSELR_CHSEL4) ? (4U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL5) == ADC_CHSELR_CHSEL5) ? (5U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL6) == ADC_CHSELR_CHSEL6) ? (6U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL7) == ADC_CHSELR_CHSEL7) ? (7U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL8) == ADC_CHSELR_CHSEL8) ? (8U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL9) == ADC_CHSELR_CHSEL9) ? (9U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL10) == ADC_CHSELR_CHSEL10) ? (10U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL11) == ADC_CHSELR_CHSEL11) ? (11U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL12) == ADC_CHSELR_CHSEL12) ? (12U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL13) == ADC_CHSELR_CHSEL13) ? (13U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL14) == ADC_CHSELR_CHSEL14) ? (14U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL15) == ADC_CHSELR_CHSEL15) ? (15U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL17) == ADC_CHSELR_CHSEL17) ? (17U) : \
- ( \
- (((__CHANNEL__) & ADC_CHSELR_CHSEL18) == ADC_CHSELR_CHSEL18) ? (18U) : \
- (0U) \
- ) \
- ) \
- ) \
- ) \
- ) \
- ) \
- ) \
- ) \
- ) \
- ) \
- ) \
- ) \
- ) \
- ) \
- ) \
- ) \
- ) \
- ) \
- )
-#endif
-
-/**
- * @brief Helper macro to get ADC channel in literal format LL_ADC_CHANNEL_x
- * from number in decimal format.
- * @note Example:
- * __LL_ADC_DECIMAL_NB_TO_CHANNEL(4)
- * will return a data equivalent to "LL_ADC_CHANNEL_4".
- * @param __DECIMAL_NB__ Value between Min_Data=0 and Max_Data=18
- * @retval Returned value can be one of the following values:
- * @arg @ref LL_ADC_CHANNEL_0
- * @arg @ref LL_ADC_CHANNEL_1
- * @arg @ref LL_ADC_CHANNEL_2
- * @arg @ref LL_ADC_CHANNEL_3
- * @arg @ref LL_ADC_CHANNEL_4
- * @arg @ref LL_ADC_CHANNEL_5
- * @arg @ref LL_ADC_CHANNEL_6
- * @arg @ref LL_ADC_CHANNEL_7
- * @arg @ref LL_ADC_CHANNEL_8
- * @arg @ref LL_ADC_CHANNEL_9
- * @arg @ref LL_ADC_CHANNEL_10
- * @arg @ref LL_ADC_CHANNEL_11
- * @arg @ref LL_ADC_CHANNEL_12
- * @arg @ref LL_ADC_CHANNEL_13
- * @arg @ref LL_ADC_CHANNEL_14
- * @arg @ref LL_ADC_CHANNEL_15
- * @arg @ref LL_ADC_CHANNEL_16 (1)
- * @arg @ref LL_ADC_CHANNEL_17
- * @arg @ref LL_ADC_CHANNEL_18
- * @arg @ref LL_ADC_CHANNEL_VREFINT (2)
- * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (2)
- * @arg @ref LL_ADC_CHANNEL_VLCD (1)(2)
- *
- * (1) On STM32L0, parameter not available on all devices: only on STM32L053xx, STM32L063xx, STM32L073xx, STM32L083xx.\n
- * (2) For ADC channel read back from ADC register,
- * comparison with internal channel parameter to be done
- * using helper macro @ref __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL().
- */
-#define __LL_ADC_DECIMAL_NB_TO_CHANNEL(__DECIMAL_NB__) \
- ( \
- ((__DECIMAL_NB__) << ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS) | \
- (ADC_CHSELR_CHSEL0 << (__DECIMAL_NB__)) \
- )
-
-/**
- * @brief Helper macro to determine whether the selected channel
- * corresponds to literal definitions of driver.
- * @note The different literal definitions of ADC channels are:
- * - ADC internal channel:
- * LL_ADC_CHANNEL_VREFINT, LL_ADC_CHANNEL_TEMPSENSOR, ...
- * - ADC external channel (channel connected to a GPIO pin):
- * LL_ADC_CHANNEL_1, LL_ADC_CHANNEL_2, ...
- * @note The channel parameter must be a value defined from literal
- * definition of a ADC internal channel (LL_ADC_CHANNEL_VREFINT,
- * LL_ADC_CHANNEL_TEMPSENSOR, ...),
- * ADC external channel (LL_ADC_CHANNEL_1, LL_ADC_CHANNEL_2, ...),
- * must not be a value from functions where a channel number is
- * returned from ADC registers,
- * because internal and external channels share the same channel
- * number in ADC registers. The differentiation is made only with
- * parameters definitions of driver.
- * @param __CHANNEL__ This parameter can be one of the following values:
- * @arg @ref LL_ADC_CHANNEL_0
- * @arg @ref LL_ADC_CHANNEL_1
- * @arg @ref LL_ADC_CHANNEL_2
- * @arg @ref LL_ADC_CHANNEL_3
- * @arg @ref LL_ADC_CHANNEL_4
- * @arg @ref LL_ADC_CHANNEL_5
- * @arg @ref LL_ADC_CHANNEL_6
- * @arg @ref LL_ADC_CHANNEL_7
- * @arg @ref LL_ADC_CHANNEL_8
- * @arg @ref LL_ADC_CHANNEL_9
- * @arg @ref LL_ADC_CHANNEL_10
- * @arg @ref LL_ADC_CHANNEL_11
- * @arg @ref LL_ADC_CHANNEL_12
- * @arg @ref LL_ADC_CHANNEL_13
- * @arg @ref LL_ADC_CHANNEL_14
- * @arg @ref LL_ADC_CHANNEL_15
- * @arg @ref LL_ADC_CHANNEL_16 (1)
- * @arg @ref LL_ADC_CHANNEL_17
- * @arg @ref LL_ADC_CHANNEL_18
- * @arg @ref LL_ADC_CHANNEL_VREFINT
- * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR
- * @arg @ref LL_ADC_CHANNEL_VLCD (1)
- *
- * (1) On STM32L0, parameter not available on all devices: only on STM32L053xx, STM32L063xx, STM32L073xx, STM32L083xx.
- * @retval Value "0" if the channel corresponds to a parameter definition of a ADC external channel (channel connected to a GPIO pin).
- * Value "1" if the channel corresponds to a parameter definition of a ADC internal channel.
- */
-#define __LL_ADC_IS_CHANNEL_INTERNAL(__CHANNEL__) \
- (((__CHANNEL__) & ADC_CHANNEL_ID_INTERNAL_CH_MASK) != 0U)
-
-/**
- * @brief Helper macro to convert a channel defined from parameter
- * definition of a ADC internal channel (LL_ADC_CHANNEL_VREFINT,
- * LL_ADC_CHANNEL_TEMPSENSOR, ...),
- * to its equivalent parameter definition of a ADC external channel
- * (LL_ADC_CHANNEL_1, LL_ADC_CHANNEL_2, ...).
- * @note The channel parameter can be, additionally to a value
- * defined from parameter definition of a ADC internal channel
- * (LL_ADC_CHANNEL_VREFINT, LL_ADC_CHANNEL_TEMPSENSOR, ...),
- * a value defined from parameter definition of
- * ADC external channel (LL_ADC_CHANNEL_1, LL_ADC_CHANNEL_2, ...)
- * or a value from functions where a channel number is returned
- * from ADC registers.
- * @param __CHANNEL__ This parameter can be one of the following values:
- * @arg @ref LL_ADC_CHANNEL_0
- * @arg @ref LL_ADC_CHANNEL_1
- * @arg @ref LL_ADC_CHANNEL_2
- * @arg @ref LL_ADC_CHANNEL_3
- * @arg @ref LL_ADC_CHANNEL_4
- * @arg @ref LL_ADC_CHANNEL_5
- * @arg @ref LL_ADC_CHANNEL_6
- * @arg @ref LL_ADC_CHANNEL_7
- * @arg @ref LL_ADC_CHANNEL_8
- * @arg @ref LL_ADC_CHANNEL_9
- * @arg @ref LL_ADC_CHANNEL_10
- * @arg @ref LL_ADC_CHANNEL_11
- * @arg @ref LL_ADC_CHANNEL_12
- * @arg @ref LL_ADC_CHANNEL_13
- * @arg @ref LL_ADC_CHANNEL_14
- * @arg @ref LL_ADC_CHANNEL_15
- * @arg @ref LL_ADC_CHANNEL_16 (1)
- * @arg @ref LL_ADC_CHANNEL_17
- * @arg @ref LL_ADC_CHANNEL_18
- * @arg @ref LL_ADC_CHANNEL_VREFINT
- * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR
- * @arg @ref LL_ADC_CHANNEL_VLCD (1)
- *
- * (1) On STM32L0, parameter not available on all devices: only on STM32L053xx, STM32L063xx, STM32L073xx, STM32L083xx.
- * @retval Returned value can be one of the following values:
- * @arg @ref LL_ADC_CHANNEL_0
- * @arg @ref LL_ADC_CHANNEL_1
- * @arg @ref LL_ADC_CHANNEL_2
- * @arg @ref LL_ADC_CHANNEL_3
- * @arg @ref LL_ADC_CHANNEL_4
- * @arg @ref LL_ADC_CHANNEL_5
- * @arg @ref LL_ADC_CHANNEL_6
- * @arg @ref LL_ADC_CHANNEL_7
- * @arg @ref LL_ADC_CHANNEL_8
- * @arg @ref LL_ADC_CHANNEL_9
- * @arg @ref LL_ADC_CHANNEL_10
- * @arg @ref LL_ADC_CHANNEL_11
- * @arg @ref LL_ADC_CHANNEL_12
- * @arg @ref LL_ADC_CHANNEL_13
- * @arg @ref LL_ADC_CHANNEL_14
- * @arg @ref LL_ADC_CHANNEL_15
- * @arg @ref LL_ADC_CHANNEL_16
- * @arg @ref LL_ADC_CHANNEL_17
- * @arg @ref LL_ADC_CHANNEL_18
- */
-#define __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL(__CHANNEL__) \
- ((__CHANNEL__) & ~ADC_CHANNEL_ID_INTERNAL_CH_MASK)
-
-/**
- * @brief Helper macro to determine whether the internal channel
- * selected is available on the ADC instance selected.
- * @note The channel parameter must be a value defined from parameter
- * definition of a ADC internal channel (LL_ADC_CHANNEL_VREFINT,
- * LL_ADC_CHANNEL_TEMPSENSOR, ...),
- * must not be a value defined from parameter definition of
- * ADC external channel (LL_ADC_CHANNEL_1, LL_ADC_CHANNEL_2, ...)
- * or a value from functions where a channel number is
- * returned from ADC registers,
- * because internal and external channels share the same channel
- * number in ADC registers. The differentiation is made only with
- * parameters definitions of driver.
- * @param __ADC_INSTANCE__ ADC instance
- * @param __CHANNEL__ This parameter can be one of the following values:
- * @arg @ref LL_ADC_CHANNEL_VREFINT
- * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR
- * @arg @ref LL_ADC_CHANNEL_VLCD (1)
- *
- * (1) On STM32L0, parameter not available on all devices: only on STM32L053xx, STM32L063xx, STM32L073xx, STM32L083xx.
-
- * @retval Value "0" if the internal channel selected is not available on the ADC instance selected.
- * Value "1" if the internal channel selected is available on the ADC instance selected.
- */
-#if defined(ADC_CCR_VLCDEN)
-#define __LL_ADC_IS_CHANNEL_INTERNAL_AVAILABLE(__ADC_INSTANCE__, __CHANNEL__) \
- ( \
- ((__CHANNEL__) == LL_ADC_CHANNEL_VREFINT) || \
- ((__CHANNEL__) == LL_ADC_CHANNEL_TEMPSENSOR) || \
- ((__CHANNEL__) == LL_ADC_CHANNEL_VLCD) \
- )
-#else
-#define __LL_ADC_IS_CHANNEL_INTERNAL_AVAILABLE(__ADC_INSTANCE__, __CHANNEL__) \
- ( \
- ((__CHANNEL__) == LL_ADC_CHANNEL_VREFINT) || \
- ((__CHANNEL__) == LL_ADC_CHANNEL_TEMPSENSOR) \
- )
-#endif
-
-/**
- * @brief Helper macro to define ADC analog watchdog parameter:
- * define a single channel to monitor with analog watchdog
- * from sequencer channel and groups definition.
- * @note To be used with function @ref LL_ADC_SetAnalogWDMonitChannels().
- * Example:
- * LL_ADC_SetAnalogWDMonitChannels(
- * ADC1, LL_ADC_AWD1,
- * __LL_ADC_ANALOGWD_CHANNEL_GROUP(LL_ADC_CHANNEL4, LL_ADC_GROUP_REGULAR))
- * @param __CHANNEL__ This parameter can be one of the following values:
- * @arg @ref LL_ADC_CHANNEL_0
- * @arg @ref LL_ADC_CHANNEL_1
- * @arg @ref LL_ADC_CHANNEL_2
- * @arg @ref LL_ADC_CHANNEL_3
- * @arg @ref LL_ADC_CHANNEL_4
- * @arg @ref LL_ADC_CHANNEL_5
- * @arg @ref LL_ADC_CHANNEL_6
- * @arg @ref LL_ADC_CHANNEL_7
- * @arg @ref LL_ADC_CHANNEL_8
- * @arg @ref LL_ADC_CHANNEL_9
- * @arg @ref LL_ADC_CHANNEL_10
- * @arg @ref LL_ADC_CHANNEL_11
- * @arg @ref LL_ADC_CHANNEL_12
- * @arg @ref LL_ADC_CHANNEL_13
- * @arg @ref LL_ADC_CHANNEL_14
- * @arg @ref LL_ADC_CHANNEL_15
- * @arg @ref LL_ADC_CHANNEL_16 (1)
- * @arg @ref LL_ADC_CHANNEL_17
- * @arg @ref LL_ADC_CHANNEL_18
- * @arg @ref LL_ADC_CHANNEL_VREFINT (2)
- * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (2)
- * @arg @ref LL_ADC_CHANNEL_VLCD (1)(2)
- *
- * (1) On STM32L0, parameter not available on all devices: only on STM32L053xx, STM32L063xx, STM32L073xx, STM32L083xx.\n
- * (2) For ADC channel read back from ADC register,
- * comparison with internal channel parameter to be done
- * using helper macro @ref __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL().
- * @param __GROUP__ This parameter can be one of the following values:
- * @arg @ref LL_ADC_GROUP_REGULAR
- * @retval Returned value can be one of the following values:
- * @arg @ref LL_ADC_AWD_DISABLE
- * @arg @ref LL_ADC_AWD_ALL_CHANNELS_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_0_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_1_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_2_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_3_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_4_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_5_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_6_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_7_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_8_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_9_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_10_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_11_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_12_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_13_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_14_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_15_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_16_REG (1)
- * @arg @ref LL_ADC_AWD_CHANNEL_17_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_18_REG
- * @arg @ref LL_ADC_AWD_CH_VREFINT_REG
- * @arg @ref LL_ADC_AWD_CH_TEMPSENSOR_REG
- * @arg @ref LL_ADC_AWD_CH_VLCD_REG (1)
- *
- * (1) On STM32L0, parameter not available on all devices: only on STM32L053xx, STM32L063xx, STM32L073xx, STM32L083xx.
- */
-#define __LL_ADC_ANALOGWD_CHANNEL_GROUP(__CHANNEL__, __GROUP__) \
- (((__CHANNEL__) & ADC_CHANNEL_ID_MASK) | ADC_CFGR1_AWDEN | ADC_CFGR1_AWDSGL)
-
-/**
- * @brief Helper macro to set the value of ADC analog watchdog threshold high
- * or low in function of ADC resolution, when ADC resolution is
- * different of 12 bits.
- * @note To be used with function @ref LL_ADC_ConfigAnalogWDThresholds()
- * or @ref LL_ADC_SetAnalogWDThresholds().
- * Example, with a ADC resolution of 8 bits, to set the value of
- * analog watchdog threshold high (on 8 bits):
- * LL_ADC_SetAnalogWDThresholds
- * (< ADCx param >,
- * __LL_ADC_ANALOGWD_SET_THRESHOLD_RESOLUTION(LL_ADC_RESOLUTION_8B, )
- * );
- * @param __ADC_RESOLUTION__ This parameter can be one of the following values:
- * @arg @ref LL_ADC_RESOLUTION_12B
- * @arg @ref LL_ADC_RESOLUTION_10B
- * @arg @ref LL_ADC_RESOLUTION_8B
- * @arg @ref LL_ADC_RESOLUTION_6B
- * @param __AWD_THRESHOLD__ Value between Min_Data=0x000 and Max_Data=0xFFF
- * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
- */
-#define __LL_ADC_ANALOGWD_SET_THRESHOLD_RESOLUTION(__ADC_RESOLUTION__, __AWD_THRESHOLD__) \
- ((__AWD_THRESHOLD__) << ((__ADC_RESOLUTION__) >> (ADC_CFGR1_RES_BITOFFSET_POS - 1U )))
-
-/**
- * @brief Helper macro to get the value of ADC analog watchdog threshold high
- * or low in function of ADC resolution, when ADC resolution is
- * different of 12 bits.
- * @note To be used with function @ref LL_ADC_GetAnalogWDThresholds().
- * Example, with a ADC resolution of 8 bits, to get the value of
- * analog watchdog threshold high (on 8 bits):
- * < threshold_value_6_bits > = __LL_ADC_ANALOGWD_GET_THRESHOLD_RESOLUTION
- * (LL_ADC_RESOLUTION_8B,
- * LL_ADC_GetAnalogWDThresholds(, LL_ADC_AWD_THRESHOLD_HIGH)
- * );
- * @param __ADC_RESOLUTION__ This parameter can be one of the following values:
- * @arg @ref LL_ADC_RESOLUTION_12B
- * @arg @ref LL_ADC_RESOLUTION_10B
- * @arg @ref LL_ADC_RESOLUTION_8B
- * @arg @ref LL_ADC_RESOLUTION_6B
- * @param __AWD_THRESHOLD_12_BITS__ Value between Min_Data=0x000 and Max_Data=0xFFF
- * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
- */
-#define __LL_ADC_ANALOGWD_GET_THRESHOLD_RESOLUTION(__ADC_RESOLUTION__, __AWD_THRESHOLD_12_BITS__) \
- ((__AWD_THRESHOLD_12_BITS__) >> ((__ADC_RESOLUTION__) >> (ADC_CFGR1_RES_BITOFFSET_POS - 1U )))
-
-/**
- * @brief Helper macro to get the ADC analog watchdog threshold high
- * or low from raw value containing both thresholds concatenated.
- * @note To be used with function @ref LL_ADC_GetAnalogWDThresholds().
- * Example, to get analog watchdog threshold high from the register raw value:
- * __LL_ADC_ANALOGWD_THRESHOLDS_HIGH_LOW(LL_ADC_AWD_THRESHOLD_HIGH, );
- * @param __AWD_THRESHOLD_TYPE__ This parameter can be one of the following values:
- * @arg @ref LL_ADC_AWD_THRESHOLD_HIGH
- * @arg @ref LL_ADC_AWD_THRESHOLD_LOW
- * @param __AWD_THRESHOLDS__ Value between Min_Data=0x00000000 and Max_Data=0xFFFFFFFF
- * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
- */
-#define __LL_ADC_ANALOGWD_THRESHOLDS_HIGH_LOW(__AWD_THRESHOLD_TYPE__, __AWD_THRESHOLDS__) \
- (((__AWD_THRESHOLD_TYPE__) == LL_ADC_AWD_THRESHOLD_LOW) \
- ? ( \
- (__AWD_THRESHOLDS__) & LL_ADC_AWD_THRESHOLD_LOW \
- ) \
- : \
- ( \
- ((__AWD_THRESHOLDS__) >> ADC_TR_HT_BITOFFSET_POS) & LL_ADC_AWD_THRESHOLD_LOW \
- ) \
- )
-
-/**
- * @brief Helper macro to select the ADC common instance
- * to which is belonging the selected ADC instance.
- * @note ADC common register instance can be used for:
- * - Set parameters common to several ADC instances
- * - Multimode (for devices with several ADC instances)
- * Refer to functions having argument "ADCxy_COMMON" as parameter.
- * @param __ADCx__ ADC instance
- * @retval ADC common register instance
- */
-#define __LL_ADC_COMMON_INSTANCE(__ADCx__) \
- (ADC1_COMMON)
-
-/**
- * @brief Helper macro to check if all ADC instances sharing the same
- * ADC common instance are disabled.
- * @note This check is required by functions with setting conditioned to
- * ADC state:
- * All ADC instances of the ADC common group must be disabled.
- * Refer to functions having argument "ADCxy_COMMON" as parameter.
- * @note On devices with only 1 ADC common instance, parameter of this macro
- * is useless and can be ignored (parameter kept for compatibility
- * with devices featuring several ADC common instances).
- * @param __ADCXY_COMMON__ ADC common instance
- * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
- * @retval Value "0" if all ADC instances sharing the same ADC common instance
- * are disabled.
- * Value "1" if at least one ADC instance sharing the same ADC common instance
- * is enabled.
- */
-#define __LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE(__ADCXY_COMMON__) \
- LL_ADC_IsEnabled(ADC1)
-
-/**
- * @brief Helper macro to define the ADC conversion data full-scale digital
- * value corresponding to the selected ADC resolution.
- * @note ADC conversion data full-scale corresponds to voltage range
- * determined by analog voltage references Vref+ and Vref-
- * (refer to reference manual).
- * @param __ADC_RESOLUTION__ This parameter can be one of the following values:
- * @arg @ref LL_ADC_RESOLUTION_12B
- * @arg @ref LL_ADC_RESOLUTION_10B
- * @arg @ref LL_ADC_RESOLUTION_8B
- * @arg @ref LL_ADC_RESOLUTION_6B
- * @retval ADC conversion data equivalent voltage value (unit: mVolt)
- */
-#define __LL_ADC_DIGITAL_SCALE(__ADC_RESOLUTION__) \
- ((0xFFFU) >> ((__ADC_RESOLUTION__) >> (ADC_CFGR1_RES_BITOFFSET_POS - 1U)))
-
-/**
- * @brief Helper macro to convert the ADC conversion data from
- * a resolution to another resolution.
- * @param __DATA__ ADC conversion data to be converted
- * @param __ADC_RESOLUTION_CURRENT__ Resolution of to the data to be converted
- * This parameter can be one of the following values:
- * @arg @ref LL_ADC_RESOLUTION_12B
- * @arg @ref LL_ADC_RESOLUTION_10B
- * @arg @ref LL_ADC_RESOLUTION_8B
- * @arg @ref LL_ADC_RESOLUTION_6B
- * @param __ADC_RESOLUTION_TARGET__ Resolution of the data after conversion
- * This parameter can be one of the following values:
- * @arg @ref LL_ADC_RESOLUTION_12B
- * @arg @ref LL_ADC_RESOLUTION_10B
- * @arg @ref LL_ADC_RESOLUTION_8B
- * @arg @ref LL_ADC_RESOLUTION_6B
- * @retval ADC conversion data to the requested resolution
- */
-#define __LL_ADC_CONVERT_DATA_RESOLUTION(__DATA__, __ADC_RESOLUTION_CURRENT__, __ADC_RESOLUTION_TARGET__) \
- (((__DATA__) \
- << ((__ADC_RESOLUTION_CURRENT__) >> (ADC_CFGR1_RES_BITOFFSET_POS - 1U))) \
- >> ((__ADC_RESOLUTION_TARGET__) >> (ADC_CFGR1_RES_BITOFFSET_POS - 1U)) \
- )
-
-/**
- * @brief Helper macro to calculate the voltage (unit: mVolt)
- * corresponding to a ADC conversion data (unit: digital value).
- * @note Analog reference voltage (Vref+) must be either known from
- * user board environment or can be calculated using ADC measurement
- * and ADC helper macro @ref __LL_ADC_CALC_VREFANALOG_VOLTAGE().
- * @param __VREFANALOG_VOLTAGE__ Analog reference voltage (unit: mV)
- * @param __ADC_DATA__ ADC conversion data (resolution 12 bits)
- * (unit: digital value).
- * @param __ADC_RESOLUTION__ This parameter can be one of the following values:
- * @arg @ref LL_ADC_RESOLUTION_12B
- * @arg @ref LL_ADC_RESOLUTION_10B
- * @arg @ref LL_ADC_RESOLUTION_8B
- * @arg @ref LL_ADC_RESOLUTION_6B
- * @retval ADC conversion data equivalent voltage value (unit: mVolt)
- */
-#define __LL_ADC_CALC_DATA_TO_VOLTAGE(__VREFANALOG_VOLTAGE__,\
- __ADC_DATA__,\
- __ADC_RESOLUTION__) \
- ((__ADC_DATA__) * (__VREFANALOG_VOLTAGE__) \
- / __LL_ADC_DIGITAL_SCALE(__ADC_RESOLUTION__) \
- )
-
-/**
- * @brief Helper macro to calculate analog reference voltage (Vref+)
- * (unit: mVolt) from ADC conversion data of internal voltage
- * reference VrefInt.
- * @note Computation is using VrefInt calibration value
- * stored in system memory for each device during production.
- * @note This voltage depends on user board environment: voltage level
- * connected to pin Vref+.
- * On devices with small package, the pin Vref+ is not present
- * and internally bonded to pin Vdda.
- * @note On this STM32 serie, calibration data of internal voltage reference
- * VrefInt corresponds to a resolution of 12 bits,
- * this is the recommended ADC resolution to convert voltage of
- * internal voltage reference VrefInt.
- * Otherwise, this macro performs the processing to scale
- * ADC conversion data to 12 bits.
- * @param __VREFINT_ADC_DATA__ ADC conversion data (resolution 12 bits)
- * of internal voltage reference VrefInt (unit: digital value).
- * @param __ADC_RESOLUTION__ This parameter can be one of the following values:
- * @arg @ref LL_ADC_RESOLUTION_12B
- * @arg @ref LL_ADC_RESOLUTION_10B
- * @arg @ref LL_ADC_RESOLUTION_8B
- * @arg @ref LL_ADC_RESOLUTION_6B
- * @retval Analog reference voltage (unit: mV)
- */
-#define __LL_ADC_CALC_VREFANALOG_VOLTAGE(__VREFINT_ADC_DATA__,\
- __ADC_RESOLUTION__) \
- (((uint32_t)(*VREFINT_CAL_ADDR) * VREFINT_CAL_VREF) \
- / __LL_ADC_CONVERT_DATA_RESOLUTION((__VREFINT_ADC_DATA__), \
- (__ADC_RESOLUTION__), \
- LL_ADC_RESOLUTION_12B) \
- )
-
-/* Note: On device STM32L011, calibration parameter TS_CAL1 is not available. */
-/* Therefore, helper macro __LL_ADC_CALC_TEMPERATURE() is not available.*/
-/* Use helper macro @ref __LL_ADC_CALC_TEMPERATURE_TYP_PARAMS(). */
-/* Note: On device STM32L010xx, temperature sensor is not available. */
-/* Therefore, helper macro related to temperature sensor are */
-/* not available. */
-#if !defined(STM32L011xx) && !defined(STM32L010xB) && !defined(STM32L010x8) && !defined(STM32L010x6) && !defined(STM32L010x4)
-/**
- * @brief Helper macro to calculate the temperature (unit: degree Celsius)
- * from ADC conversion data of internal temperature sensor.
- * @note Computation is using temperature sensor calibration values
- * stored in system memory for each device during production.
- * @note Calculation formula:
- * Temperature = ((TS_ADC_DATA - TS_CAL1)
- * * (TS_CAL2_TEMP - TS_CAL1_TEMP))
- * / (TS_CAL2 - TS_CAL1) + TS_CAL1_TEMP
- * with TS_ADC_DATA = temperature sensor raw data measured by ADC
- * Avg_Slope = (TS_CAL2 - TS_CAL1)
- * / (TS_CAL2_TEMP - TS_CAL1_TEMP)
- * TS_CAL1 = equivalent TS_ADC_DATA at temperature
- * TEMP_DEGC_CAL1 (calibrated in factory)
- * TS_CAL2 = equivalent TS_ADC_DATA at temperature
- * TEMP_DEGC_CAL2 (calibrated in factory)
- * Caution: Calculation relevancy under reserve that calibration
- * parameters are correct (address and data).
- * To calculate temperature using temperature sensor
- * datasheet typical values (generic values less, therefore
- * less accurate than calibrated values),
- * use helper macro @ref __LL_ADC_CALC_TEMPERATURE_TYP_PARAMS().
- * @note As calculation input, the analog reference voltage (Vref+) must be
- * defined as it impacts the ADC LSB equivalent voltage.
- * @note Analog reference voltage (Vref+) must be either known from
- * user board environment or can be calculated using ADC measurement
- * and ADC helper macro @ref __LL_ADC_CALC_VREFANALOG_VOLTAGE().
- * @note On this STM32 serie, calibration data of temperature sensor
- * corresponds to a resolution of 12 bits,
- * this is the recommended ADC resolution to convert voltage of
- * temperature sensor.
- * Otherwise, this macro performs the processing to scale
- * ADC conversion data to 12 bits.
- * @param __VREFANALOG_VOLTAGE__ Analog reference voltage (unit: mV)
- * @param __TEMPSENSOR_ADC_DATA__ ADC conversion data of internal
- * temperature sensor (unit: digital value).
- * @param __ADC_RESOLUTION__ ADC resolution at which internal temperature
- * sensor voltage has been measured.
- * This parameter can be one of the following values:
- * @arg @ref LL_ADC_RESOLUTION_12B
- * @arg @ref LL_ADC_RESOLUTION_10B
- * @arg @ref LL_ADC_RESOLUTION_8B
- * @arg @ref LL_ADC_RESOLUTION_6B
- * @retval Temperature (unit: degree Celsius)
- */
-#define __LL_ADC_CALC_TEMPERATURE(__VREFANALOG_VOLTAGE__,\
- __TEMPSENSOR_ADC_DATA__,\
- __ADC_RESOLUTION__) \
- (((( ((int32_t)((__LL_ADC_CONVERT_DATA_RESOLUTION((__TEMPSENSOR_ADC_DATA__), \
- (__ADC_RESOLUTION__), \
- LL_ADC_RESOLUTION_12B) \
- * (__VREFANALOG_VOLTAGE__)) \
- / TEMPSENSOR_CAL_VREFANALOG) \
- - (int32_t) *TEMPSENSOR_CAL1_ADDR) \
- ) * (int32_t)(TEMPSENSOR_CAL2_TEMP - TEMPSENSOR_CAL1_TEMP) \
- ) / (int32_t)((int32_t)*TEMPSENSOR_CAL2_ADDR - (int32_t)*TEMPSENSOR_CAL1_ADDR) \
- ) + TEMPSENSOR_CAL1_TEMP \
- )
-#endif
-
-/* Note: On device STM32L010xx, temperature sensor is not available. */
-/* Therefore, helper macro related to temperature sensor are */
-/* not available. */
-#if !defined(STM32L010xB) && !defined(STM32L010x8) && !defined(STM32L010x6) && !defined(STM32L010x4)
-/**
- * @brief Helper macro to calculate the temperature (unit: degree Celsius)
- * from ADC conversion data of internal temperature sensor.
- * @note Computation is using temperature sensor typical values
- * (refer to device datasheet).
- * @note Calculation formula:
- * Temperature = (TS_TYP_CALx_VOLT(uV) - TS_ADC_DATA * Conversion_uV)
- * / Avg_Slope + CALx_TEMP
- * with TS_ADC_DATA = temperature sensor raw data measured by ADC
- * (unit: digital value)
- * Avg_Slope = temperature sensor slope
- * (unit: uV/Degree Celsius)
- * TS_TYP_CALx_VOLT = temperature sensor digital value at
- * temperature CALx_TEMP (unit: mV)
- * Caution: Calculation relevancy under reserve the temperature sensor
- * of the current device has characteristics in line with
- * datasheet typical values.
- * If temperature sensor calibration values are available on
- * on this device (presence of macro __LL_ADC_CALC_TEMPERATURE()),
- * temperature calculation will be more accurate using
- * helper macro @ref __LL_ADC_CALC_TEMPERATURE().
- * @note As calculation input, the analog reference voltage (Vref+) must be
- * defined as it impacts the ADC LSB equivalent voltage.
- * @note Analog reference voltage (Vref+) must be either known from
- * user board environment or can be calculated using ADC measurement
- * and ADC helper macro @ref __LL_ADC_CALC_VREFANALOG_VOLTAGE().
- * @note ADC measurement data must correspond to a resolution of 12bits
- * (full scale digital value 4095). If not the case, the data must be
- * preliminarily rescaled to an equivalent resolution of 12 bits.
- * @param __TEMPSENSOR_TYP_AVGSLOPE__ Device datasheet data: Temperature sensor slope typical value (unit: uV/DegCelsius).
- * On STM32L0, refer to device datasheet parameter "Avg_Slope".
- * @param __TEMPSENSOR_TYP_CALX_V__ Device datasheet data: Temperature sensor voltage typical value (at temperature and Vref+ defined in parameters below) (unit: mV).
- * On STM32L0, refer to device datasheet parameter "V130" (corresponding to TS_CAL2).
- * @param __TEMPSENSOR_CALX_TEMP__ Device datasheet data: Temperature at which temperature sensor voltage (see parameter above) is corresponding (unit: mV)
- * @param __VREFANALOG_VOLTAGE__ Analog voltage reference (Vref+) voltage (unit: mV)
- * @param __TEMPSENSOR_ADC_DATA__ ADC conversion data of internal temperature sensor (unit: digital value).
- * @param __ADC_RESOLUTION__ ADC resolution at which internal temperature sensor voltage has been measured.
- * This parameter can be one of the following values:
- * @arg @ref LL_ADC_RESOLUTION_12B
- * @arg @ref LL_ADC_RESOLUTION_10B
- * @arg @ref LL_ADC_RESOLUTION_8B
- * @arg @ref LL_ADC_RESOLUTION_6B
- * @retval Temperature (unit: degree Celsius)
- */
-#define __LL_ADC_CALC_TEMPERATURE_TYP_PARAMS(__TEMPSENSOR_TYP_AVGSLOPE__,\
- __TEMPSENSOR_TYP_CALX_V__,\
- __TEMPSENSOR_CALX_TEMP__,\
- __VREFANALOG_VOLTAGE__,\
- __TEMPSENSOR_ADC_DATA__,\
- __ADC_RESOLUTION__) \
- ((( ( \
- (int32_t)((((__TEMPSENSOR_ADC_DATA__) * (__VREFANALOG_VOLTAGE__)) \
- / __LL_ADC_DIGITAL_SCALE(__ADC_RESOLUTION__)) \
- * 1000) \
- - \
- (int32_t)(((__TEMPSENSOR_TYP_CALX_V__)) \
- * 1000) \
- ) \
- ) / (__TEMPSENSOR_TYP_AVGSLOPE__) \
- ) + (__TEMPSENSOR_CALX_TEMP__) \
- )
-#endif
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-
-/* Exported functions --------------------------------------------------------*/
-/** @defgroup ADC_LL_Exported_Functions ADC Exported Functions
- * @{
- */
-
-/** @defgroup ADC_LL_EF_DMA_Management ADC DMA management
- * @{
- */
-/* Note: LL ADC functions to set DMA transfer are located into sections of */
-/* configuration of ADC instance, groups and multimode (if available): */
-/* @ref LL_ADC_REG_SetDMATransfer(), ... */
-
-/**
- * @brief Function to help to configure DMA transfer from ADC: retrieve the
- * ADC register address from ADC instance and a list of ADC registers
- * intended to be used (most commonly) with DMA transfer.
- * @note These ADC registers are data registers:
- * when ADC conversion data is available in ADC data registers,
- * ADC generates a DMA transfer request.
- * @note This macro is intended to be used with LL DMA driver, refer to
- * function "LL_DMA_ConfigAddresses()".
- * Example:
- * LL_DMA_ConfigAddresses(DMA1,
- * LL_DMA_CHANNEL_1,
- * LL_ADC_DMA_GetRegAddr(ADC1, LL_ADC_DMA_REG_REGULAR_DATA),
- * (uint32_t)&< array or variable >,
- * LL_DMA_DIRECTION_PERIPH_TO_MEMORY);
- * @note For devices with several ADC: in multimode, some devices
- * use a different data register outside of ADC instance scope
- * (common data register). This macro manages this register difference,
- * only ADC instance has to be set as parameter.
- * @rmtoll DR DATA LL_ADC_DMA_GetRegAddr
- * @param ADCx ADC instance
- * @param Register This parameter can be one of the following values:
- * @arg @ref LL_ADC_DMA_REG_REGULAR_DATA
- * @retval ADC register address
- */
-__STATIC_INLINE uint32_t LL_ADC_DMA_GetRegAddr(ADC_TypeDef *ADCx, uint32_t Register)
-{
- /* Prevent unused argument compilation warning */
- (void)Register;
-
- /* Retrieve address of register DR */
- return (uint32_t)&(ADCx->DR);
-}
-
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EF_Configuration_ADC_Common Configuration of ADC hierarchical scope: common to several ADC instances
- * @{
- */
-
-/**
- * @brief Set parameter common to several ADC: Clock source and prescaler.
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * All ADC instances of the ADC common group must be disabled.
- * This check can be done with function @ref LL_ADC_IsEnabled() for each
- * ADC instance or by using helper macro helper macro
- * @ref __LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE().
- * @rmtoll CCR PRESC LL_ADC_SetCommonClock
- * @param ADCxy_COMMON ADC common instance
- * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
- * @param CommonClock This parameter can be one of the following values:
- * @arg @ref LL_ADC_CLOCK_ASYNC_DIV1 (1)
- * @arg @ref LL_ADC_CLOCK_ASYNC_DIV2 (1)
- * @arg @ref LL_ADC_CLOCK_ASYNC_DIV4 (1)
- * @arg @ref LL_ADC_CLOCK_ASYNC_DIV6 (1)
- * @arg @ref LL_ADC_CLOCK_ASYNC_DIV8 (1)
- * @arg @ref LL_ADC_CLOCK_ASYNC_DIV10 (1)
- * @arg @ref LL_ADC_CLOCK_ASYNC_DIV12 (1)
- * @arg @ref LL_ADC_CLOCK_ASYNC_DIV16 (1)
- * @arg @ref LL_ADC_CLOCK_ASYNC_DIV32 (1)
- * @arg @ref LL_ADC_CLOCK_ASYNC_DIV64 (1)
- * @arg @ref LL_ADC_CLOCK_ASYNC_DIV128 (1)
- * @arg @ref LL_ADC_CLOCK_ASYNC_DIV256 (1)
- *
- * (1) ADC common clock asynchronous prescaler is applied to
- * each ADC instance if the corresponding ADC instance clock
- * is set to clock source asynchronous.
- * (refer to function @ref LL_ADC_SetClock() ).
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_SetCommonClock(ADC_Common_TypeDef *ADCxy_COMMON, uint32_t CommonClock)
-{
- MODIFY_REG(ADCxy_COMMON->CCR, ADC_CCR_PRESC, CommonClock);
-}
-
-/**
- * @brief Get parameter common to several ADC: Clock source and prescaler.
- * @rmtoll CCR PRESC LL_ADC_GetCommonClock
- * @param ADCxy_COMMON ADC common instance
- * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
- * @retval Returned value can be one of the following values:
- * @arg @ref LL_ADC_CLOCK_ASYNC_DIV1 (1)
- * @arg @ref LL_ADC_CLOCK_ASYNC_DIV2 (1)
- * @arg @ref LL_ADC_CLOCK_ASYNC_DIV4 (1)
- * @arg @ref LL_ADC_CLOCK_ASYNC_DIV6 (1)
- * @arg @ref LL_ADC_CLOCK_ASYNC_DIV8 (1)
- * @arg @ref LL_ADC_CLOCK_ASYNC_DIV10 (1)
- * @arg @ref LL_ADC_CLOCK_ASYNC_DIV12 (1)
- * @arg @ref LL_ADC_CLOCK_ASYNC_DIV16 (1)
- * @arg @ref LL_ADC_CLOCK_ASYNC_DIV32 (1)
- * @arg @ref LL_ADC_CLOCK_ASYNC_DIV64 (1)
- * @arg @ref LL_ADC_CLOCK_ASYNC_DIV128 (1)
- * @arg @ref LL_ADC_CLOCK_ASYNC_DIV256 (1)
- *
- * (1) ADC common clock asynchronous prescaler is applied to
- * each ADC instance if the corresponding ADC instance clock
- * is set to clock source asynchronous.
- * (refer to function @ref LL_ADC_SetClock() ).
- */
-__STATIC_INLINE uint32_t LL_ADC_GetCommonClock(ADC_Common_TypeDef *ADCxy_COMMON)
-{
- return (uint32_t)(READ_BIT(ADCxy_COMMON->CCR, ADC_CCR_PRESC));
-}
-
-/**
- * @brief Set parameter common to several ADC: Clock low frequency mode.
- * Refer to reference manual for alignments formats
- * dependencies to ADC resolutions.
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be disabled or enabled without conversion on going
- * on group regular.
- * @rmtoll CCR LFMEN LL_ADC_SetCommonFrequencyMode
- * @param ADCxy_COMMON ADC common instance
- * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
- * @param CommonFrequencyMode This parameter can be one of the following values:
- * @arg @ref LL_ADC_CLOCK_FREQ_MODE_HIGH
- * @arg @ref LL_ADC_CLOCK_FREQ_MODE_LOW
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_SetCommonFrequencyMode(ADC_Common_TypeDef *ADCxy_COMMON, uint32_t CommonFrequencyMode)
-{
- MODIFY_REG(ADCxy_COMMON->CCR, ADC_CCR_LFMEN, CommonFrequencyMode);
-}
-
-/**
- * @brief Get parameter common to several ADC: Clock low frequency mode.
- * Refer to reference manual for alignments formats
- * dependencies to ADC resolutions.
- * @rmtoll CCR LFMEN LL_ADC_GetCommonFrequencyMode
- * @param ADCxy_COMMON ADC common instance
- * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
- * @retval Returned value can be one of the following values:
- * @arg @ref LL_ADC_CLOCK_FREQ_MODE_HIGH
- * @arg @ref LL_ADC_CLOCK_FREQ_MODE_LOW
- */
-__STATIC_INLINE uint32_t LL_ADC_GetCommonFrequencyMode(ADC_Common_TypeDef *ADCxy_COMMON)
-{
- return (uint32_t)(READ_BIT(ADCxy_COMMON->CCR, ADC_CCR_LFMEN));
-}
-
-/**
- * @brief Set parameter common to several ADC: measurement path to internal
- * channels (VrefInt, temperature sensor, ...).
- * @note One or several values can be selected.
- * Example: (LL_ADC_PATH_INTERNAL_VREFINT |
- * LL_ADC_PATH_INTERNAL_TEMPSENSOR)
- * @note Stabilization time of measurement path to internal channel:
- * After enabling internal paths, before starting ADC conversion,
- * a delay is required for internal voltage reference and
- * temperature sensor stabilization time.
- * Refer to device datasheet.
- * Refer to literal @ref LL_ADC_DELAY_VREFINT_STAB_US.
- * Refer to literal @ref LL_ADC_DELAY_TEMPSENSOR_STAB_US.
- * @note ADC internal channel sampling time constraint:
- * For ADC conversion of internal channels,
- * a sampling time minimum value is required.
- * Refer to device datasheet.
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * All ADC instances of the ADC common group must be disabled.
- * This check can be done with function @ref LL_ADC_IsEnabled() for each
- * ADC instance or by using helper macro helper macro
- * @ref __LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE().
- * @rmtoll CCR VREFEN LL_ADC_SetCommonPathInternalCh\n
- * CCR TSEN LL_ADC_SetCommonPathInternalCh\n
- * CCR VLCDEN LL_ADC_SetCommonPathInternalCh
- * @param ADCxy_COMMON ADC common instance
- * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
- * @param PathInternal This parameter can be a combination of the following values:
- * @arg @ref LL_ADC_PATH_INTERNAL_NONE
- * @arg @ref LL_ADC_PATH_INTERNAL_VREFINT
- * @arg @ref LL_ADC_PATH_INTERNAL_TEMPSENSOR (2)
- * @arg @ref LL_ADC_PATH_INTERNAL_VLCD (1)
- *
- * (1) value not defined in all devices: only on STM32L053xx, STM32L063xx, STM32L073xx, STM32L083xx.
- * (2) value not defined in all devices: only on STM32L053xx, STM32L063xx, STM32L073xx, STM32L083xx, STM32L04xxx, STM32L03xxx, STM32L02xxx.
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_SetCommonPathInternalCh(ADC_Common_TypeDef *ADCxy_COMMON, uint32_t PathInternal)
-{
-#if defined (ADC_CCR_VLCDEN) && defined (ADC_CCR_TSEN)
- MODIFY_REG(ADCxy_COMMON->CCR, ADC_CCR_VREFEN | ADC_CCR_TSEN | ADC_CCR_VLCDEN, PathInternal);
-#elif defined (ADC_CCR_TSEN)
- MODIFY_REG(ADCxy_COMMON->CCR, ADC_CCR_VREFEN | ADC_CCR_TSEN, PathInternal);
-#else
- MODIFY_REG(ADCxy_COMMON->CCR, ADC_CCR_VREFEN, PathInternal);
-#endif
-}
-
-/**
- * @brief Get parameter common to several ADC: measurement path to internal
- * channels (VrefInt, temperature sensor, ...).
- * @note One or several values can be selected.
- * Example: (LL_ADC_PATH_INTERNAL_VREFINT |
- * LL_ADC_PATH_INTERNAL_TEMPSENSOR)
- * @rmtoll CCR VREFEN LL_ADC_GetCommonPathInternalCh\n
- * CCR TSEN LL_ADC_GetCommonPathInternalCh\n
- * CCR VLCDEN LL_ADC_GetCommonPathInternalCh
- * @param ADCxy_COMMON ADC common instance
- * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
- * @retval Returned value can be a combination of the following values:
- * @arg @ref LL_ADC_PATH_INTERNAL_NONE
- * @arg @ref LL_ADC_PATH_INTERNAL_VREFINT
- * @arg @ref LL_ADC_PATH_INTERNAL_TEMPSENSOR (2)
- * @arg @ref LL_ADC_PATH_INTERNAL_VLCD (1)
- *
- * (1) value not defined in all devices: only on STM32L053xx, STM32L063xx, STM32L073xx, STM32L083xx.
- * (2) value not defined in all devices: only on STM32L053xx, STM32L063xx, STM32L073xx, STM32L083xx, STM32L04xxx, STM32L03xxx, STM32L02xxx.
- */
-__STATIC_INLINE uint32_t LL_ADC_GetCommonPathInternalCh(ADC_Common_TypeDef *ADCxy_COMMON)
-{
-#if defined (ADC_CCR_VLCDEN) && defined (ADC_CCR_TSEN)
- return (uint32_t)(READ_BIT(ADCxy_COMMON->CCR, ADC_CCR_VREFEN | ADC_CCR_TSEN | ADC_CCR_VLCDEN));
-#elif defined (ADC_CCR_TSEN)
- return (uint32_t)(READ_BIT(ADCxy_COMMON->CCR, ADC_CCR_VREFEN | ADC_CCR_TSEN));
-#else
- return (uint32_t)(READ_BIT(ADCxy_COMMON->CCR, ADC_CCR_VREFEN));
-#endif
-}
-
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EF_Configuration_ADC_Instance Configuration of ADC hierarchical scope: ADC instance
- * @{
- */
-
-/**
- * @brief Set ADC instance clock source and prescaler.
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be disabled.
- * @rmtoll CFGR2 CKMODE LL_ADC_SetClock
- * @param ADCx ADC instance
- * @param ClockSource This parameter can be one of the following values:
- * @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV4
- * @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV2
- * @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV1 (2)
- * @arg @ref LL_ADC_CLOCK_ASYNC (1)
- *
- * (1) Asynchronous clock prescaler can be configured using
- * function @ref LL_ADC_SetCommonClock().\n
- * (2) Caution: This parameter has some clock ratio constraints:
- * This configuration must be enabled only if PCLK has a 50%
- * duty clock cycle (APB prescaler configured inside the RCC
- * must be bypassed and the system clock must by 50% duty
- * cycle).
- * Refer to reference manual.
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_SetClock(ADC_TypeDef *ADCx, uint32_t ClockSource)
-{
- MODIFY_REG(ADCx->CFGR2, ADC_CFGR2_CKMODE, ClockSource);
-}
-
-/**
- * @brief Get ADC instance clock source and prescaler.
- * @rmtoll CFGR2 CKMODE LL_ADC_GetClock
- * @param ADCx ADC instance
- * @retval Returned value can be one of the following values:
- * @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV4
- * @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV2
- * @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV1 (2)
- * @arg @ref LL_ADC_CLOCK_ASYNC (1)
- *
- * (1) Asynchronous clock prescaler can be retrieved using
- * function @ref LL_ADC_GetCommonClock().\n
- * (2) Caution: This parameter has some clock ratio constraints:
- * This configuration must be enabled only if PCLK has a 50%
- * duty clock cycle (APB prescaler configured inside the RCC
- * must be bypassed and the system clock must by 50% duty
- * cycle).
- * Refer to reference manual.
- */
-__STATIC_INLINE uint32_t LL_ADC_GetClock(ADC_TypeDef *ADCx)
-{
- return (uint32_t)(READ_BIT(ADCx->CFGR2, ADC_CFGR2_CKMODE));
-}
-
-/**
- * @brief Set ADC calibration factor in the mode single-ended
- * or differential (for devices with differential mode available).
- * @note This function is intended to set calibration parameters
- * without having to perform a new calibration using
- * @ref LL_ADC_StartCalibration().
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be enabled, without calibration on going, without conversion
- * on going on group regular.
- * @rmtoll CALFACT CALFACT LL_ADC_SetCalibrationFactor
- * @param ADCx ADC instance
- * @param CalibrationFactor Value between Min_Data=0x00 and Max_Data=0x7F
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_SetCalibrationFactor(ADC_TypeDef *ADCx, uint32_t CalibrationFactor)
-{
- MODIFY_REG(ADCx->CALFACT,
- ADC_CALFACT_CALFACT,
- CalibrationFactor);
-}
-
-/**
- * @brief Get ADC calibration factor in the mode single-ended
- * or differential (for devices with differential mode available).
- * @note Calibration factors are set by hardware after performing
- * a calibration run using function @ref LL_ADC_StartCalibration().
- * @rmtoll CALFACT CALFACT LL_ADC_GetCalibrationFactor
- * @param ADCx ADC instance
- * @retval Value between Min_Data=0x00 and Max_Data=0x7F
- */
-__STATIC_INLINE uint32_t LL_ADC_GetCalibrationFactor(ADC_TypeDef *ADCx)
-{
- return (uint32_t)(READ_BIT(ADCx->CALFACT, ADC_CALFACT_CALFACT));
-}
-
-/**
- * @brief Set ADC resolution.
- * Refer to reference manual for alignments formats
- * dependencies to ADC resolutions.
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be disabled or enabled without conversion on going
- * on group regular.
- * @rmtoll CFGR1 RES LL_ADC_SetResolution
- * @param ADCx ADC instance
- * @param Resolution This parameter can be one of the following values:
- * @arg @ref LL_ADC_RESOLUTION_12B
- * @arg @ref LL_ADC_RESOLUTION_10B
- * @arg @ref LL_ADC_RESOLUTION_8B
- * @arg @ref LL_ADC_RESOLUTION_6B
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_SetResolution(ADC_TypeDef *ADCx, uint32_t Resolution)
-{
- MODIFY_REG(ADCx->CFGR1, ADC_CFGR1_RES, Resolution);
-}
-
-/**
- * @brief Get ADC resolution.
- * Refer to reference manual for alignments formats
- * dependencies to ADC resolutions.
- * @rmtoll CFGR1 RES LL_ADC_GetResolution
- * @param ADCx ADC instance
- * @retval Returned value can be one of the following values:
- * @arg @ref LL_ADC_RESOLUTION_12B
- * @arg @ref LL_ADC_RESOLUTION_10B
- * @arg @ref LL_ADC_RESOLUTION_8B
- * @arg @ref LL_ADC_RESOLUTION_6B
- */
-__STATIC_INLINE uint32_t LL_ADC_GetResolution(ADC_TypeDef *ADCx)
-{
- return (uint32_t)(READ_BIT(ADCx->CFGR1, ADC_CFGR1_RES));
-}
-
-/**
- * @brief Set ADC conversion data alignment.
- * @note Refer to reference manual for alignments formats
- * dependencies to ADC resolutions.
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be disabled or enabled without conversion on going
- * on group regular.
- * @rmtoll CFGR1 ALIGN LL_ADC_SetDataAlignment
- * @param ADCx ADC instance
- * @param DataAlignment This parameter can be one of the following values:
- * @arg @ref LL_ADC_DATA_ALIGN_RIGHT
- * @arg @ref LL_ADC_DATA_ALIGN_LEFT
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_SetDataAlignment(ADC_TypeDef *ADCx, uint32_t DataAlignment)
-{
- MODIFY_REG(ADCx->CFGR1, ADC_CFGR1_ALIGN, DataAlignment);
-}
-
-/**
- * @brief Get ADC conversion data alignment.
- * @note Refer to reference manual for alignments formats
- * dependencies to ADC resolutions.
- * @rmtoll CFGR1 ALIGN LL_ADC_GetDataAlignment
- * @param ADCx ADC instance
- * @retval Returned value can be one of the following values:
- * @arg @ref LL_ADC_DATA_ALIGN_RIGHT
- * @arg @ref LL_ADC_DATA_ALIGN_LEFT
- */
-__STATIC_INLINE uint32_t LL_ADC_GetDataAlignment(ADC_TypeDef *ADCx)
-{
- return (uint32_t)(READ_BIT(ADCx->CFGR1, ADC_CFGR1_ALIGN));
-}
-
-/**
- * @brief Set ADC low power mode.
- * @note Description of ADC low power modes:
- * - ADC low power mode "auto wait": Dynamic low power mode,
- * ADC conversions occurrences are limited to the minimum necessary
- * in order to reduce power consumption.
- * New ADC conversion starts only when the previous
- * unitary conversion data (for ADC group regular)
- * has been retrieved by user software.
- * In the meantime, ADC remains idle: does not performs any
- * other conversion.
- * This mode allows to automatically adapt the ADC conversions
- * triggers to the speed of the software that reads the data.
- * Moreover, this avoids risk of overrun for low frequency
- * applications.
- * How to use this low power mode:
- * - Do not use with interruption or DMA since these modes
- * have to clear immediately the EOC flag to free the
- * IRQ vector sequencer.
- * - Do use with polling: 1. Start conversion,
- * 2. Later on, when conversion data is needed: poll for end of
- * conversion to ensure that conversion is completed and
- * retrieve ADC conversion data. This will trig another
- * ADC conversion start.
- * - ADC low power mode "auto power-off" (feature available on
- * this device if parameter LL_ADC_LP_MODE_AUTOOFF is available):
- * the ADC automatically powers-off after a conversion and
- * automatically wakes up when a new conversion is triggered
- * (with startup time between trigger and start of sampling).
- * This feature can be combined with low power mode "auto wait".
- * @note With ADC low power mode "auto wait", the ADC conversion data read
- * is corresponding to previous ADC conversion start, independently
- * of delay during which ADC was idle.
- * Therefore, the ADC conversion data may be outdated: does not
- * correspond to the current voltage level on the selected
- * ADC channel.
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be disabled or enabled without conversion on going
- * on group regular.
- * @rmtoll CFGR1 WAIT LL_ADC_SetLowPowerMode\n
- * CFGR1 AUTOFF LL_ADC_SetLowPowerMode
- * @param ADCx ADC instance
- * @param LowPowerMode This parameter can be one of the following values:
- * @arg @ref LL_ADC_LP_MODE_NONE
- * @arg @ref LL_ADC_LP_AUTOWAIT
- * @arg @ref LL_ADC_LP_AUTOPOWEROFF
- * @arg @ref LL_ADC_LP_AUTOWAIT_AUTOPOWEROFF
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_SetLowPowerMode(ADC_TypeDef *ADCx, uint32_t LowPowerMode)
-{
- MODIFY_REG(ADCx->CFGR1, (ADC_CFGR1_WAIT | ADC_CFGR1_AUTOFF), LowPowerMode);
-}
-
-/**
- * @brief Get ADC low power mode:
- * @note Description of ADC low power modes:
- * - ADC low power mode "auto wait": Dynamic low power mode,
- * ADC conversions occurrences are limited to the minimum necessary
- * in order to reduce power consumption.
- * New ADC conversion starts only when the previous
- * unitary conversion data (for ADC group regular)
- * has been retrieved by user software.
- * In the meantime, ADC remains idle: does not performs any
- * other conversion.
- * This mode allows to automatically adapt the ADC conversions
- * triggers to the speed of the software that reads the data.
- * Moreover, this avoids risk of overrun for low frequency
- * applications.
- * How to use this low power mode:
- * - Do not use with interruption or DMA since these modes
- * have to clear immediately the EOC flag to free the
- * IRQ vector sequencer.
- * - Do use with polling: 1. Start conversion,
- * 2. Later on, when conversion data is needed: poll for end of
- * conversion to ensure that conversion is completed and
- * retrieve ADC conversion data. This will trig another
- * ADC conversion start.
- * - ADC low power mode "auto power-off" (feature available on
- * this device if parameter LL_ADC_LP_MODE_AUTOOFF is available):
- * the ADC automatically powers-off after a conversion and
- * automatically wakes up when a new conversion is triggered
- * (with startup time between trigger and start of sampling).
- * This feature can be combined with low power mode "auto wait".
- * @note With ADC low power mode "auto wait", the ADC conversion data read
- * is corresponding to previous ADC conversion start, independently
- * of delay during which ADC was idle.
- * Therefore, the ADC conversion data may be outdated: does not
- * correspond to the current voltage level on the selected
- * ADC channel.
- * @rmtoll CFGR1 WAIT LL_ADC_GetLowPowerMode\n
- * CFGR1 AUTOFF LL_ADC_GetLowPowerMode
- * @param ADCx ADC instance
- * @retval Returned value can be one of the following values:
- * @arg @ref LL_ADC_LP_MODE_NONE
- * @arg @ref LL_ADC_LP_AUTOWAIT
- * @arg @ref LL_ADC_LP_AUTOPOWEROFF
- * @arg @ref LL_ADC_LP_AUTOWAIT_AUTOPOWEROFF
- */
-__STATIC_INLINE uint32_t LL_ADC_GetLowPowerMode(ADC_TypeDef *ADCx)
-{
- return (uint32_t)(READ_BIT(ADCx->CFGR1, (ADC_CFGR1_WAIT | ADC_CFGR1_AUTOFF)));
-}
-
-/**
- * @brief Set sampling time common to a group of channels.
- * @note Unit: ADC clock cycles.
- * @note On this STM32 serie, sampling time scope is on ADC instance:
- * Sampling time common to all channels.
- * (on some other STM32 families, sampling time is channel wise)
- * @note In case of internal channel (VrefInt, TempSensor, ...) to be
- * converted:
- * sampling time constraints must be respected (sampling time can be
- * adjusted in function of ADC clock frequency and sampling time
- * setting).
- * Refer to device datasheet for timings values (parameters TS_vrefint,
- * TS_temp, ...).
- * @note Conversion time is the addition of sampling time and processing time.
- * On this STM32 serie, ADC processing time is:
- * - 12.5 ADC clock cycles at ADC resolution 12 bits
- * - 10.5 ADC clock cycles at ADC resolution 10 bits
- * - 8.5 ADC clock cycles at ADC resolution 8 bits
- * - 6.5 ADC clock cycles at ADC resolution 6 bits
- * @note In case of ADC conversion of internal channel (VrefInt,
- * temperature sensor, ...), a sampling time minimum value
- * is required.
- * Refer to device datasheet.
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be disabled or enabled without conversion on going
- * on group regular.
- * @rmtoll SMPR SMP LL_ADC_SetSamplingTimeCommonChannels
- * @param ADCx ADC instance
- * @param SamplingTime This parameter can be one of the following values:
- * @arg @ref LL_ADC_SAMPLINGTIME_1CYCLE_5
- * @arg @ref LL_ADC_SAMPLINGTIME_3CYCLES_5
- * @arg @ref LL_ADC_SAMPLINGTIME_7CYCLES_5
- * @arg @ref LL_ADC_SAMPLINGTIME_12CYCLES_5
- * @arg @ref LL_ADC_SAMPLINGTIME_19CYCLES_5
- * @arg @ref LL_ADC_SAMPLINGTIME_39CYCLES_5
- * @arg @ref LL_ADC_SAMPLINGTIME_79CYCLES_5
- * @arg @ref LL_ADC_SAMPLINGTIME_160CYCLES_5
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_SetSamplingTimeCommonChannels(ADC_TypeDef *ADCx, uint32_t SamplingTime)
-{
- MODIFY_REG(ADCx->SMPR, ADC_SMPR_SMP, SamplingTime);
-}
-
-/**
- * @brief Get sampling time common to a group of channels.
- * @note Unit: ADC clock cycles.
- * @note On this STM32 serie, sampling time scope is on ADC instance:
- * Sampling time common to all channels.
- * (on some other STM32 families, sampling time is channel wise)
- * @note Conversion time is the addition of sampling time and processing time.
- * Refer to reference manual for ADC processing time of
- * this STM32 serie.
- * @rmtoll SMPR SMP LL_ADC_GetSamplingTimeCommonChannels
- * @param ADCx ADC instance
- * @retval Returned value can be one of the following values:
- * @arg @ref LL_ADC_SAMPLINGTIME_1CYCLE_5
- * @arg @ref LL_ADC_SAMPLINGTIME_3CYCLES_5
- * @arg @ref LL_ADC_SAMPLINGTIME_7CYCLES_5
- * @arg @ref LL_ADC_SAMPLINGTIME_12CYCLES_5
- * @arg @ref LL_ADC_SAMPLINGTIME_19CYCLES_5
- * @arg @ref LL_ADC_SAMPLINGTIME_39CYCLES_5
- * @arg @ref LL_ADC_SAMPLINGTIME_79CYCLES_5
- * @arg @ref LL_ADC_SAMPLINGTIME_160CYCLES_5
- */
-__STATIC_INLINE uint32_t LL_ADC_GetSamplingTimeCommonChannels(ADC_TypeDef *ADCx)
-{
- return (uint32_t)(READ_BIT(ADCx->SMPR, ADC_SMPR_SMP));
-}
-
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EF_Configuration_ADC_Group_Regular Configuration of ADC hierarchical scope: group regular
- * @{
- */
-
-/**
- * @brief Set ADC group regular conversion trigger source:
- * internal (SW start) or from external peripheral (timer event,
- * external interrupt line).
- * @note On this STM32 serie, setting trigger source to external trigger
- * also set trigger polarity to rising edge
- * (default setting for compatibility with some ADC on other
- * STM32 families having this setting set by HW default value).
- * In case of need to modify trigger edge, use
- * function @ref LL_ADC_REG_SetTriggerEdge().
- * @note Availability of parameters of trigger sources from timer
- * depends on timers availability on the selected device.
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be disabled or enabled without conversion on going
- * on group regular.
- * @rmtoll CFGR1 EXTSEL LL_ADC_REG_SetTriggerSource\n
- * CFGR1 EXTEN LL_ADC_REG_SetTriggerSource
- * @param ADCx ADC instance
- * @param TriggerSource This parameter can be one of the following values:
- * @arg @ref LL_ADC_REG_TRIG_SOFTWARE
- * @arg @ref LL_ADC_REG_TRIG_EXT_TIM6_TRGO
- * @arg @ref LL_ADC_REG_TRIG_EXT_TIM21_CH2
- * @arg @ref LL_ADC_REG_TRIG_EXT_TIM2_TRGO
- * @arg @ref LL_ADC_REG_TRIG_EXT_TIM2_CH4
- * @arg @ref LL_ADC_REG_TRIG_EXT_TIM22_TRGO
- * @arg @ref LL_ADC_REG_TRIG_EXT_TIM2_CH3 (*)
- * @arg @ref LL_ADC_REG_TRIG_EXT_TIM3_TRGO
- * @arg @ref LL_ADC_REG_TRIG_EXT_EXTI_LINE11
- *
- * (*) value not defined in all devices
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_REG_SetTriggerSource(ADC_TypeDef *ADCx, uint32_t TriggerSource)
-{
- MODIFY_REG(ADCx->CFGR1, ADC_CFGR1_EXTEN | ADC_CFGR1_EXTSEL, TriggerSource);
-}
-
-/**
- * @brief Get ADC group regular conversion trigger source:
- * internal (SW start) or from external peripheral (timer event,
- * external interrupt line).
- * @note To determine whether group regular trigger source is
- * internal (SW start) or external, without detail
- * of which peripheral is selected as external trigger,
- * (equivalent to
- * "if(LL_ADC_REG_GetTriggerSource(ADC1) == LL_ADC_REG_TRIG_SOFTWARE)")
- * use function @ref LL_ADC_REG_IsTriggerSourceSWStart.
- * @note Availability of parameters of trigger sources from timer
- * depends on timers availability on the selected device.
- * @rmtoll CFGR1 EXTSEL LL_ADC_REG_GetTriggerSource\n
- * CFGR1 EXTEN LL_ADC_REG_GetTriggerSource
- * @param ADCx ADC instance
- * @retval Returned value can be one of the following values:
- * @arg @ref LL_ADC_REG_TRIG_SOFTWARE
- * @arg @ref LL_ADC_REG_TRIG_EXT_TIM6_TRGO
- * @arg @ref LL_ADC_REG_TRIG_EXT_TIM21_CH2
- * @arg @ref LL_ADC_REG_TRIG_EXT_TIM2_TRGO
- * @arg @ref LL_ADC_REG_TRIG_EXT_TIM2_CH4
- * @arg @ref LL_ADC_REG_TRIG_EXT_TIM22_TRGO
- * @arg @ref LL_ADC_REG_TRIG_EXT_TIM2_CH3 (*)
- * @arg @ref LL_ADC_REG_TRIG_EXT_TIM3_TRGO
- * @arg @ref LL_ADC_REG_TRIG_EXT_EXTI_LINE11
- *
- * (*) value not defined in all devices
- */
-__STATIC_INLINE uint32_t LL_ADC_REG_GetTriggerSource(ADC_TypeDef *ADCx)
-{
- uint32_t TriggerSource = READ_BIT(ADCx->CFGR1, ADC_CFGR1_EXTSEL | ADC_CFGR1_EXTEN);
-
- /* Value for shift of {0; 4; 8; 12} depending on value of bitfield */
- /* corresponding to ADC_CFGR1_EXTEN {0; 1; 2; 3}. */
- uint32_t ShiftExten = ((TriggerSource & ADC_CFGR1_EXTEN) >> (ADC_REG_TRIG_EXTEN_BITOFFSET_POS - 2U));
-
- /* Set bitfield corresponding to ADC_CFGR1_EXTEN and ADC_CFGR1_EXTSEL */
- /* to match with triggers literals definition. */
- return ((TriggerSource
- & (ADC_REG_TRIG_SOURCE_MASK >> ShiftExten) & ADC_CFGR1_EXTSEL)
- | ((ADC_REG_TRIG_EDGE_MASK >> ShiftExten) & ADC_CFGR1_EXTEN)
- );
-}
-
-/**
- * @brief Get ADC group regular conversion trigger source internal (SW start)
- or external.
- * @note In case of group regular trigger source set to external trigger,
- * to determine which peripheral is selected as external trigger,
- * use function @ref LL_ADC_REG_GetTriggerSource().
- * @rmtoll CFGR1 EXTEN LL_ADC_REG_IsTriggerSourceSWStart
- * @param ADCx ADC instance
- * @retval Value "0" if trigger source external trigger
- * Value "1" if trigger source SW start.
- */
-__STATIC_INLINE uint32_t LL_ADC_REG_IsTriggerSourceSWStart(ADC_TypeDef *ADCx)
-{
- return (READ_BIT(ADCx->CFGR1, ADC_CFGR1_EXTEN) == (LL_ADC_REG_TRIG_SOFTWARE & ADC_CFGR1_EXTEN));
-}
-
-/**
- * @brief Set ADC group regular conversion trigger polarity.
- * @note Applicable only for trigger source set to external trigger.
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be disabled or enabled without conversion on going
- * on group regular.
- * @rmtoll CFGR1 EXTEN LL_ADC_REG_SetTriggerEdge
- * @param ADCx ADC instance
- * @param ExternalTriggerEdge This parameter can be one of the following values:
- * @arg @ref LL_ADC_REG_TRIG_EXT_RISING
- * @arg @ref LL_ADC_REG_TRIG_EXT_FALLING
- * @arg @ref LL_ADC_REG_TRIG_EXT_RISINGFALLING
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_REG_SetTriggerEdge(ADC_TypeDef *ADCx, uint32_t ExternalTriggerEdge)
-{
- MODIFY_REG(ADCx->CFGR1, ADC_CFGR1_EXTEN, ExternalTriggerEdge);
-}
-
-/**
- * @brief Get ADC group regular conversion trigger polarity.
- * @note Applicable only for trigger source set to external trigger.
- * @rmtoll CFGR1 EXTEN LL_ADC_REG_GetTriggerEdge
- * @param ADCx ADC instance
- * @retval Returned value can be one of the following values:
- * @arg @ref LL_ADC_REG_TRIG_EXT_RISING
- * @arg @ref LL_ADC_REG_TRIG_EXT_FALLING
- * @arg @ref LL_ADC_REG_TRIG_EXT_RISINGFALLING
- */
-__STATIC_INLINE uint32_t LL_ADC_REG_GetTriggerEdge(ADC_TypeDef *ADCx)
-{
- return (uint32_t)(READ_BIT(ADCx->CFGR1, ADC_CFGR1_EXTEN));
-}
-
-
-/**
- * @brief Set ADC group regular sequencer scan direction.
- * @note On some other STM32 families, this setting is not available and
- * the default scan direction is forward.
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be disabled or enabled without conversion on going
- * on group regular.
- * @rmtoll CFGR1 SCANDIR LL_ADC_REG_SetSequencerScanDirection
- * @param ADCx ADC instance
- * @param ScanDirection This parameter can be one of the following values:
- * @arg @ref LL_ADC_REG_SEQ_SCAN_DIR_FORWARD
- * @arg @ref LL_ADC_REG_SEQ_SCAN_DIR_BACKWARD
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_REG_SetSequencerScanDirection(ADC_TypeDef *ADCx, uint32_t ScanDirection)
-{
- MODIFY_REG(ADCx->CFGR1, ADC_CFGR1_SCANDIR, ScanDirection);
-}
-
-/**
- * @brief Get ADC group regular sequencer scan direction.
- * @note On some other STM32 families, this setting is not available and
- * the default scan direction is forward.
- * @rmtoll CFGR1 SCANDIR LL_ADC_REG_GetSequencerScanDirection
- * @param ADCx ADC instance
- * @retval Returned value can be one of the following values:
- * @arg @ref LL_ADC_REG_SEQ_SCAN_DIR_FORWARD
- * @arg @ref LL_ADC_REG_SEQ_SCAN_DIR_BACKWARD
- */
-__STATIC_INLINE uint32_t LL_ADC_REG_GetSequencerScanDirection(ADC_TypeDef *ADCx)
-{
- return (uint32_t)(READ_BIT(ADCx->CFGR1, ADC_CFGR1_SCANDIR));
-}
-
-/**
- * @brief Set ADC group regular sequencer discontinuous mode:
- * sequence subdivided and scan conversions interrupted every selected
- * number of ranks.
- * @note It is not possible to enable both ADC group regular
- * continuous mode and sequencer discontinuous mode.
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be disabled or enabled without conversion on going
- * on group regular.
- * @rmtoll CFGR1 DISCEN LL_ADC_REG_SetSequencerDiscont\n
- * @param ADCx ADC instance
- * @param SeqDiscont This parameter can be one of the following values:
- * @arg @ref LL_ADC_REG_SEQ_DISCONT_DISABLE
- * @arg @ref LL_ADC_REG_SEQ_DISCONT_1RANK
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_REG_SetSequencerDiscont(ADC_TypeDef *ADCx, uint32_t SeqDiscont)
-{
- MODIFY_REG(ADCx->CFGR1, ADC_CFGR1_DISCEN, SeqDiscont);
-}
-
-/**
- * @brief Get ADC group regular sequencer discontinuous mode:
- * sequence subdivided and scan conversions interrupted every selected
- * number of ranks.
- * @rmtoll CFGR1 DISCEN LL_ADC_REG_GetSequencerDiscont\n
- * @param ADCx ADC instance
- * @retval Returned value can be one of the following values:
- * @arg @ref LL_ADC_REG_SEQ_DISCONT_DISABLE
- * @arg @ref LL_ADC_REG_SEQ_DISCONT_1RANK
- */
-__STATIC_INLINE uint32_t LL_ADC_REG_GetSequencerDiscont(ADC_TypeDef *ADCx)
-{
- return (uint32_t)(READ_BIT(ADCx->CFGR1, ADC_CFGR1_DISCEN));
-}
-
-/**
- * @brief Set ADC group regular sequence: channel on rank corresponding to
- * channel number.
- * @note This function performs:
- * - Channels ordering into each rank of scan sequence:
- * rank of each channel is fixed by channel HW number
- * (channel 0 fixed on rank 0, channel 1 fixed on rank1, ...).
- * - Set channels selected by overwriting the current sequencer
- * configuration.
- * @note On this STM32 serie, ADC group regular sequencer is
- * not fully configurable: sequencer length and each rank
- * affectation to a channel are fixed by channel HW number.
- * @note Depending on devices and packages, some channels may not be available.
- * Refer to device datasheet for channels availability.
- * @note On this STM32 serie, to measure internal channels (VrefInt,
- * TempSensor, ...), measurement paths to internal channels must be
- * enabled separately.
- * This can be done using function @ref LL_ADC_SetCommonPathInternalCh().
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be disabled or enabled without conversion on going
- * on group regular.
- * @note One or several values can be selected.
- * Example: (LL_ADC_CHANNEL_4 | LL_ADC_CHANNEL_12 | ...)
- * @rmtoll CHSELR CHSEL0 LL_ADC_REG_SetSequencerChannels\n
- * CHSELR CHSEL1 LL_ADC_REG_SetSequencerChannels\n
- * CHSELR CHSEL2 LL_ADC_REG_SetSequencerChannels\n
- * CHSELR CHSEL3 LL_ADC_REG_SetSequencerChannels\n
- * CHSELR CHSEL4 LL_ADC_REG_SetSequencerChannels\n
- * CHSELR CHSEL5 LL_ADC_REG_SetSequencerChannels\n
- * CHSELR CHSEL6 LL_ADC_REG_SetSequencerChannels\n
- * CHSELR CHSEL7 LL_ADC_REG_SetSequencerChannels\n
- * CHSELR CHSEL8 LL_ADC_REG_SetSequencerChannels\n
- * CHSELR CHSEL9 LL_ADC_REG_SetSequencerChannels\n
- * CHSELR CHSEL10 LL_ADC_REG_SetSequencerChannels\n
- * CHSELR CHSEL11 LL_ADC_REG_SetSequencerChannels\n
- * CHSELR CHSEL12 LL_ADC_REG_SetSequencerChannels\n
- * CHSELR CHSEL13 LL_ADC_REG_SetSequencerChannels\n
- * CHSELR CHSEL14 LL_ADC_REG_SetSequencerChannels\n
- * CHSELR CHSEL15 LL_ADC_REG_SetSequencerChannels\n
- * CHSELR CHSEL16 LL_ADC_REG_SetSequencerChannels\n
- * CHSELR CHSEL17 LL_ADC_REG_SetSequencerChannels\n
- * CHSELR CHSEL18 LL_ADC_REG_SetSequencerChannels
- * @param ADCx ADC instance
- * @param Channel This parameter can be a combination of the following values:
- * @arg @ref LL_ADC_CHANNEL_0
- * @arg @ref LL_ADC_CHANNEL_1
- * @arg @ref LL_ADC_CHANNEL_2
- * @arg @ref LL_ADC_CHANNEL_3
- * @arg @ref LL_ADC_CHANNEL_4
- * @arg @ref LL_ADC_CHANNEL_5
- * @arg @ref LL_ADC_CHANNEL_6
- * @arg @ref LL_ADC_CHANNEL_7
- * @arg @ref LL_ADC_CHANNEL_8
- * @arg @ref LL_ADC_CHANNEL_9
- * @arg @ref LL_ADC_CHANNEL_10
- * @arg @ref LL_ADC_CHANNEL_11
- * @arg @ref LL_ADC_CHANNEL_12
- * @arg @ref LL_ADC_CHANNEL_13
- * @arg @ref LL_ADC_CHANNEL_14
- * @arg @ref LL_ADC_CHANNEL_15
- * @arg @ref LL_ADC_CHANNEL_16 (1)
- * @arg @ref LL_ADC_CHANNEL_17
- * @arg @ref LL_ADC_CHANNEL_18
- * @arg @ref LL_ADC_CHANNEL_VREFINT
- * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR
- * @arg @ref LL_ADC_CHANNEL_VLCD (1)
- *
- * (1) On STM32L0, parameter not available on all devices: only on STM32L053xx, STM32L063xx, STM32L073xx, STM32L083xx.
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_REG_SetSequencerChannels(ADC_TypeDef *ADCx, uint32_t Channel)
-{
- /* Parameter "Channel" is used with masks because containing */
- /* other bits reserved for other purpose. */
- WRITE_REG(ADCx->CHSELR, (Channel & ADC_CHANNEL_ID_BITFIELD_MASK));
-}
-
-/**
- * @brief Add channel to ADC group regular sequence: channel on rank corresponding to
- * channel number.
- * @note This function performs:
- * - Channels ordering into each rank of scan sequence:
- * rank of each channel is fixed by channel HW number
- * (channel 0 fixed on rank 0, channel 1 fixed on rank1, ...).
- * - Set channels selected by adding them to the current sequencer
- * configuration.
- * @note On this STM32 serie, ADC group regular sequencer is
- * not fully configurable: sequencer length and each rank
- * affectation to a channel are fixed by channel HW number.
- * @note Depending on devices and packages, some channels may not be available.
- * Refer to device datasheet for channels availability.
- * @note On this STM32 serie, to measure internal channels (VrefInt,
- * TempSensor, ...), measurement paths to internal channels must be
- * enabled separately.
- * This can be done using function @ref LL_ADC_SetCommonPathInternalCh().
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be disabled or enabled without conversion on going
- * on group regular.
- * @note One or several values can be selected.
- * Example: (LL_ADC_CHANNEL_4 | LL_ADC_CHANNEL_12 | ...)
- * @rmtoll CHSELR CHSEL0 LL_ADC_REG_SetSequencerChAdd\n
- * CHSELR CHSEL1 LL_ADC_REG_SetSequencerChAdd\n
- * CHSELR CHSEL2 LL_ADC_REG_SetSequencerChAdd\n
- * CHSELR CHSEL3 LL_ADC_REG_SetSequencerChAdd\n
- * CHSELR CHSEL4 LL_ADC_REG_SetSequencerChAdd\n
- * CHSELR CHSEL5 LL_ADC_REG_SetSequencerChAdd\n
- * CHSELR CHSEL6 LL_ADC_REG_SetSequencerChAdd\n
- * CHSELR CHSEL7 LL_ADC_REG_SetSequencerChAdd\n
- * CHSELR CHSEL8 LL_ADC_REG_SetSequencerChAdd\n
- * CHSELR CHSEL9 LL_ADC_REG_SetSequencerChAdd\n
- * CHSELR CHSEL10 LL_ADC_REG_SetSequencerChAdd\n
- * CHSELR CHSEL11 LL_ADC_REG_SetSequencerChAdd\n
- * CHSELR CHSEL12 LL_ADC_REG_SetSequencerChAdd\n
- * CHSELR CHSEL13 LL_ADC_REG_SetSequencerChAdd\n
- * CHSELR CHSEL14 LL_ADC_REG_SetSequencerChAdd\n
- * CHSELR CHSEL15 LL_ADC_REG_SetSequencerChAdd\n
- * CHSELR CHSEL16 LL_ADC_REG_SetSequencerChAdd\n
- * CHSELR CHSEL17 LL_ADC_REG_SetSequencerChAdd\n
- * CHSELR CHSEL18 LL_ADC_REG_SetSequencerChAdd
- * @param ADCx ADC instance
- * @param Channel This parameter can be a combination of the following values:
- * @arg @ref LL_ADC_CHANNEL_0
- * @arg @ref LL_ADC_CHANNEL_1
- * @arg @ref LL_ADC_CHANNEL_2
- * @arg @ref LL_ADC_CHANNEL_3
- * @arg @ref LL_ADC_CHANNEL_4
- * @arg @ref LL_ADC_CHANNEL_5
- * @arg @ref LL_ADC_CHANNEL_6
- * @arg @ref LL_ADC_CHANNEL_7
- * @arg @ref LL_ADC_CHANNEL_8
- * @arg @ref LL_ADC_CHANNEL_9
- * @arg @ref LL_ADC_CHANNEL_10
- * @arg @ref LL_ADC_CHANNEL_11
- * @arg @ref LL_ADC_CHANNEL_12
- * @arg @ref LL_ADC_CHANNEL_13
- * @arg @ref LL_ADC_CHANNEL_14
- * @arg @ref LL_ADC_CHANNEL_15
- * @arg @ref LL_ADC_CHANNEL_16 (1)
- * @arg @ref LL_ADC_CHANNEL_17
- * @arg @ref LL_ADC_CHANNEL_18
- * @arg @ref LL_ADC_CHANNEL_VREFINT
- * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR
- * @arg @ref LL_ADC_CHANNEL_VLCD (1)
- *
- * (1) On STM32L0, parameter not available on all devices: only on STM32L053xx, STM32L063xx, STM32L073xx, STM32L083xx.
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_REG_SetSequencerChAdd(ADC_TypeDef *ADCx, uint32_t Channel)
-{
- /* Parameter "Channel" is used with masks because containing */
- /* other bits reserved for other purpose. */
- SET_BIT(ADCx->CHSELR, (Channel & ADC_CHANNEL_ID_BITFIELD_MASK));
-}
-
-/**
- * @brief Remove channel to ADC group regular sequence: channel on rank corresponding to
- * channel number.
- * @note This function performs:
- * - Channels ordering into each rank of scan sequence:
- * rank of each channel is fixed by channel HW number
- * (channel 0 fixed on rank 0, channel 1 fixed on rank1, ...).
- * - Set channels selected by removing them to the current sequencer
- * configuration.
- * @note On this STM32 serie, ADC group regular sequencer is
- * not fully configurable: sequencer length and each rank
- * affectation to a channel are fixed by channel HW number.
- * @note Depending on devices and packages, some channels may not be available.
- * Refer to device datasheet for channels availability.
- * @note On this STM32 serie, to measure internal channels (VrefInt,
- * TempSensor, ...), measurement paths to internal channels must be
- * enabled separately.
- * This can be done using function @ref LL_ADC_SetCommonPathInternalCh().
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be disabled or enabled without conversion on going
- * on group regular.
- * @note One or several values can be selected.
- * Example: (LL_ADC_CHANNEL_4 | LL_ADC_CHANNEL_12 | ...)
- * @rmtoll CHSELR CHSEL0 LL_ADC_REG_SetSequencerChRem\n
- * CHSELR CHSEL1 LL_ADC_REG_SetSequencerChRem\n
- * CHSELR CHSEL2 LL_ADC_REG_SetSequencerChRem\n
- * CHSELR CHSEL3 LL_ADC_REG_SetSequencerChRem\n
- * CHSELR CHSEL4 LL_ADC_REG_SetSequencerChRem\n
- * CHSELR CHSEL5 LL_ADC_REG_SetSequencerChRem\n
- * CHSELR CHSEL6 LL_ADC_REG_SetSequencerChRem\n
- * CHSELR CHSEL7 LL_ADC_REG_SetSequencerChRem\n
- * CHSELR CHSEL8 LL_ADC_REG_SetSequencerChRem\n
- * CHSELR CHSEL9 LL_ADC_REG_SetSequencerChRem\n
- * CHSELR CHSEL10 LL_ADC_REG_SetSequencerChRem\n
- * CHSELR CHSEL11 LL_ADC_REG_SetSequencerChRem\n
- * CHSELR CHSEL12 LL_ADC_REG_SetSequencerChRem\n
- * CHSELR CHSEL13 LL_ADC_REG_SetSequencerChRem\n
- * CHSELR CHSEL14 LL_ADC_REG_SetSequencerChRem\n
- * CHSELR CHSEL15 LL_ADC_REG_SetSequencerChRem\n
- * CHSELR CHSEL16 LL_ADC_REG_SetSequencerChRem\n
- * CHSELR CHSEL17 LL_ADC_REG_SetSequencerChRem\n
- * CHSELR CHSEL18 LL_ADC_REG_SetSequencerChRem
- * @param ADCx ADC instance
- * @param Channel This parameter can be a combination of the following values:
- * @arg @ref LL_ADC_CHANNEL_0
- * @arg @ref LL_ADC_CHANNEL_1
- * @arg @ref LL_ADC_CHANNEL_2
- * @arg @ref LL_ADC_CHANNEL_3
- * @arg @ref LL_ADC_CHANNEL_4
- * @arg @ref LL_ADC_CHANNEL_5
- * @arg @ref LL_ADC_CHANNEL_6
- * @arg @ref LL_ADC_CHANNEL_7
- * @arg @ref LL_ADC_CHANNEL_8
- * @arg @ref LL_ADC_CHANNEL_9
- * @arg @ref LL_ADC_CHANNEL_10
- * @arg @ref LL_ADC_CHANNEL_11
- * @arg @ref LL_ADC_CHANNEL_12
- * @arg @ref LL_ADC_CHANNEL_13
- * @arg @ref LL_ADC_CHANNEL_14
- * @arg @ref LL_ADC_CHANNEL_15
- * @arg @ref LL_ADC_CHANNEL_16 (1)
- * @arg @ref LL_ADC_CHANNEL_17
- * @arg @ref LL_ADC_CHANNEL_18
- * @arg @ref LL_ADC_CHANNEL_VREFINT
- * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR
- * @arg @ref LL_ADC_CHANNEL_VLCD (1)
- *
- * (1) On STM32L0, parameter not available on all devices: only on STM32L053xx, STM32L063xx, STM32L073xx, STM32L083xx.
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_REG_SetSequencerChRem(ADC_TypeDef *ADCx, uint32_t Channel)
-{
- /* Parameter "Channel" is used with masks because containing */
- /* other bits reserved for other purpose. */
- CLEAR_BIT(ADCx->CHSELR, (Channel & ADC_CHANNEL_ID_BITFIELD_MASK));
-}
-
-/**
- * @brief Get ADC group regular sequence: channel on rank corresponding to
- * channel number.
- * @note This function performs:
- * - Channels order reading into each rank of scan sequence:
- * rank of each channel is fixed by channel HW number
- * (channel 0 fixed on rank 0, channel 1 fixed on rank1, ...).
- * @note On this STM32 serie, ADC group regular sequencer is
- * not fully configurable: sequencer length and each rank
- * affectation to a channel are fixed by channel HW number.
- * @note Depending on devices and packages, some channels may not be available.
- * Refer to device datasheet for channels availability.
- * @note On this STM32 serie, to measure internal channels (VrefInt,
- * TempSensor, ...), measurement paths to internal channels must be
- * enabled separately.
- * This can be done using function @ref LL_ADC_SetCommonPathInternalCh().
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be disabled or enabled without conversion on going
- * on group regular.
- * @note One or several values can be retrieved.
- * Example: (LL_ADC_CHANNEL_4 | LL_ADC_CHANNEL_12 | ...)
- * @rmtoll CHSELR CHSEL0 LL_ADC_REG_GetSequencerChannels\n
- * CHSELR CHSEL1 LL_ADC_REG_GetSequencerChannels\n
- * CHSELR CHSEL2 LL_ADC_REG_GetSequencerChannels\n
- * CHSELR CHSEL3 LL_ADC_REG_GetSequencerChannels\n
- * CHSELR CHSEL4 LL_ADC_REG_GetSequencerChannels\n
- * CHSELR CHSEL5 LL_ADC_REG_GetSequencerChannels\n
- * CHSELR CHSEL6 LL_ADC_REG_GetSequencerChannels\n
- * CHSELR CHSEL7 LL_ADC_REG_GetSequencerChannels\n
- * CHSELR CHSEL8 LL_ADC_REG_GetSequencerChannels\n
- * CHSELR CHSEL9 LL_ADC_REG_GetSequencerChannels\n
- * CHSELR CHSEL10 LL_ADC_REG_GetSequencerChannels\n
- * CHSELR CHSEL11 LL_ADC_REG_GetSequencerChannels\n
- * CHSELR CHSEL12 LL_ADC_REG_GetSequencerChannels\n
- * CHSELR CHSEL13 LL_ADC_REG_GetSequencerChannels\n
- * CHSELR CHSEL14 LL_ADC_REG_GetSequencerChannels\n
- * CHSELR CHSEL15 LL_ADC_REG_GetSequencerChannels\n
- * CHSELR CHSEL16 LL_ADC_REG_GetSequencerChannels\n
- * CHSELR CHSEL17 LL_ADC_REG_GetSequencerChannels\n
- * CHSELR CHSEL18 LL_ADC_REG_GetSequencerChannels
- * @param ADCx ADC instance
- * @retval Returned value can be a combination of the following values:
- * @arg @ref LL_ADC_CHANNEL_0
- * @arg @ref LL_ADC_CHANNEL_1
- * @arg @ref LL_ADC_CHANNEL_2
- * @arg @ref LL_ADC_CHANNEL_3
- * @arg @ref LL_ADC_CHANNEL_4
- * @arg @ref LL_ADC_CHANNEL_5
- * @arg @ref LL_ADC_CHANNEL_6
- * @arg @ref LL_ADC_CHANNEL_7
- * @arg @ref LL_ADC_CHANNEL_8
- * @arg @ref LL_ADC_CHANNEL_9
- * @arg @ref LL_ADC_CHANNEL_10
- * @arg @ref LL_ADC_CHANNEL_11
- * @arg @ref LL_ADC_CHANNEL_12
- * @arg @ref LL_ADC_CHANNEL_13
- * @arg @ref LL_ADC_CHANNEL_14
- * @arg @ref LL_ADC_CHANNEL_15
- * @arg @ref LL_ADC_CHANNEL_16 (1)
- * @arg @ref LL_ADC_CHANNEL_17
- * @arg @ref LL_ADC_CHANNEL_18
- * @arg @ref LL_ADC_CHANNEL_VREFINT
- * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR
- * @arg @ref LL_ADC_CHANNEL_VLCD (1)
- *
- * (1) On STM32L0, parameter not available on all devices: only on STM32L053xx, STM32L063xx, STM32L073xx, STM32L083xx.
- */
-__STATIC_INLINE uint32_t LL_ADC_REG_GetSequencerChannels(ADC_TypeDef *ADCx)
-{
- uint32_t ChannelsBitfield = READ_BIT(ADCx->CHSELR, ADC_CHSELR_CHSEL);
-
- return ( (((ChannelsBitfield & ADC_CHSELR_CHSEL0) >> ADC_CHSELR_CHSEL0_BITOFFSET_POS) * LL_ADC_CHANNEL_0)
- | (((ChannelsBitfield & ADC_CHSELR_CHSEL1) >> ADC_CHSELR_CHSEL1_BITOFFSET_POS) * LL_ADC_CHANNEL_1)
- | (((ChannelsBitfield & ADC_CHSELR_CHSEL2) >> ADC_CHSELR_CHSEL2_BITOFFSET_POS) * LL_ADC_CHANNEL_2)
- | (((ChannelsBitfield & ADC_CHSELR_CHSEL3) >> ADC_CHSELR_CHSEL3_BITOFFSET_POS) * LL_ADC_CHANNEL_3)
- | (((ChannelsBitfield & ADC_CHSELR_CHSEL4) >> ADC_CHSELR_CHSEL4_BITOFFSET_POS) * LL_ADC_CHANNEL_4)
- | (((ChannelsBitfield & ADC_CHSELR_CHSEL5) >> ADC_CHSELR_CHSEL5_BITOFFSET_POS) * LL_ADC_CHANNEL_5)
- | (((ChannelsBitfield & ADC_CHSELR_CHSEL6) >> ADC_CHSELR_CHSEL6_BITOFFSET_POS) * LL_ADC_CHANNEL_6)
- | (((ChannelsBitfield & ADC_CHSELR_CHSEL7) >> ADC_CHSELR_CHSEL7_BITOFFSET_POS) * LL_ADC_CHANNEL_7)
- | (((ChannelsBitfield & ADC_CHSELR_CHSEL8) >> ADC_CHSELR_CHSEL8_BITOFFSET_POS) * LL_ADC_CHANNEL_8)
- | (((ChannelsBitfield & ADC_CHSELR_CHSEL9) >> ADC_CHSELR_CHSEL9_BITOFFSET_POS) * LL_ADC_CHANNEL_9)
- | (((ChannelsBitfield & ADC_CHSELR_CHSEL10) >> ADC_CHSELR_CHSEL10_BITOFFSET_POS) * LL_ADC_CHANNEL_10)
- | (((ChannelsBitfield & ADC_CHSELR_CHSEL11) >> ADC_CHSELR_CHSEL11_BITOFFSET_POS) * LL_ADC_CHANNEL_11)
- | (((ChannelsBitfield & ADC_CHSELR_CHSEL12) >> ADC_CHSELR_CHSEL12_BITOFFSET_POS) * LL_ADC_CHANNEL_12)
- | (((ChannelsBitfield & ADC_CHSELR_CHSEL13) >> ADC_CHSELR_CHSEL13_BITOFFSET_POS) * LL_ADC_CHANNEL_13)
- | (((ChannelsBitfield & ADC_CHSELR_CHSEL14) >> ADC_CHSELR_CHSEL14_BITOFFSET_POS) * LL_ADC_CHANNEL_14)
- | (((ChannelsBitfield & ADC_CHSELR_CHSEL15) >> ADC_CHSELR_CHSEL15_BITOFFSET_POS) * LL_ADC_CHANNEL_15)
-#if defined(ADC_CCR_VLCDEN)
- | (((ChannelsBitfield & ADC_CHSELR_CHSEL16) >> ADC_CHSELR_CHSEL16_BITOFFSET_POS) * LL_ADC_CHANNEL_16)
-#endif
- | (((ChannelsBitfield & ADC_CHSELR_CHSEL17) >> ADC_CHSELR_CHSEL17_BITOFFSET_POS) * LL_ADC_CHANNEL_17)
- | (((ChannelsBitfield & ADC_CHSELR_CHSEL18) >> ADC_CHSELR_CHSEL18_BITOFFSET_POS) * LL_ADC_CHANNEL_18)
- );
-}
-/**
- * @brief Set ADC continuous conversion mode on ADC group regular.
- * @note Description of ADC continuous conversion mode:
- * - single mode: one conversion per trigger
- * - continuous mode: after the first trigger, following
- * conversions launched successively automatically.
- * @note It is not possible to enable both ADC group regular
- * continuous mode and sequencer discontinuous mode.
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be disabled or enabled without conversion on going
- * on group regular.
- * @rmtoll CFGR1 CONT LL_ADC_REG_SetContinuousMode
- * @param ADCx ADC instance
- * @param Continuous This parameter can be one of the following values:
- * @arg @ref LL_ADC_REG_CONV_SINGLE
- * @arg @ref LL_ADC_REG_CONV_CONTINUOUS
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_REG_SetContinuousMode(ADC_TypeDef *ADCx, uint32_t Continuous)
-{
- MODIFY_REG(ADCx->CFGR1, ADC_CFGR1_CONT, Continuous);
-}
-
-/**
- * @brief Get ADC continuous conversion mode on ADC group regular.
- * @note Description of ADC continuous conversion mode:
- * - single mode: one conversion per trigger
- * - continuous mode: after the first trigger, following
- * conversions launched successively automatically.
- * @rmtoll CFGR1 CONT LL_ADC_REG_GetContinuousMode
- * @param ADCx ADC instance
- * @retval Returned value can be one of the following values:
- * @arg @ref LL_ADC_REG_CONV_SINGLE
- * @arg @ref LL_ADC_REG_CONV_CONTINUOUS
- */
-__STATIC_INLINE uint32_t LL_ADC_REG_GetContinuousMode(ADC_TypeDef *ADCx)
-{
- return (uint32_t)(READ_BIT(ADCx->CFGR1, ADC_CFGR1_CONT));
-}
-
-/**
- * @brief Set ADC group regular conversion data transfer: no transfer or
- * transfer by DMA, and DMA requests mode.
- * @note If transfer by DMA selected, specifies the DMA requests
- * mode:
- * - Limited mode (One shot mode): DMA transfer requests are stopped
- * when number of DMA data transfers (number of
- * ADC conversions) is reached.
- * This ADC mode is intended to be used with DMA mode non-circular.
- * - Unlimited mode: DMA transfer requests are unlimited,
- * whatever number of DMA data transfers (number of
- * ADC conversions).
- * This ADC mode is intended to be used with DMA mode circular.
- * @note If ADC DMA requests mode is set to unlimited and DMA is set to
- * mode non-circular:
- * when DMA transfers size will be reached, DMA will stop transfers of
- * ADC conversions data ADC will raise an overrun error
- * (overrun flag and interruption if enabled).
- * @note To configure DMA source address (peripheral address),
- * use function @ref LL_ADC_DMA_GetRegAddr().
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be disabled or enabled without conversion on going
- * on group regular.
- * @rmtoll CFGR1 DMAEN LL_ADC_REG_SetDMATransfer\n
- * CFGR1 DMACFG LL_ADC_REG_SetDMATransfer
- * @param ADCx ADC instance
- * @param DMATransfer This parameter can be one of the following values:
- * @arg @ref LL_ADC_REG_DMA_TRANSFER_NONE
- * @arg @ref LL_ADC_REG_DMA_TRANSFER_LIMITED
- * @arg @ref LL_ADC_REG_DMA_TRANSFER_UNLIMITED
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_REG_SetDMATransfer(ADC_TypeDef *ADCx, uint32_t DMATransfer)
-{
- MODIFY_REG(ADCx->CFGR1, ADC_CFGR1_DMAEN | ADC_CFGR1_DMACFG, DMATransfer);
-}
-
-/**
- * @brief Get ADC group regular conversion data transfer: no transfer or
- * transfer by DMA, and DMA requests mode.
- * @note If transfer by DMA selected, specifies the DMA requests
- * mode:
- * - Limited mode (One shot mode): DMA transfer requests are stopped
- * when number of DMA data transfers (number of
- * ADC conversions) is reached.
- * This ADC mode is intended to be used with DMA mode non-circular.
- * - Unlimited mode: DMA transfer requests are unlimited,
- * whatever number of DMA data transfers (number of
- * ADC conversions).
- * This ADC mode is intended to be used with DMA mode circular.
- * @note If ADC DMA requests mode is set to unlimited and DMA is set to
- * mode non-circular:
- * when DMA transfers size will be reached, DMA will stop transfers of
- * ADC conversions data ADC will raise an overrun error
- * (overrun flag and interruption if enabled).
- * @note To configure DMA source address (peripheral address),
- * use function @ref LL_ADC_DMA_GetRegAddr().
- * @rmtoll CFGR1 DMAEN LL_ADC_REG_GetDMATransfer\n
- * CFGR1 DMACFG LL_ADC_REG_GetDMATransfer
- * @param ADCx ADC instance
- * @retval Returned value can be one of the following values:
- * @arg @ref LL_ADC_REG_DMA_TRANSFER_NONE
- * @arg @ref LL_ADC_REG_DMA_TRANSFER_LIMITED
- * @arg @ref LL_ADC_REG_DMA_TRANSFER_UNLIMITED
- */
-__STATIC_INLINE uint32_t LL_ADC_REG_GetDMATransfer(ADC_TypeDef *ADCx)
-{
- return (uint32_t)(READ_BIT(ADCx->CFGR1, ADC_CFGR1_DMAEN | ADC_CFGR1_DMACFG));
-}
-
-/**
- * @brief Set ADC group regular behavior in case of overrun:
- * data preserved or overwritten.
- * @note Compatibility with devices without feature overrun:
- * other devices without this feature have a behavior
- * equivalent to data overwritten.
- * The default setting of overrun is data preserved.
- * Therefore, for compatibility with all devices, parameter
- * overrun should be set to data overwritten.
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be disabled or enabled without conversion on going
- * on group regular.
- * @rmtoll CFGR1 OVRMOD LL_ADC_REG_SetOverrun
- * @param ADCx ADC instance
- * @param Overrun This parameter can be one of the following values:
- * @arg @ref LL_ADC_REG_OVR_DATA_PRESERVED
- * @arg @ref LL_ADC_REG_OVR_DATA_OVERWRITTEN
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_REG_SetOverrun(ADC_TypeDef *ADCx, uint32_t Overrun)
-{
- MODIFY_REG(ADCx->CFGR1, ADC_CFGR1_OVRMOD, Overrun);
-}
-
-/**
- * @brief Get ADC group regular behavior in case of overrun:
- * data preserved or overwritten.
- * @rmtoll CFGR1 OVRMOD LL_ADC_REG_GetOverrun
- * @param ADCx ADC instance
- * @retval Returned value can be one of the following values:
- * @arg @ref LL_ADC_REG_OVR_DATA_PRESERVED
- * @arg @ref LL_ADC_REG_OVR_DATA_OVERWRITTEN
- */
-__STATIC_INLINE uint32_t LL_ADC_REG_GetOverrun(ADC_TypeDef *ADCx)
-{
- return (uint32_t)(READ_BIT(ADCx->CFGR1, ADC_CFGR1_OVRMOD));
-}
-
-/**
- * @}
- */
-
-
-/** @defgroup ADC_LL_EF_Configuration_ADC_AnalogWatchdog Configuration of ADC transversal scope: analog watchdog
- * @{
- */
-
-/**
- * @brief Set ADC analog watchdog monitored channels:
- * a single channel or all channels,
- * on ADC group regular.
- * @note Once monitored channels are selected, analog watchdog
- * is enabled.
- * @note In case of need to define a single channel to monitor
- * with analog watchdog from sequencer channel definition,
- * use helper macro @ref __LL_ADC_ANALOGWD_CHANNEL_GROUP().
- * @note On this STM32 serie, there is only 1 kind of analog watchdog
- * instance:
- * - AWD standard (instance AWD1):
- * - channels monitored: can monitor 1 channel or all channels.
- * - groups monitored: ADC group regular.
- * - resolution: resolution is not limited (corresponds to
- * ADC resolution configured).
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be disabled or enabled without conversion on going
- * on group regular.
- * @rmtoll CFGR1 AWDCH LL_ADC_SetAnalogWDMonitChannels\n
- * CFGR1 AWDSGL LL_ADC_SetAnalogWDMonitChannels\n
- * CFGR1 AWDEN LL_ADC_SetAnalogWDMonitChannels
- * @param ADCx ADC instance
- * @param AWDChannelGroup This parameter can be one of the following values:
- * @arg @ref LL_ADC_AWD_DISABLE
- * @arg @ref LL_ADC_AWD_ALL_CHANNELS_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_0_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_1_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_2_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_3_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_4_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_5_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_6_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_7_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_8_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_9_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_10_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_11_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_12_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_13_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_14_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_15_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_16_REG (1)
- * @arg @ref LL_ADC_AWD_CHANNEL_17_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_18_REG
- * @arg @ref LL_ADC_AWD_CH_VREFINT_REG
- * @arg @ref LL_ADC_AWD_CH_TEMPSENSOR_REG
- * @arg @ref LL_ADC_AWD_CH_VLCD_REG (1)
- *
- * (1) On STM32L0, parameter not available on all devices: only on STM32L053xx, STM32L063xx, STM32L073xx, STM32L083xx.
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_SetAnalogWDMonitChannels(ADC_TypeDef *ADCx, uint32_t AWDChannelGroup)
-{
- MODIFY_REG(ADCx->CFGR1,
- (ADC_CFGR1_AWDCH | ADC_CFGR1_AWDSGL | ADC_CFGR1_AWDEN),
- (AWDChannelGroup & ADC_AWD_CR_ALL_CHANNEL_MASK));
-}
-
-/**
- * @brief Get ADC analog watchdog monitored channel.
- * @note Usage of the returned channel number:
- * - To reinject this channel into another function LL_ADC_xxx:
- * the returned channel number is only partly formatted on definition
- * of literals LL_ADC_CHANNEL_x. Therefore, it has to be compared
- * with parts of literals LL_ADC_CHANNEL_x or using
- * helper macro @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
- * Then the selected literal LL_ADC_CHANNEL_x can be used
- * as parameter for another function.
- * - To get the channel number in decimal format:
- * process the returned value with the helper macro
- * @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
- * Applicable only when the analog watchdog is set to monitor
- * one channel.
- * @note On this STM32 serie, there is only 1 kind of analog watchdog
- * instance:
- * - AWD standard (instance AWD1):
- * - channels monitored: can monitor 1 channel or all channels.
- * - groups monitored: ADC group regular.
- * - resolution: resolution is not limited (corresponds to
- * ADC resolution configured).
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be disabled or enabled without conversion on going
- * on group regular.
- * @rmtoll CFGR1 AWDCH LL_ADC_GetAnalogWDMonitChannels\n
- * CFGR1 AWDSGL LL_ADC_GetAnalogWDMonitChannels\n
- * CFGR1 AWDEN LL_ADC_GetAnalogWDMonitChannels
- * @param ADCx ADC instance
- * @retval Returned value can be one of the following values:
- * @arg @ref LL_ADC_AWD_DISABLE
- * @arg @ref LL_ADC_AWD_ALL_CHANNELS_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_0_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_1_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_2_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_3_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_4_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_5_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_6_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_7_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_8_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_9_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_10_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_11_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_12_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_13_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_14_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_15_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_16_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_17_REG
- * @arg @ref LL_ADC_AWD_CHANNEL_18_REG
- */
-__STATIC_INLINE uint32_t LL_ADC_GetAnalogWDMonitChannels(ADC_TypeDef *ADCx)
-{
- uint32_t AWDChannelGroup = READ_BIT(ADCx->CFGR1, (ADC_CFGR1_AWDCH | ADC_CFGR1_AWDSGL | ADC_CFGR1_AWDEN));
-
- /* Note: Set variable according to channel definition including channel ID */
- /* with bitfield. */
- uint32_t AWDChannelSingle = ((AWDChannelGroup & ADC_CFGR1_AWDSGL) >> ADC_CFGR1_AWDSGL_BITOFFSET_POS);
- uint32_t AWDChannelBitField = (ADC_CHANNEL_0_BITFIELD << ((AWDChannelGroup & ADC_CHANNEL_ID_NUMBER_MASK) >> ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS));
-
- return (AWDChannelGroup | (AWDChannelBitField * AWDChannelSingle));
-}
-
-/**
- * @brief Set ADC analog watchdog thresholds value of both thresholds
- * high and low.
- * @note If value of only one threshold high or low must be set,
- * use function @ref LL_ADC_SetAnalogWDThresholds().
- * @note In case of ADC resolution different of 12 bits,
- * analog watchdog thresholds data require a specific shift.
- * Use helper macro @ref __LL_ADC_ANALOGWD_SET_THRESHOLD_RESOLUTION().
- * @note On this STM32 serie, there is only 1 kind of analog watchdog
- * instance:
- * - AWD standard (instance AWD1):
- * - channels monitored: can monitor 1 channel or all channels.
- * - groups monitored: ADC group regular.
- * - resolution: resolution is not limited (corresponds to
- * ADC resolution configured).
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be disabled or enabled without conversion on going
- * on group regular.
- * @rmtoll TR HT LL_ADC_ConfigAnalogWDThresholds\n
- * TR LT LL_ADC_ConfigAnalogWDThresholds
- * @param ADCx ADC instance
- * @param AWDThresholdHighValue Value between Min_Data=0x000 and Max_Data=0xFFF
- * @param AWDThresholdLowValue Value between Min_Data=0x000 and Max_Data=0xFFF
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_ConfigAnalogWDThresholds(ADC_TypeDef *ADCx, uint32_t AWDThresholdHighValue, uint32_t AWDThresholdLowValue)
-{
- MODIFY_REG(ADCx->TR,
- ADC_TR_HT | ADC_TR_LT,
- (AWDThresholdHighValue << ADC_TR_HT_BITOFFSET_POS) | AWDThresholdLowValue);
-}
-
-/**
- * @brief Set ADC analog watchdog threshold value of threshold
- * high or low.
- * @note If values of both thresholds high or low must be set,
- * use function @ref LL_ADC_ConfigAnalogWDThresholds().
- * @note In case of ADC resolution different of 12 bits,
- * analog watchdog thresholds data require a specific shift.
- * Use helper macro @ref __LL_ADC_ANALOGWD_SET_THRESHOLD_RESOLUTION().
- * @note On this STM32 serie, there is only 1 kind of analog watchdog
- * instance:
- * - AWD standard (instance AWD1):
- * - channels monitored: can monitor 1 channel or all channels.
- * - groups monitored: ADC group regular.
- * - resolution: resolution is not limited (corresponds to
- * ADC resolution configured).
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be disabled or enabled without conversion on going
- * on group regular.
- * @rmtoll TR HT LL_ADC_SetAnalogWDThresholds\n
- * TR LT LL_ADC_SetAnalogWDThresholds
- * @param ADCx ADC instance
- * @param AWDThresholdsHighLow This parameter can be one of the following values:
- * @arg @ref LL_ADC_AWD_THRESHOLD_HIGH
- * @arg @ref LL_ADC_AWD_THRESHOLD_LOW
- * @param AWDThresholdValue Value between Min_Data=0x000 and Max_Data=0xFFF
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_SetAnalogWDThresholds(ADC_TypeDef *ADCx, uint32_t AWDThresholdsHighLow, uint32_t AWDThresholdValue)
-{
- /* Parameter "AWDThresholdsHighLow" is used with mask "0x00000010" */
- /* to be equivalent to "POSITION_VAL(AWDThresholdsHighLow)": if threshold */
- /* high is selected, then data is shifted to LSB. Else(threshold low), */
- /* data is not shifted. */
- MODIFY_REG(ADCx->TR,
- AWDThresholdsHighLow,
- AWDThresholdValue << ((AWDThresholdsHighLow >> ADC_TR_HT_BITOFFSET_POS) & ((uint32_t)0x00000010U)));
-}
-
-/**
- * @brief Get ADC analog watchdog threshold value of threshold high,
- * threshold low or raw data with ADC thresholds high and low
- * concatenated.
- * @note If raw data with ADC thresholds high and low is retrieved,
- * the data of each threshold high or low can be isolated
- * using helper macro:
- * @ref __LL_ADC_ANALOGWD_THRESHOLDS_HIGH_LOW().
- * @note In case of ADC resolution different of 12 bits,
- * analog watchdog thresholds data require a specific shift.
- * Use helper macro @ref __LL_ADC_ANALOGWD_GET_THRESHOLD_RESOLUTION().
- * @rmtoll TR HT LL_ADC_GetAnalogWDThresholds\n
- * TR LT LL_ADC_GetAnalogWDThresholds
- * @param ADCx ADC instance
- * @param AWDThresholdsHighLow This parameter can be one of the following values:
- * @arg @ref LL_ADC_AWD_THRESHOLD_HIGH
- * @arg @ref LL_ADC_AWD_THRESHOLD_LOW
- * @arg @ref LL_ADC_AWD_THRESHOLDS_HIGH_LOW
- * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
-*/
-__STATIC_INLINE uint32_t LL_ADC_GetAnalogWDThresholds(ADC_TypeDef *ADCx, uint32_t AWDThresholdsHighLow)
-{
- /* Parameter "AWDThresholdsHighLow" is used with mask "0x00000010" */
- /* to be equivalent to "POSITION_VAL(AWDThresholdsHighLow)": if threshold */
- /* high is selected, then data is shifted to LSB. Else(threshold low or */
- /* both thresholds), data is not shifted. */
- return (uint32_t)(READ_BIT(ADCx->TR,
- (AWDThresholdsHighLow | ADC_TR_LT))
- >> ((~AWDThresholdsHighLow) & (0x00000010U))
- );
-}
-
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EF_Configuration_ADC_oversampling Configuration of ADC transversal scope: oversampling
- * @{
- */
-
-/**
- * @brief Set ADC oversampling scope.
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be disabled or enabled without conversion on going
- * on group regular.
- * @rmtoll CFGR2 OVSE LL_ADC_SetOverSamplingScope
- * @param ADCx ADC instance
- * @param OvsScope This parameter can be one of the following values:
- * @arg @ref LL_ADC_OVS_DISABLE
- * @arg @ref LL_ADC_OVS_GRP_REGULAR_CONTINUED
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_SetOverSamplingScope(ADC_TypeDef *ADCx, uint32_t OvsScope)
-{
- MODIFY_REG(ADCx->CFGR2, ADC_CFGR2_OVSE, OvsScope);
-}
-
-/**
- * @brief Get ADC oversampling scope.
- * @rmtoll CFGR2 OVSE LL_ADC_GetOverSamplingScope
- * @param ADCx ADC instance
- * @retval Returned value can be one of the following values:
- * @arg @ref LL_ADC_OVS_DISABLE
- * @arg @ref LL_ADC_OVS_GRP_REGULAR_CONTINUED
- */
-__STATIC_INLINE uint32_t LL_ADC_GetOverSamplingScope(ADC_TypeDef *ADCx)
-{
- return (uint32_t)(READ_BIT(ADCx->CFGR2, ADC_CFGR2_OVSE));
-}
-
-/**
- * @brief Set ADC oversampling discontinuous mode (triggered mode)
- * on the selected ADC group.
- * @note Number of oversampled conversions are done either in:
- * - continuous mode (all conversions of oversampling ratio
- * are done from 1 trigger)
- * - discontinuous mode (each conversion of oversampling ratio
- * needs a trigger)
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be disabled or enabled without conversion on going
- * on group regular.
- * @rmtoll CFGR2 TOVS LL_ADC_SetOverSamplingDiscont
- * @param ADCx ADC instance
- * @param OverSamplingDiscont This parameter can be one of the following values:
- * @arg @ref LL_ADC_OVS_REG_CONT
- * @arg @ref LL_ADC_OVS_REG_DISCONT
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_SetOverSamplingDiscont(ADC_TypeDef *ADCx, uint32_t OverSamplingDiscont)
-{
- MODIFY_REG(ADCx->CFGR2, ADC_CFGR2_TOVS, OverSamplingDiscont);
-}
-
-/**
- * @brief Get ADC oversampling discontinuous mode (triggered mode)
- * on the selected ADC group.
- * @note Number of oversampled conversions are done either in:
- * - continuous mode (all conversions of oversampling ratio
- * are done from 1 trigger)
- * - discontinuous mode (each conversion of oversampling ratio
- * needs a trigger)
- * @rmtoll CFGR2 TOVS LL_ADC_GetOverSamplingDiscont
- * @param ADCx ADC instance
- * @retval Returned value can be one of the following values:
- * @arg @ref LL_ADC_OVS_REG_CONT
- * @arg @ref LL_ADC_OVS_REG_DISCONT
- */
-__STATIC_INLINE uint32_t LL_ADC_GetOverSamplingDiscont(ADC_TypeDef *ADCx)
-{
- return (uint32_t)(READ_BIT(ADCx->CFGR2, ADC_CFGR2_TOVS));
-}
-
-/**
- * @brief Set ADC oversampling
- * @note This function set the 2 items of oversampling configuration:
- * - ratio
- * - shift
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be disabled or enabled without conversion on going
- * on group regular.
- * @rmtoll CFGR2 OVSS LL_ADC_ConfigOverSamplingRatioShift\n
- * CFGR2 OVSR LL_ADC_ConfigOverSamplingRatioShift
- * @param ADCx ADC instance
- * @param Ratio This parameter can be one of the following values:
- * @arg @ref LL_ADC_OVS_RATIO_2
- * @arg @ref LL_ADC_OVS_RATIO_4
- * @arg @ref LL_ADC_OVS_RATIO_8
- * @arg @ref LL_ADC_OVS_RATIO_16
- * @arg @ref LL_ADC_OVS_RATIO_32
- * @arg @ref LL_ADC_OVS_RATIO_64
- * @arg @ref LL_ADC_OVS_RATIO_128
- * @arg @ref LL_ADC_OVS_RATIO_256
- * @param Shift This parameter can be one of the following values:
- * @arg @ref LL_ADC_OVS_SHIFT_NONE
- * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_1
- * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_2
- * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_3
- * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_4
- * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_5
- * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_6
- * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_7
- * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_8
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_ConfigOverSamplingRatioShift(ADC_TypeDef *ADCx, uint32_t Ratio, uint32_t Shift)
-{
- MODIFY_REG(ADCx->CFGR2, (ADC_CFGR2_OVSS | ADC_CFGR2_OVSR), (Shift | Ratio));
-}
-
-/**
- * @brief Get ADC oversampling ratio
- * @rmtoll CFGR2 OVSR LL_ADC_GetOverSamplingRatio
- * @param ADCx ADC instance
- * @retval Ratio This parameter can be one of the following values:
- * @arg @ref LL_ADC_OVS_RATIO_2
- * @arg @ref LL_ADC_OVS_RATIO_4
- * @arg @ref LL_ADC_OVS_RATIO_8
- * @arg @ref LL_ADC_OVS_RATIO_16
- * @arg @ref LL_ADC_OVS_RATIO_32
- * @arg @ref LL_ADC_OVS_RATIO_64
- * @arg @ref LL_ADC_OVS_RATIO_128
- * @arg @ref LL_ADC_OVS_RATIO_256
-*/
-__STATIC_INLINE uint32_t LL_ADC_GetOverSamplingRatio(ADC_TypeDef *ADCx)
-{
- return (uint32_t)(READ_BIT(ADCx->CFGR2, ADC_CFGR2_OVSR));
-}
-
-/**
- * @brief Get ADC oversampling shift
- * @rmtoll CFGR2 OVSS LL_ADC_GetOverSamplingShift
- * @param ADCx ADC instance
- * @retval Shift This parameter can be one of the following values:
- * @arg @ref LL_ADC_OVS_SHIFT_NONE
- * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_1
- * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_2
- * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_3
- * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_4
- * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_5
- * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_6
- * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_7
- * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_8
-*/
-__STATIC_INLINE uint32_t LL_ADC_GetOverSamplingShift(ADC_TypeDef *ADCx)
-{
- return (uint32_t)(READ_BIT(ADCx->CFGR2, ADC_CFGR2_OVSS));
-}
-
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EF_Operation_ADC_Instance Operation on ADC hierarchical scope: ADC instance
- * @{
- */
-
-/**
- * @brief Enable ADC instance internal voltage regulator.
- * @note On this STM32 serie, there are three possibilities to enable
- * the voltage regulator:
- * - by enabling it manually
- * using function @ref LL_ADC_EnableInternalRegulator().
- * - by launching a calibration
- * using function @ref LL_ADC_StartCalibration().
- * - by enabling the ADC
- * using function @ref LL_ADC_Enable().
- * @note On this STM32 serie, after ADC internal voltage regulator enable,
- * a delay for ADC internal voltage regulator stabilization
- * is required before performing a ADC calibration or ADC enable.
- * Refer to device datasheet, parameter "tUP_LDO".
- * Refer to literal @ref LL_ADC_DELAY_INTERNAL_REGUL_STAB_US.
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be ADC disabled.
- * @rmtoll CR ADVREGEN LL_ADC_EnableInternalRegulator
- * @param ADCx ADC instance
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_EnableInternalRegulator(ADC_TypeDef *ADCx)
-{
- /* Note: Write register with some additional bits forced to state reset */
- /* instead of modifying only the selected bit for this function, */
- /* to not interfere with bits with HW property "rs". */
- MODIFY_REG(ADCx->CR,
- ADC_CR_BITS_PROPERTY_RS,
- ADC_CR_ADVREGEN);
-}
-
-/**
- * @brief Disable ADC internal voltage regulator.
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be ADC disabled.
- * @rmtoll CR ADVREGEN LL_ADC_DisableInternalRegulator
- * @param ADCx ADC instance
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_DisableInternalRegulator(ADC_TypeDef *ADCx)
-{
- CLEAR_BIT(ADCx->CR, (ADC_CR_ADVREGEN | ADC_CR_BITS_PROPERTY_RS));
-}
-
-/**
- * @brief Get the selected ADC instance internal voltage regulator state.
- * @rmtoll CR ADVREGEN LL_ADC_IsInternalRegulatorEnabled
- * @param ADCx ADC instance
- * @retval 0: internal regulator is disabled, 1: internal regulator is enabled.
- */
-__STATIC_INLINE uint32_t LL_ADC_IsInternalRegulatorEnabled(ADC_TypeDef *ADCx)
-{
- return (READ_BIT(ADCx->CR, ADC_CR_ADVREGEN) == (ADC_CR_ADVREGEN));
-}
-
-/**
- * @brief Enable the selected ADC instance.
- * @note On this STM32 serie, after ADC enable, a delay for
- * ADC internal analog stabilization is required before performing a
- * ADC conversion start.
- * Refer to device datasheet, parameter tSTAB.
- * @note On this STM32 serie, flag LL_ADC_FLAG_ADRDY is raised when the ADC
- * is enabled and when conversion clock is active.
- * (not only core clock: this ADC has a dual clock domain)
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be ADC disabled and ADC internal voltage regulator enabled.
- * @rmtoll CR ADEN LL_ADC_Enable
- * @param ADCx ADC instance
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_Enable(ADC_TypeDef *ADCx)
-{
- /* Note: Write register with some additional bits forced to state reset */
- /* instead of modifying only the selected bit for this function, */
- /* to not interfere with bits with HW property "rs". */
- MODIFY_REG(ADCx->CR,
- ADC_CR_BITS_PROPERTY_RS,
- ADC_CR_ADEN);
-}
-
-/**
- * @brief Disable the selected ADC instance.
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be not disabled. Must be enabled without conversion on going
- * on group regular.
- * @rmtoll CR ADDIS LL_ADC_Disable
- * @param ADCx ADC instance
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_Disable(ADC_TypeDef *ADCx)
-{
- /* Note: Write register with some additional bits forced to state reset */
- /* instead of modifying only the selected bit for this function, */
- /* to not interfere with bits with HW property "rs". */
- MODIFY_REG(ADCx->CR,
- ADC_CR_BITS_PROPERTY_RS,
- ADC_CR_ADDIS);
-}
-
-/**
- * @brief Get the selected ADC instance enable state.
- * @note On this STM32 serie, flag LL_ADC_FLAG_ADRDY is raised when the ADC
- * is enabled and when conversion clock is active.
- * (not only core clock: this ADC has a dual clock domain)
- * @rmtoll CR ADEN LL_ADC_IsEnabled
- * @param ADCx ADC instance
- * @retval 0: ADC is disabled, 1: ADC is enabled.
- */
-__STATIC_INLINE uint32_t LL_ADC_IsEnabled(ADC_TypeDef *ADCx)
-{
- return (READ_BIT(ADCx->CR, ADC_CR_ADEN) == (ADC_CR_ADEN));
-}
-
-/**
- * @brief Get the selected ADC instance disable state.
- * @rmtoll CR ADDIS LL_ADC_IsDisableOngoing
- * @param ADCx ADC instance
- * @retval 0: no ADC disable command on going.
- */
-__STATIC_INLINE uint32_t LL_ADC_IsDisableOngoing(ADC_TypeDef *ADCx)
-{
- return (READ_BIT(ADCx->CR, ADC_CR_ADDIS) == (ADC_CR_ADDIS));
-}
-
-/**
- * @brief Start ADC calibration in the mode single-ended
- * or differential (for devices with differential mode available).
- * @note On this STM32 serie, a minimum number of ADC clock cycles
- * are required between ADC end of calibration and ADC enable.
- * Refer to literal @ref LL_ADC_DELAY_CALIB_ENABLE_ADC_CYCLES.
- * @note In case of usage of ADC with DMA transfer:
- * On this STM32 serie, ADC DMA transfer request should be disabled
- * during calibration:
- * Calibration factor is available in data register
- * and also transfered by DMA.
- * To not insert ADC calibration factor among ADC conversion data
- * in array variable, DMA transfer must be disabled during
- * calibration.
- * (DMA transfer setting backup and disable before calibration,
- * DMA transfer setting restore after calibration.
- * Refer to functions @ref LL_ADC_REG_GetDMATransfer(),
- * @ref LL_ADC_REG_SetDMATransfer() ).
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be ADC disabled.
- * @rmtoll CR ADCAL LL_ADC_StartCalibration
- * @param ADCx ADC instance
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_StartCalibration(ADC_TypeDef *ADCx)
-{
- /* Note: Write register with some additional bits forced to state reset */
- /* instead of modifying only the selected bit for this function, */
- /* to not interfere with bits with HW property "rs". */
- MODIFY_REG(ADCx->CR,
- ADC_CR_BITS_PROPERTY_RS,
- ADC_CR_ADCAL);
-}
-
-/**
- * @brief Get ADC calibration state.
- * @rmtoll CR ADCAL LL_ADC_IsCalibrationOnGoing
- * @param ADCx ADC instance
- * @retval 0: calibration complete, 1: calibration in progress.
- */
-__STATIC_INLINE uint32_t LL_ADC_IsCalibrationOnGoing(ADC_TypeDef *ADCx)
-{
- return (READ_BIT(ADCx->CR, ADC_CR_ADCAL) == (ADC_CR_ADCAL));
-}
-
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EF_Operation_ADC_Group_Regular Operation on ADC hierarchical scope: group regular
- * @{
- */
-
-/**
- * @brief Start ADC group regular conversion.
- * @note On this STM32 serie, this function is relevant for both
- * internal trigger (SW start) and external trigger:
- * - If ADC trigger has been set to software start, ADC conversion
- * starts immediately.
- * - If ADC trigger has been set to external trigger, ADC conversion
- * will start at next trigger event (on the selected trigger edge)
- * following the ADC start conversion command.
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be enabled without conversion on going on group regular,
- * without conversion stop command on going on group regular,
- * without ADC disable command on going.
- * @rmtoll CR ADSTART LL_ADC_REG_StartConversion
- * @param ADCx ADC instance
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_REG_StartConversion(ADC_TypeDef *ADCx)
-{
- /* Note: Write register with some additional bits forced to state reset */
- /* instead of modifying only the selected bit for this function, */
- /* to not interfere with bits with HW property "rs". */
- MODIFY_REG(ADCx->CR,
- ADC_CR_BITS_PROPERTY_RS,
- ADC_CR_ADSTART);
-}
-
-/**
- * @brief Stop ADC group regular conversion.
- * @note On this STM32 serie, setting of this feature is conditioned to
- * ADC state:
- * ADC must be enabled with conversion on going on group regular,
- * without ADC disable command on going.
- * @rmtoll CR ADSTP LL_ADC_REG_StopConversion
- * @param ADCx ADC instance
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_REG_StopConversion(ADC_TypeDef *ADCx)
-{
- /* Note: Write register with some additional bits forced to state reset */
- /* instead of modifying only the selected bit for this function, */
- /* to not interfere with bits with HW property "rs". */
- MODIFY_REG(ADCx->CR,
- ADC_CR_BITS_PROPERTY_RS,
- ADC_CR_ADSTP);
-}
-
-/**
- * @brief Get ADC group regular conversion state.
- * @rmtoll CR ADSTART LL_ADC_REG_IsConversionOngoing
- * @param ADCx ADC instance
- * @retval 0: no conversion is on going on ADC group regular.
- */
-__STATIC_INLINE uint32_t LL_ADC_REG_IsConversionOngoing(ADC_TypeDef *ADCx)
-{
- return (READ_BIT(ADCx->CR, ADC_CR_ADSTART) == (ADC_CR_ADSTART));
-}
-
-/**
- * @brief Get ADC group regular command of conversion stop state
- * @rmtoll CR ADSTP LL_ADC_REG_IsStopConversionOngoing
- * @param ADCx ADC instance
- * @retval 0: no command of conversion stop is on going on ADC group regular.
- */
-__STATIC_INLINE uint32_t LL_ADC_REG_IsStopConversionOngoing(ADC_TypeDef *ADCx)
-{
- return (READ_BIT(ADCx->CR, ADC_CR_ADSTP) == (ADC_CR_ADSTP));
-}
-
-/**
- * @brief Get ADC group regular conversion data, range fit for
- * all ADC configurations: all ADC resolutions and
- * all oversampling increased data width (for devices
- * with feature oversampling).
- * @rmtoll DR DATA LL_ADC_REG_ReadConversionData32
- * @param ADCx ADC instance
- * @retval Value between Min_Data=0x00000000 and Max_Data=0xFFFFFFFF
- */
-__STATIC_INLINE uint32_t LL_ADC_REG_ReadConversionData32(ADC_TypeDef *ADCx)
-{
- return (uint32_t)(READ_BIT(ADCx->DR, ADC_DR_DATA));
-}
-
-/**
- * @brief Get ADC group regular conversion data, range fit for
- * ADC resolution 12 bits.
- * @note For devices with feature oversampling: Oversampling
- * can increase data width, function for extended range
- * may be needed: @ref LL_ADC_REG_ReadConversionData32.
- * @rmtoll DR DATA LL_ADC_REG_ReadConversionData12
- * @param ADCx ADC instance
- * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
- */
-__STATIC_INLINE uint16_t LL_ADC_REG_ReadConversionData12(ADC_TypeDef *ADCx)
-{
- return (uint16_t)(READ_BIT(ADCx->DR, ADC_DR_DATA));
-}
-
-/**
- * @brief Get ADC group regular conversion data, range fit for
- * ADC resolution 10 bits.
- * @note For devices with feature oversampling: Oversampling
- * can increase data width, function for extended range
- * may be needed: @ref LL_ADC_REG_ReadConversionData32.
- * @rmtoll DR DATA LL_ADC_REG_ReadConversionData10
- * @param ADCx ADC instance
- * @retval Value between Min_Data=0x000 and Max_Data=0x3FF
- */
-__STATIC_INLINE uint16_t LL_ADC_REG_ReadConversionData10(ADC_TypeDef *ADCx)
-{
- return (uint16_t)(READ_BIT(ADCx->DR, ADC_DR_DATA));
-}
-
-/**
- * @brief Get ADC group regular conversion data, range fit for
- * ADC resolution 8 bits.
- * @note For devices with feature oversampling: Oversampling
- * can increase data width, function for extended range
- * may be needed: @ref LL_ADC_REG_ReadConversionData32.
- * @rmtoll DR DATA LL_ADC_REG_ReadConversionData8
- * @param ADCx ADC instance
- * @retval Value between Min_Data=0x00 and Max_Data=0xFF
- */
-__STATIC_INLINE uint8_t LL_ADC_REG_ReadConversionData8(ADC_TypeDef *ADCx)
-{
- return (uint8_t)(READ_BIT(ADCx->DR, ADC_DR_DATA));
-}
-
-/**
- * @brief Get ADC group regular conversion data, range fit for
- * ADC resolution 6 bits.
- * @note For devices with feature oversampling: Oversampling
- * can increase data width, function for extended range
- * may be needed: @ref LL_ADC_REG_ReadConversionData32.
- * @rmtoll DR DATA LL_ADC_REG_ReadConversionData6
- * @param ADCx ADC instance
- * @retval Value between Min_Data=0x00 and Max_Data=0x3F
- */
-__STATIC_INLINE uint8_t LL_ADC_REG_ReadConversionData6(ADC_TypeDef *ADCx)
-{
- return (uint8_t)(READ_BIT(ADCx->DR, ADC_DR_DATA));
-}
-
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EF_FLAG_Management ADC flag management
- * @{
- */
-
-/**
- * @brief Get flag ADC ready.
- * @note On this STM32 serie, flag LL_ADC_FLAG_ADRDY is raised when the ADC
- * is enabled and when conversion clock is active.
- * (not only core clock: this ADC has a dual clock domain)
- * @rmtoll ISR ADRDY LL_ADC_IsActiveFlag_ADRDY
- * @param ADCx ADC instance
- * @retval State of bit (1 or 0).
- */
-__STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_ADRDY(ADC_TypeDef *ADCx)
-{
- return (READ_BIT(ADCx->ISR, LL_ADC_FLAG_ADRDY) == (LL_ADC_FLAG_ADRDY));
-}
-
-/**
- * @brief Get flag ADC group regular end of unitary conversion.
- * @rmtoll ISR EOC LL_ADC_IsActiveFlag_EOC
- * @param ADCx ADC instance
- * @retval State of bit (1 or 0).
- */
-__STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_EOC(ADC_TypeDef *ADCx)
-{
- return (READ_BIT(ADCx->ISR, ADC_ISR_EOC) == (ADC_ISR_EOC));
-}
-
-/**
- * @brief Get flag ADC group regular end of sequence conversions.
- * @rmtoll ISR EOSEQ LL_ADC_IsActiveFlag_EOS
- * @param ADCx ADC instance
- * @retval State of bit (1 or 0).
- */
-__STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_EOS(ADC_TypeDef *ADCx)
-{
- return (READ_BIT(ADCx->ISR, LL_ADC_FLAG_EOS) == (LL_ADC_FLAG_EOS));
-}
-
-/**
- * @brief Get flag ADC group regular overrun.
- * @rmtoll ISR OVR LL_ADC_IsActiveFlag_OVR
- * @param ADCx ADC instance
- * @retval State of bit (1 or 0).
- */
-__STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_OVR(ADC_TypeDef *ADCx)
-{
- return (READ_BIT(ADCx->ISR, LL_ADC_FLAG_OVR) == (LL_ADC_FLAG_OVR));
-}
-
-/**
- * @brief Get flag ADC group regular end of sampling phase.
- * @rmtoll ISR EOSMP LL_ADC_IsActiveFlag_EOSMP
- * @param ADCx ADC instance
- * @retval State of bit (1 or 0).
- */
-__STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_EOSMP(ADC_TypeDef *ADCx)
-{
- return (READ_BIT(ADCx->ISR, LL_ADC_FLAG_EOSMP) == (LL_ADC_FLAG_EOSMP));
-}
-
-/**
- * @brief Get flag ADC analog watchdog 1 flag
- * @rmtoll ISR AWD LL_ADC_IsActiveFlag_AWD1
- * @param ADCx ADC instance
- * @retval State of bit (1 or 0).
- */
-__STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_AWD1(ADC_TypeDef *ADCx)
-{
- return (READ_BIT(ADCx->ISR, LL_ADC_FLAG_AWD1) == (LL_ADC_FLAG_AWD1));
-}
-
-/**
- * @brief Get flag ADC end of calibration.
- * @rmtoll ISR EOCAL LL_ADC_IsActiveFlag_EOCAL
- * @param ADCx ADC instance
- * @retval State of bit (1 or 0).
- */
-__STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_EOCAL(ADC_TypeDef *ADCx)
-{
- return (READ_BIT(ADCx->ISR, LL_ADC_FLAG_EOCAL) == (LL_ADC_FLAG_EOCAL));
-}
-
-/**
- * @brief Clear flag ADC ready.
- * @note On this STM32 serie, flag LL_ADC_FLAG_ADRDY is raised when the ADC
- * is enabled and when conversion clock is active.
- * (not only core clock: this ADC has a dual clock domain)
- * @rmtoll ISR ADRDY LL_ADC_ClearFlag_ADRDY
- * @param ADCx ADC instance
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_ClearFlag_ADRDY(ADC_TypeDef *ADCx)
-{
- WRITE_REG(ADCx->ISR, LL_ADC_FLAG_ADRDY);
-}
-
-/**
- * @brief Clear flag ADC group regular end of unitary conversion.
- * @rmtoll ISR EOC LL_ADC_ClearFlag_EOC
- * @param ADCx ADC instance
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_ClearFlag_EOC(ADC_TypeDef *ADCx)
-{
- WRITE_REG(ADCx->ISR, LL_ADC_FLAG_EOC);
-}
-
-/**
- * @brief Clear flag ADC group regular end of sequence conversions.
- * @rmtoll ISR EOSEQ LL_ADC_ClearFlag_EOS
- * @param ADCx ADC instance
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_ClearFlag_EOS(ADC_TypeDef *ADCx)
-{
- WRITE_REG(ADCx->ISR, LL_ADC_FLAG_EOS);
-}
-
-/**
- * @brief Clear flag ADC group regular overrun.
- * @rmtoll ISR OVR LL_ADC_ClearFlag_OVR
- * @param ADCx ADC instance
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_ClearFlag_OVR(ADC_TypeDef *ADCx)
-{
- WRITE_REG(ADCx->ISR, LL_ADC_FLAG_OVR);
-}
-
-/**
- * @brief Clear flag ADC group regular end of sampling phase.
- * @rmtoll ISR EOSMP LL_ADC_ClearFlag_EOSMP
- * @param ADCx ADC instance
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_ClearFlag_EOSMP(ADC_TypeDef *ADCx)
-{
- WRITE_REG(ADCx->ISR, LL_ADC_FLAG_EOSMP);
-}
-
-/**
- * @brief Clear flag ADC analog watchdog 1.
- * @rmtoll ISR AWD LL_ADC_ClearFlag_AWD1
- * @param ADCx ADC instance
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_ClearFlag_AWD1(ADC_TypeDef *ADCx)
-{
- WRITE_REG(ADCx->ISR, LL_ADC_FLAG_AWD1);
-}
-
-/**
- * @brief Clear flag ADC end of calibration.
- * @rmtoll ISR EOCAL LL_ADC_ClearFlag_EOCAL
- * @param ADCx ADC instance
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_ClearFlag_EOCAL(ADC_TypeDef *ADCx)
-{
- WRITE_REG(ADCx->ISR, LL_ADC_FLAG_EOCAL);
-}
-
-/**
- * @}
- */
-
-/** @defgroup ADC_LL_EF_IT_Management ADC IT management
- * @{
- */
-
-/**
- * @brief Enable ADC ready.
- * @rmtoll IER ADRDYIE LL_ADC_EnableIT_ADRDY
- * @param ADCx ADC instance
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_EnableIT_ADRDY(ADC_TypeDef *ADCx)
-{
- SET_BIT(ADCx->IER, LL_ADC_IT_ADRDY);
-}
-
-/**
- * @brief Enable interruption ADC group regular end of unitary conversion.
- * @rmtoll IER EOCIE LL_ADC_EnableIT_EOC
- * @param ADCx ADC instance
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_EnableIT_EOC(ADC_TypeDef *ADCx)
-{
- SET_BIT(ADCx->IER, LL_ADC_IT_EOC);
-}
-
-/**
- * @brief Enable interruption ADC group regular end of sequence conversions.
- * @rmtoll IER EOSEQIE LL_ADC_EnableIT_EOS
- * @param ADCx ADC instance
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_EnableIT_EOS(ADC_TypeDef *ADCx)
-{
- SET_BIT(ADCx->IER, LL_ADC_IT_EOS);
-}
-
-/**
- * @brief Enable ADC group regular interruption overrun.
- * @rmtoll IER OVRIE LL_ADC_EnableIT_OVR
- * @param ADCx ADC instance
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_EnableIT_OVR(ADC_TypeDef *ADCx)
-{
- SET_BIT(ADCx->IER, LL_ADC_IT_OVR);
-}
-
-/**
- * @brief Enable interruption ADC group regular end of sampling.
- * @rmtoll IER EOSMPIE LL_ADC_EnableIT_EOSMP
- * @param ADCx ADC instance
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_EnableIT_EOSMP(ADC_TypeDef *ADCx)
-{
- SET_BIT(ADCx->IER, LL_ADC_IT_EOSMP);
-}
-
-/**
- * @brief Enable interruption ADC analog watchdog 1.
- * @rmtoll IER AWDIE LL_ADC_EnableIT_AWD1
- * @param ADCx ADC instance
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_EnableIT_AWD1(ADC_TypeDef *ADCx)
-{
- SET_BIT(ADCx->IER, LL_ADC_IT_AWD1);
-}
-
-/**
- * @brief Enable interruption ADC end of calibration.
- * @rmtoll IER EOCALIE LL_ADC_EnableIT_EOCAL
- * @param ADCx ADC instance
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_EnableIT_EOCAL(ADC_TypeDef *ADCx)
-{
- SET_BIT(ADCx->IER, LL_ADC_IT_EOCAL);
-}
-
-/**
- * @brief Disable interruption ADC ready.
- * @rmtoll IER ADRDYIE LL_ADC_DisableIT_ADRDY
- * @param ADCx ADC instance
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_DisableIT_ADRDY(ADC_TypeDef *ADCx)
-{
- CLEAR_BIT(ADCx->IER, LL_ADC_IT_ADRDY);
-}
-
-/**
- * @brief Disable interruption ADC group regular end of unitary conversion.
- * @rmtoll IER EOCIE LL_ADC_DisableIT_EOC
- * @param ADCx ADC instance
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_DisableIT_EOC(ADC_TypeDef *ADCx)
-{
- CLEAR_BIT(ADCx->IER, LL_ADC_IT_EOC);
-}
-
-/**
- * @brief Disable interruption ADC group regular end of sequence conversions.
- * @rmtoll IER EOSEQIE LL_ADC_DisableIT_EOS
- * @param ADCx ADC instance
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_DisableIT_EOS(ADC_TypeDef *ADCx)
-{
- CLEAR_BIT(ADCx->IER, LL_ADC_IT_EOS);
-}
-
-/**
- * @brief Disable interruption ADC group regular overrun.
- * @rmtoll IER OVRIE LL_ADC_DisableIT_OVR
- * @param ADCx ADC instance
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_DisableIT_OVR(ADC_TypeDef *ADCx)
-{
- CLEAR_BIT(ADCx->IER, LL_ADC_IT_OVR);
-}
-
-/**
- * @brief Disable interruption ADC group regular end of sampling.
- * @rmtoll IER EOSMPIE LL_ADC_DisableIT_EOSMP
- * @param ADCx ADC instance
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_DisableIT_EOSMP(ADC_TypeDef *ADCx)
-{
- CLEAR_BIT(ADCx->IER, LL_ADC_IT_EOSMP);
-}
-
-/**
- * @brief Disable interruption ADC analog watchdog 1.
- * @rmtoll IER AWDIE LL_ADC_DisableIT_AWD1
- * @param ADCx ADC instance
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_DisableIT_AWD1(ADC_TypeDef *ADCx)
-{
- CLEAR_BIT(ADCx->IER, LL_ADC_IT_AWD1);
-}
-
-/**
- * @brief Disable interruption ADC end of calibration.
- * @rmtoll IER EOCALIE LL_ADC_DisableIT_EOCAL
- * @param ADCx ADC instance
- * @retval None
- */
-__STATIC_INLINE void LL_ADC_DisableIT_EOCAL(ADC_TypeDef *ADCx)
-{
- CLEAR_BIT(ADCx->IER, LL_ADC_IT_EOCAL);
-}
-
-/**
- * @brief Get state of interruption ADC ready
- * (0: interrupt disabled, 1: interrupt enabled).
- * @rmtoll IER ADRDYIE LL_ADC_IsEnabledIT_ADRDY
- * @param ADCx ADC instance
- * @retval State of bit (1 or 0).
- */
-__STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_ADRDY(ADC_TypeDef *ADCx)
-{
- return (READ_BIT(ADCx->IER, LL_ADC_IT_ADRDY) == (LL_ADC_IT_ADRDY));
-}
-
-/**
- * @brief Get state of interruption ADC group regular end of unitary conversion
- * (0: interrupt disabled, 1: interrupt enabled).
- * @rmtoll IER EOCIE LL_ADC_IsEnabledIT_EOC
- * @param ADCx ADC instance
- * @retval State of bit (1 or 0).
- */
-__STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_EOC(ADC_TypeDef *ADCx)
-{
- return (READ_BIT(ADCx->IER, LL_ADC_IT_EOC) == (LL_ADC_IT_EOC));
-}
-
-/**
- * @brief Get state of interruption ADC group regular end of sequence conversions
- * (0: interrupt disabled, 1: interrupt enabled).
- * @rmtoll IER EOSEQIE LL_ADC_IsEnabledIT_EOS
- * @param ADCx ADC instance
- * @retval State of bit (1 or 0).
- */
-__STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_EOS(ADC_TypeDef *ADCx)
-{
- return (READ_BIT(ADCx->IER, LL_ADC_IT_EOS) == (LL_ADC_IT_EOS));
-}
-
-/**
- * @brief Get state of interruption ADC group regular overrun
- * (0: interrupt disabled, 1: interrupt enabled).
- * @rmtoll IER OVRIE LL_ADC_IsEnabledIT_OVR
- * @param ADCx ADC instance
- * @retval State of bit (1 or 0).
- */
-__STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_OVR(ADC_TypeDef *ADCx)
-{
- return (READ_BIT(ADCx->IER, LL_ADC_IT_OVR) == (LL_ADC_IT_OVR));
-}
-
-/**
- * @brief Get state of interruption ADC group regular end of sampling
- * (0: interrupt disabled, 1: interrupt enabled).
- * @rmtoll IER EOSMPIE LL_ADC_IsEnabledIT_EOSMP
- * @param ADCx ADC instance
- * @retval State of bit (1 or 0).
- */
-__STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_EOSMP(ADC_TypeDef *ADCx)
-{
- return (READ_BIT(ADCx->IER, LL_ADC_IT_EOSMP) == (LL_ADC_IT_EOSMP));
-}
-
-/**
- * @brief Get state of interruption ADC analog watchdog 1
- * (0: interrupt disabled, 1: interrupt enabled).
- * @rmtoll IER AWDIE LL_ADC_IsEnabledIT_AWD1
- * @param ADCx ADC instance
- * @retval State of bit (1 or 0).
- */
-__STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_AWD1(ADC_TypeDef *ADCx)
-{
- return (READ_BIT(ADCx->IER, LL_ADC_IT_AWD1) == (LL_ADC_IT_AWD1));
-}
-
-/**
- * @brief Get state of interruption ADC end of calibration
- * (0: interrupt disabled, 1: interrupt enabled).
- * @rmtoll IER EOCALIE LL_ADC_IsEnabledIT_EOCAL
- * @param ADCx ADC instance
- * @retval State of bit (1 or 0).
- */
-__STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_EOCAL(ADC_TypeDef *ADCx)
-{
- return (READ_BIT(ADCx->IER, LL_ADC_IT_EOCAL) == (LL_ADC_IT_EOCAL));
-}
-
-/**
- * @}
- */
-
-#if defined(USE_FULL_LL_DRIVER)
-/** @defgroup ADC_LL_EF_Init Initialization and de-initialization functions
- * @{
- */
-
-/* Initialization of some features of ADC common parameters and multimode */
-ErrorStatus LL_ADC_CommonDeInit(ADC_Common_TypeDef *ADCxy_COMMON);
-ErrorStatus LL_ADC_CommonInit(ADC_Common_TypeDef *ADCxy_COMMON, LL_ADC_CommonInitTypeDef *ADC_CommonInitStruct);
-void LL_ADC_CommonStructInit(LL_ADC_CommonInitTypeDef *ADC_CommonInitStruct);
-
-/* De-initialization of ADC instance */
-ErrorStatus LL_ADC_DeInit(ADC_TypeDef *ADCx);
-
-/* Initialization of some features of ADC instance */
-ErrorStatus LL_ADC_Init(ADC_TypeDef *ADCx, LL_ADC_InitTypeDef *ADC_InitStruct);
-void LL_ADC_StructInit(LL_ADC_InitTypeDef *ADC_InitStruct);
-
-/* Initialization of some features of ADC instance and ADC group regular */
-ErrorStatus LL_ADC_REG_Init(ADC_TypeDef *ADCx, LL_ADC_REG_InitTypeDef *ADC_REG_InitStruct);
-void LL_ADC_REG_StructInit(LL_ADC_REG_InitTypeDef *ADC_REG_InitStruct);
-
-/**
- * @}
- */
-#endif /* USE_FULL_LL_DRIVER */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-#endif /* ADC1 */
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __STM32L0xx_LL_ADC_H */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h b/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h
deleted file mode 100644
index aac198d92b..0000000000
--- a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h
+++ /dev/null
@@ -1,1171 +0,0 @@
-/**
- ******************************************************************************
- * @file stm32l0xx_ll_bus.h
- * @author MCD Application Team
- * @brief Header file of BUS LL module.
-
- @verbatim
- ##### RCC Limitations #####
- ==============================================================================
- [..]
- A delay between an RCC peripheral clock enable and the effective peripheral
- enabling should be taken into account in order to manage the peripheral read/write
- from/to registers.
- (+) This delay depends on the peripheral mapping.
- (++) AHB & APB peripherals, 1 dummy read is necessary
-
- [..]
- Workarounds:
- (#) For AHB & APB peripherals, a dummy read to the peripheral register has been
- inserted in each LL_{BUS}_GRP{x}_EnableClock() function.
-
- @endverbatim
- ******************************************************************************
- * @attention
- *
- *
Licensed by ST under BSD 3-Clause license (the "License"). You may not use this package except in compliance with the License. You may obtain a copy of the License at:
The STM32Cube HAL and LL, an STM32 abstraction layer embedded software, ensure maximized portability across STM32 portfolio.
-
The portable APIs layer provides a generic, multi instanced and simple set of APIs to interact with the upper layer (application, libraries and stacks). It is composed of native and extended APIs set. It is directly built around a generic architecture and allows the build-upon layers, like the middleware layer, to implement its functions without knowing in-depth the used STM32 device. This improves the library code reusability and guarantees an easy portability on other devices and STM32 families.
-
The Low Layer (LL) drivers are part of the STM32Cube firmware HAL that provides a basic set of optimized and one shot services. The Low layer drivers, contrary to the HAL ones are not fully portable across the STM32 families; the availability of some functions depends on the physical availability of the relative features on the product. The Low Layer (LL) drivers are designed to offer the following features:
-
-
New set of inline functions for direct and atomic register access
-
One-shot operations that can be used by the HAL drivers or from application level
-
Full independence from HAL and standalone usage (without HAL drivers)
-
Full features coverage of all the supported peripherals
-
-
-
-
Update History
-
-
-
-
Main Changes
-
Patch release to fix known defects and enhancements implementation.
-
Contents
-
-
HAL updates
-
-
HAL EXTI update
-
-
Update HAL_EXTI_GetConfigLine() API to set default configuration value of Trigger and GPIOSel before checking each corresponding registers.
-
-
HAL GPIO driver
-
-
Update HAL_GPIO_Init() API to avoid the configuration of PUPDR register when Analog mode is selected.
-
-
HAL ADC update
-
-
Update timeout mechanism to avoid false timeout detection in case of preemption.
-
Update LL_ADC driver to prevent unused argument compilation warning.
-
-
HAL/LL DAC update
-
-
Fix compilation error when USE_DAC_REGISTER_CALLBACKS is activated.
-
Remove ‘register’ storage class specifier from LL DAC driver.
-
Update LL_ADC_DMA_GetRegAddr() API to prevent unused argument compilation warning.
-
Update HAL timeout mechanism to avoid false timeout detection in case of preemption.
-
-
HAL IWDG update
-
-
Update HAL_IWDG_Init() API in order to fix HAL_GetTick() timeout vulnerability issue.
-
-
HAL/LL RTC update
-
-
Update __RTC_…(__HANDLE__, …) macros to access registers through (__HANDLE__)->Instance pointer and avoid “unused variable” warnings.
-
Correct month management in IS_LL_RTC_MONTH() macro.
-
Update implementations of LL_RTC_BAK_SetRegister() and LL_RTC_BAK_GetRegister() to comply to MISRAC rule 17.4.
-
-
HAL TIM update
-
-
Update HAL_TIMEx_OnePulseN_Start and HAL_TIMEx_OnePulseN_Stop (pooling and IT mode) to take into consideration all OutputChannel parameters.
-
Update input capture measurement in DMA mode to avoid zero return values at high frequencies.
-
Correct reversed description of TIM_LL_EC_ONEPULSEMODE One Pulse Mode.
-
-
HAL LPTIM update
-
-
Update HAL_LPTIM_Init implementation to configure digital filter for external clock when LPTIM is clocked by an internal clock source.
-
-
HAL I2C update
-
-
Update I2C_IsAcknowledgeFailed() API to avoid I2C in busy state if NACK received after transmitting register address.
-
-
LL USART update
-
-
Remove useless check on maximum BRR value by removing IS_LL_USART_BRR_MAX() macro.
-
Handling of UART concurrent register access in case of race condition between Tx and Rx transfers (HAL UART and LL LPUART)
-
-
HAL SMBUS update
-
-
Add the support of wake up capability.
-
-
HAL/LL SPI update
-
-
Update to fix MISRA-C 2012 Rule-13.2
-
Update LL_SPI_TransmitData8() API to avoid casting the result to 8 bits.
-
-
HAL UART update
-
-
Fix erroneous UART’s handle state in case of error returned after DMA reception start within UART_Start_Receive_DMA().
-
Correction on UART ReceptionType management in case of ReceptionToIdle API are called from RxEvent callback.
-
Handling of UART concurrent register access in case of race condition between Tx and Rx transfers (HAL UART and LL LPUART).
-
-
HAL RNG update
-
-
Update timeout mechanism to avoid false timeout detection in case of preemption.
-
-
HAL USB_FS update
-
-
HAL PCD: add fix transfer complete for IN Interrupt transaction in single buffer mode.
-
Race condition in USB PCD control endpoint receive ISR.
-
-
-
-
-
-
-
-
-
Main Changes
-
-
General updates to fix known defects and enhancements implementation
-
Add new HAL EXTI driver
-
Add new HAL SMBUS extended driver to support SMBUS fast Mode Plus.
-
Remove HAL LPTIM Extended driver to move its contain to HAL LPTIM header file.
-
Correct MISRA-C 2012: Rule-10.5, Rule-10.4_a, Rule-2.7 and Rule-21.1
-
Remove useless casts
-
-
Contents
-
-
HAL driver
-
-
Update HAL driver to allow user to change systick period to 1ms, 10 ms or 100 ms:
-
-
Add the following new API’s :
-
-
HAL_GetTickPrio(): Returns a tick priority.
-
HAL_SetTickFreq(): Sets new tick frequency.
-
HAL_GetTickFreq(): Returns tick frequency.
-
-
Add HAL_TickFreqTypeDef enumeration for the different Tick Frequencies: 10 Hz, 100 Hz and 1KHz (default).
-
-
Update HAL_Init_Tick() API to proporely store the priority when using the non-default time base.
-
Add new defines for ARM compiler V6:
-
-
__weak
-
__packed
-
__NOINLINE
-
-
-
HAL/LL ADC update
-
-
Update HAL_ADC_Stop_DMA() API to check if DMA state is Busy before calling HAL_DMA_Abort() API to avoid DMA internal error.
-
Update LL_ADC_REG_Init() API to avoid enabling continuous mode and discontinuous mode simultaneously.
-
-
HAL/LL IWDG update
-
-
Update HAL_IWDG_DEFAULT_TIMEOUT define value to consider LSI value instead of hardcoded value
-
-
HAL/LL WWDG update
-
-
Update WWDG frequency, min and max timeout values
-
Update HAL WWDG driver description
-
-
HAL CORTEX update
-
-
Update IS_NVIC_PREEMPTION_PRIORITY macro in order to prevent PreemptPriority assert failure
-
-
HAL/LL PWR update
-
-
Reset bit ULP before entering in low power modes in case ULP=1 and EN_VREFINT = 1.
-
-
Update HAL_PWR_EnterSLEEPMode() and HAL_PWR_EnterSTOPMode() APIs
-
-
-
HAL/LL RTC update
-
-
Optimize HAL implementation Daylight saving feature to subtract or add one hour to the calendar in one single operation without going through the initialization procedure:
-
Update SPI Transmit/Receive APIs with assert for 8-bit.
-
-
Update SPI_DMAReceiveCplt() API to handle efficiently the repeated transfers.
-
-
Disable TX DMA request only in bidirectional receive mode
-
-
Update HAL_SPI_Init() API
-
-
To avoid setting the BaudRatePrescaler in case of Slave Motorola Mode
-
Use the bit-mask for SPI configuration
-
-
Update Transmit/Receive processes in half-duplex mode
-
-
Disable the SPI instance before setting BDIOE bit
-
-
Fix wrong timeout management
-
-
Calculate Timeout based on a software loop to avoid blocking issue if Systick is disabled
-
-
Update to implement Erratasheet: BSY bit may stay high at the end of a data transfer in Slave mode.
-
-
HAL/LL I2S update
-
-
Update HAL_I2S_DMAStop() API to be more safe
-
-
Add a check on BSY, TXE and RXNE flags before disabling the I2S
-
-
Update HAL_I2S_DMAStop() API to fix multi-call transfer issue(to avoid re-initializing the I2S for the next transfer).
-
-
Add __HAL_I2SEXT_FLUSH_RX_DR() and __HAL_I2S_FLUSH_RX_DR() macros to flush the remaining data inside DR registers.
-
Add new ErrorCode define: HAL_I2S_ERROR_BUSY_LINE_RX
-
-
-
HAL SMBUS update
-
-
Add support of Fast Mode Plus to be SMBus rev 3 compliant.
-
-
Add HAL_SMBUSEx_EnableFastModePlus() and HAL_SMBUSEx_DisableFastModePlus() APIs to manage Fm+.
-
-
-
HAL/LL TIM update
-
-
Add new macros to enable and disable the fast mode when using the one pulse mode to output a waveform with a minimum delay
-
-
__HAL_TIM_ENABLE_OCxFAST() and __HAL_TIM_DISABLE_OCxFAST().
-
-
Update Encoder interface mode to keep TIM_CCER_CCxNP bits low
-
-
Add TIM_ENCODERINPUTPOLARITY_RISING and TIM_ENCODERINPUTPOLARITY_FALLING definitions to determine encoder input polarity.
-
Add IS_TIM_ENCODERINPUT_POLARITY() macro to check the encoder input polarity.
-
Update HAL_TIM_Encoder_Init() API
-
Replace IS_TIM_IC_POLARITY() macro by IS_TIM_ENCODERINPUT_POLARITY() macro.
-
-
Update driver to handle channel state and DMA burst state independently allowing to use multiple DMA request with different channels of same timer
-
-
Introduce DMA burst state management mechanism
-
-
Add a new structure for DMA Burst States definition : HAL_TIM_DMABurstStateTypeDef
-
Update __HAL_TIM_RESET_HANDLE_STATE to support DMABurstState
-
Add a new API HAL_TIM_DMABurstState() to get the actual state of a DMA burst operation
-
-
Add HAL_TIM_DMABurstStateTypeDef enumeration
-
-
Add DMABurstState, the DMA burst operation state, to the TIM_HandleTypeDef structure
-
-
-
Implement TIM channel state management mechanism
-
-
Add new private macro
-
-
TIM_CHANNEL_STATE_SET_ALL
-
TIM_CHANNEL_STATE_SET
-
TIM_CHANNEL_STATE_GET
-
-
-
Add new API HAL_TIM_GetActiveChannel()
-
-
Add new API HAL_TIM_GetChannelState() to get actual state of the TIM channel
-
Add a new structure for TIM channel States definition : HAL_TIM_ChannelStateTypeDef
-
Update __HAL_TIM_RESET_HANDLE_STATE to support ChannelState
-
-
Add HAL_TIM_ChannelStateTypeDef enumeration
-
-
Add ChannelState to the TIM_HandleTypeDef structure to manage TIM channel operation state
-
-
-
Update HAL_TIMEx_MasterConfigSynchronization() API to avoid functional errors and assert fails when using some TIM instances as input trigger.
-
-
Replace IS_TIM_SYNCHRO_INSTANCE() macro by IS_TIM_MASTER_INSTANCE() macro.
-
Add IS_TIM_SLAVE_INSTANCE() macro to check on TIM_SMCR_MSM bit.
-
-
Add new API HAL_TIM_DMABurst_MultiWriteStart() allowing to configure the DMA Burst to transfer multiple Data from the memory to the TIM peripheral
-
Add new API HAL_TIM_DMABurst_MultiReadStart() allowing to configure the DMA Burst to transfer Data from the TIM peripheral to the memory
-
Remove “register” “C” keyword: The register storage class specifier was deprecated in C++11 and removed in C++17
-
Correct inverted values of LL_TIM_COUNTERMODE_CENTER_DOWN and LL_TIM_COUNTERMODE_CENTER_UP
-
Remove extra DMABurst Base Addresses not consistent with reference manual
-
Move the TIM input remapping TIM3_TI4_GPIOC9_AF2 and TIM3_TI1_GPIO definition from USB section
-
Update LL_TIM_GetCounterMode() implementation to return adequate values to the routine expected ones.
-
-
LL LPTIM update
-
-
Fix typos introduced in some comments
-
Remove useless check on LPTIM2 instance introduced in the driver not consistent with the referance manual
-
Update HAL_LPTIM_Init implementation to configure digital filter for external clock when LPTIM is clocked by an internal clock source
-
Add a polling mechanism to check on LPTIM_FLAG_XXOK flags in different API
-
-
Add LPTIM_WaitForFlag() to wait for flag set.
-
Perform new checks on HAL_LPTIM_STATE_TIMEOUT.
-
-
-
HAL/LL IRDA update
-
-
Align HAL IRDA driver with latest updates and enhancements
-
Optimize HAL IRDA to avoid using macros as argument of function calls
-
Update description of “HAL_IRDA_Transmit_XXX”, “HAL_IRDA_Receive_XXX” APIs with more details about the data size management
-
-
HAL/LL SMARTCARD update
-
-
Update HAL_SMARTCARD_Transmit(), HAL_SMARTCARD_Transmit_IT(), HAL_SMARTCARD_Transmit_DMA() and SMARTCARD_EndTransmit_IT() APIs implementation to fix an issue when No repetition after NACK is received in smartcard T=0
-
Optimize HAL SMARTCARD to avoid using macros as argument of function calls
-
-
HAL/LL UART update
-
-
Implementation of ReceptionToIdle reception services enhancement
-
-
Align the HAL UART driver with latest updates and enhancements to support the new enhancement of ReceptionToIdle
-
-
Add HAL_UART_RxTypeTypeDef to the UART_HandleTypeDef structure to identify the type of ongoing Reception
-
Add UART Reception Event Callback registration features
-
-
Add HAL_UART_RegisterRxEventCallback, HAL_UART_UnRegisterRxEventCallback and HAL_UARTEx_RxEventCallback APIs
-
Add pUART_RxEventCallbackTypeDef pointer to a UART Rx Event specific callback function
-
Add a set of APIs specific to Reception to Idle transfer in different mode
-
-
Add HAL_UARTEx_ReceiveToIdle API to receive an amount of data in blocking mode till either the expected number of data is received or an IDLE event occurs.
-
-
Add HAL_UARTEx_ReceiveToIdle_IT() API to receive an amount of data in interrupt mode till either the expected number of data is received or an IDLE event occurs.
-
Add HAL_UARTEx_ReceiveToIdle_DMA() API to receive an amount of data in DMA mode till either the expected number of data is received or an IDLE event occurs.
-
Update impelmentation of HAL_UART_Receive(), HAL_UART_Receive_IT() and HAL_UART_Receive_DMA() to support the new enhancement of ReceptionToIdle
-
-
Add UART_Start_Receive_IT() to start Receive operation in interrupt mode
-
Add UART_Start_Receive_DMA() to start Receive operation in DMA mode.
-
-
-
Rework BRR register value computation in HAL_UART_Init() for code footprint size optimization
-
Update UART polling processes to handle efficiently the Lock mechanism
-
-
Move the process unlock at the top of the HAL_UART_Receive() and HAL_UART_Transmit() API.
-
-
-
Add RTO (Receiver Time Out) support to UART HAL flags and IRQ macros
-
-
Add HAL_UART_ERROR_RTO define of Receiver Timeout error to the UART Error Definition section
-
-
Add UART_FLAG_RTOF define of Receiver Timeout flag to the UART Flags section
-
Add UART_IT_RTO define of Receiver Timeout interruption to the UART interrupts definition
-
Add UART_CLEAR_RTOF define of Receiver Timeout clear flag to the UART Clear Flags section
-
Implementation of a new macro IS_UART_RECEIVER_TIMEOUT_VALUE to check the receiver timeout value
-
Add new APIs HAL_UART_DisableReceiverTimeout(), HAL_UART_DisableReceiverTimeout() to Enable/Disable the UART receiver timeout feature.
-
Add new API HAL_UART_ReceiverTimeout_Config() to update on the fly the receiver timeout value in RTOR register
-
Update HAL_UART_IRQHandler() to handle UART_ISR_RTOF flag and IT
-
-
LL LPUART update
-
-
Remove “register” “C” keyword: The register storage class specifier was deprecated in C++11 and removed in C++17
-
Align LL LPUART driver with latest updates and enhancements
-
-
HAL/LL USART update
-
-
Add RTO (Receiver Time Out) support to USART HAL flags and IRQ macros
-
-
Add HAL_USART_ERROR_RTO define of Receiver Timeout error to the USART Error Definition section
-
-
Add USART_FLAG_RTOF define of Receiver Timeout flag to the USART Flags section
-
Add USART_CLEAR_RTOF define of Receiver Timeout clear flag to the USART Clear Flags section
-
-
Update HAL_USART_IRQHandler to add support to the Receiver Timeout Interruption
-
-
Optimize HAL USART to avoid using macros as argument of function calls
-
Update description of “HAL_USART_Transmit_XXX”, “HAL_USART_Receive_XXX” APIs with more details about the data size management
-
Fix typos introduced in some APIs descriptions
-
Remove “register” “C” keyword: The register storage class specifier was deprecated in C++11 and removed in C++17
-
-
LL UTILS update
-
-
UTILS_SetFlashLatency() API renamed to LL_SetFlashLatency() and set exportable.
-
-
-
-
-
-
-
-
Main Changes
-
-
General updates to fix known defects and enhancements implementation
-
-
Contents
-
-
HAL Generic update
-
-
Add new template driver to configure timebase using TIMER :
-
-
stm32l0xx_hal_timebase_tim_template.c
-
-
-
HAL/LL GPIO update
-
-
Update GPIO initialization sequence to avoid unwanted pulse on GPIO Pin’s.
-
Update HAL_GPIO_TogglePin() API to improve robustness: allow multi Pin’s toggling
-
-
HAL/LL I2C update
-
-
Update HAL_I2C_ER_IRQHandler() API to fix acknowledge failure issue with I2C memory IT processes
-
-
Add stop condition generation when NACK occurs.
-
-
Update I2C_DMAXferCplt(), I2C_DMAError() and I2C_DMAAbort() APIs to fix hardfault issue when hdmatx and hdmarx parameters in i2c handle aren’t initialized (NULL pointer).
-
-
Add additional check on hi2c->hdmtx and hi2c->hdmarx before resetting DMA Tx/Rx complete callbacks
-
-
Update Sequential transfer APIs to adjust xfermode condition.
-
-
Replace hi2c->XferCount < MAX_NBYTE_SIZE by hi2c->XferCount <= MAX_NBYTE_SIZE which corresponds to a case without reload
-
-
-
HAL/LL USB driver
-
-
Bug fix: USB_ReadPMA() and USB_WritePMA() by ensuring 16-bits access to USB PMA memory
-
Bug fix: correct USB RX count calculation
-
Fix USB Bulk transfer double buffer mode
-
Remove register keyword from USB defined macros as no more supported by C++ compiler
-
Minor rework on USBD_Start() and USBD_Stop() APIs: stopping device will be handled by HAL_PCD_DeInit() API.
-
Remove non used API for USB device mode.
-
-
-
-
-
-
-
-
Main Changes
-
Patch release
-
-
Update of HAL driver to include latest corrections and ensure compatibility with legacy code.
-
The V1.10.2 version contains all the updates implemented in V1.10.1 version. For more details, please refer to the History.
-
-
Contents
-
-
HAL
-
-
Updated HAL_GetUID() functions to correct address offset.
-
-
Legacy
-
-
Updated stm32_hal_legacy.h file to add missing definitions and ensure compatibility with legacy code.
-
-
-
-
-
-
-
-
Main Changes
-
Patch release
-
-
Update of HAL FLASH, RCC and SPI drivers to include latest corrections
-
-
Contents
-
-
HAL RCC
-
-
Updated HAL_RCC_OscConfig() to add missing checks and to modify return status.
-
-
HAL FLASH
-
-
Updated HAL_FLASH_Unlock() and HAL_FLASH_OB_Unlock() to handle interrupts disabling.
-
Updated FLASH_OB_GetRDP() to return the correct RDP level.
-
-
HAL SPI
-
-
Updated HAL SPI driver to handle STM32L0 erratasheets.
-
-
-
-
-
-
-
-
Main Changes
-
Major maintenance release
-
-
Add support of new L0 Value Line devices
-
Add support of HAL callback registration feature
-
Add several enhancements implementation
-
Fix known defects to be aligned with others STM32 series
-
-
Contents
-
-
HAL/LL generic
-
-
Add support of HAL callback registration feature
-
-
The feature disabled by default is available for the following HAL drivers:
-
The feature may be enabled individually per HAL PPP driver by setting the corresponding definition USE_HAL_PPP_REGISTER_CALLBACKS to 1U in stm32l0xx_hal_conf.h project configuration file (template file stm32l0xx_hal_conf_template.h available from Drivers/STM32L0xx_HAL_Driver/Inc)
-
Once enabled, the user application may resort to HAL_PPP_RegisterCallback() to register specific callback function(s) and unregister it(them) with HAL_PPP_UnRegisterCallback().
-
Updated HAL/LL Driver compliancy with MISRA C 2004 rules
-
-
MISRA C 2004 rules 10.4, 11.4, 12.4
-
-
Updated HAL/LL Driver compliancy with MISRA C 2012 rules
-
-
MISRA C 2012 rules 16.3, 17.4, 21.1
-
-
Corrected Doxygen tags in macros description to have generate correct CHM format.
-
stm32l0xx_hal_def.h
-
-
Updated file to avoid compiler warnings from __packed definitions.
-
Updated UNUSED() macro to fix compilation warning with g++ compiler.
-
Replaced include stdio.h by stddef.h.
-
Updated __RAM_FUNC define to not impose function type.
-
-
stm32l0xx_hal_conf_template.h
-
-
Updated default MSI_VALUE reset value set in SystemCoreClock.
-
Added USE_SPI_CRC definition to be aligned with SPI driver.
-
-
-
-
HAL
-
-
Added HAL_GetUIDw0(), HAL_GetUIDw1() and HAL_GetUIDw2() for 96-bit UID.
-
Modified default HAL_Delay implementation to guarantee minimum delay.
Add HAL_UART_RegisterCallback() and HAL_UART_UnRegisterCallback() APIs
-
Add callback identifiers in HAL_UART_CallbackIDTypeDef enumerated typedef
-
Add HAL_USART_RegisterCallback() and HAL_USART_UnRegisterCallback() APIs
-
Add callback identifiers in HAL_USART_CallbackIDTypeDef enumerated typedef
-
-
-
LL UTILS
-
-
Corrected LL_GetUID_Word2 function to fix error in UID flash location.
-
Fixed mismatch return type in LL_GetPackageType(void).
-
Update UTILS_MAX_FREQUENCY_SCALE3 value.
-
-
HAL USB
-
-
Aligned HAL USB driver with latest updates and enhancements.
-
Upgrade to USB Device Library v2.5.1.
-
-
HAL WWDG
-
-
ligned HAL WWDG driver with latest updates and enhancements.
-
dd callback registration feature
-
-
Add HAL_WWDG_RegisterCallback() and HAL_WWDG_UnRegisterCallback() APIs
-
Add callback identifiers in HAL_WWDG_CallbackIDTypeDef enumerated typedef
-
-
-
-
-
-
-
-
Main Changes
-
Internal release
-
-
-
-
-
Main Changes
-
Maintenance release
-
Contents
-
-
HAL/LL generic
-
-
Updated :
-
Removed DATE and VERSION fields from header files.
-
Updated CHM User Manual for Drivers/STM32L0xx_HAL_Driver.
-
-
LL ADC
-
-
Updated LL ADC driver to exclude __LL_ADC_CALC_TEMPERATURE macro for STM32L011xx devices.
-
-
HAL COMP
-
-
Updated HAL_COMP_Init manage default case as LPTIM1 for COMP1 and LPTIM2 for COMP2.
-
-
HAL/LL I2C
-
-
Replaced POSITION val notion by associated I2C_xxx_pos CMSIS definition.
-
Updated LL_I2C_Init() function to add condition to test the value of OwnAddress1 before calling the inline LL function LL_I2C_EnableOwnAddress1().
-
Updated implementation of I2C_TransferConfig() function.
-
-
HAL PCD
-
-
Removed the lock/unlock from HAL_PCD_EP_Receive/HAL_PCD_EP_Transmit functions.
-
-
-
-
-
-
-
-
Main Changes
-
Patch release
-
Contents
-
-
HAL LCD
-
-
Update of stm32l0xx_hal_lcd.h to avoid C++ compilation errors.
-
-
-
-
-
-
-
-
Main Changes
-
Maintenance release
-
Contents
-
-
HAL generic
-
-
Updated HAL Driver compliancy with MISRA C 2004 rules:
-
-
MISRA C 2004 rule 2.2 (source code shall only use /* */ style comments)
-
MISRA C 2004 rule 5.2 (tmpreg variable shall not be used inside MACRO)
-
MISRA C 2004 rule 10.3 (illegal explicit conversion from type unsigned int to uint16_t *)
-
MISRA C 2004 rule 10.4 (value of a complex expression of floating type shall only be cast to a floating type that is narrower or of the same size)
-
MISRA C 2004 rule 10.6 (U suffix applied to all constants of unsigned type)
-
MISRA C 2004 rule 12.6 (logical operators should not be confused with bitwise operators)
-
MISRA C 2004 rule 14.3 (a null statement shall only occur on a line by itself)
-
MISRA C 2004 rule 14.8 (statement forming the body of a switch, while, do while or for statement shall be a compound statement)
-
MISRA C 2004 rule 14.9 (if {expression} / else construct shall be followed by a compound statement)
-
MISRA C 2004 rule 19.10 (in function-like macro definition, each instance of a parameter shall be enclosed in parenthesis)
-
MISRA C 2004 rule 19.11 (all macro identifiers in preprocessor directives shall be defined before use)
-
MISRA C 2004 rule 19.15 (precautions shall be taken in order to prevent the contents of a header file being included twice)
-
-
-
HAL/LL ADC
-
-
Corrected ADC_SAMPLETIME_xCYCLE_5 naming to be aligned to reference manual.
-
Enabled management of low power auto-wait: flags must be cleared by user when fetching ADC conversion data.
-
Disabled DMA transfer during ADC calibration.
-
-
HAL CRC
-
-
Updated HAL_CRC_DeInit() function (restored IDR Register to Reset value).
-
-
HAL COMP
-
-
Updated HAL_COMP_Init() function to clear EXTI interrupt mode in case comparator is re-configured in mode trigger none.
-
Updated HAL_COMP_IRQHandler() function in window mode, so that both EXTI flags are cleared and HAL_COMP_TriggerCallback() function is called only once.
-
Updated HAL COMP init() function: VrefInt startup delay is taken into account, with delay of duration COMP_DELAY_VOLTAGE_SCALER_STAB_US.
-
Updated HAL_COMPEx_EnableVREFINT() by adding Wait Time.
-
-
HAL DMA
-
-
Provided new function HAL_DMA_Abort_IT() to abort current DMA transfer under interrupt mode without polling for DMA enable bit.
-
-
HAL FLASH
-
-
Updated HAL_FLASH_IRQHandler(), HAL_FLASHEx_Erase_IT(), HAL_FLASH_Program_IT(), and HAL_FLASHEx_Erase_IT() functions.
-
Renamed HAL_FLASHRAMFUNC_GetError() sto HAL_FLASHEx_GetError().
-
-
HAL GPIO
-
-
Updated IS_GPIO_PIN() macro to cover full u32 bits.
-
Updated HAL_GPIO_DeInit() function to configure GPIO port mode register to input state.
-
-
HAL I2C
-
-
Aligned HAL I2C driver with the new state machine definition.
-
Added support of repeated start feature with the following new APIs
-
-
HAL_I2C_Master_Sequential_Transmit_IT(), HAL_I2C_Master_Sequential_Receive_IT() and HAL_I2C_Master_Abort_IT(),
-
HAL_I2C_Slave_Sequential_Transmit_IT() and HAL_I2C_Slave_Sequential_Receive_IT()
-
HAL_I2C_EnableListen_IT() and HAL_I2C_DisableListen_IT()
-
New user callbacks HAL_I2C_ListenCpltCallback() and HAL_I2C_AddrCallback()
-
-
Reworked DMA end process and I2C error management during DMA transfer.
-
Updated WaitOnFlag management (timeout measurement should be always cumulative).
-
Optimized HAL_I2C_XX_IRQHandler() functions (read status registers only once).
-
Added error management in case of DMA transfer through HAL_DMA_Abort_IT() and DMA XferAbortCallback().
-
Updated HAL_I2CEx_EnableFastModePlus() enabling fast mode plus driving capability through CFGR2 register.
-
Disabled I2C_OARx_EN bit before any configuration in OAR1 or 2 in HAL_I2C_Init().
-
Add I2C_FIRST_AND_NEXT_FRAME for I2C Sequential transfer options: allow to manage a sequence with start condition, address and data to transfer without a final stop condition, an then permit a call to the same master sequential interface several times.
-
Updated HAL_I2C_Master_Sequential_Transmit_IT() function (wrong state check).
Updated I2C driver to reset state to LISTEN before calling HAL_I2C_Slave_Sequential_Transmit_IT() function.
-
-
HAL I2S
-
-
Updated LL_I2S_Init() function to use default ou computed values for prescaler.
-
-
HAL IWDG
-
-
Overall driver rework for better implementation
-
-
Removed HAL_IWDG_Start(), HAL_IWDG_MspInit() and HAL_IWDG_GetState() APIs.
-
-
-
HAL PWR
-
-
Added new HAL_PWREx_GetVoltageRange()function returning Voltage Scaling range, to be aligned with L1 serie.
-
-
HAL RCC
-
-
Aligned HAL RCC driver with others series.
-
Renamed RCC_PLLMUL_x to RCC_PLL_MULx and RCC_PLLDIV_x to RCC_PLL_DIVx, to be aligned with L1 serie.
-
Updated declaration of HAL_RCC_NMI_IRQHandler() function.
-
Updated HAL IRQHandler and callbacks API for CRS management.
-
-
HAL SMBUS
-
-
Aligned driver with others series: fix known defects and added several enhancements implementation.
-
Added support of new feature Zone Read/Write.
-
-
HAL SPI
-
-
Added missing __IO in SPI_HandleTypeDef definition.
-
-
HAL TIM
-
-
Corrected TIM22_ETR_GPIO and TIM22_ETR_LSE definitions for STM32L011xx and STM32L021xx devices.
-
-
HAL UART-USART / IRDA / SMARTCARD
-
-
Added missing __IO in UART/USART/IRDA/SMARTCARD_HandleTypeDef definition (for TxXferCount and RxXferCount).
-
Modified UART/SMARTCARD configuration sequence order in HAL_UART/SMARTCARD_Init() function, to avoid issue on Transmit line when UART/SMARTCARD_SetConfig() is called before UART/SMARTCARD_AdvFeatureConfig().
-
Removed RXNE check in UART/USART/IRDA/SMARTCARD_Receive_IT() function, as RXNE is already cleared by reading RDR, or by writing 1 to RXFRQ in the RQR register.
-
Reviewed UART/IRDA/SMARTCARD state machine to avoid cases where UART/IRDA/SMARTCARD state is overwritten by UART/IRDA/SMARTCARD IRQ.
-
Ensure proper alignment of data pointer in Transmit and Receive functions to avoid toolchain compilation hardfault.
-
Optimized WaitOnFlag management in HAL_UART/USART/IRDA/SMARTCARD_Transmit() function.
-
Optimized all HAL IRQ Handler routines.
-
Implemented new APIs for HAL UART/USART/IRDA/SMARTCARD Abort management: HAL_PPP_Abort(), HAL_PPP_AbortTransmit(), HAL_PPP_AbortReceive(), HAL_PPP_Abort_IT(), HAL_PPP_AbortTransmit_IT(), HAL_PPP_AbortReceive_IT().
-
Added definition of USART_STOPBITS_0_5 (in addition to 1, 1.5, 2 stop bits).
-
Updated USART_GETCLOCKSOURCE() macro definition in order to reflect USART instances availability on L0 devices.
-
Updated HAL_UART_Init() that can not be performed on USART4 and USART5 instances for L07x/L08x.
-
-
HAL USB
-
-
Added missing USB_CNTR_SOFM in the setting of wInterrupt_Mask global variable.
-
Updated HAL_PCD_ActivateRemoteWakeup() and HAL_PCD_DeActivateRemoteWakeup() functions to check on LPM state before USB resume.
-
-
HAL WWDG
-
-
Overall driver rework for better implementation
-
-
Remove HAL_WWDG_Start(), HAL_WWDG_Start_IT(), HAL_WWDG_MspDeInit() and HAL_WWDG_GetState() APIs.
-
Update the HAL_WWDG_Refresh(WWDG_HandleTypeDef *hwwdg, uint32_t counter) function and API by removing the “counter” parameter.
-
-
-
-
-
-
-
-
-
Main Changes
-
Maintenance release
-
Contents
-
-
HAL/LL COMP update
-
-
Added missing definition for COMP_INPUT_PLUS_IO6 and LL_COMP_INPUT_PLUS_IO6, supported by STM32L0 Category1 (STM32L011xx, STM32L021xx).
-
Removed COMP_INVERTINGINPUT_IO3 definition.
-
Renamed COMP_INVERTINGINPUT_IO2 to COMP_INPUT_MINUS_DAC1_CH2.
-
The EXTI set-up is now managed by HAL_COMP_Init() function, using updated definitions of COMP_TRIGGERMODE_xxx.
-
-
Therefore, the functions HAL_COMP_Start_IT() and HAH_COMP_Stop_IT() have been removed.
-
In any mode, the application must use HAL_COMP_Start() and HAL_COMP_Stop().
-
-
For information, this update was already available in V1.6.0.
-
-
-
-
HAL RTC update
-
-
Updated HAL_RTCEx_SetWakeUpTimer_IT() function by adding clear of Wake-Up flag before enabling the interrupt.
Added new __HAL_SYSCFG_VLCD_CAPA_CONFIG() macro to configure the VLCD Decoupling capacitance connection.
-
Added new __HAL_SYSCFG_GET_VLCD_CAPA_CONFIG() macro to return the decoupling of LCD capacitance configured by user.
-
Added LCD Voltage output buffer enable macro definitions.
-
-
-
-
-
-
-
-
Main Changes
-
Maintenance release
-
-
First official release supporting the Low Level drivers for the STM32L0xx family:
-
-
Low Layer drivers APIs provide register level programming: they require deep knowledge of peripherals described in STM32L0xx Reference Manual.
-
Low Layer drivers are available for: ADC, COMP, CORTEX, CRC, CRS,DAC, DMA, EXTI, GPIO, I2C, IWDG, LPTIM, LPUART, PWR, RCC, RNG, RTC, SPI, TIM, USART, WWDG peripherals and additional Low Level Bus, System and Utilities APIs.
-
Low Layer drivers APIs are implemented as static inline function in new Inc/stm32l0xx_ll_ppp.h files for PPP peripherals, there is no configuration file and each stm32l0xx_ll_ppp.h file must be included in user code.
-
-
-
Contents
-
-
Updates of the HAL
-
-
HAL_SYSCFG_EnableVREFINT() and HAL_SYSCFG_DisableVREFINT() functions and HAL_VREFINT_Cmd macro suppressed since VREFINT is managed by the system.
-
Several updates on dedicated HAL as specified in the list below. The major changes concerns HAL_COMP and HAL_UART.
-
-
HAL update
-
-
Change the way the APB AHB prescaler table is defined inside the HAL.
-
Change the variable ‘uwTick’ from ‘static’ to ‘global’.
-
Compliancy with MISRA C 2004 rule 10.6 (A “U” suffix shall be applied to all constants of unsigned type)
-
Compliancy with MISRA C 2004 rule 16.4. (The identifiers used in the declaration and definition of a function shall be identical)
-
-
HAL COMP update
-
-
Major rework on the lock and on the state machine associated to the COMP HAL.
-
Optimization of several functions and uniformization of the driver within the whole STM32 family.
-
-
HAL CRYPT update
-
-
Correct the usage of several compilation switches related to STM32L081xx.
-
-
HAL DMA update
-
-
Add the following macro : HAL_DMA_GET_COUNTER.
-
-
HAL FLASH update
-
-
Update the two following macros : __HAL_FLASH_PREFETCH_BUFFER_ENABLE and __HAL_FLASH_PREFETCH_BUFFER_DISABLE.
-
-
HAL IRDA update
-
-
Improve management of the EIE bits for Tx and Rx transfers.
-
-
HAL I2C update
-
-
Allow I2C transmission with data size equal to 0.
-
Add new macro IS_I2C_WAKEUP_FROMSTOP_INSTANCE.
-
-
HAL LPTIM update
-
-
Update of the LPTIM driver in order to support the exti line 23.
-
-
HAL UART update
-
-
Improve UART state machine behavior in case of interrupts.
-
Update the macros UART_DIV_SAMPLING8 and UART_DIV_SAMPLING16 to correct UART baudrate calculation
-
Add an RXDATA flush request inside the UART_Receive_IT function when the RxState is not in reception state.
-
-
HAL RCC update
-
-
Correct the setup of the global variable ‘SystemCoreClock’.
-
Update of the CRS interrupt sources.
-
Renamed RCC_CRS_SYNCWARM into RCC_CRS_SYNCWARN and renamed RCC_CRS_TRIMOV into RCC_CRS_TRIMOVF.
-
-
-
-
-
-
-
-
Main Changes
-
Maintenance release
-
Contents
-
-
Main HAL updates
-
-
Compliancy with MISRA coding rules (MISRA C 2004 rule 10.5 except for hal_pcd.c file and MISRA C 2004 rule 5.3).
-
Several functions inside the HAL have been updated in order to prevent unused argument compilation warnings.
-
The startup timeout value for many clocks (as HSE, HSI, LSI, MSI, PLL) have been updated to reach a more accurate value (alignement to the Datasheet).
-
The macro __HAL_CORTEX_SYSTICKCLK_CONFIG() has been removed since this service is already covered by the function HAL_SYSTICK_CLKSourceConfig().
-
-
HAL update
-
-
Update the SYSCFG_BOOT_SYSTEMFLASH definition. (SYSCFG_BOOT_SYSTEMFLASH is now equal to SYSCFG_CFGR1_BOOT_MODE_0 instead of SYSCFG_CFGR1_MEM_MODE_0)
-
The HSE_STARTUP_TIMEOUT is now equal to 100 instead of 5000.
-
-
HAL I2C update
-
-
Update the HAL_I2C_Slave_Receive function. Store last data received when requested.
-
Improvement of the HAL_I2C_MasterReceive function. Error management update. (HAL_ERROR detection versus HAL_TIMEOUT)
-
Improvement of the I2C_MasterTransmit_ISR function. Adding of several error checks, unlock of the process when requested.
-
Improvement of the I2C_MasterReceive_DMA function. Adding of several error checks and abort DMA when requested.
-
-
HAL UART update
-
-
Update the check of parameters inside the function HAL_LIN_SendBreak().
-
Correction of an error present on the V1.4.0 release. On the V1.4.0 release, the clock used inside the function USART_SetConfig(..) was never set.
-
-
HAL DMA update
-
-
Update the DMA_handler structure in order to be MISRA-C 2004 rule 5.3 compliant.
-
-
HAL SPI update
-
-
Update the SPI_handler structure in order to be MISRA-C 2004 rule 5.3 compliant.
-
-
HAL RCC update
-
-
Update support of RCC_MC03 when requested.
-
Update support of dynamic HSE prescaler configuration for LCD/RTC peripherals.
-
Some updates inside the HAL_RCC_ClockConfig function.
-
Some updates inside the HAL_RCC_MCOConfig function. The enabling of the MCO clocks (__MC01_CLK_ENABLE() or __MCO2_CLK_ENABLE()) is done separately depending on the MCO selected.
-
The function HAL_RCCEx_GetPeriphCLKFreq() has been reworked.
-
The function HAL_RCCEx_PeriphCLKConfig() has been updated. A new error is now detected when trying to update the HSE divider dynamically.
-
-
HAL TSC update
-
-
Several updates inside the HAL_TSC_Start function and HAL_TSC_Init function. Check of input parameters
-
-
HAL ADC update
-
-
The channel 16 (ADC_CHANNEL_16) is not available on all devices.
-
-
HAL CORTEX update
-
-
The macro __HAL_CORTEX_SYSTICKCLK_CONFIG(..) has been removed since this service is already covered by the function HAL_SYSTICK_CLKSourceConfig().
-
-
HAL FLASH update
-
-
The restriction which was present on V1.4.0 and linked to the OPTVERR bit usage on STM32L031xx and STM32L041xx has been removed.
-
-
This is due to the fact that the new STM32L031xx/STM32L041xx devices supports now this feature.
-
On the first revision of the STM32L031xx/STM32L031xx devices (RevID = 0x1000 retrieved via HAL_GetREVID()), the OPTVERR bit was not functional. The OPTVERR (Option valid error bit) is set by hardware when, during an Option byte loading, there was a mismatch for one or more configurations.
-
-
-
-
-
-
-
-
-
Main Changes
-
Maintenance release
-
-
This release includes the support of the support of STM32L011xx and STM32L021xx devices
-
On STM32L011xx/STM32L021xx, compared to STM32L07xxx/STM32L08xxx, some of the main differences are listed hereafter :
-
-
SRAM size set to 2KB (instead of 20KB)
-
Flash size set to 16KB (instead of 192KB)
-
GPIO available :A,B,C (instead of A,B,C,D,E,H)
-
Timers available : TIM2,TIM21,LPTIM1 (instead of TIM2,TIM3,TIM6,TIM7,TIM21,TIM22,LPTIM1)
-
-
-
Contents
-
-
HAL COMP update
-
-
Update of the non inverting inputs available on the whole L0 family.
-
-
HAL RCC update
-
-
Usage of a common PLLMulTable[] defined in system_stm32l0xx.c.
-
Update in the definition of the different tampers.
-
Minor renaming of several macros.
-
-
HAL TIMER update
-
-
Handle lock initialization in all TIM init functions.
-
-
HAL LCD update
-
-
Add support of new MuxSegment field inside the init structure.
-
-
HAL DMA update
-
-
Alignment of the different channels within the L0 family.
-
-
-
-
-
-
-
-
Main Changes
-
Major maintenance release
-
-
Major update of the HAL API :
-
-
all MACROs and LITERALs values have been reworked to align all STM32 Families as much as possible
-
Important information : A stm32_hal_legacy.h file has been added to the FW package in order to support the old MACROs and LITERAL values used in the previous versions of customer applications
-
In HAL MACROs definitions : do { } while(0) have been used in multi statement macros
-
-
This release includes the support of the support of STM32L031xx and STM32L041xx devices On STM32L031xx/STM32L041xx, compared to STM32L07xxx/STM32L08xxx, the main differences are as follow :
-
-
SRAM size set to 8KB (instead of 20KB)
-
Flash size set to 32KB (instead of 192KB)
-
GPIO available :A,B,C,H (instead of A,B,C,D,E,H)
-
Timers available : TIM2,TIM21,TIM22,LPTIM1 (instead of TIM2,TIM3,TIM6,TIM7,TIM21,TIM22,LPTIM1)
-
-
-
Contents
-
-
HAL ADC update
-
-
ADC assert param needs to be more specific for discontinuous mode, nb of discont conversions
-
ADC external trigger definition is not complete Flag EOS should not be reset in HAL_ADC_GetValue()
-
ADC poll for event must return timeout instead of error
-
ADC state machine update - States with bitfields are now used for a more accurate status
-
ADC run in LPrun mode needs SYSCFG buffers enabled
-
ADC_CLOCK_SYNC_PCLK_DIVx was not correct
-
Remove WaitLoopIndex at the beginning of the function HAL_ADC_Enable
-
ADC parameter “ADC_SOFTWARE_START” for compatibility with other STM32 devices
-
ADC poll for conversion must return error status in case of ADC-DMA mode
-
ADC identical error code returned generates confusion
-
Issue observed with ADC start simultaneous commands
-
The HAl_Delay() is not required when ADVREGEN is set
RTC alignment of different HAL_RTC_XXIRQHandler() implementations
-
RTC Bits Mask literals to be used in macro definition
-
RTC macro __HAL_RTC_TAMPER_GET_IT() issue in param: INTERRUPT@arg list
-
RTC wrong description of the subsecond item of RTC_TimeTypeDef structure in the header file
-
RTC WUTWF is not reliable
-
HAL_RTC_GetTime function does not return the actual subfraction
-
[STM32L031xx/STM32L041xx] RTC macros renaming for RTC_OUTPUT_REMAP_XX and RTC_TIMESTAMPPIN_XX
-
Enhance @note describing the use of HAL RTC APIs
-
-
HAL SPI update
-
-
SPI HAL_SPI_TransmitReceive_DMA() Remove DMA Tx Callback in case of RxOnly mode
-
SPI HandleTypeDef.ErrorCode must be typed uint32_t
-
Warnings with True Studio IDE (tempreg variable not used)
-
-
HAL TIM update
-
-
TIM problem to use ETR as OCrefClear source
-
TIM Wrong remaping of the TIM2_ETR
-
TIM register BDTR does not exist
-
The assert on trigger polarity for TI1F_ED should be removed
-
TIM Add macros to ENABLE/DISABLE URS bit in TIM CR1 register
-
TIM HAL_TIM_OC_ConfigChannel() / HAL_TIM_PWM_ConfigChannel() Missed/Unused assert param to be added/removed
-
TIM Remove HAL_TIM_SlaveConfigSynchronization_DMA() from HAL_TIM API
-
TIM Trigger DMA request should be activated when working with a slave mode
-
TIM Timer Register Corruption using HAL_TIM_IC_ConfigChannel
-
TIM DMA transfer should be aborted when stopping a DMA burst
-
Add “TIM_CHANNEL_ALL” as an argument for all Encoder Start/Stop process in the comment section
-
HAL_TIM_DMADelayPulseCplt callback missing information
-
HAL_TIM_DMACaptureCplt callback missing information
-
TIM Trigger DMA request should be activated when working with a slave mode
-
TIM Trigger interrupt should be activated when working with a slave mode
-
__HAL_TIM_PRESCALER() shall be corrected: use ‘=’ instead of ‘|=’
-
-
HAL UART/USART update
-
-
UART Incorrect UART speed setting on HSI clock
-
Wrong Baud Rate calculation in case of OVER8
-
UART missing closing bracket in header file
-
UART Circular mode when transmitting data not well supported
-
UART/LPUART number of stop bits to correct
-
USART Incorrect number of stop bits definition
-
UART HAL_UART_IRQHandler function not clearing correctly the interrupt flags
-
USART Setting of BRR register bit3:0 not inline with RM when OVER8 sampling mode is used
-
UART UART_WaitOnFlagUntilTimeout should not assign UART handle state to HAL_UART_STATE_TIMEOUT
-
USART Wrong values used as parameter of __HAL_USART_CLEAR_IT() in HAL_USART_IRQHandler()
-
USART BRR setting is wrong compared to Baudrate value
-
USART HAL_USART_Init() update to reach max frequencies (enable oversampling by 8)
-
USART USART_DMAReceiveCplt() Update to set the USART state after performing the test on it
-
UART The code associated to several macros need to be completed
-
USART UART DMA implementation issue: missed clear the TC bit in the SR
-
Wrong USART_IT_CM defined value
-
Issue with Lin mode data length
-
Wrong description for Interrupt mode IO operation within HAL UART driver
-
Change UART_DMATransmitCplt- new implementation to remove WaitOnFlag in ISR
-
Change UART TX-IT implementation to remove WaitOnFlag in ISR
-
The IS_UART_OVERSAMPLING(SAMPLING) is not called in UART_SetConfig()
-
HAL UART enhancement: remove the check on RXNE flag after reading the DR register
-
UART/USART/IRDA/SMARTCARD transmit process enhancement to use TXE instead of TC
-
Add MACRO to UART HAL to control CTS and RTS from the customer application
-
-
HAL PCD update
-
-
HAL_PCD_EP_Transmit() not functional
-
HAL PCD clear flag macros configuration
-
Bad IN/OUT EndPoint parameter array size
-
HAL PCD miss #define for ep0_mps parameter
-
USB HAL PCD missing #define PCD_SPEED_HIGH
-
-
-
-
-
-
-
-
Main Changes
-
Official release
-
-
This release includes the support of the STM32L071xx, STM32L072xx, STM32L073xx, STM32L082xx, STM32L083xx devices
-
Fix known defects and add several enhancements implementation
-
-
Contents
-
-
HAL Flash** update
-
-
Flash : 192K Dual Bank
-
-
HAL TIM** update
-
-
4 new instances : TIM3, TIM7, TIM21, TIM22
-
-
HAL USART** update
-
-
2 new instances : USART 4, USART 5
-
-
HAL I2C** update
-
-
1 new instance I2C3
-
-
HAL GPIO** update
-
-
GPIO Port E
-
-
HAL DAC** update
-
-
A second channel has been introduced
-
-
HAL FIREWALL introduction
-
-
Known Limitations
-
-
Introduced a FW patch to deactivate the HW SPI-V2.3 correction in case of I2S PCM Short mode usage (Please refer to the STM32L073xx Errata Sheet for more details). In this use case, we come back to the HW SPI 2.2 behavior which is correct for the I2S PCM short mode
-
-
-
-
-
-
-
-
-
Main Changes
-
Official release
-
Contents
-
-
HAL generic** update
-
-
Fix flag clear procedure: use atomic write operation “=” instead of ready-modify-write operation “|=” or “&=”
-
Fix on Timeout management, Timeout value set to 0 passed to API automatically exits the function after checking the flag without any wait
-
Common update for the following communication peripherals: SPI, UART, USART and IRDA
-
-
Add DMA circular mode support
-
Remove lock from recursive process
-
-
Add new macro __HAL_RESET_HANDLE_STATE to reset a given handle state
-
When USE_RTOS == 1 (in stm32l0xx_hal_conf.h), the __HAL_LOCK() is not defined instead of being defined empty
-
Use "__IO const" instead of "__I", to avoid any compilation issue when __cplusplus switch is defined
-
Add new functions for the DBGMCU module
-
-
HAL_EnableDBGSleepMode()
-
HAL_DisableDBGSleepMode()
-
HAL_EnableDBGStopMode()
-
HAL_DisableDBGStopMode()
-
HAL_EnableDBGStandbyMode()
-
HAL_DisableDBGStandbyMode()
-
-
Miscellaneous comments update
-
-
HAL FLASH** update
-
-
Add new functions: HAL_FLASHEx_OB_SelectPCROP() and HAL_FLASHEx_OB_DeSelectPCROP()
-
Some functions was renamed and moved to the extension files (stm32l0xx_hal_flash_ex.h/.c)
-
-
Rename FLASH_HalfPageProgram() into HAL_FLASHEx_HalfPageProgram()
-
Rename FLASH_EnableRunPowerDown() into HAL_FLASHEx_EnableRunPowerDown()
-
Rename FLASH_DisableRunPowerDown() into HAL_FLASHEx_DisableRunPowerDown()
-
Rename all HAL_DATA_EEPROMEx_xxx() functions into HAL_FLASHEx_DATAEEPROM_xxx()
-
Note: aliases has been added to keep compatibility with previous version
-
-
-
HAL GPIO** update
-
-
Remove IS_GET_GPIO_PIN macro
-
Add a new function HAL_GPIO_LockPin()
-
Private Macro __HAL_GET_GPIO_SOURCE renamed into GET_GPIO_SOURCE
-
-
HAL DMA** update
-
-
Fix in HAL_DMA_PollForTransfer() to set error code HAL_DMA_ERROR_TE in case of HAL_ERROR status
-
-
HAL PWR** update
-
-
HAL_PWR_PVDConfig(): add clear of the EXTI trigger before new configuration
-
Fix in HAL_PWR_EnterSTANDBYMode() to not clear Wakeup flag (WUF), which need to be cleared at application level before to call this function
-
-
HAL RCC** update
-
-
Allow to calibrate the HSI when it is used as system clock source
-
Fix implementation of IS_RCC_OSCILLATORTYPE() macro
-
-
HAL ADC** update
-
-
Update ADC internal channels mapping: TEMPSENSOR connected to ADC_CHANNEL_18 and VLCD mapped to ADC_CHANNEL_16
-
Skip polling for ADRDY flag when Low Power Auto Off mode is enabled
-
-
HAL COMP** update
-
-
Add LPTIMConnection field in the COMP_InitTypeDef structure.
-
Add new defines: COMP_LPTIMCONNECTION_DISABLED, COMP_LPTIMCONNECTION_ENABLED
-
Add new macro IS_COMP_LPTIMCONNECTION
-
-
HAL LPTIM** update
-
-
Add CKPOL configuration for encoder mode
-
-
HAL WWDG** update
-
-
Miscellaneous minor update on the source code
-
-
HAL IWDG** update
-
-
Miscellaneous minor update on the source code
-
-
HAL CRC** update
-
-
Some functions was renamed and moved to the extension files (stm32l0xx_hal_crc_ex.h/.c)
-
-
HAL_CRC_Input_Data_Reverse() renamed into HAL_CRCEx_Input_Data_Reverse()
-
HAL_CRC_Output_Data_Reverse() renamed into HAL_CRCEx_Output_Data_Reverse()
-
Note: aliases has been added to keep compatibility with previous version
-
-
-
HAL CRYP** update
-
-
HAL_CRYP_ComputationCpltCallback() renamed into HAL_CRYPEx_ComputationCpltCallback() and moved to the extension files (stm32l0xx_hal_cryp_ex.h/.c)
-
Note: alias has been added to keep compatibility with previous version
-
-
HAL I2C** update
-
-
Add management of NACK event in Master transmitter mode and Slave transmitter/receiver modes (only in polling mode), in that case the current transfer is stopped.
Add specific macros to manage the flags cleared only by a software sequence
-
-
__HAL_SMARTCARD_CLEAR_PEFLAG()
-
__HAL_SMARTCARD_CLEAR_FEFLAG()
-
__HAL_SMARTCARD_CLEAR_NEFLAG()
-
__HAL_SMARTCARD_CLEAR_OREFLAG()
-
__HAL_SMARTCARD_CLEAR_IDLEFLAG()
-
-
Add several enhancements without affecting the driver functionalities
-
-
Add a new state HAL_SMARTCARD_STATE_BUSY_TX_RX and all processes has been updated accordingly
-
Update HAL_SMARTCARD_Transmit_IT() to enable SMARTCARD_IT_TXE instead of SMARTCARD_IT_TC
-
-
-
HAL SPI** update
-
-
Bugs fix
-
-
SPI interface is used in synchronous polling mode: at high clock rates like SPI prescaler 2 and 4, calling HAL_SPI_TransmitReceive() returns with error HAL_TIMEOUT
-
HAL_SPI_TransmitReceive_DMA() does not clean up the TX DMA, so any subsequent SPI calls return the DMA error
-
HAL_SPI_Transmit_DMA() is failing when data size is equal to 1 byte
-
-
Add the following APIs used within the DMA process
-
-
-
-
diff --git a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal.c b/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal.c
deleted file mode 100644
index 6e0fd7071a..0000000000
--- a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal.c
+++ /dev/null
@@ -1,674 +0,0 @@
-/**
- ******************************************************************************
- * @file stm32l0xx_hal.c
- * @author MCD Application Team
- * @brief HAL module driver.
- * This is the common part of the HAL initialization
- *
- @verbatim
- ==============================================================================
- ##### How to use this driver #####
- ==============================================================================
- [..]
- The common HAL driver contains a set of generic and common APIs that can be
- used by the PPP peripheral drivers and the user to start using the HAL.
- [..]
- The HAL contains two APIs categories:
- (+) Common HAL APIs
- (+) Services HAL APIs
-
- @endverbatim
- ******************************************************************************
- * @attention
- *
- *
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-#include "stm32l0xx_hal.h"
-
-/** @addtogroup STM32L0xx_HAL_Driver
- * @{
- */
-
-#ifdef HAL_MODULE_ENABLED
-
-/** @addtogroup HAL
- * @brief HAL module driver.
- * @{
- */
-
-/** @addtogroup HAL_Exported_Constants
- * @{
- */
-
-/** @defgroup HAL_Version HAL Version
- * @{
- */
-
-/**
- * @brief STM32L0xx HAL Driver version number
- */
-#define __STM32L0xx_HAL_VERSION_MAIN (0x01U) /*!< [31:24] main version */
-#define __STM32L0xx_HAL_VERSION_SUB1 (0x0AU) /*!< [23:16] sub1 version */
-#define __STM32L0xx_HAL_VERSION_SUB2 (0x05U) /*!< [15:8] sub2 version */
-#define __STM32L0xx_HAL_VERSION_RC (0x00U) /*!< [7:0] release candidate */
-#define __STM32L0xx_HAL_VERSION ((__STM32L0xx_HAL_VERSION_MAIN << 24U)\
- |(__STM32L0xx_HAL_VERSION_SUB1 << 16U)\
- |(__STM32L0xx_HAL_VERSION_SUB2 << 8U )\
- |(__STM32L0xx_HAL_VERSION_RC))
-
-#define IDCODE_DEVID_MASK (0x00000FFFU)
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/* Exported variables --------------------------------------------------------*/
-/** @addtogroup HAL_Exported_Variables
- * @{
- */
-__IO uint32_t uwTick;
-uint32_t uwTickPrio = (1UL << __NVIC_PRIO_BITS); /* Invalid PRIO */
-HAL_TickFreqTypeDef uwTickFreq = HAL_TICK_FREQ_DEFAULT; /* 1KHz */
-/**
- * @}
- */
-
-/* Exported functions --------------------------------------------------------*/
-/** @addtogroup HAL_Exported_Functions
- * @{
- */
-
-/** @addtogroup HAL_Exported_Functions_Group1
- * @brief Initialization and de-initialization functions
- *
-@verbatim
- ===============================================================================
- ##### Initialization and de-initialization functions #####
- ===============================================================================
- [..] This section provides functions allowing to:
- (+) Initialize the Flash interface, the NVIC allocation and initial clock
- configuration. It initializes the source of time base also when timeout
- is needed and the backup domain when enabled.
- (+) De-initialize common part of the HAL.
- (+) Configure the time base source to have 1ms time base with a dedicated
- Tick interrupt priority.
- (++) SysTick timer is used by default as source of time base, but user
- can eventually implement his proper time base source (a general purpose
- timer for example or other time source), keeping in mind that Time base
- duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and
- handled in milliseconds basis.
- (++) Time base configuration function (HAL_InitTick ()) is called automatically
- at the beginning of the program after reset by HAL_Init() or at any time
- when clock is configured, by HAL_RCC_ClockConfig().
- (++) Source of time base is configured to generate interrupts at regular
- time intervals. Care must be taken if HAL_Delay() is called from a
- peripheral ISR process, the Tick interrupt line must have higher priority
- (numerically lower) than the peripheral interrupt. Otherwise the caller
- ISR process will be blocked.
- (++) functions affecting time base configurations are declared as __weak
- to make override possible in case of other implementations in user file.
-
-@endverbatim
- * @{
- */
-
-/**
- * @brief This function configures the Flash prefetch, Flash preread and Buffer cache,
- * Configures time base source, NVIC and Low level hardware
- * @note This function is called at the beginning of program after reset and before
- * the clock configuration
- * @note The time base configuration is based on MSI clock when exiting from Reset.
- * Once done, time base tick start incrementing.
- * In the default implementation,Systick is used as source of time base.
- * the tick variable is incremented each 1ms in its ISR.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_Init(void)
-{
- HAL_StatusTypeDef status = HAL_OK;
-
- /* Configure Buffer cache, Flash prefetch, Flash preread */
-#if (BUFFER_CACHE_DISABLE != 0)
- __HAL_FLASH_BUFFER_CACHE_DISABLE();
-#endif /* BUFFER_CACHE_DISABLE */
-
-#if (PREREAD_ENABLE != 0)
- __HAL_FLASH_PREREAD_BUFFER_ENABLE();
-#endif /* PREREAD_ENABLE */
-
-#if (PREFETCH_ENABLE != 0)
- __HAL_FLASH_PREFETCH_BUFFER_ENABLE();
-#endif /* PREFETCH_ENABLE */
-
- /* Use SysTick as time base source and configure 1ms tick (default clock after Reset is MSI) */
- if (HAL_InitTick(TICK_INT_PRIORITY) != HAL_OK)
- {
- status = HAL_ERROR;
- }
- else
- {
- /* Init the low level hardware */
- HAL_MspInit();
- }
-
- /* Return function status */
- return status;
-}
-
-/**
- * @brief This function de-initializes common part of the HAL and stops the source
- * of time base.
- * @note This function is optional.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_DeInit(void)
-{
- /* Reset of all peripherals */
- __HAL_RCC_APB1_FORCE_RESET();
- __HAL_RCC_APB1_RELEASE_RESET();
-
- __HAL_RCC_APB2_FORCE_RESET();
- __HAL_RCC_APB2_RELEASE_RESET();
-
- __HAL_RCC_AHB_FORCE_RESET();
- __HAL_RCC_AHB_RELEASE_RESET();
-
- __HAL_RCC_IOP_FORCE_RESET();
- __HAL_RCC_IOP_RELEASE_RESET();
-
- /* De-Init the low level hardware */
- HAL_MspDeInit();
-
- /* Return function status */
- return HAL_OK;
-}
-
-/**
- * @brief Initializes the MSP.
- * @retval None
- */
-__weak void HAL_MspInit(void)
-{
- /* NOTE : This function should not be modified, when the callback is needed,
- the HAL_MspInit could be implemented in the user file
- */
-}
-
-/**
- * @brief DeInitializes the MSP.
- * @retval None
- */
-__weak void HAL_MspDeInit(void)
-{
- /* NOTE : This function should not be modified, when the callback is needed,
- the HAL_MspDeInit could be implemented in the user file
- */
-}
-
-/**
- * @brief This function configures the source of the time base:
- * The time source is configured to have 1ms time base with a dedicated
- * Tick interrupt priority.
- * @note This function is called automatically at the beginning of program after
- * reset by HAL_Init() or at any time when clock is reconfigured by HAL_RCC_ClockConfig().
- * @note In the default implementation, SysTick timer is the source of time base.
- * It is used to generate interrupts at regular time intervals.
- * Care must be taken if HAL_Delay() is called from a peripheral ISR process,
- * The SysTick interrupt must have higher priority (numerically lower)
- * than the peripheral interrupt. Otherwise the caller ISR process will be blocked.
- * The function is declared as __weak to be overwritten in case of other
- * implementation in user file.
- * @param TickPriority Tick interrupt priority.
- * @retval HAL status
- */
-__weak HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
-{
- /* Configure the SysTick to have interrupt in 1ms time basis*/
- if (HAL_SYSTICK_Config(SystemCoreClock / (1000U / uwTickFreq)) > 0U)
- {
- return HAL_ERROR;
- }
-
- /* Configure the SysTick IRQ priority */
- if (TickPriority < (1UL << __NVIC_PRIO_BITS))
- {
- HAL_NVIC_SetPriority(SysTick_IRQn, TickPriority, 0U);
- uwTickPrio = TickPriority;
- }
- else
- {
- return HAL_ERROR;
- }
-
- /* Return function status */
- return HAL_OK;
-}
-
-/**
- * @}
- */
-
-/** @addtogroup HAL_Exported_Functions_Group2
- * @brief HAL Control functions
- *
-@verbatim
- ===============================================================================
- ##### HAL Control functions #####
- ===============================================================================
- [..] This section provides functions allowing to:
- (+) Provide a tick value in millisecond
- (+) Provide a blocking delay in millisecond
- (+) Suspend the time base source interrupt
- (+) Resume the time base source interrupt
- (+) Get the HAL API driver version
- (+) Get the device identifier
- (+) Get the device revision identifier
-
-@endverbatim
- * @{
- */
-
-/**
- * @brief This function is called to increment a global variable "uwTick"
- * used as application time base.
- * @note In the default implementation, this variable is incremented each 1ms
- * in SysTick ISR.
- * @note This function is declared as __weak to be overwritten in case of other
- * implementations in user file.
- * @retval None
- */
-__weak void HAL_IncTick(void)
-{
- uwTick += uwTickFreq;
-}
-
-/**
- * @brief Provides a tick value in millisecond.
- * @note This function is declared as __weak to be overwritten in case of other
- * implementations in user file.
- * @retval tick value
- */
-__weak uint32_t HAL_GetTick(void)
-{
- return uwTick;
-}
-
-/**
- * @brief This function returns a tick priority.
- * @retval tick priority
- */
-uint32_t HAL_GetTickPrio(void)
-{
- return uwTickPrio;
-}
-
-/**
- * @brief Set new tick Freq.
- * @retval Status
- */
-HAL_StatusTypeDef HAL_SetTickFreq(HAL_TickFreqTypeDef Freq)
-{
- HAL_StatusTypeDef status = HAL_OK;
- HAL_TickFreqTypeDef prevTickFreq;
-
- assert_param(IS_TICKFREQ(Freq));
-
- if (uwTickFreq != Freq)
- {
- /* Back up uwTickFreq frequency */
- prevTickFreq = uwTickFreq;
-
- /* Update uwTickFreq global variable used by HAL_InitTick() */
- uwTickFreq = Freq;
-
- /* Apply the new tick Freq */
- status = HAL_InitTick(uwTickPrio);
-
- if (status != HAL_OK)
- {
- /* Restore previous tick frequency */
- uwTickFreq = prevTickFreq;
- }
- }
-
- return status;
-}
-
-/**
- * @brief Return tick frequency.
- * @retval tick period in Hz
- */
-HAL_TickFreqTypeDef HAL_GetTickFreq(void)
-{
- return uwTickFreq;
-}
-
-/**
- * @brief This function provides minimum delay (in milliseconds) based
- * on variable incremented.
- * @note In the default implementation , SysTick timer is the source of time base.
- * It is used to generate interrupts at regular time intervals where uwTick
- * is incremented.
- * @note This function is declared as __weak to be overwritten in case of other
- * implementations in user file.
- * @param Delay specifies the delay time length, in milliseconds.
- * @retval None
- */
-__weak void HAL_Delay(uint32_t Delay)
-{
- uint32_t tickstart = HAL_GetTick();
- uint32_t wait = Delay;
-
- /* Add a freq to guarantee minimum wait */
- if (wait < HAL_MAX_DELAY)
- {
- wait += (uint32_t)(uwTickFreq);
- }
-
- while((HAL_GetTick() - tickstart) < wait)
- {
- }
-}
-
-/**
- * @brief Suspends the Tick increment.
- * @note In the default implementation , SysTick timer is the source of time base. It is
- * used to generate interrupts at regular time intervals. Once HAL_SuspendTick()
- * is called, the SysTick interrupt will be disabled and so Tick increment
- * is suspended.
- * @note This function is declared as __weak to be overwritten in case of other
- * implementations in user file.
- * @retval None
- */
-__weak void HAL_SuspendTick(void)
-{
- /* Disable SysTick Interrupt */
- SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk;
-}
-
-/**
- * @brief Resumes the Tick increment.
- * @note In the default implementation , SysTick timer is the source of time base. It is
- * used to generate interrupts at regular time intervals. Once HAL_ResumeTick()
- * is called, the SysTick interrupt will be enabled and so Tick increment
- * is resumed.
- * @note This function is declared as __weak to be overwritten in case of other
- * implementations in user file.
- * @retval None
- */
-__weak void HAL_ResumeTick(void)
-{
- /* Enable SysTick Interrupt */
- SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk;
-}
-
-/**
- * @brief Returns the HAL revision
- * @retval version: 0xXYZR (8bits for each decimal, R for RC)
- */
-uint32_t HAL_GetHalVersion(void)
-{
- return __STM32L0xx_HAL_VERSION;
-}
-
-/**
- * @brief Returns the device revision identifier.
- * @retval Device revision identifier
- */
-uint32_t HAL_GetREVID(void)
-{
- return((DBGMCU->IDCODE) >> 16U);
-}
-
-/**
- * @brief Returns the device identifier.
- * @retval Device identifier
- */
-uint32_t HAL_GetDEVID(void)
-{
- return((DBGMCU->IDCODE) & IDCODE_DEVID_MASK);
-}
-
-/**
- * @brief Returns the first word of the unique device identifier (UID based on 96 bits)
- * @retval Device identifier
- */
-uint32_t HAL_GetUIDw0(void)
-{
- return(READ_REG(*((uint32_t *)UID_BASE)));
-}
-
-/**
- * @brief Returns the second word of the unique device identifier (UID based on 96 bits)
- * @retval Device identifier
- */
-uint32_t HAL_GetUIDw1(void)
-{
- return(READ_REG(*((uint32_t *)(UID_BASE + 0x04U))));
-}
-
-/**
- * @brief Returns the third word of the unique device identifier (UID based on 96 bits)
- * @retval Device identifier
- */
-uint32_t HAL_GetUIDw2(void)
-{
- return(READ_REG(*((uint32_t *)(UID_BASE + 0x14U))));
-}
-
-/**
- * @}
- */
-
-/** @addtogroup HAL_Exported_Functions_Group2
- * @brief HAL Debug functions
- *
-@verbatim
- ===============================================================================
- ##### HAL Debug functions #####
- ===============================================================================
- [..] This section provides functions allowing to:
- (+) Enable/Disable Debug module during SLEEP mode
- (+) Enable/Disable Debug module during STOP mode
- (+) Enable/Disable Debug module during STANDBY mode
-
-@endverbatim
- * @{
- */
-
-/**
- * @brief Enables the Debug Module during SLEEP mode
- * @retval None
- */
-void HAL_DBGMCU_EnableDBGSleepMode(void)
-{
- SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP);
-}
-
-/**
- * @brief Disables the Debug Module during SLEEP mode
- * @retval None
- */
-void HAL_DBGMCU_DisableDBGSleepMode(void)
-{
- CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP);
-}
-
-/**
- * @brief Enables the Debug Module during STOP mode
- * @retval None
- */
-void HAL_DBGMCU_EnableDBGStopMode(void)
-{
- SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP);
-}
-
-/**
- * @brief Disables the Debug Module during STOP mode
- * @retval None
- */
-void HAL_DBGMCU_DisableDBGStopMode(void)
-{
- CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP);
-}
-
-/**
- * @brief Enables the Debug Module during STANDBY mode
- * @retval None
- */
-void HAL_DBGMCU_EnableDBGStandbyMode(void)
-{
- SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY);
-}
-
-/**
- * @brief Disables the Debug Module during STANDBY mode
- * @retval None
- */
-void HAL_DBGMCU_DisableDBGStandbyMode(void)
-{
- CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY);
-}
-
-/**
- * @brief Enable low power mode behavior when the MCU is in Debug mode.
- * @param Periph: specifies the low power mode.
- * This parameter can be any combination of the following values:
- * @arg DBGMCU_SLEEP: Keep debugger connection during SLEEP mode
- * @arg DBGMCU_STOP: Keep debugger connection during STOP mode
- * @arg DBGMCU_STANDBY: Keep debugger connection during STANDBY mode
- * @retval None
- */
-void HAL_DBGMCU_DBG_EnableLowPowerConfig(uint32_t Periph)
-{
- /* Check the parameters */
- assert_param(IS_DBGMCU_PERIPH(Periph));
-
- DBGMCU->CR |= Periph;
-
-}
-/**
- * @brief Disable low power mode behavior when the MCU is in Debug mode.
- * @param Periph: specifies the low power mode.
- * This parameter can be any combination of the following values:
- * @arg DBGMCU_SLEEP: Keep debugger connection during SLEEP mode
- * @arg DBGMCU_STOP: Keep debugger connection during STOP mode
- * @arg DBGMCU_STANDBY: Keep debugger connection during STANDBY mode
- * @retval None
- */
-void HAL_DBGMCU_DBG_DisableLowPowerConfig(uint32_t Periph)
-{
- /* Check the parameters */
- assert_param(IS_DBGMCU_PERIPH(Periph));
- {
- DBGMCU->CR &= ~Periph;
- }
-}
-
-/**
- * @}
- */
-
-/** @addtogroup HAL_Exported_Functions_Group3
- * @brief HAL SYSCFG configuration functions
- *
-@verbatim
- ===============================================================================
- ##### HAL SYSCFG configuration functions #####
- ===============================================================================
- [..] This section provides functions allowing to:
- (+) Return the boot mode
- (+) Select the output of internal reference voltage (VREFINT)
- (+) Lock/Unlock the SYSCFG VREF register values
-
-@endverbatim
- * @{
- */
-
-/**
- * @brief Returns the boot mode as configured by user.
- * @retval The boot mode as configured by user. The returned value can be one
- * of the following values:
- * - 0x00000000 : Boot is configured in Main Flash memory
- * - 0x00000100 : Boot is configured in System Flash memory
- * - 0x00000300 : Boot is configured in Embedded SRAM memory
- */
-uint32_t HAL_SYSCFG_GetBootMode(void)
-{
- return (SYSCFG->CFGR1 & SYSCFG_CFGR1_BOOT_MODE);
-}
-
-/**
- * @brief Selects the output of internal reference voltage (VREFINT).
- * The VREFINT output can be routed to(PB0) or
- * (PB1) or both.
- * @param SYSCFG_Vrefint_OUTPUT: new state of the Vrefint output.
- * This parameter can be one of the following values:
- * @arg SYSCFG_VREFINT_OUT_NONE
- * @arg SYSCFG_VREFINT_OUT_PB0
- * @arg SYSCFG_VREFINT_OUT_PB1
- * @arg SYSCFG_VREFINT_OUT_PB0_PB1
- * @retval None
- */
-void HAL_SYSCFG_VREFINT_OutputSelect(uint32_t SYSCFG_Vrefint_OUTPUT)
-{
- /* Check the parameters */
- assert_param(IS_SYSCFG_VREFINT_OUT_SELECT(SYSCFG_Vrefint_OUTPUT));
-
- /* Set the output Vrefint pin */
- SYSCFG->CFGR3 &= ~(SYSCFG_CFGR3_VREF_OUT);
- SYSCFG->CFGR3 |= (uint32_t)(SYSCFG_Vrefint_OUTPUT);
-}
-
-/**
- * @brief Lock the SYSCFG VREF register values
- * @retval None
- */
-void HAL_SYSCFG_Enable_Lock_VREFINT(void)
-{
- /* Enable the LOCK by setting REF_LOCK bit in the CFGR3 register */
- SET_BIT(SYSCFG->CFGR3, SYSCFG_CFGR3_REF_LOCK);
-}
-
-/**
- * @brief Unlock the overall SYSCFG VREF register values
- * @retval None
- */
-void HAL_SYSCFG_Disable_Lock_VREFINT(void)
-{
- /* Disable the LOCK by setting REF_LOCK bit in the CFGR3 register */
- CLEAR_BIT(SYSCFG->CFGR3, SYSCFG_CFGR3_REF_LOCK);
-}
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-#endif /* HAL_MODULE_ENABLED */
-/**
- * @}
- */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
-
diff --git a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_adc.c b/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_adc.c
deleted file mode 100644
index 753c0bef40..0000000000
--- a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_adc.c
+++ /dev/null
@@ -1,2516 +0,0 @@
-/**
- ******************************************************************************
- * @file stm32l0xx_hal_adc.c
- * @author MCD Application Team
- * @brief This file provides firmware functions to manage the following
- * functionalities of the Analog to Digital Convertor (ADC)
- * peripheral:
- * + Initialization and de-initialization functions
- * ++ Initialization and Configuration of ADC
- * + Operation functions
- * ++ Start, stop, get result of conversions of regular
- * group, using 3 possible modes: polling, interruption or DMA.
- * + Control functions
- * ++ Channels configuration on regular group
- * ++ Analog Watchdog configuration
- * + State functions
- * ++ ADC state machine management
- * ++ Interrupts and flags management
- * Other functions (extended functions) are available in file
- * "stm32l0xx_hal_adc_ex.c".
- *
- @verbatim
- ==============================================================================
- ##### ADC peripheral features #####
- ==============================================================================
- [..]
- (+) 12-bit, 10-bit, 8-bit or 6-bit configurable resolution.
-
- (+) Interrupt generation at the end of regular conversion and in case of
- analog watchdog or overrun events.
-
- (+) Single and continuous conversion modes.
-
- (+) Scan mode for conversion of several channels sequentially.
-
- (+) Data alignment with in-built data coherency.
-
- (+) Programmable sampling time (common for all channels)
-
- (+) External trigger (timer or EXTI) with configurable polarity
-
- (+) DMA request generation for transfer of conversions data of regular group.
-
- (+) ADC calibration
-
- (+) ADC conversion of regular group.
-
- (+) ADC supply requirements: 1.62 V to 3.6 V.
-
- (+) ADC input range: from Vref- (connected to Vssa) to Vref+ (connected to
- Vdda or to an external voltage reference).
-
-
- ##### How to use this driver #####
- ==============================================================================
- [..]
-
- *** Configuration of top level parameters related to ADC ***
- ============================================================
- [..]
-
- (#) Enable the ADC interface
- (++) As prerequisite, ADC clock must be configured at RCC top level.
- Caution: On STM32L0, ADC clock frequency max is 16MHz (refer
- to device datasheet).
- Therefore, ADC clock prescaler must be configured in
- function of ADC clock source frequency to remain below
- this maximum frequency.
-
- (++) Two clock settings are mandatory:
- (+++) ADC clock (core clock, also possibly conversion clock).
-
- (+++) ADC clock (conversions clock).
- Two possible clock sources: synchronous clock derived from APB clock
- or asynchronous clock derived from ADC dedicated HSI RC oscillator
- 16MHz.
- If asynchronous clock is selected, parameter "HSIState" must be set either:
- - to "...HSIState = RCC_HSI_ON" to maintain the HSI16 oscillator
- always enabled: can be used to supply the main system clock.
-
- (+++) Example:
- Into HAL_ADC_MspInit() (recommended code location) or with
- other device clock parameters configuration:
- (+++) __HAL_RCC_ADC1_CLK_ENABLE(); (mandatory)
-
- HSI enable (optional: if asynchronous clock selected)
- (+++) RCC_OscInitTypeDef RCC_OscInitStructure;
- (+++) RCC_OscInitStructure.OscillatorType = RCC_OSCILLATORTYPE_HSI;
- (+++) RCC_OscInitStructure.HSI16CalibrationValue = RCC_HSICALIBRATION_DEFAULT;
- (+++) RCC_OscInitStructure.HSIState = RCC_HSI_ON;
- (+++) RCC_OscInitStructure.PLL... (optional if used for system clock)
- (+++) HAL_RCC_OscConfig(&RCC_OscInitStructure);
-
- (++) ADC clock source and clock prescaler are configured at ADC level with
- parameter "ClockPrescaler" using function HAL_ADC_Init().
-
- (#) ADC pins configuration
- (++) Enable the clock for the ADC GPIOs
- using macro __HAL_RCC_GPIOx_CLK_ENABLE()
- (++) Configure these ADC pins in analog mode
- using function HAL_GPIO_Init()
-
- (#) Optionally, in case of usage of ADC with interruptions:
- (++) Configure the NVIC for ADC
- using function HAL_NVIC_EnableIRQ(ADCx_IRQn)
- (++) Insert the ADC interruption handler function HAL_ADC_IRQHandler()
- into the function of corresponding ADC interruption vector
- ADCx_IRQHandler().
-
- (#) Optionally, in case of usage of DMA:
- (++) Configure the DMA (DMA channel, mode normal or circular, ...)
- using function HAL_DMA_Init().
- (++) Configure the NVIC for DMA
- using function HAL_NVIC_EnableIRQ(DMAx_Channelx_IRQn)
- (++) Insert the ADC interruption handler function HAL_ADC_IRQHandler()
- into the function of corresponding DMA interruption vector
- DMAx_Channelx_IRQHandler().
-
- *** Configuration of ADC, group regular, channels parameters ***
- ================================================================
- [..]
-
- (#) Configure the ADC parameters (resolution, data alignment, ...)
- and regular group parameters (conversion trigger, sequencer, ...)
- using function HAL_ADC_Init().
-
- (#) Configure the channels for regular group parameters (channel number,
- channel rank into sequencer, ..., into regular group)
- using function HAL_ADC_ConfigChannel().
-
- (#) Optionally, configure the analog watchdog parameters (channels
- monitored, thresholds, ...)
- using function HAL_ADC_AnalogWDGConfig().
-
-
- (#) When device is in mode low-power (low-power run, low-power sleep or stop mode),
- function "HAL_ADCEx_EnableVREFINT()" must be called before function HAL_ADC_Init().
- In case of internal temperature sensor to be measured:
- function "HAL_ADCEx_EnableVREFINTTempSensor()" must be called similarilly
-
- *** Execution of ADC conversions ***
- ====================================
- [..]
-
- (#) Optionally, perform an automatic ADC calibration to improve the
- conversion accuracy
- using function HAL_ADCEx_Calibration_Start().
-
- (#) ADC driver can be used among three modes: polling, interruption,
- transfer by DMA.
-
- (++) ADC conversion by polling:
- (+++) Activate the ADC peripheral and start conversions
- using function HAL_ADC_Start()
- (+++) Wait for ADC conversion completion
- using function HAL_ADC_PollForConversion()
- (+++) Retrieve conversion results
- using function HAL_ADC_GetValue()
- (+++) Stop conversion and disable the ADC peripheral
- using function HAL_ADC_Stop()
-
- (++) ADC conversion by interruption:
- (+++) Activate the ADC peripheral and start conversions
- using function HAL_ADC_Start_IT()
- (+++) Wait for ADC conversion completion by call of function
- HAL_ADC_ConvCpltCallback()
- (this function must be implemented in user program)
- (+++) Retrieve conversion results
- using function HAL_ADC_GetValue()
- (+++) Stop conversion and disable the ADC peripheral
- using function HAL_ADC_Stop_IT()
-
- (++) ADC conversion with transfer by DMA:
- (+++) Activate the ADC peripheral and start conversions
- using function HAL_ADC_Start_DMA()
- (+++) Wait for ADC conversion completion by call of function
- HAL_ADC_ConvCpltCallback() or HAL_ADC_ConvHalfCpltCallback()
- (these functions must be implemented in user program)
- (+++) Conversion results are automatically transferred by DMA into
- destination variable address.
- (+++) Stop conversion and disable the ADC peripheral
- using function HAL_ADC_Stop_DMA()
-
- [..]
-
- (@) Callback functions must be implemented in user program:
- (+@) HAL_ADC_ErrorCallback()
- (+@) HAL_ADC_LevelOutOfWindowCallback() (callback of analog watchdog)
- (+@) HAL_ADC_ConvCpltCallback()
- (+@) HAL_ADC_ConvHalfCpltCallback
-
- *** Deinitialization of ADC ***
- ============================================================
- [..]
-
- (#) Disable the ADC interface
- (++) ADC clock can be hard reset and disabled at RCC top level.
- (++) Hard reset of ADC peripherals
- using macro __ADCx_FORCE_RESET(), __ADCx_RELEASE_RESET().
- (++) ADC clock disable
- using the equivalent macro/functions as configuration step.
- (+++) Example:
- Into HAL_ADC_MspDeInit() (recommended code location) or with
- other device clock parameters configuration:
- (+++) RCC_OscInitStructure.OscillatorType = RCC_OSCILLATORTYPE_HSI;
- (+++) RCC_OscInitStructure.HSIState = RCC_HSI_OFF; (if not used for system clock)
- (+++) HAL_RCC_OscConfig(&RCC_OscInitStructure);
-
- (#) ADC pins configuration
- (++) Disable the clock for the ADC GPIOs
- using macro __HAL_RCC_GPIOx_CLK_DISABLE()
-
- (#) Optionally, in case of usage of ADC with interruptions:
- (++) Disable the NVIC for ADC
- using function HAL_NVIC_EnableIRQ(ADCx_IRQn)
-
- (#) Optionally, in case of usage of DMA:
- (++) Deinitialize the DMA
- using function HAL_DMA_Init().
- (++) Disable the NVIC for DMA
- using function HAL_NVIC_EnableIRQ(DMAx_Channelx_IRQn)
-
- [..]
-
- *** Callback registration ***
- =============================================
- [..]
-
- The compilation flag USE_HAL_ADC_REGISTER_CALLBACKS, when set to 1,
- allows the user to configure dynamically the driver callbacks.
- Use Functions HAL_ADC_RegisterCallback()
- to register an interrupt callback.
- [..]
-
- Function HAL_ADC_RegisterCallback() allows to register following callbacks:
- (+) ConvCpltCallback : ADC conversion complete callback
- (+) ConvHalfCpltCallback : ADC conversion DMA half-transfer callback
- (+) LevelOutOfWindowCallback : ADC analog watchdog 1 callback
- (+) ErrorCallback : ADC error callback
- (+) MspInitCallback : ADC Msp Init callback
- (+) MspDeInitCallback : ADC Msp DeInit callback
- This function takes as parameters the HAL peripheral handle, the Callback ID
- and a pointer to the user callback function.
- [..]
-
- Use function HAL_ADC_UnRegisterCallback to reset a callback to the default
- weak function.
- [..]
-
- HAL_ADC_UnRegisterCallback takes as parameters the HAL peripheral handle,
- and the Callback ID.
- This function allows to reset following callbacks:
- (+) ConvCpltCallback : ADC conversion complete callback
- (+) ConvHalfCpltCallback : ADC conversion DMA half-transfer callback
- (+) LevelOutOfWindowCallback : ADC analog watchdog 1 callback
- (+) ErrorCallback : ADC error callback
- (+) MspInitCallback : ADC Msp Init callback
- (+) MspDeInitCallback : ADC Msp DeInit callback
- [..]
-
- By default, after the HAL_ADC_Init() and when the state is HAL_ADC_STATE_RESET
- all callbacks are set to the corresponding weak functions:
- examples HAL_ADC_ConvCpltCallback(), HAL_ADC_ErrorCallback().
- Exception done for MspInit and MspDeInit functions that are
- reset to the legacy weak functions in the HAL_ADC_Init()/ HAL_ADC_DeInit() only when
- these callbacks are null (not registered beforehand).
- [..]
-
- If MspInit or MspDeInit are not null, the HAL_ADC_Init()/ HAL_ADC_DeInit()
- keep and use the user MspInit/MspDeInit callbacks (registered beforehand) whatever the state.
- [..]
-
- Callbacks can be registered/unregistered in HAL_ADC_STATE_READY state only.
- Exception done MspInit/MspDeInit functions that can be registered/unregistered
- in HAL_ADC_STATE_READY or HAL_ADC_STATE_RESET state,
- thus registered (user) MspInit/DeInit callbacks can be used during the Init/DeInit.
- [..]
-
- Then, the user first registers the MspInit/MspDeInit user callbacks
- using HAL_ADC_RegisterCallback() before calling HAL_ADC_DeInit()
- or HAL_ADC_Init() function.
- [..]
-
- When the compilation flag USE_HAL_ADC_REGISTER_CALLBACKS is set to 0 or
- not defined, the callback registration feature is not available and all callbacks
- are set to the corresponding weak functions.
-
- @endverbatim
- ******************************************************************************
- * @attention
- *
- *
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-#include "stm32l0xx_hal.h"
-
-/** @addtogroup STM32L0xx_HAL_Driver
- * @{
- */
-
-/** @defgroup ADCEx ADCEx
- * @brief ADC Extended HAL module driver
- * @{
- */
-
-#ifdef HAL_ADC_MODULE_ENABLED
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-/** @defgroup ADCEx_Private_Constants ADC Extended Private Constants
- * @{
- */
-
- /* Fixed timeout values for ADC calibration, enable settling time, disable */
- /* settling time. */
- /* Values defined to be higher than worst cases: low clock frequency, */
- /* maximum prescaler. */
- /* Unit: ms */
- #define ADC_CALIBRATION_TIMEOUT 10U
-
-/* Delay for VREFINT stabilization time. */
-/* Internal reference startup time max value is 3ms (refer to device datasheet, parameter TVREFINT). */
-/* Unit: ms */
-#define SYSCFG_BUF_VREFINT_ENABLE_TIMEOUT (3U)
-
-/* Delay for TEMPSENSOR stabilization time. */
-/* Temperature sensor startup time max value is 10us (refer to device datasheet, parameter tSTART). */
-/* Unit: ms */
-#define SYSCFG_BUF_TEMPSENSOR_ENABLE_TIMEOUT (1U)
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Exported functions --------------------------------------------------------*/
-
-/** @defgroup ADCEx_Exported_Functions ADC Extended Exported Functions
- * @{
- */
-
-/** @defgroup ADCEx_Exported_Functions_Group1 Extended Input and Output operation functions
- * @brief Extended IO operation functions
- *
-@verbatim
- ===============================================================================
- ##### IO operation functions #####
- ===============================================================================
- [..] This section provides functions allowing to:
- (+) Perform the ADC calibration.
-@endverbatim
- * @{
- */
-
-/**
- * @brief Perform an ADC automatic self-calibration
- * Calibration prerequisite: ADC must be disabled (execute this
- * function before HAL_ADC_Start() or after HAL_ADC_Stop() ).
- * @note Calibration factor can be read after calibration, using function
- * HAL_ADC_GetValue() (value on 7 bits: from DR[6;0]).
- * @param hadc ADC handle
- * @param SingleDiff Selection of single-ended or differential input
- * This parameter can be only of the following values:
- * @arg ADC_SINGLE_ENDED: Channel in mode input single ended
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_ADCEx_Calibration_Start(ADC_HandleTypeDef* hadc, uint32_t SingleDiff)
-{
- HAL_StatusTypeDef tmp_hal_status = HAL_OK;
- uint32_t tickstart = 0U;
- uint32_t backup_setting_adc_dma_transfer = 0U; /* Note: Variable not declared as volatile because register read is already declared as volatile */
-
- /* Check the parameters */
- assert_param(IS_ADC_ALL_INSTANCE(hadc->Instance));
-
- /* Process locked */
- __HAL_LOCK(hadc);
-
- /* Calibration prerequisite: ADC must be disabled. */
- if (ADC_IS_ENABLE(hadc) == RESET)
- {
- /* Set ADC state */
- ADC_STATE_CLR_SET(hadc->State,
- HAL_ADC_STATE_REG_BUSY,
- HAL_ADC_STATE_BUSY_INTERNAL);
-
- /* Disable ADC DMA transfer request during calibration */
- /* Note: Specificity of this STM32 serie: Calibration factor is */
- /* available in data register and also transfered by DMA. */
- /* To not insert ADC calibration factor among ADC conversion data */
- /* in array variable, DMA transfer must be disabled during */
- /* calibration. */
- backup_setting_adc_dma_transfer = READ_BIT(hadc->Instance->CFGR1, ADC_CFGR1_DMAEN | ADC_CFGR1_DMACFG);
- CLEAR_BIT(hadc->Instance->CFGR1, ADC_CFGR1_DMAEN | ADC_CFGR1_DMACFG);
-
- /* Start ADC calibration */
- hadc->Instance->CR |= ADC_CR_ADCAL;
-
- tickstart = HAL_GetTick();
-
- /* Wait for calibration completion */
- while(HAL_IS_BIT_SET(hadc->Instance->CR, ADC_CR_ADCAL))
- {
- if((HAL_GetTick() - tickstart) > ADC_CALIBRATION_TIMEOUT)
- {
- /* New check to avoid false timeout detection in case of preemption */
- if(HAL_IS_BIT_SET(hadc->Instance->CR, ADC_CR_ADCAL))
- {
- /* Update ADC state machine to error */
- ADC_STATE_CLR_SET(hadc->State,
- HAL_ADC_STATE_BUSY_INTERNAL,
- HAL_ADC_STATE_ERROR_INTERNAL);
-
- /* Process unlocked */
- __HAL_UNLOCK(hadc);
-
- return HAL_ERROR;
- }
- }
- }
-
- /* Restore ADC DMA transfer request after calibration */
- SET_BIT(hadc->Instance->CFGR1, backup_setting_adc_dma_transfer);
-
- /* Set ADC state */
- ADC_STATE_CLR_SET(hadc->State,
- HAL_ADC_STATE_BUSY_INTERNAL,
- HAL_ADC_STATE_READY);
- }
- else
- {
- /* Update ADC state machine to error */
- SET_BIT(hadc->State, HAL_ADC_STATE_ERROR_CONFIG);
-
- tmp_hal_status = HAL_ERROR;
- }
-
- /* Process unlocked */
- __HAL_UNLOCK(hadc);
-
- /* Return function status */
- return tmp_hal_status;
-}
-
-/**
- * @brief Get the calibration factor.
- * @param hadc ADC handle.
- * @param SingleDiff This parameter can be only:
- * @arg ADC_SINGLE_ENDED: Channel in mode input single ended.
- * @retval Calibration value.
- */
-uint32_t HAL_ADCEx_Calibration_GetValue(ADC_HandleTypeDef* hadc, uint32_t SingleDiff)
-{
- /* Check the parameters */
- assert_param(IS_ADC_ALL_INSTANCE(hadc->Instance));
- assert_param(IS_ADC_SINGLE_DIFFERENTIAL(SingleDiff));
-
- /* Return the ADC calibration value */
- return ((hadc->Instance->CALFACT) & 0x0000007FU);
-}
-
-/**
- * @brief Set the calibration factor to overwrite automatic conversion result.
- * ADC must be enabled and no conversion is ongoing.
- * @param hadc ADC handle
- * @param SingleDiff This parameter can be only:
- * @arg ADC_SINGLE_ENDED: Channel in mode input single ended.
- * @param CalibrationFactor Calibration factor (coded on 7 bits maximum)
- * @retval HAL state
- */
-HAL_StatusTypeDef HAL_ADCEx_Calibration_SetValue(ADC_HandleTypeDef* hadc, uint32_t SingleDiff, uint32_t CalibrationFactor)
-{
- HAL_StatusTypeDef tmp_hal_status = HAL_OK;
-
- /* Check the parameters */
- assert_param(IS_ADC_ALL_INSTANCE(hadc->Instance));
- assert_param(IS_ADC_SINGLE_DIFFERENTIAL(SingleDiff));
- assert_param(IS_ADC_CALFACT(CalibrationFactor));
-
- /* Process locked */
- __HAL_LOCK(hadc);
-
- /* Verification of hardware constraints before modifying the calibration */
- /* factors register: ADC must be enabled, no conversion on going. */
- if ( (ADC_IS_ENABLE(hadc) != RESET) &&
- (ADC_IS_CONVERSION_ONGOING_REGULAR(hadc) == RESET) )
- {
- /* Set the selected ADC calibration value */
- hadc->Instance->CALFACT &= ~ADC_CALFACT_CALFACT;
- hadc->Instance->CALFACT |= CalibrationFactor;
- }
- else
- {
- /* Update ADC state machine to error */
- SET_BIT(hadc->State, HAL_ADC_STATE_ERROR_INTERNAL);
- /* Update ADC state machine to error */
- SET_BIT(hadc->ErrorCode, HAL_ADC_ERROR_INTERNAL);
-
- /* Update ADC state machine to error */
- tmp_hal_status = HAL_ERROR;
- }
-
- /* Process unlocked */
- __HAL_UNLOCK(hadc);
-
- /* Return function status */
- return tmp_hal_status;
-}
-
-/**
- * @brief Enables the buffer of Vrefint for the ADC, required when device is in mode low-power (low-power run, low-power sleep or stop mode)
- * This function must be called before function HAL_ADC_Init()
- * (in case of previous ADC operations: function HAL_ADC_DeInit() must be called first)
- * For more details on procedure and buffer current consumption, refer to device reference manual.
- * @note This is functional only if the LOCK is not set.
- * @note This API is obsolete. This configuration is done in HAL_ADC_ConfigChannel().
- * @retval None
- */
-HAL_StatusTypeDef HAL_ADCEx_EnableVREFINT(void)
-{
- uint32_t tickstart = 0U;
-
- /* Enable the Buffer for the ADC by setting ENBUF_SENSOR_ADC bit in the CFGR3 register */
- SET_BIT(SYSCFG->CFGR3, SYSCFG_CFGR3_ENBUF_VREFINT_ADC);
-
- /* Wait for Vrefint buffer effectively enabled */
- /* Get tick count */
- tickstart = HAL_GetTick();
-
- while(HAL_IS_BIT_CLR(SYSCFG->CFGR3, SYSCFG_CFGR3_VREFINT_RDYF))
- {
- if((HAL_GetTick() - tickstart) > SYSCFG_BUF_VREFINT_ENABLE_TIMEOUT)
- {
- /* New check to avoid false timeout detection in case of preemption */
- if(HAL_IS_BIT_CLR(SYSCFG->CFGR3, SYSCFG_CFGR3_VREFINT_RDYF))
- {
- return HAL_ERROR;
- }
- }
- }
-
- return HAL_OK;
-}
-
-/**
- * @brief Disables the Buffer Vrefint for the ADC.
- * @note This is functional only if the LOCK is not set.
- * @note This API is obsolete. This configuration is done in HAL_ADC_ConfigChannel().
- * @retval None
- */
-void HAL_ADCEx_DisableVREFINT(void)
-{
- /* Disable the Vrefint by resetting ENBUF_SENSOR_ADC bit in the CFGR3 register */
- CLEAR_BIT(SYSCFG->CFGR3, SYSCFG_CFGR3_ENBUF_VREFINT_ADC);
-}
-
-/**
- * @brief Enables the buffer of temperature sensor for the ADC, required when device is in mode low-power (low-power run, low-power sleep or stop mode)
- * This function must be called before function HAL_ADC_Init()
- * (in case of previous ADC operations: function HAL_ADC_DeInit() must be called first)
- * For more details on procedure and buffer current consumption, refer to device reference manual.
- * @note This is functional only if the LOCK is not set.
- * @note This API is obsolete. This configuration is done in HAL_ADC_ConfigChannel().
- * @retval None
- */
-HAL_StatusTypeDef HAL_ADCEx_EnableVREFINTTempSensor(void)
-{
- uint32_t tickstart = 0U;
-
- /* Enable the Buffer for the ADC by setting ENBUF_SENSOR_ADC bit in the CFGR3 register */
- SET_BIT(SYSCFG->CFGR3, SYSCFG_CFGR3_ENBUF_SENSOR_ADC);
-
- /* Wait for Vrefint buffer effectively enabled */
- /* Get tick count */
- tickstart = HAL_GetTick();
-
- while(HAL_IS_BIT_CLR(SYSCFG->CFGR3, SYSCFG_CFGR3_VREFINT_RDYF))
- {
- if((HAL_GetTick() - tickstart) > SYSCFG_BUF_TEMPSENSOR_ENABLE_TIMEOUT)
- {
- /* New check to avoid false timeout detection in case of preemption */
- if(HAL_IS_BIT_CLR(SYSCFG->CFGR3, SYSCFG_CFGR3_VREFINT_RDYF))
- {
- return HAL_ERROR;
- }
- }
- }
-
- return HAL_OK;
-}
-
-/**
- * @brief Disables the VREFINT and Sensor for the ADC.
- * @note This is functional only if the LOCK is not set.
- * @note This API is obsolete. This configuration is done in HAL_ADC_ConfigChannel().
- * @retval None
- */
-void HAL_ADCEx_DisableVREFINTTempSensor(void)
-{
- /* Disable the Vrefint by resetting ENBUF_SENSOR_ADC bit in the CFGR3 register */
- CLEAR_BIT(SYSCFG->CFGR3, SYSCFG_CFGR3_ENBUF_SENSOR_ADC);
-}
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-#endif /* HAL_ADC_MODULE_ENABLED */
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_comp.c b/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_comp.c
deleted file mode 100644
index ae148ee1d4..0000000000
--- a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_comp.c
+++ /dev/null
@@ -1,1068 +0,0 @@
-/**
- ******************************************************************************
- * @file stm32l0xx_hal_comp.c
- * @author MCD Application Team
- * @brief COMP HAL module driver.
- * This file provides firmware functions to manage the following
- * functionalities of the COMP peripheral:
- * + Initialization and de-initialization functions
- * + Start/Stop operation functions in polling mode
- * + Start/Stop operation functions in interrupt mode (through EXTI interrupt)
- * + Peripheral control functions
- * + Peripheral state functions
- *
- @verbatim
-================================================================================
- ##### COMP Peripheral features #####
-================================================================================
-
- [..]
- The STM32L0xx device family integrates two analog comparators instances
- COMP1 and COMP2:
- (#) The COMP input minus (inverting input) and input plus (non inverting input)
- can be set to internal references or to GPIO pins
- (refer to GPIO list in reference manual).
-
- (#) The COMP output level is available using HAL_COMP_GetOutputLevel()
- and can be redirected to other peripherals: GPIO pins (in mode
- alternate functions for comparator), timers.
- (refer to GPIO list in reference manual).
-
- (#) Pairs of comparators instances can be combined in window mode
- (2 consecutive instances odd and even COMP and COMP).
-
- (#) The comparators have interrupt capability through the EXTI controller
- with wake-up from sleep and stop modes:
- (++) COMP1 is internally connected to EXTI Line 21
- (++) COMP2 is internally connected to EXTI Line 22
-
- From the corresponding IRQ handler, the right interrupt source can be retrieved
- using macro __HAL_COMP_COMP1_EXTI_GET_FLAG() and __HAL_COMP_COMP2_EXTI_GET_FLAG().
-
- ##### How to use this driver #####
-================================================================================
- [..]
- This driver provides functions to configure and program the comparator instances
- of STM32L0xx devices.
-
- To use the comparator, perform the following steps:
-
- (#) Initialize the COMP low level resources by implementing the HAL_COMP_MspInit():
- (++) Configure the GPIO connected to comparator inputs plus and minus in analog mode
- using HAL_GPIO_Init().
- (++) If needed, configure the GPIO connected to comparator output in alternate function mode
- using HAL_GPIO_Init().
- (++) If required enable the COMP interrupt by configuring and enabling EXTI line in Interrupt mode and
- selecting the desired sensitivity level using HAL_GPIO_Init() function. After that enable the comparator
- interrupt vector using HAL_NVIC_EnableIRQ() function.
-
- (#) Configure the comparator using HAL_COMP_Init() function:
- (++) Select the input minus (inverting input)
- (++) Select the input plus (non-inverting input)
- (++) Select the output polarity
- (++) Select the power mode
- (++) Select the window mode
-
- -@@- HAL_COMP_Init() calls internally __HAL_RCC_SYSCFG_CLK_ENABLE()
- to enable internal control clock of the comparators.
- However, this is a legacy strategy. In future STM32 families,
- COMP clock enable must be implemented by user in "HAL_COMP_MspInit()".
- Therefore, for compatibility anticipation, it is recommended to
- implement __HAL_RCC_SYSCFG_CLK_ENABLE() in "HAL_COMP_MspInit()".
-
- (#) Reconfiguration on-the-fly of comparator can be done by calling again
- function HAL_COMP_Init() with new input structure parameters values.
-
- (#) Enable the comparator using HAL_COMP_Start() function.
-
- (#) Use HAL_COMP_TriggerCallback() or HAL_COMP_GetOutputLevel() functions
- to manage comparator outputs (events and output level).
-
- (#) Disable the comparator using HAL_COMP_Stop() function.
-
- (#) De-initialize the comparator using HAL_COMP_DeInit() function.
-
- (#) For safety purpose, comparator configuration can be locked using HAL_COMP_Lock() function.
- The only way to unlock the comparator is a device hardware reset.
-
- *** Callback registration ***
- =============================================
- [..]
-
- The compilation flag USE_HAL_COMP_REGISTER_CALLBACKS, when set to 1,
- allows the user to configure dynamically the driver callbacks.
- Use Functions HAL_COMP_RegisterCallback()
- to register an interrupt callback.
- [..]
-
- Function HAL_COMP_RegisterCallback() allows to register following callbacks:
- (+) TriggerCallback : callback for COMP trigger.
- (+) MspInitCallback : callback for Msp Init.
- (+) MspDeInitCallback : callback for Msp DeInit.
- This function takes as parameters the HAL peripheral handle, the Callback ID
- and a pointer to the user callback function.
- [..]
-
- Use function HAL_COMP_UnRegisterCallback to reset a callback to the default
- weak function.
- [..]
-
- HAL_COMP_UnRegisterCallback takes as parameters the HAL peripheral handle,
- and the Callback ID.
- This function allows to reset following callbacks:
- (+) TriggerCallback : callback for COMP trigger.
- (+) MspInitCallback : callback for Msp Init.
- (+) MspDeInitCallback : callback for Msp DeInit.
- [..]
-
- By default, after the HAL_COMP_Init() and when the state is HAL_COMP_STATE_RESET
- all callbacks are set to the corresponding weak functions:
- example HAL_COMP_TriggerCallback().
- Exception done for MspInit and MspDeInit functions that are
- reset to the legacy weak functions in the HAL_COMP_Init()/ HAL_COMP_DeInit() only when
- these callbacks are null (not registered beforehand).
- [..]
-
- If MspInit or MspDeInit are not null, the HAL_COMP_Init()/ HAL_COMP_DeInit()
- keep and use the user MspInit/MspDeInit callbacks (registered beforehand) whatever the state.
- [..]
-
- Callbacks can be registered/unregistered in HAL_COMP_STATE_READY state only.
- Exception done MspInit/MspDeInit functions that can be registered/unregistered
- in HAL_COMP_STATE_READY or HAL_COMP_STATE_RESET state,
- thus registered (user) MspInit/DeInit callbacks can be used during the Init/DeInit.
- [..]
-
- Then, the user first registers the MspInit/MspDeInit user callbacks
- using HAL_COMP_RegisterCallback() before calling HAL_COMP_DeInit()
- or HAL_COMP_Init() function.
- [..]
-
- When the compilation flag USE_HAL_COMP_REGISTER_CALLBACKS is set to 0 or
- not defined, the callback registration feature is not available and all callbacks
- are set to the corresponding weak functions.
-
- @endverbatim
- ******************************************************************************
-
- Table 1. COMP inputs and output for STM32L0xx devices
- +---------------------------------------------------------+
- | | | COMP1 | COMP2 |
- |----------------|----------------|-----------|-----------|
- | | IO1 | PA1 | PA3 |
- | Input plus | IO2 | --- | PA4 |
- | | IO3 | --- | PB5 |
- | | IO4 | --- | PB6 |
- | | IO5 | --- | PB7 |
- |----------------|----------------|-----------------------|
- | | 1/4 VrefInt | --- | Available |
- | | 1/2 VrefInt | --- | Available |
- | | 3/4 VrefInt | --- | Available |
- | Input minus | VrefInt | Available | Available |
- | | DAC1 channel 1 | Available | Available |
- | | DAC1 channel 2 | Available | Available |
- | | IO1 | PA0 | PA2 |
- | | IO2 | PA5 | PA5 |
- | | IO3 | --- | PB3 |
- +---------------------------------------------------------+
- | Output | | PA0 (1) | PA2 (1) |
- | | | PA6 (1) | PA7 (1) |
- | | | PA11 (1) | PA12 (1) |
- | | | LPTIM | LPTIM |
- | | | TIM (2) | TIM (2) |
- +-----------------------------------------------------------+
- (1) GPIO must be set to alternate function for comparator
- (2) Comparators output to timers is set in timers instances.
-
- ******************************************************************************
- * @attention
- *
- *
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- ******************************************************************************
- */
-
-#if !defined (STM32L010xB) && !defined (STM32L010x8) && !defined (STM32L010x6) && !defined (STM32L010x4)
-/* Includes ------------------------------------------------------------------*/
-#include "stm32l0xx_hal.h"
-
-/** @addtogroup STM32L0xx_HAL_Driver
- * @{
- */
-
-#ifdef HAL_COMP_MODULE_ENABLED
-
-/** @addtogroup COMPEx
- * @brief Extended COMP HAL module driver
- * @{
- */
-
-/* Private define ------------------------------------------------------------*/
-/** @addtogroup COMP_Private_Constants
- * @{
- */
-
-/* Delay for COMP voltage scaler stabilization time (voltage from VrefInt, */
-/* delay based on VrefInt startup time). */
-/* Literal set to maximum value (refer to device datasheet, */
-/* parameter "TVREFINT"). */
-/* Unit: us */
-#define COMP_DELAY_VOLTAGE_SCALER_STAB_US (3000U) /*!< Delay for COMP voltage scaler stabilization time */
-
-/**
- * @}
- */
-
-/* Exported functions --------------------------------------------------------*/
-/** @addtogroup COMPEx_Exported_Functions
- * @{
- */
-
-/** @addtogroup COMPEx_Exported_Functions_Group1
- * @brief Extended functions to manage VREFINT for the comparator
- *
- * @{
- */
-
-/**
- * @brief Enable Vrefint and path to comparator, used by comparator
- * instance COMP2 input based on VrefInt or subdivision of VrefInt.
- * @note The equivalent of this function is managed automatically when
- * using function "HAL_COMP_Init()".
- * @note VrefInt requires a startup time
- * (refer to device datasheet, parameter "TVREFINT").
- * This function waits for the startup time
- * (alternative solution: poll for bit SYSCFG_CFGR3_VREFINT_RDYF set).
- * @note VrefInt must be disabled before entering in low-power mode.
- * Refer to description of bit EN_VREFINT in reference manual.
- * @retval None
- */
-void HAL_COMPEx_EnableVREFINT(void)
-{
- __IO uint32_t wait_loop_index = 0U;
-
- /* Enable VrefInt voltage reference and buffer */
- SYSCFG->CFGR3 |= (SYSCFG_CFGR3_ENBUFLP_VREFINT_COMP | SYSCFG_CFGR3_EN_VREFINT);
-
- /* Wait loop initialization and execution */
- /* Note: Variable divided by 2 to compensate partially */
- /* CPU processing cycles. */
- wait_loop_index = (COMP_DELAY_VOLTAGE_SCALER_STAB_US * (SystemCoreClock / (1000000U * 2U)));
- while(wait_loop_index != 0U)
- {
- wait_loop_index--;
- }
-}
-
-/**
- * @brief Disable Vrefint and path to comparator, used by comparator
- * instance COMP2 input based on VrefInt or subdivision of VrefInt.
- * @note VrefInt must be disabled before entering in low-power mode.
- * Refer to description of bit EN_VREFINT in reference manual.
- * @retval None
- */
-void HAL_COMPEx_DisableVREFINT(void)
-{
- /* Disable VrefInt voltage reference and buffer */
- SYSCFG->CFGR3 &= (uint32_t)~((uint32_t)(SYSCFG_CFGR3_ENBUFLP_VREFINT_COMP | SYSCFG_CFGR3_EN_VREFINT));
-}
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-#endif /* HAL_COMP_MODULE_ENABLED */
-
-/**
- * @}
- */
-#endif /* #if !defined (STM32L010xB) && !defined (STM32L010x8) && !defined (STM32L010x6) && !defined (STM32L010x4) */
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_cortex.c b/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_cortex.c
deleted file mode 100644
index 4d0d72b8a4..0000000000
--- a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_cortex.c
+++ /dev/null
@@ -1,415 +0,0 @@
-/**
- ******************************************************************************
- * @file stm32l0xx_hal_cortex.c
- * @author MCD Application Team
- * @brief CORTEX HAL module driver.
- * This file provides firmware functions to manage the following
- * functionalities of the CORTEX:
- * + Initialization and Configuration functions
- * + Peripheral Control functions
- *
- @verbatim
- ==============================================================================
- ##### How to use this driver #####
- ==============================================================================
- [..]
- *** How to configure Interrupts using CORTEX HAL driver ***
- ===========================================================
- [..]
- This section provides functions allowing to configure the NVIC interrupts (IRQ).
- The Cortex M0+ exceptions are managed by CMSIS functions.
- (#) Enable and Configure the priority of the selected IRQ Channels.
- The priority can be 0..3.
-
- -@- Lower priority values gives higher priority.
- -@- Priority Order:
- (#@) Lowest priority.
- (#@) Lowest hardware priority (IRQn position).
-
- (#) Configure the priority of the selected IRQ Channels using HAL_NVIC_SetPriority()
-
- (#) Enable the selected IRQ Channels using HAL_NVIC_EnableIRQ()
-
- [..]
- *** How to configure Systick using CORTEX HAL driver ***
- ========================================================
- [..]
- Setup SysTick Timer for time base.
-
- (+) The HAL_SYSTICK_Config()function calls the SysTick_Config() function which
- is a CMSIS function that:
- (++) Configures the SysTick Reload register with value passed as function parameter.
- (++) Configures the SysTick IRQ priority to the lowest value (0x03).
- (++) Resets the SysTick Counter register.
- (++) Configures the SysTick Counter clock source to be Core Clock Source (HCLK).
- (++) Enables the SysTick Interrupt.
- (++) Starts the SysTick Counter.
-
- (+) You can change the SysTick Clock source to be HCLK_Div8 by calling the function
- HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK_DIV8) just after the
- HAL_SYSTICK_Config() function call. The HAL_SYSTICK_CLKSourceConfig() function is defined
- inside the stm32l0xx_hal_cortex.c file.
-
- (+) You can change the SysTick IRQ priority by calling the
- HAL_NVIC_SetPriority(SysTick_IRQn,...) function just after the HAL_SYSTICK_Config() function
- call. The HAL_NVIC_SetPriority() call the NVIC_SetPriority() function which is a CMSIS function.
-
- (+) To adjust the SysTick time base, use the following formula:
-
- Reload Value = SysTick Counter Clock (Hz) x Desired Time base (s)
- (++) Reload Value is the parameter to be passed for HAL_SYSTICK_Config() function
- (++) Reload Value should not exceed 0xFFFFFF
-
- @endverbatim
- ******************************************************************************
- * @attention
- *
- *
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-#include "stm32l0xx_hal.h"
-
-/** @addtogroup STM32L0xx_HAL_Driver
- * @{
- */
-
-/** @defgroup CRCEx CRCEx
- * @brief CRC Extended HAL module driver
- * @{
- */
-
-#ifdef HAL_CRC_MODULE_ENABLED
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Exported functions --------------------------------------------------------*/
-
-/** @defgroup CRCEx_Exported_Functions CRC Extended Exported Functions
- * @{
- */
-
-/** @defgroup CRCEx_Exported_Functions_Group1 Extended Initialization/de-initialization functions
- * @brief Extended Initialization and Configuration functions.
- *
-@verbatim
- ===============================================================================
- ##### Extended configuration functions #####
- ===============================================================================
- [..] This section provides functions allowing to:
- (+) Configure the generating polynomial
- (+) Configure the input data inversion
- (+) Configure the output data inversion
-
-@endverbatim
- * @{
- */
-
-
-/**
- * @brief Initialize the CRC polynomial if different from default one.
- * @param hcrc CRC handle
- * @param Pol CRC generating polynomial (7, 8, 16 or 32-bit long).
- * This parameter is written in normal representation, e.g.
- * @arg for a polynomial of degree 7, X^7 + X^6 + X^5 + X^2 + 1 is written 0x65
- * @arg for a polynomial of degree 16, X^16 + X^12 + X^5 + 1 is written 0x1021
- * @param PolyLength CRC polynomial length.
- * This parameter can be one of the following values:
- * @arg @ref CRC_POLYLENGTH_7B 7-bit long CRC (generating polynomial of degree 7)
- * @arg @ref CRC_POLYLENGTH_8B 8-bit long CRC (generating polynomial of degree 8)
- * @arg @ref CRC_POLYLENGTH_16B 16-bit long CRC (generating polynomial of degree 16)
- * @arg @ref CRC_POLYLENGTH_32B 32-bit long CRC (generating polynomial of degree 32)
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_CRCEx_Polynomial_Set(CRC_HandleTypeDef *hcrc, uint32_t Pol, uint32_t PolyLength)
-{
- HAL_StatusTypeDef status = HAL_OK;
- uint32_t msb = 31U; /* polynomial degree is 32 at most, so msb is initialized to max value */
-
- /* Check the parameters */
- assert_param(IS_CRC_POL_LENGTH(PolyLength));
-
- /* check polynomial definition vs polynomial size:
- * polynomial length must be aligned with polynomial
- * definition. HAL_ERROR is reported if Pol degree is
- * larger than that indicated by PolyLength.
- * Look for MSB position: msb will contain the degree of
- * the second to the largest polynomial member. E.g., for
- * X^7 + X^6 + X^5 + X^2 + 1, msb = 6. */
- while ((msb-- > 0U) && ((Pol & ((uint32_t)(0x1U) << (msb & 0x1FU))) == 0U))
- {
- }
-
- switch (PolyLength)
- {
- case CRC_POLYLENGTH_7B:
- if (msb >= HAL_CRC_LENGTH_7B)
- {
- status = HAL_ERROR;
- }
- break;
- case CRC_POLYLENGTH_8B:
- if (msb >= HAL_CRC_LENGTH_8B)
- {
- status = HAL_ERROR;
- }
- break;
- case CRC_POLYLENGTH_16B:
- if (msb >= HAL_CRC_LENGTH_16B)
- {
- status = HAL_ERROR;
- }
- break;
-
- case CRC_POLYLENGTH_32B:
- /* no polynomial definition vs. polynomial length issue possible */
- break;
- default:
- status = HAL_ERROR;
- break;
- }
- if (status == HAL_OK)
- {
- /* set generating polynomial */
- WRITE_REG(hcrc->Instance->POL, Pol);
-
- /* set generating polynomial size */
- MODIFY_REG(hcrc->Instance->CR, CRC_CR_POLYSIZE, PolyLength);
- }
- /* Return function status */
- return status;
-}
-
-/**
- * @brief Set the Reverse Input data mode.
- * @param hcrc CRC handle
- * @param InputReverseMode Input Data inversion mode.
- * This parameter can be one of the following values:
- * @arg @ref CRC_INPUTDATA_INVERSION_NONE no change in bit order (default value)
- * @arg @ref CRC_INPUTDATA_INVERSION_BYTE Byte-wise bit reversal
- * @arg @ref CRC_INPUTDATA_INVERSION_HALFWORD HalfWord-wise bit reversal
- * @arg @ref CRC_INPUTDATA_INVERSION_WORD Word-wise bit reversal
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_CRCEx_Input_Data_Reverse(CRC_HandleTypeDef *hcrc, uint32_t InputReverseMode)
-{
- /* Check the parameters */
- assert_param(IS_CRC_INPUTDATA_INVERSION_MODE(InputReverseMode));
-
- /* Change CRC peripheral state */
- hcrc->State = HAL_CRC_STATE_BUSY;
-
- /* set input data inversion mode */
- MODIFY_REG(hcrc->Instance->CR, CRC_CR_REV_IN, InputReverseMode);
- /* Change CRC peripheral state */
- hcrc->State = HAL_CRC_STATE_READY;
-
- /* Return function status */
- return HAL_OK;
-}
-
-/**
- * @brief Set the Reverse Output data mode.
- * @param hcrc CRC handle
- * @param OutputReverseMode Output Data inversion mode.
- * This parameter can be one of the following values:
- * @arg @ref CRC_OUTPUTDATA_INVERSION_DISABLE no CRC inversion (default value)
- * @arg @ref CRC_OUTPUTDATA_INVERSION_ENABLE bit-level inversion (e.g. for a 8-bit CRC: 0xB5 becomes 0xAD)
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_CRCEx_Output_Data_Reverse(CRC_HandleTypeDef *hcrc, uint32_t OutputReverseMode)
-{
- /* Check the parameters */
- assert_param(IS_CRC_OUTPUTDATA_INVERSION_MODE(OutputReverseMode));
-
- /* Change CRC peripheral state */
- hcrc->State = HAL_CRC_STATE_BUSY;
-
- /* set output data inversion mode */
- MODIFY_REG(hcrc->Instance->CR, CRC_CR_REV_OUT, OutputReverseMode);
-
- /* Change CRC peripheral state */
- hcrc->State = HAL_CRC_STATE_READY;
-
- /* Return function status */
- return HAL_OK;
-}
-
-
-
-
-/**
- * @}
- */
-
-
-/**
- * @}
- */
-
-
-#endif /* HAL_CRC_MODULE_ENABLED */
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_cryp.c b/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_cryp.c
deleted file mode 100644
index b536844f7a..0000000000
--- a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_cryp.c
+++ /dev/null
@@ -1,2161 +0,0 @@
-/**
- ******************************************************************************
- * @file stm32l0xx_hal_cryp.c
- * @author MCD Application Team
- * @brief CRYP HAL module driver.
- *
- * This file provides firmware functions to manage the following
- * functionalities of the Cryptography (CRYP) peripheral:
- * + Initialization and de-initialization functions
- * + Processing functions by algorithm using polling mode
- * + Processing functions by algorithm using interrupt mode
- * + Processing functions by algorithm using DMA mode
- * + Peripheral State functions
- *
- @verbatim
- ==============================================================================
- ##### How to use this driver #####
- ==============================================================================
- [..]
- The CRYP HAL driver can be used as follows:
-
- (#)Initialize the CRYP low level resources by implementing the HAL_CRYP_MspInit():
- (##) Enable the CRYP interface clock using __HAL_RCC_AES_CLK_ENABLE()
- (##) In case of using interrupts (e.g. HAL_CRYP_AESECB_Encrypt_IT())
- (+) Configure the CRYP interrupt priority using HAL_NVIC_SetPriority()
- (+) Enable the CRYP IRQ handler using HAL_NVIC_EnableIRQ()
- (+) In CRYP IRQ handler, call HAL_CRYP_IRQHandler()
- (##) In case of using DMA to control data transfer (e.g. HAL_CRYP_AESECB_Encrypt_DMA())
- (+) Enable the DMA1 interface clock using
- (++) __HAL_RCC_DMA1_CLK_ENABLE()
- (+) Configure and enable two DMA Channels one for managing data transfer from
- memory to peripheral (input channel) and another channel for managing data
- transfer from peripheral to memory (output channel)
- (+) Associate the initialized DMA handle to the CRYP DMA handle
- using __HAL_LINKDMA()
- (+) Configure the priority and enable the NVIC for the transfer complete
- interrupt on the two DMA Streams. The output stream should have higher
- priority than the input stream.
- (++) HAL_NVIC_SetPriority()
- (++) HAL_NVIC_EnableIRQ()
-
- (#)Initialize the CRYP HAL using HAL_CRYP_Init(). This function configures mainly:
- (##) The data type: 1-bit, 8-bit, 16-bit and 32-bit
- (##) The encryption/decryption key.
- (##) The initialization vector (counter). It is not used ECB mode.
-
- (#)Three processing (encryption/decryption) functions are available:
- (##) Polling mode: encryption and decryption APIs are blocking functions
- i.e. they process the data and wait till the processing is finished
- e.g. HAL_CRYP_AESCBC_Encrypt()
- (##) Interrupt mode: encryption and decryption APIs are not blocking functions
- i.e. they process the data under interrupt
- e.g. HAL_CRYP_AESCBC_Encrypt_IT()
- (##) DMA mode: encryption and decryption APIs are not blocking functions
- i.e. the data transfer is ensured by DMA
- e.g. HAL_CRYP_AESCBC_Encrypt_DMA()
-
- (#)When the processing function is called for the first time after HAL_CRYP_Init()
- the CRYP peripheral is initialized and processes the buffer in input.
- At second call, the processing function performs an append of the already
- processed buffer.
- When a new data block is to be processed, call HAL_CRYP_Init() then the
- processing function.
-
- (#)Call HAL_CRYP_DeInit() to deinitialize the CRYP peripheral.
-
- @endverbatim
- ******************************************************************************
- * @attention
- *
- *
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- ******************************************************************************
- */
-
-#if defined (STM32L021xx) || defined (STM32L041xx) || defined (STM32L062xx) || defined (STM32L063xx) || defined (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx)
-/* Includes ------------------------------------------------------------------*/
-#include "stm32l0xx_hal.h"
-
-/** @addtogroup STM32L0xx_HAL_Driver
- * @{
- */
-#ifdef HAL_CRYP_MODULE_ENABLED
-
-
-/** @addtogroup CRYPEx
- * @brief CRYP HAL Extended module driver.
- * @{
- */
-
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/** @addtogroup CRYPEx_Exported_Functions
- * @{
- */
-
-
-/** @addtogroup CRYPEx_Exported_Functions_Group1
- * @brief Extended features functions.
- *
-@verbatim
- ===============================================================================
- ##### Extended features functions #####
- ===============================================================================
- [..] This section provides callback functions:
- (+) Computation completed.
-
-@endverbatim
- * @{
- */
-
-/**
- * @brief Computation completed callbacks.
- * @param hcryp pointer to a CRYP_HandleTypeDef structure that contains
- * the configuration information for CRYP module
- * @retval None
- */
-__weak void HAL_CRYPEx_ComputationCpltCallback(CRYP_HandleTypeDef *hcryp)
-{
- /* Prevent unused argument(s) compilation warning */
- UNUSED(hcryp);
-
- /* NOTE : This function Should not be modified, when the callback is needed,
- the HAL_CRYP_ComputationCpltCallback could be implemented in the user file
- */
-}
-
-/**
- * @}
- */
-
-
-/**
- * @}
- */
-/**
- * @}
- */
-
-#endif /* HAL_CRYP_MODULE_ENABLED */
-
-/**
- * @}
- */
-#endif /* STM32L021xx || STM32L041xx || STM32L062xx || STM32L063xx || STM32L081xx || STM32L082xx || STM32L083xx */
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
-
diff --git a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_dac.c b/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_dac.c
deleted file mode 100644
index abb9967ec9..0000000000
--- a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_dac.c
+++ /dev/null
@@ -1,1027 +0,0 @@
-/**
- ******************************************************************************
- * @file stm32l0xx_hal_dac.c
- * @author MCD Application Team
- * @brief DAC HAL module driver.
- * This file provides firmware functions to manage the following
- * functionalities of the Digital to Analog Converter (DAC) peripheral:
- * + Initialization and de-initialization functions
- * + IO operation functions
- * + Peripheral Control functions
- * + Peripheral State and Errors functions
- *
- *
- @verbatim
- ==============================================================================
- ##### DAC Peripheral features #####
- ==============================================================================
- [..]
- *** DAC Channels ***
- ====================
- [..]
- STM32L0 devices integrate one or two 12-bit Digital Analog Converters
- (i.e. one or 2 channel(s))
- 1 channel : STM32L05x STM32L06x devices
- 2 channels: STM32L07x STM32L08x devices
-
- When 2 channels are available, the 2 converters (i.e. channel1 & channel2)
- can be used independently or simultaneously (dual mode):
- (#) DAC channel1 with DAC_OUT1 (PA4) as output
- (#) DAC channel2 with DAC_OUT2 (PA5) as output (STM32L07x/STM32L08x only)
- (#) Channel1 & channel2 can be used independently or simultaneously in dual mode (STM32L07x/STM32L08x only)
-
- *** DAC Triggers ***
- ====================
- [..]
- Digital to Analog conversion can be non-triggered using DAC_TRIGGER_NONE
- and DAC_OUT1/DAC_OUT2 is available once writing to DHRx register.
- [..]
- Digital to Analog conversion can be triggered by:
- (#) External event: EXTI Line 9 (any GPIOx_PIN_9) using DAC_TRIGGER_EXT_IT9.
- The used pin (GPIOx_PIN_9) must be configured in input mode.
-
- (#) Timers TRGO:
- STM32L05x/STM32L06x : TIM2, TIM6 and TIM21
- STM32L07x/STM32L08x : TIM2, TIM3, TIM6, TIM7 and TIM21
- (DAC_TRIGGER_T2_TRGO, DAC_TRIGGER_T6_TRGO...)
-
- (#) Software using DAC_TRIGGER_SOFTWARE
-
- *** DAC Buffer mode feature ***
- ===============================
- [..]
- Each DAC channel integrates an output buffer that can be used to
- reduce the output impedance, and to drive external loads directly
- without having to add an external operational amplifier.
- To enable, the output buffer use
- sConfig.DAC_OutputBuffer = DAC_OUTPUTBUFFER_ENABLE;
- [..]
- (@) Refer to the device datasheet for more details about output
- impedance value with and without output buffer.
-
- *** DAC wave generation feature ***
- ===================================
- [..]
- Both DAC channels can be used to generate
- (#) Noise wave using HAL_DACEx_NoiseWaveGenerate()
- (#) Triangle wave using HAL_DACEx_TriangleWaveGenerate()
-
- *** DAC data format ***
- =======================
- [..]
- The DAC data format can be:
- (#) 8-bit right alignment using DAC_ALIGN_8B_R
- (#) 12-bit left alignment using DAC_ALIGN_12B_L
- (#) 12-bit right alignment using DAC_ALIGN_12B_R
-
- *** DAC data value to voltage correspondence ***
- ================================================
- [..]
- The analog output voltage on each DAC channel pin is determined
- by the following equation:
- [..]
- DAC_OUTx = VREF+ * DOR / 4095
- (+) with DOR is the Data Output Register
- [..]
- VEF+ is the input voltage reference (refer to the device datasheet)
- [..]
- e.g. To set DAC_OUT1 to 0.7V, use
- (+) Assuming that VREF+ = 3.3V, DAC_OUT1 = (3.3 * 868) / 4095 = 0.7V
-
- *** DMA requests ***
- =====================
- [..]
- A DMA1 request can be generated when an external trigger (but not a software trigger)
- occurs if DMA1 requests are enabled using HAL_DAC_Start_DMA().
- DMA1 requests are mapped as following:
- (#) DAC channel1 : mapped on DMA1 Request9 channel2 which must be
- already configured
- (#) DAC channel2 : mapped on DMA1 Request15 channel4 which must be
- already configured (STM32L07x/STM32L08x only)
-
- -@- For Dual mode (STM32L07x/STM32L08x only) and specific signal (Triangle and noise) generation please
- refer to Extension Features Driver description
-
-
- ##### How to use this driver #####
- ==============================================================================
- [..]
- (+) DAC APB clock must be enabled to get write access to DAC
- registers using HAL_DAC_Init()
- (+) Configure DAC_OUT1: PA4 in analog mode.
- (+) Configure DAC_OUT2: PA5 in analog mode (STM32L07x/STM32L08x only).
- (+) Configure the DAC channel using HAL_DAC_ConfigChannel() function.
- (+) Enable the DAC channel using HAL_DAC_Start() or HAL_DAC_Start_DMA functions
-
- *** Polling mode IO operation ***
- =================================
- [..]
- (+) Start the DAC peripheral using HAL_DAC_Start()
- (+) To read the DAC last data output value, use the HAL_DAC_GetValue() function.
- (+) Stop the DAC peripheral using HAL_DAC_Stop()
-
- *** DMA mode IO operation ***
- ==============================
- [..]
- (+) Start the DAC peripheral using HAL_DAC_Start_DMA(), at this stage the user specify the length
- of data to be transferred at each end of conversion
- (+) At the middle of data transfer HAL_DAC_ConvHalfCpltCallbackCh1()or HAL_DAC_ConvHalfCpltCallbackCh2()
- function is executed and user can add his own code by customization of function pointer
- HAL_DAC_ConvHalfCpltCallbackCh1 or HAL_DAC_ConvHalfCpltCallbackCh2
- (+) At The end of data transfer HAL_DAC_ConvCpltCallbackCh1()or HAL_DAC_ConvCpltCallbackCh2()
- function is executed and user can add his own code by customization of function pointer
- HAL_DAC_ConvCpltCallbackCh1 or HAL_DAC_ConvCpltCallbackCh2
- (+) In case of transfer Error, HAL_DAC_ErrorCallbackCh1() function is executed and user can
- add his own code by customization of function pointer HAL_DAC_ErrorCallbackCh1
- (+) In case of DMA underrun, DAC interruption triggers and execute internal function HAL_DAC_IRQHandler.
- HAL_DAC_DMAUnderrunCallbackCh1()or HAL_DAC_DMAUnderrunCallbackCh2()
- function is executed and user can add his own code by customization of function pointer
- HAL_DAC_DMAUnderrunCallbackCh1 or HAL_DAC_DMAUnderrunCallbackCh2
- add his own code by customization of function pointer HAL_DAC_ErrorCallbackCh1
- (+) Stop the DAC peripheral using HAL_DAC_Stop_DMA()
-
- *** Callback registration ***
- =============================================
- [..]
- The compilation define USE_HAL_DAC_REGISTER_CALLBACKS when set to 1
- allows the user to configure dynamically the driver callbacks.
-
- Use Functions HAL_DAC_RegisterCallback() to register a user callback,
- it allows to register following callbacks:
- (+) ConvCpltCallbackCh1 : callback when a half transfer is completed on Ch1.
- (+) ConvHalfCpltCallbackCh1 : callback when a transfer is completed on Ch1.
- (+) ErrorCallbackCh1 : callback when an error occurs on Ch1.
- (+) DMAUnderrunCallbackCh1 : callback when an underrun error occurs on Ch1.
- (+) ConvCpltCallbackCh2 : callback when a half transfer is completed on Ch2.
- (+) ConvHalfCpltCallbackCh2 : callback when a transfer is completed on Ch2.
- (+) ErrorCallbackCh2 : callback when an error occurs on Ch2.
- (+) DMAUnderrunCallbackCh2 : callback when an underrun error occurs on Ch2.
- (+) MspInitCallback : DAC MspInit.
- (+) MspDeInitCallback : DAC MspdeInit.
- This function takes as parameters the HAL peripheral handle, the Callback ID
- and a pointer to the user callback function.
-
- Use function HAL_DAC_UnRegisterCallback() to reset a callback to the default
- weak (surcharged) function. It allows to reset following callbacks:
- (+) ConvCpltCallbackCh1 : callback when a half transfer is completed on Ch1.
- (+) ConvHalfCpltCallbackCh1 : callback when a transfer is completed on Ch1.
- (+) ErrorCallbackCh1 : callback when an error occurs on Ch1.
- (+) DMAUnderrunCallbackCh1 : callback when an underrun error occurs on Ch1.
- (+) ConvCpltCallbackCh2 : callback when a half transfer is completed on Ch2.
- (+) ConvHalfCpltCallbackCh2 : callback when a transfer is completed on Ch2.
- (+) ErrorCallbackCh2 : callback when an error occurs on Ch2.
- (+) DMAUnderrunCallbackCh2 : callback when an underrun error occurs on Ch2.
- (+) MspInitCallback : DAC MspInit.
- (+) MspDeInitCallback : DAC MspdeInit.
- (+) All Callbacks
- This function) takes as parameters the HAL peripheral handle and the Callback ID.
-
- By default, after the HAL_DAC_Init and if the state is HAL_DAC_STATE_RESET
- all callbacks are reset to the corresponding legacy weak (surcharged) functions.
- Exception done for MspInit and MspDeInit callbacks that are respectively
- reset to the legacy weak (surcharged) functions in the HAL_DAC_Init
- and HAL_DAC_DeInit only when these callbacks are null (not registered beforehand).
- If not, MspInit or MspDeInit are not null, the HAL_DAC_Init and HAL_DAC_DeInit
- keep and use the user MspInit/MspDeInit callbacks (registered beforehand)
-
- Callbacks can be registered/unregistered in READY state only.
- Exception done for MspInit/MspDeInit callbacks that can be registered/unregistered
- in READY or RESET state, thus registered (user) MspInit/DeInit callbacks can be used
- during the Init/DeInit.
- In that case first register the MspInit/MspDeInit user callbacks
- using HAL_DAC_RegisterCallback before calling HAL_DAC_DeInit
- or HAL_DAC_Init function.
-
- When The compilation define USE_HAL_DAC_REGISTER_CALLBACKS is set to 0 or
- not defined, the callback registering feature is not available
- and weak (surcharged) callbacks are used.
-
- *** DAC HAL driver macros list ***
- =============================================
- [..]
- Below the list of most used macros in DAC HAL driver.
-
- (+) __HAL_DAC_ENABLE : Enable the DAC peripheral
- (+) __HAL_DAC_DISABLE : Disable the DAC peripheral
- (+) __HAL_DAC_CLEAR_FLAG: Clear the DAC's pending flags
- (+) __HAL_DAC_GET_FLAG: Get the selected DAC's flag status
-
- [..]
- (@) You can refer to the DAC HAL driver header file for more useful macros
-
- @endverbatim
- ******************************************************************************
- * @attention
- *
- *
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- ******************************************************************************
- */
-#if !defined (STM32L010xB) && !defined (STM32L010x8) && !defined (STM32L010x6) && !defined (STM32L010x4) && !defined (STM32L011xx) && !defined (STM32L021xx) && !defined (STM32L031xx) && !defined (STM32L041xx)
-
-/* Includes ------------------------------------------------------------------*/
-#include "stm32l0xx_hal.h"
-
-/** @addtogroup STM32L0xx_HAL_Driver
- * @{
- */
-
-#ifdef HAL_FIREWALL_MODULE_ENABLED
-
-/** @addtogroup FIREWALL
- * @brief HAL FIREWALL module driver
- * @{
- */
-
-
-
-/** @addtogroup FIREWALL_Exported_Functions
- * @{
- */
-
-/** @addtogroup FIREWALL_Exported_Functions_Group1
- * @brief Initialization and Configuration Functions
- *
-@verbatim
-===============================================================================
- ##### Initialization and Configuration functions #####
- ===============================================================================
- [..]
- This subsection provides the functions allowing to initialize the Firewall.
- Initialization is done by HAL_FIREWALL_Config():
-
- (+) Enable the Firewall clock thru __HAL_RCC_FIREWALL_CLK_ENABLE() macro.
-
- (+) Set the protected code segment address start and length.
-
- (+) Set the protected non-volatile and/or volatile data segments
- address starts and lengths if applicable.
-
- (+) Set the volatile data segment execution and sharing status.
-
- (+) Length must be set to 0 for an unprotected segment.
-
-@endverbatim
- * @{
- */
-
-/**
- * @brief Initialize the Firewall according to the FIREWALL_InitTypeDef structure parameters.
- * @param fw_init: Firewall initialization structure
- * @note The API returns HAL_ERROR if the Firewall is already enabled.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_FIREWALL_Config(FIREWALL_InitTypeDef * fw_init)
-{
- /* Check the Firewall initialization structure allocation */
- if(fw_init == NULL)
- {
- return HAL_ERROR;
- }
-
- /* Enable Firewall clock */
- __HAL_RCC_FIREWALL_CLK_ENABLE();
-
- /* Make sure that Firewall is not enabled already */
- if (__HAL_FIREWALL_IS_ENABLED() != RESET)
- {
- return HAL_ERROR;
- }
-
- /* Check Firewall configuration addresses and lengths when segment is protected */
- /* Code segment */
- if (fw_init->CodeSegmentLength != 0U)
- {
- assert_param(IS_FIREWALL_CODE_SEGMENT_ADDRESS(fw_init->CodeSegmentStartAddress));
- assert_param(IS_FIREWALL_CODE_SEGMENT_LENGTH(fw_init->CodeSegmentStartAddress, fw_init->CodeSegmentLength));
- /* Make sure that NonVDataSegmentLength is properly set to prevent code segment access */
- if (fw_init->NonVDataSegmentLength < 0x100)
- {
- return HAL_ERROR;
- }
- }
- /* Non volatile data segment */
- if (fw_init->NonVDataSegmentLength != 0U)
- {
- assert_param(IS_FIREWALL_NONVOLATILEDATA_SEGMENT_ADDRESS(fw_init->NonVDataSegmentStartAddress));
- assert_param(IS_FIREWALL_NONVOLATILEDATA_SEGMENT_LENGTH(fw_init->NonVDataSegmentStartAddress, fw_init->NonVDataSegmentLength));
- }
- /* Volatile data segment */
- if (fw_init->VDataSegmentLength != 0U)
- {
- assert_param(IS_FIREWALL_VOLATILEDATA_SEGMENT_ADDRESS(fw_init->VDataSegmentStartAddress));
- assert_param(IS_FIREWALL_VOLATILEDATA_SEGMENT_LENGTH(fw_init->VDataSegmentStartAddress, fw_init->VDataSegmentLength));
- }
-
- /* Check Firewall Configuration Register parameters */
- assert_param(IS_FIREWALL_VOLATILEDATA_EXECUTE(fw_init->VolatileDataExecution));
- assert_param(IS_FIREWALL_VOLATILEDATA_SHARE(fw_init->VolatileDataShared));
-
-
- /* Configuration */
-
- /* Protected code segment start address configuration */
- WRITE_REG(FIREWALL->CSSA, (FW_CSSA_ADD & fw_init->CodeSegmentStartAddress));
- /* Protected code segment length configuration */
- WRITE_REG(FIREWALL->CSL, (FW_CSL_LENG & fw_init->CodeSegmentLength));
-
- /* Protected non volatile data segment start address configuration */
- WRITE_REG(FIREWALL->NVDSSA, (FW_NVDSSA_ADD & fw_init->NonVDataSegmentStartAddress));
- /* Protected non volatile data segment length configuration */
- WRITE_REG(FIREWALL->NVDSL, (FW_NVDSL_LENG & fw_init->NonVDataSegmentLength));
-
- /* Protected volatile data segment start address configuration */
- WRITE_REG(FIREWALL->VDSSA, (FW_VDSSA_ADD & fw_init->VDataSegmentStartAddress));
- /* Protected volatile data segment length configuration */
- WRITE_REG(FIREWALL->VDSL, (FW_VDSL_LENG & fw_init->VDataSegmentLength));
-
- /* Set Firewall Configuration Register VDE and VDS bits
- (volatile data execution and shared configuration) */
- MODIFY_REG(FIREWALL->CR, FW_CR_VDS|FW_CR_VDE, fw_init->VolatileDataExecution|fw_init->VolatileDataShared);
-
- return HAL_OK;
-}
-
-/**
- * @brief Retrieve the Firewall configuration.
- * @param fw_config: Firewall configuration, type is same as initialization structure
- * @note This API can't be executed inside a code area protected by the Firewall
- * when the Firewall is enabled
- * @note If NVDSL register is different from 0, that is, if the non volatile data segment
- * is defined, this API can't be executed when the Firewall is enabled.
- * @note User should resort to __HAL_FIREWALL_GET_PREARM() macro to retrieve FPA bit status
- * @retval None
- */
-void HAL_FIREWALL_GetConfig(FIREWALL_InitTypeDef * fw_config)
-{
-
- /* Enable Firewall clock, in case no Firewall configuration has been carried
- out up to this point */
- __HAL_RCC_FIREWALL_CLK_ENABLE();
-
- /* Retrieve code segment protection setting */
- fw_config->CodeSegmentStartAddress = (READ_REG(FIREWALL->CSSA) & FW_CSSA_ADD);
- fw_config->CodeSegmentLength = (READ_REG(FIREWALL->CSL) & FW_CSL_LENG);
-
- /* Retrieve non volatile data segment protection setting */
- fw_config->NonVDataSegmentStartAddress = (READ_REG(FIREWALL->NVDSSA) & FW_NVDSSA_ADD);
- fw_config->NonVDataSegmentLength = (READ_REG(FIREWALL->NVDSL) & FW_NVDSL_LENG);
-
- /* Retrieve volatile data segment protection setting */
- fw_config->VDataSegmentStartAddress = (READ_REG(FIREWALL->VDSSA) & FW_VDSSA_ADD);
- fw_config->VDataSegmentLength = (READ_REG(FIREWALL->VDSL) & FW_VDSL_LENG);
-
- /* Retrieve volatile data execution setting */
- fw_config->VolatileDataExecution = (READ_REG(FIREWALL->CR) & FW_CR_VDE);
-
- /* Retrieve volatile data shared setting */
- fw_config->VolatileDataShared = (READ_REG(FIREWALL->CR) & FW_CR_VDS);
-
- return;
-}
-
-
-
-/**
- * @brief Enable FIREWALL.
- * @note Firewall is enabled in clearing FWDIS bit of SYSCFG CFGR1 register.
- * Once enabled, the Firewall cannot be disabled by software. Only a
- * system reset can set again FWDIS bit.
- * @retval None
- */
-void HAL_FIREWALL_EnableFirewall(void)
-{
- /* Clears FWDIS bit of SYSCFG CFGR1 register */
- CLEAR_BIT(SYSCFG->CFGR2, SYSCFG_CFGR2_FWDISEN);
-
-}
-
-/**
- * @brief Enable FIREWALL pre arm.
- * @note When FPA bit is set, any code executed outside the protected segment
- * will close the Firewall.
- * @note This API provides the same service as __HAL_FIREWALL_PREARM_ENABLE() macro
- * but can't be executed inside a code area protected by the Firewall.
- * @note When the Firewall is disabled, user can resort to HAL_FIREWALL_EnablePreArmFlag() API any time.
- * @note When the Firewall is enabled and NVDSL register is equal to 0 (that is,
- * when the non volatile data segment is not defined),
- * ** this API can be executed when the Firewall is closed
- * ** when the Firewall is opened, user should resort to
- * __HAL_FIREWALL_PREARM_ENABLE() macro instead
- * @note When the Firewall is enabled and NVDSL register is different from 0
- * (that is, when the non volatile data segment is defined)
- * ** FW_CR register can be accessed only when the Firewall is opened:
- * user should resort to __HAL_FIREWALL_PREARM_ENABLE() macro instead.
- * @retval None
- */
-void HAL_FIREWALL_EnablePreArmFlag(void)
-{
- /* Set FPA bit */
- SET_BIT(FIREWALL->CR, FW_CR_FPA);
-}
-
-
-/**
- * @brief Disable FIREWALL pre arm.
- * @note When FPA bit is reset, any code executed outside the protected segment
- * when the Firewall is opened will generate a system reset.
- * @note This API provides the same service as __HAL_FIREWALL_PREARM_DISABLE() macro
- * but can't be executed inside a code area protected by the Firewall.
- * @note When the Firewall is disabled, user can resort to HAL_FIREWALL_EnablePreArmFlag() API any time.
- * @note When the Firewall is enabled and NVDSL register is equal to 0 (that is,
- * when the non volatile data segment is not defined),
- * ** this API can be executed when the Firewall is closed
- * ** when the Firewall is opened, user should resort to
- * __HAL_FIREWALL_PREARM_DISABLE() macro instead
- * @note When the Firewall is enabled and NVDSL register is different from 0
- * (that is, when the non volatile data segment is defined)
- * ** FW_CR register can be accessed only when the Firewall is opened:
- * user should resort to __HAL_FIREWALL_PREARM_DISABLE() macro instead.
-
- * @retval None
- */
-void HAL_FIREWALL_DisablePreArmFlag(void)
-{
- /* Clear FPA bit */
- CLEAR_BIT(FIREWALL->CR, FW_CR_FPA);
-}
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-#endif /* HAL_FIREWALL_MODULE_ENABLED */
-
-/**
- * @}
- */
-
-#endif /* #if !defined (STM32L010xB) && !defined (STM32L010x8) && !defined (STM32L010x6) && !defined (STM32L010x4) && !defined (STM32L011xx) && !defined (STM32L021xx) && !defined (STM32L031xx) && !defined (STM32L041xx) */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_flash.c b/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_flash.c
deleted file mode 100644
index 346998a3d3..0000000000
--- a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_flash.c
+++ /dev/null
@@ -1,769 +0,0 @@
-/**
- ******************************************************************************
- * @file stm32l0xx_hal_flash.c
- * @author MCD Application Team
- * @brief FLASH HAL module driver.
- * This file provides firmware functions to manage the following
- * functionalities of the internal FLASH memory:
- * + Program operations functions
- * + Memory Control functions
- * + Peripheral State functions
- *
- @verbatim
- ==============================================================================
- ##### FLASH peripheral features #####
- ==============================================================================
- [..] The Flash memory interface manages CPU AHB I-Code and D-Code accesses
- to the Flash memory. It implements the erase and program Flash memory operations
- and the read and write protection mechanisms.
-
- [..] The Flash memory interface accelerates code execution with a system of instruction
- prefetch.
-
- [..] The FLASH main features are:
- (+) Flash memory read operations
- (+) Flash memory program/erase operations
- (+) Read / write protections
- (+) Prefetch on I-Code
- (+) Option Bytes programming
-
-
- ##### How to use this driver #####
- ==============================================================================
- [..]
- This driver provides functions and macros to configure and program the FLASH
- memory of all STM32L0xx devices.
-
- (#) FLASH Memory I/O Programming functions: this group includes all needed
- functions to erase and program the main memory:
- (++) Lock and Unlock the FLASH interface
- (++) Erase function: Erase page
- (++) Program functions: Fast Word and Half Page(should be
- executed from internal SRAM).
-
- (#) DATA EEPROM Programming functions: this group includes all
- needed functions to erase and program the DATA EEPROM memory:
- (++) Lock and Unlock the DATA EEPROM interface.
- (++) Erase function: Erase Byte, erase HalfWord, erase Word, erase
- Double Word (should be executed from internal SRAM).
- (++) Program functions: Fast Program Byte, Fast Program Half-Word,
- FastProgramWord, Program Byte, Program Half-Word,
- Program Word and Program Double-Word (should be executed
- from internal SRAM).
-
- (#) FLASH Option Bytes Programming functions: this group includes all needed
- functions to manage the Option Bytes:
- (++) Lock and Unlock the Option Bytes
- (++) Set/Reset the write protection
- (++) Set the Read protection Level
- (++) Program the user Option Bytes
- (++) Launch the Option Bytes loader
- (++) Set/Get the Read protection Level.
- (++) Set/Get the BOR level.
- (++) Get the Write protection.
- (++) Get the user option bytes.
-
- (#) Interrupts and flags management functions : this group
- includes all needed functions to:
- (++) Handle FLASH interrupts
- (++) Wait for last FLASH operation according to its status
- (++) Get error flag status
-
- (#) FLASH Interface configuration functions: this group includes
- the management of following features:
- (++) Enable/Disable the RUN PowerDown mode.
- (++) Enable/Disable the SLEEP PowerDown mode.
-
- (#) FLASH Peripheral State methods: this group includes
- the management of following features:
- (++) Wait for the FLASH operation
- (++) Get the specific FLASH error flag
-
- [..] In addition to these function, this driver includes a set of macros allowing
- to handle the following operations:
-
- (+) Set/Get the latency
- (+) Enable/Disable the prefetch buffer
- (+) Enable/Disable the preread buffer
- (+) Enable/Disable the Flash power-down
- (+) Enable/Disable the FLASH interrupts
- (+) Monitor the FLASH flags status
-
- ##### Programming operation functions #####
- ===============================================================================
- [..]
- This subsection provides a set of functions allowing to manage the FLASH
- program operations.
-
- [..] The FLASH Memory Programming functions, includes the following functions:
- (+) HAL_FLASH_Unlock(void);
- (+) HAL_FLASH_Lock(void);
- (+) HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint32_t Data)
- (+) HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint32_t Data)
-
- [..] Any operation of erase or program should follow these steps:
- (#) Call the HAL_FLASH_Unlock() function to enable the flash control register and
- program memory access.
- (#) Call the desired function to erase page or program data.
- (#) Call the HAL_FLASH_Lock() to disable the flash program memory access
- (recommended to protect the FLASH memory against possible unwanted operation).
-
- ##### Option Bytes Programming functions #####
- ==============================================================================
-
- [..] The FLASH_Option Bytes Programming_functions, includes the following functions:
- (+) HAL_FLASH_OB_Unlock(void);
- (+) HAL_FLASH_OB_Lock(void);
- (+) HAL_FLASH_OB_Launch(void);
- (+) HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit);
- (+) HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit);
-
- [..] Any operation of erase or program should follow these steps:
- (#) Call the HAL_FLASH_OB_Unlock() function to enable the Flash option control
- register access.
- (#) Call the following functions to program the desired option bytes.
- (++) HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit);
- (#) Once all needed option bytes to be programmed are correctly written, call the
- HAL_FLASH_OB_Launch(void) function to launch the Option Bytes programming process.
- (#) Call the HAL_FLASH_OB_Lock() to disable the Flash option control register access (recommended
- to protect the option Bytes against possible unwanted operations).
-
- [..] Proprietary code Read Out Protection (PcROP):
- (#) The PcROP sector is selected by using the same option bytes as the Write
- protection. As a result, these 2 options are exclusive each other.
- (#) To activate PCROP mode for Flash sectors(s), you need to follow the sequence below:
- (++) Use this function HAL_FLASHEx_AdvOBProgram with PCROPState = OB_PCROP_STATE_ENABLE.
-
- @endverbatim
- ******************************************************************************
- * @attention
- *
- *
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-#include "stm32l0xx_hal.h"
-
-/** @addtogroup STM32L0xx_HAL_Driver
- * @{
- */
-
-#ifdef HAL_FLASH_MODULE_ENABLED
-
-/** @addtogroup FLASH
- * @{
- */
-/** @addtogroup FLASH_Private_Variables
- * @{
- */
-extern FLASH_ProcessTypeDef pFlash;
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/** @defgroup FLASH_RAMFUNC FLASH_RAMFUNC
- * @brief FLASH functions executed from RAM
- * @{
- */
-
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/** @defgroup FLASH_RAMFUNC_Private_Functions FLASH RAM Private Functions
- * @{
- */
-
-static __RAM_FUNC HAL_StatusTypeDef FLASHRAM_WaitForLastOperation(uint32_t Timeout);
-static __RAM_FUNC HAL_StatusTypeDef FLASHRAM_SetErrorCode(void);
-
-/**
- * @}
- */
-
-/* Private functions ---------------------------------------------------------*/
-
-/** @defgroup FLASH_RAMFUNC_Exported_Functions FLASH RAM Exported Functions
- *
-@verbatim
- ===============================================================================
- ##### ramfunc functions #####
- ===============================================================================
- [..]
- This subsection provides a set of functions that should be executed from RAM
- transfers.
-
-@endverbatim
- * @{
- */
-
-/** @defgroup FLASH_RAMFUNC_Exported_Functions_Group1 Peripheral features functions
- * @{
- */
-
-/**
- * @brief Enable the power down mode during RUN mode.
- * @note This function can be used only when the user code is running from Internal SRAM.
- * @retval HAL status
- */
-__RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_EnableRunPowerDown(void)
-{
- /* Enable the Power Down in Run mode*/
- __HAL_FLASH_POWER_DOWN_ENABLE();
-
- return HAL_OK;
-}
-
-/**
- * @brief Disable the power down mode during RUN mode.
- * @note This function can be used only when the user code is running from Internal SRAM.
- * @retval HAL status
- */
-__RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_DisableRunPowerDown(void)
-{
- /* Disable the Power Down in Run mode*/
- __HAL_FLASH_POWER_DOWN_DISABLE();
-
- return HAL_OK;
-}
-
-/**
- * @}
- */
-
-/** @defgroup FLASH_RAMFUNC_Exported_Functions_Group2 Programming and erasing operation functions
- *
-@verbatim
-@endverbatim
- * @{
- */
-
-#if defined(FLASH_PECR_PARALLBANK)
-/**
- * @brief Erases a specified 2 pages in program memory in parallel.
- * @note This function can be used only for STM32L07xxx/STM32L08xxx devices.
- * To correctly run this function, the @ref HAL_FLASH_Unlock() function
- * must be called before.
- * Call the @ref HAL_FLASH_Lock() to disable the flash memory access
- * (recommended to protect the FLASH memory against possible unwanted operation).
- * @param Page_Address1: The page address in program memory to be erased in
- * the first Bank (BANK1). This parameter should be between FLASH_BASE
- * and FLASH_BANK1_END.
- * @param Page_Address2: The page address in program memory to be erased in
- * the second Bank (BANK2). This parameter should be between FLASH_BANK2_BASE
- * and FLASH_BANK2_END.
- * @note A Page is erased in the Program memory only if the address to load
- * is the start address of a page (multiple of @ref FLASH_PAGE_SIZE bytes).
- * @retval HAL status
- */
-__RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_EraseParallelPage(uint32_t Page_Address1, uint32_t Page_Address2)
-{
- HAL_StatusTypeDef status = HAL_OK;
-
- /* Wait for last operation to be completed */
- status = FLASHRAM_WaitForLastOperation(FLASH_TIMEOUT_VALUE);
-
- if(status == HAL_OK)
- {
- /* Proceed to erase the page */
- SET_BIT(FLASH->PECR, FLASH_PECR_PARALLBANK);
- SET_BIT(FLASH->PECR, FLASH_PECR_ERASE);
- SET_BIT(FLASH->PECR, FLASH_PECR_PROG);
-
- /* Write 00000000h to the first word of the first program page to erase */
- *(__IO uint32_t *)Page_Address1 = 0x00000000U;
- /* Write 00000000h to the first word of the second program page to erase */
- *(__IO uint32_t *)Page_Address2 = 0x00000000U;
-
- /* Wait for last operation to be completed */
- status = FLASHRAM_WaitForLastOperation(FLASH_TIMEOUT_VALUE);
-
- /* If the erase operation is completed, disable the ERASE, PROG and PARALLBANK bits */
- CLEAR_BIT(FLASH->PECR, FLASH_PECR_PROG);
- CLEAR_BIT(FLASH->PECR, FLASH_PECR_ERASE);
- CLEAR_BIT(FLASH->PECR, FLASH_PECR_PARALLBANK);
- }
- /* Return the Erase Status */
- return status;
-}
-
-/**
- * @brief Program 2 half pages in program memory in parallel (half page size is 16 Words).
- * @note This function can be used only for STM32L07xxx/STM32L08xxx devices.
- * @param Address1: specifies the first address to be written in the first bank
- * (BANK1). This parameter should be between FLASH_BASE and (FLASH_BANK1_END - FLASH_PAGE_SIZE).
- * @param pBuffer1: pointer to the buffer containing the data to be written
- * to the first half page in the first bank.
- * @param Address2: specifies the second address to be written in the second bank
- * (BANK2). This parameter should be between FLASH_BANK2_BASE and (FLASH_BANK2_END - FLASH_PAGE_SIZE).
- * @param pBuffer2: pointer to the buffer containing the data to be written
- * to the second half page in the second bank.
- * @note To correctly run this function, the @ref HAL_FLASH_Unlock() function
- * must be called before.
- * Call the @ref HAL_FLASH_Lock() to disable the flash memory access
- * (recommended to protect the FLASH memory against possible unwanted operation).
- * @note Half page write is possible only from SRAM.
- * @note A half page is written to the program memory only if the first
- * address to load is the start address of a half page (multiple of 64
- * bytes) and the 15 remaining words to load are in the same half page.
- * @note During the Program memory half page write all read operations are
- * forbidden (this includes DMA read operations and debugger read
- * operations such as breakpoints, periodic updates, etc.).
- * @note If a PGAERR is set during a Program memory half page write, the
- * complete write operation is aborted. Software should then reset the
- * FPRG and PROG/DATA bits and restart the write operation from the
- * beginning.
- * @retval HAL status
- */
-__RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_ProgramParallelHalfPage(uint32_t Address1, uint32_t* pBuffer1, uint32_t Address2, uint32_t* pBuffer2)
-{
- uint32_t count = 0U;
- HAL_StatusTypeDef status = HAL_OK;
-
- /* Wait for last operation to be completed */
- status = FLASHRAM_WaitForLastOperation(FLASH_TIMEOUT_VALUE);
-
- if(status == HAL_OK)
- {
- /* Proceed to program the new half page */
- SET_BIT(FLASH->PECR, FLASH_PECR_PARALLBANK);
- SET_BIT(FLASH->PECR, FLASH_PECR_FPRG);
- SET_BIT(FLASH->PECR, FLASH_PECR_PROG);
-
- /* Wait for last operation to be completed */
- status = FLASHRAM_WaitForLastOperation(FLASH_TIMEOUT_VALUE);
- if(status == HAL_OK)
- {
- /* Disable all IRQs */
- __disable_irq();
-
- /* Write the first half page directly with 16 different words */
- while(count < 16U)
- {
- /* Address1 doesn't need to be increased */
- *(__IO uint32_t*) Address1 = *pBuffer1;
- pBuffer1++;
- count ++;
- }
-
- /* Write the second half page directly with 16 different words */
- count = 0U;
- while(count < 16U)
- {
- /* Address2 doesn't need to be increased */
- *(__IO uint32_t*) Address2 = *pBuffer2;
- pBuffer2++;
- count ++;
- }
-
- /* Enable IRQs */
- __enable_irq();
-
- /* Wait for last operation to be completed */
- status = FLASHRAM_WaitForLastOperation(FLASH_TIMEOUT_VALUE);
- }
-
- /* if the write operation is completed, disable the PROG, FPRG and PARALLBANK bits */
- CLEAR_BIT(FLASH->PECR, FLASH_PECR_PROG);
- CLEAR_BIT(FLASH->PECR, FLASH_PECR_FPRG);
- CLEAR_BIT(FLASH->PECR, FLASH_PECR_PARALLBANK);
- }
-
- /* Return the Write Status */
- return status;
-}
-#endif /* FLASH_PECR_PARALLBANK */
-
-/**
- * @brief Program a half page in program memory.
- * @param Address specifies the address to be written.
- * @param pBuffer pointer to the buffer containing the data to be written to
- * the half page.
- * @note To correctly run this function, the @ref HAL_FLASH_Unlock() function
- * must be called before.
- * Call the @ref HAL_FLASH_Lock() to disable the flash memory access
- * (recommended to protect the FLASH memory against possible unwanted operation)
- * @note Half page write is possible only from SRAM.
- * @note A half page is written to the program memory only if the first
- * address to load is the start address of a half page (multiple of 64
- * bytes) and the 15 remaining words to load are in the same half page.
- * @note During the Program memory half page write all read operations are
- * forbidden (this includes DMA read operations and debugger read
- * operations such as breakpoints, periodic updates, etc.).
- * @note If a PGAERR is set during a Program memory half page write, the
- * complete write operation is aborted. Software should then reset the
- * FPRG and PROG/DATA bits and restart the write operation from the
- * beginning.
- * @retval HAL status
- */
-__RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_HalfPageProgram(uint32_t Address, uint32_t* pBuffer)
-{
- uint32_t count = 0U;
- HAL_StatusTypeDef status = HAL_OK;
-
- /* Wait for last operation to be completed */
- status = FLASHRAM_WaitForLastOperation(FLASH_TIMEOUT_VALUE);
-
- if(status == HAL_OK)
- {
- /* Proceed to program the new half page */
- SET_BIT(FLASH->PECR, FLASH_PECR_FPRG);
- SET_BIT(FLASH->PECR, FLASH_PECR_PROG);
-
- /* Disable all IRQs */
- __disable_irq();
-
- /* Write one half page directly with 16 different words */
- while(count < 16U)
- {
- /* Address doesn't need to be increased */
- *(__IO uint32_t*) Address = *pBuffer;
- pBuffer++;
- count ++;
- }
-
- /* Enable IRQs */
- __enable_irq();
-
- /* Wait for last operation to be completed */
- status = FLASHRAM_WaitForLastOperation(FLASH_TIMEOUT_VALUE);
-
- /* If the write operation is completed, disable the PROG and FPRG bits */
- CLEAR_BIT(FLASH->PECR, FLASH_PECR_PROG);
- CLEAR_BIT(FLASH->PECR, FLASH_PECR_FPRG);
- }
-
- /* Return the Write Status */
- return status;
-}
-
-/**
- * @}
- */
-
-/** @defgroup FLASH_RAMFUNC_Exported_Functions_Group3 Peripheral errors functions
- * @brief Peripheral errors functions
- *
-@verbatim
- ===============================================================================
- ##### Peripheral errors functions #####
- ===============================================================================
- [..]
- This subsection permit to get in run-time errors of the FLASH peripheral.
-
-@endverbatim
- * @{
- */
-
-/**
- * @brief Get the specific FLASH errors flag.
- * @param Error pointer is the error value. It can be a mixed of:
- * @arg @ref HAL_FLASH_ERROR_RD FLASH Read Protection error flag (PCROP)
- * @arg @ref HAL_FLASH_ERROR_SIZE FLASH Programming Parallelism error flag
- * @arg @ref HAL_FLASH_ERROR_PGA FLASH Programming Alignment error flag
- * @arg @ref HAL_FLASH_ERROR_WRP FLASH Write protected error flag
- * @arg @ref HAL_FLASH_ERROR_OPTV FLASH Option valid error flag
- * @arg @ref HAL_FLASH_ERROR_FWWERR FLASH Write or Erase operation aborted
- * @arg @ref HAL_FLASH_ERROR_NOTZERO FLASH Write operation is done in a not-erased region
- * @retval HAL Status
- */
-__RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_GetError(uint32_t * Error)
-{
- *Error = pFlash.ErrorCode;
- return HAL_OK;
-}
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/** @addtogroup FLASH_RAMFUNC_Private_Functions
- * @{
- */
-
-/**
- * @brief Set the specific FLASH error flag.
- * @retval HAL Status
- */
-static __RAM_FUNC HAL_StatusTypeDef FLASHRAM_SetErrorCode(void)
-{
- uint32_t flags = 0;
-
- if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_WRPERR))
- {
- pFlash.ErrorCode |= HAL_FLASH_ERROR_WRP;
- flags |= FLASH_FLAG_WRPERR;
- }
- if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_PGAERR))
- {
- pFlash.ErrorCode |= HAL_FLASH_ERROR_PGA;
- flags |= FLASH_FLAG_PGAERR;
- }
- if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_SIZERR))
- {
- pFlash.ErrorCode |= HAL_FLASH_ERROR_SIZE;
- flags |= FLASH_FLAG_SIZERR;
- }
- if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_OPTVERR))
- {
- /* WARNING : On the first cut of STM32L031xx and STM32L041xx devices,
- * (RefID = 0x1000) the FLASH_FLAG_OPTVERR bit was not behaving
- * as expected. If the user run an application using the first
- * cut of the STM32L031xx device or the first cut of the STM32L041xx
- * device, this error should be ignored. The revId of the device
- * can be retrieved via the HAL_GetREVID() function.
- *
- */
- pFlash.ErrorCode |= HAL_FLASH_ERROR_OPTV;
- flags |= FLASH_FLAG_OPTVERR;
- }
-
- if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_RDERR))
- {
- pFlash.ErrorCode |= HAL_FLASH_ERROR_RD;
- flags |= FLASH_FLAG_RDERR;
- }
- if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_FWWERR))
- {
- pFlash.ErrorCode |= HAL_FLASH_ERROR_FWWERR;
- flags |= HAL_FLASH_ERROR_FWWERR;
- }
- if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_NOTZEROERR))
- {
- pFlash.ErrorCode |= HAL_FLASH_ERROR_NOTZERO;
- flags |= FLASH_FLAG_NOTZEROERR;
- }
-
- /* Clear FLASH error pending bits */
- __HAL_FLASH_CLEAR_FLAG(flags);
-
- return HAL_OK;
-}
-
-/**
- * @brief Wait for a FLASH operation to complete.
- * @param Timeout maximum flash operationtimeout
- * @retval HAL status
- */
-static __RAM_FUNC HAL_StatusTypeDef FLASHRAM_WaitForLastOperation(uint32_t Timeout)
-{
- /* Wait for the FLASH operation to complete by polling on BUSY flag to be reset.
- Even if the FLASH operation fails, the BUSY flag will be reset and an error
- flag will be set */
-
- while(__HAL_FLASH_GET_FLAG(FLASH_FLAG_BSY) && (Timeout != 0x00U))
- {
- Timeout--;
- }
-
- if(Timeout == 0x00U)
- {
- return HAL_TIMEOUT;
- }
-
- /* Check FLASH End of Operation flag */
- if (__HAL_FLASH_GET_FLAG(FLASH_FLAG_EOP))
- {
- /* Clear FLASH End of Operation pending bit */
- __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP);
- }
-
- if( __HAL_FLASH_GET_FLAG(FLASH_FLAG_WRPERR) ||
- __HAL_FLASH_GET_FLAG(FLASH_FLAG_PGAERR) ||
- __HAL_FLASH_GET_FLAG(FLASH_FLAG_SIZERR) ||
- __HAL_FLASH_GET_FLAG(FLASH_FLAG_OPTVERR) ||
- __HAL_FLASH_GET_FLAG(FLASH_FLAG_RDERR) ||
- __HAL_FLASH_GET_FLAG(FLASH_FLAG_FWWERR) ||
- __HAL_FLASH_GET_FLAG(FLASH_FLAG_NOTZEROERR) )
- {
- /*Save the error code*/
-
- /* WARNING : On the first cut of STM32L031xx and STM32L041xx devices,
- * (RefID = 0x1000) the FLASH_FLAG_OPTVERR bit was not behaving
- * as expected. If the user run an application using the first
- * cut of the STM32L031xx device or the first cut of the STM32L041xx
- * device, this error should be ignored. The revId of the device
- * can be retrieved via the HAL_GetREVID() function.
- *
- */
- FLASHRAM_SetErrorCode();
- return HAL_ERROR;
- }
-
- /* There is no error flag set */
- return HAL_OK;
-}
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-#endif /* HAL_FLASH_MODULE_ENABLED */
-/**
- * @}
- */
-
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_gpio.c b/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_gpio.c
deleted file mode 100644
index f07472bbb7..0000000000
--- a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_gpio.c
+++ /dev/null
@@ -1,532 +0,0 @@
-/**
- ******************************************************************************
- * @file stm32l0xx_hal_gpio.c
- * @author MCD Application Team
- * @brief GPIO HAL module driver.
- * This file provides firmware functions to manage the following
- * functionalities of the General Purpose Input/Output (GPIO) peripheral:
- * + Initialization and de-initialization functions
- * + IO operation functions
- *
- @verbatim
- ==============================================================================
- ##### GPIO Peripheral features #####
- ==============================================================================
- [..]
- (+) Each port bit of the general-purpose I/O (GPIO) ports can be individually
- configured by software in several modes:
- (++) Input mode
- (++) Analog mode
- (++) Output mode
- (++) Alternate function mode
- (++) External interrupt/event lines
-
- (+) During and just after reset, the alternate functions and external interrupt
- lines are not active and the I/O ports are configured in input floating mode.
-
- (+) All GPIO pins have weak internal pull-up and pull-down resistors, which can be
- activated or not.
-
- (+) In Output or Alternate mode, each IO can be configured on open-drain or push-pull
- type and the IO speed can be selected depending on the VDD value.
-
- (+) The microcontroller IO pins are connected to onboard peripherals/modules through a
- multiplexer that allows only one peripheral alternate function (AF) connected
- to an IO pin at a time. In this way, there can be no conflict between peripherals
- sharing the same IO pin.
-
- (+) All ports have external interrupt/event capability. To use external interrupt
- lines, the port must be configured in input mode. All available GPIO pins are
- connected to the 16 external interrupt/event lines from EXTI0 to EXTI15.
-
- (+) The external interrupt/event controller consists of up to 28 edge detectors
- (16 lines are connected to GPIO) for generating event/interrupt requests (each
- input line can be independently configured to select the type (interrupt or event)
- and the corresponding trigger event (rising or falling or both). Each line can
- also be masked independently.
-
- ##### How to use this driver #####
- ==============================================================================
- [..]
- (#) Enable the GPIO IOPORT clock using the following function: __HAL_RCC_GPIOx_CLK_ENABLE().
-
- (#) Configure the GPIO pin(s) using HAL_GPIO_Init().
- (++) Configure the IO mode using "Mode" member from GPIO_InitTypeDef structure
- (++) Activate Pull-up, Pull-down resistor using "Pull" member from GPIO_InitTypeDef
- structure.
- (++) In case of Output or alternate function mode selection: the speed is
- configured through "Speed" member from GPIO_InitTypeDef structure.
- (++) In alternate mode is selection, the alternate function connected to the IO
- is configured through "Alternate" member from GPIO_InitTypeDef structure.
- (++) Analog mode is required when a pin is to be used as ADC channel
- or DAC output.
- (++) In case of external interrupt/event selection the "Mode" member from
- GPIO_InitTypeDef structure select the type (interrupt or event) and
- the corresponding trigger event (rising or falling or both).
-
- (#) In case of external interrupt/event mode selection, configure NVIC IRQ priority
- mapped to the EXTI line using HAL_NVIC_SetPriority() and enable it using
- HAL_NVIC_EnableIRQ().
-
- (#) HAL_GPIO_DeInit allows to set register values to their reset value. This function
- is also to be used when unconfiguring pin which was used as an external interrupt
- or in event mode. That is the only way to reset the corresponding bit in
- EXTI & SYSCFG registers.
-
- (#) To get the level of a pin configured in input mode use HAL_GPIO_ReadPin().
-
- (#) To set/reset the level of a pin configured in output mode use
- HAL_GPIO_WritePin()/HAL_GPIO_TogglePin().
-
- (#) To lock pin configuration until next reset use HAL_GPIO_LockPin().
-
- (#) During and just after reset, the alternate functions are not
- active and the GPIO pins are configured in input floating mode (except JTAG
- pins).
-
- (#) The LSE oscillator pins OSC32_IN and OSC32_OUT can be used as general purpose
- (PC14 and PC15, respectively) when the LSE oscillator is off. The LSE has
- priority over the GPIO function.
-
- (#) The HSE oscillator pins OSC_IN/OSC_OUT can be used as
- general purpose PH0 and PH1, respectively, when the HSE oscillator is off.
- The HSE has priority over the GPIO function.
-
- @endverbatim
- ******************************************************************************
- * @attention
- *
- *
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-#include "stm32l0xx_hal.h"
-
-/** @addtogroup STM32L0xx_HAL_Driver
- * @{
- */
-
-#ifdef HAL_GPIO_MODULE_ENABLED
-
-/** @addtogroup GPIO
- * @brief GPIO HAL module driver
- * @{
- */
-
-/* Private define ------------------------------------------------------------*/
-/** @addtogroup GPIO_Private
- * @{
- */
-#define GPIO_NUMBER (16U)
-/**
- * @}
- */
-/** @addtogroup GPIO_Exported_Functions
- * @{
- */
-
-/** @addtogroup GPIO_Exported_Functions_Group1
- * @brief Initialization and de-initialization functions
- *
-@verbatim
- ===============================================================================
- ##### Initialization and de-initialization functions #####
- ===============================================================================
-
-@endverbatim
- * @{
- */
-
-/**
- * @brief Initializes the GPIOx peripheral according to the specified parameters in the GPIO_Init.
- * @param GPIOx where x can be (A..E and H) to select the GPIO peripheral for STM32L0XX family devices.
- * Note that GPIOE is not available on all devices.
- * @param GPIO_Init pointer to a GPIO_InitTypeDef structure that contains
- * the configuration information for the specified GPIO peripheral.
- * @retval None
- */
-void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init)
-{
- uint32_t position = 0x00U;
- uint32_t iocurrent = 0x00U;
- uint32_t temp = 0x00U;
-
- /* Check the parameters */
- assert_param(IS_GPIO_MODE(GPIO_Init->Mode));
- assert_param(IS_GPIO_PIN_AVAILABLE(GPIOx, (GPIO_Init->Pin)));
-
- /* Configure the port pins */
- while (((GPIO_Init->Pin) >> position) != 0)
- {
- /* Get the IO position */
- iocurrent = (GPIO_Init->Pin) & (1U << position);
-
- if (iocurrent)
- {
- /*--------------------- GPIO Mode Configuration ------------------------*/
- /* In case of Output or Alternate function mode selection */
- if (((GPIO_Init->Mode & GPIO_MODE) == MODE_OUTPUT) ||
- ((GPIO_Init->Mode & GPIO_MODE) == MODE_AF))
- {
- /* Check the Speed parameter */
- assert_param(IS_GPIO_SPEED(GPIO_Init->Speed));
- /* Configure the IO Speed */
- temp = GPIOx->OSPEEDR;
- temp &= ~(GPIO_OSPEEDER_OSPEED0 << (position * 2U));
- temp |= (GPIO_Init->Speed << (position * 2U));
- GPIOx->OSPEEDR = temp;
-
- /* Configure the IO Output Type */
- temp = GPIOx->OTYPER;
- temp &= ~(GPIO_OTYPER_OT_0 << position) ;
- temp |= (((GPIO_Init->Mode & OUTPUT_TYPE) >> OUTPUT_TYPE_Pos) << position);
- GPIOx->OTYPER = temp;
- }
-
- if ((GPIO_Init->Mode & GPIO_MODE) != MODE_ANALOG)
- {
- /* Check the Pull parameter */
- assert_param(IS_GPIO_PULL(GPIO_Init->Pull));
-
- /* Activate the Pull-up or Pull down resistor for the current IO */
- temp = GPIOx->PUPDR;
- temp &= ~(GPIO_PUPDR_PUPD0 << (position * 2U));
- temp |= ((GPIO_Init->Pull) << (position * 2U));
- GPIOx->PUPDR = temp;
- }
-
- /* In case of Alternate function mode selection */
- if ((GPIO_Init->Mode & GPIO_MODE) == MODE_AF)
- {
- /* Check the Alternate function parameters */
- assert_param(IS_GPIO_AF_INSTANCE(GPIOx));
- assert_param(IS_GPIO_AF(GPIO_Init->Alternate));
-
- /* Configure Alternate function mapped with the current IO */
- temp = GPIOx->AFR[position >> 3U];
- temp &= ~(0xFUL << ((uint32_t)(position & 0x07UL) * 4U));
- temp |= ((uint32_t)(GPIO_Init->Alternate) << (((uint32_t)position & (uint32_t)0x07U) * 4U));
- GPIOx->AFR[position >> 3U] = temp;
- }
-
- /* Configure IO Direction mode (Input, Output, Alternate or Analog) */
- temp = GPIOx->MODER;
- temp &= ~(GPIO_MODER_MODE0 << (position * 2U));
- temp |= ((GPIO_Init->Mode & GPIO_MODE) << (position * 2U));
- GPIOx->MODER = temp;
-
- /*--------------------- EXTI Mode Configuration ------------------------*/
- /* Configure the External Interrupt or event for the current IO */
- if ((GPIO_Init->Mode & EXTI_MODE) != 0x00U)
- {
- /* Enable SYSCFG Clock */
- __HAL_RCC_SYSCFG_CLK_ENABLE();
-
- temp = SYSCFG->EXTICR[position >> 2U];
- CLEAR_BIT(temp, (0x0FUL) << (4U * (position & 0x03U)));
- SET_BIT(temp, (GPIO_GET_INDEX(GPIOx)) << (4 * (position & 0x03U)));
- SYSCFG->EXTICR[position >> 2U] = temp;
-
- /* Clear EXTI line configuration */
- temp = EXTI->IMR;
- temp &= ~((uint32_t)iocurrent);
- if ((GPIO_Init->Mode & EXTI_IT) != 0x00U)
- {
- temp |= iocurrent;
- }
- EXTI->IMR = temp;
-
- temp = EXTI->EMR;
- temp &= ~((uint32_t)iocurrent);
- if ((GPIO_Init->Mode & EXTI_EVT) != 0x00U)
- {
- temp |= iocurrent;
- }
- EXTI->EMR = temp;
-
- /* Clear Rising Falling edge configuration */
- temp = EXTI->RTSR;
- temp &= ~((uint32_t)iocurrent);
- if ((GPIO_Init->Mode & TRIGGER_RISING) != 0x00U)
- {
- temp |= iocurrent;
- }
- EXTI->RTSR = temp;
-
- temp = EXTI->FTSR;
- temp &= ~((uint32_t)iocurrent);
- if ((GPIO_Init->Mode & TRIGGER_FALLING) != 0x00U)
- {
- temp |= iocurrent;
- }
- EXTI->FTSR = temp;
- }
- }
- position++;
- }
-}
-
-/**
- * @brief De-initializes the GPIOx peripheral registers to their default reset values.
- * @param GPIOx where x can be (A..E and H) to select the GPIO peripheral for STM32L0XX family devices.
- * Note that GPIOE is not available on all devices.
- * @param GPIO_Pin specifies the port bit to be written.
- * This parameter can be one of GPIO_PIN_x where x can be (0..15).
- * All port bits are not necessarily available on all GPIOs.
- * @retval None
- */
-void HAL_GPIO_DeInit(GPIO_TypeDef *GPIOx, uint32_t GPIO_Pin)
-{
- uint32_t position = 0x00U;
- uint32_t iocurrent = 0x00U;
- uint32_t tmp = 0x00U;
-
- /* Check the parameters */
- assert_param(IS_GPIO_PIN_AVAILABLE(GPIOx, GPIO_Pin));
-
- /* Configure the port pins */
- while ((GPIO_Pin >> position) != 0)
- {
- /* Get the IO position */
- iocurrent = (GPIO_Pin) & (1U << position);
-
- if (iocurrent)
- {
- /*------------------------- EXTI Mode Configuration --------------------*/
- /* Clear the External Interrupt or Event for the current IO */
-
- tmp = SYSCFG->EXTICR[position >> 2U];
- tmp &= ((0x0FUL) << (4U * (position & 0x03U)));
- if (tmp == (GPIO_GET_INDEX(GPIOx) << (4U * (position & 0x03U))))
- {
- /* Clear EXTI line configuration */
- EXTI->IMR &= ~((uint32_t)iocurrent);
- EXTI->EMR &= ~((uint32_t)iocurrent);
-
- /* Clear Rising Falling edge configuration */
- EXTI->RTSR &= ~((uint32_t)iocurrent);
- EXTI->FTSR &= ~((uint32_t)iocurrent);
-
- tmp = (0x0FUL) << (4U * (position & 0x03U));
- SYSCFG->EXTICR[position >> 2U] &= ~tmp;
- }
-
- /*------------------------- GPIO Mode Configuration --------------------*/
- /* Configure IO Direction in Input Floting Mode */
- GPIOx->MODER |= (GPIO_MODER_MODE0 << (position * 2U));
-
- /* Configure the default Alternate Function in current IO */
- GPIOx->AFR[position >> 3U] &= ~(0xFUL << ((uint32_t)(position & 0x07UL) * 4U));
-
- /* Deactivate the Pull-up oand Pull-down resistor for the current IO */
- GPIOx->PUPDR &= ~(GPIO_PUPDR_PUPD0 << (position * 2U));
-
- /* Configure the default value IO Output Type */
- GPIOx->OTYPER &= ~(GPIO_OTYPER_OT_0 << position);
-
- /* Configure the default value for IO Speed */
- GPIOx->OSPEEDR &= ~(GPIO_OSPEEDER_OSPEED0 << (position * 2U));
- }
- position++;
- }
-}
-
-/**
- * @}
- */
-
-/** @addtogroup GPIO_Exported_Functions_Group2
- * @brief GPIO Read and Write
- *
-@verbatim
- ===============================================================================
- ##### IO operation functions #####
- ===============================================================================
-
-@endverbatim
- * @{
- */
-
-/**
- * @brief Reads the specified input port pin.
- * @param GPIOx where x can be (A..E and H) to select the GPIO peripheral for STM32L0xx family devices.
- * Note that GPIOE is not available on all devices.
- * @param GPIO_Pin specifies the port bit to read.
- * This parameter can be GPIO_PIN_x where x can be (0..15).
- * All port bits are not necessarily available on all GPIOs.
- * @retval The input port pin value.
- */
-GPIO_PinState HAL_GPIO_ReadPin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
-{
- GPIO_PinState bitstatus;
-
- /* Check the parameters */
- assert_param(IS_GPIO_PIN_AVAILABLE(GPIOx, GPIO_Pin));
-
- if ((GPIOx->IDR & GPIO_Pin) != (uint32_t)GPIO_PIN_RESET)
- {
- bitstatus = GPIO_PIN_SET;
- }
- else
- {
- bitstatus = GPIO_PIN_RESET;
- }
- return bitstatus;
-}
-
-/**
- * @brief Sets or clears the selected data port bit.
- *
- * @note This function uses GPIOx_BSRR register to allow atomic read/modify
- * accesses. In this way, there is no risk of an IRQ occurring between
- * the read and the modify access.
- *
- * @param GPIOx where x can be (A..E and H) to select the GPIO peripheral for STM32L0xx family devices.
- * Note that GPIOE is not available on all devices.
- * @param GPIO_Pin specifies the port bit to be written.
- * This parameter can be one of GPIO_PIN_x where x can be (0..15).
- * All port bits are not necessarily available on all GPIOs.
- * @param PinState specifies the value to be written to the selected bit.
- * This parameter can be one of the GPIO_PinState enum values:
- * GPIO_PIN_RESET: to clear the port pin
- * GPIO_PIN_SET: to set the port pin
- * @retval None
- */
-void HAL_GPIO_WritePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState)
-{
- /* Check the parameters */
- assert_param(IS_GPIO_PIN_AVAILABLE(GPIOx, GPIO_Pin));
- assert_param(IS_GPIO_PIN_ACTION(PinState));
-
- if (PinState != GPIO_PIN_RESET)
- {
- GPIOx->BSRR = GPIO_Pin;
- }
- else
- {
- GPIOx->BRR = GPIO_Pin ;
- }
-}
-
-/**
- * @brief Toggles the specified GPIO pins.
- * @param GPIOx Where x can be (A..E and H) to select the GPIO peripheral for STM32L0xx family devices.
- * Note that GPIOE is not available on all devices.
- * All port bits are not necessarily available on all GPIOs.
- * @param GPIO_Pin Specifies the pins to be toggled.
- * @retval None
- */
-void HAL_GPIO_TogglePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
-{
- uint32_t odr;
-
- /* Check the parameters */
- assert_param(IS_GPIO_PIN_AVAILABLE(GPIOx, GPIO_Pin));
-
- /* get current Ouput Data Register value */
- odr = GPIOx->ODR;
-
- /* Set selected pins that were at low level, and reset ones that were high */
- GPIOx->BSRR = ((odr & GPIO_Pin) << GPIO_NUMBER) | (~odr & GPIO_Pin);
-}
-
-/**
-* @brief Locks GPIO Pins configuration registers.
-* @note The locked registers are GPIOx_MODER, GPIOx_OTYPER, GPIOx_OSPEEDR,
-* GPIOx_PUPDR, GPIOx_AFRL and GPIOx_AFRH.
-* @note The configuration of the locked GPIO pins can no longer be modified
-* until the next reset.
-* @param GPIOx where x can be (A..E and H) to select the GPIO peripheral for STM32L0xx family.
-* Note that GPIOE is not available on all devices.
-* @param GPIO_Pin specifies the port bit to be locked.
-* This parameter can be any combination of GPIO_Pin_x where x can be (0..15).
-* All port bits are not necessarily available on all GPIOs.
-* @retval None
-*/
-HAL_StatusTypeDef HAL_GPIO_LockPin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
-{
- __IO uint32_t tmp = GPIO_LCKR_LCKK;
-
- /* Check the parameters */
- assert_param(IS_GPIO_PIN_AVAILABLE(GPIOx, GPIO_Pin));
-
- /* Apply lock key write sequence */
- tmp |= GPIO_Pin;
- /* Set LCKx bit(s): LCKK='1' + LCK[15-0] */
- GPIOx->LCKR = tmp;
- /* Reset LCKx bit(s): LCKK='0' + LCK[15-0] */
- GPIOx->LCKR = GPIO_Pin;
- /* Set LCKx bit(s): LCKK='1' + LCK[15-0] */
- GPIOx->LCKR = tmp;
- /* Read LCKK register. This read is mandatory to complete key lock sequence */
- tmp = GPIOx->LCKR;
-
- /* read again in order to confirm lock is active */
- if ((GPIOx->LCKR & GPIO_LCKR_LCKK) != RESET)
- {
- return HAL_OK;
- }
- else
- {
- return HAL_ERROR;
- }
-}
-/**
- * @brief This function handles EXTI interrupt request.
- * @param GPIO_Pin Specifies the pins connected to the EXTI line.
- * @retval None
- */
-void HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin)
-{
- /* EXTI line interrupt detected */
- if (__HAL_GPIO_EXTI_GET_IT(GPIO_Pin) != RESET)
- {
- __HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin);
- HAL_GPIO_EXTI_Callback(GPIO_Pin);
- }
-}
-
-/**
- * @brief EXTI line detection callbacks.
- * @param GPIO_Pin Specifies the pins connected to the EXTI line.
- * @retval None
- */
-__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,
- the HAL_GPIO_EXTI_Callback could be implemented in the user file
- */
-}
-
-/**
- * @}
- */
-
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-#endif /* HAL_GPIO_MODULE_ENABLED */
-
-/**
- * @}
- */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
-
diff --git a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_i2c.c b/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_i2c.c
deleted file mode 100644
index f644a74dfc..0000000000
--- a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_i2c.c
+++ /dev/null
@@ -1,6794 +0,0 @@
-/**
- ******************************************************************************
- * @file stm32l0xx_hal_i2c.c
- * @author MCD Application Team
- * @brief I2C HAL module driver.
- * This file provides firmware functions to manage the following
- * functionalities of the Inter Integrated Circuit (I2C) peripheral:
- * + Initialization and de-initialization functions
- * + IO operation functions
- * + Peripheral State and Errors functions
- *
- @verbatim
- ==============================================================================
- ##### How to use this driver #####
- ==============================================================================
- [..]
- The I2C HAL driver can be used as follows:
-
- (#) Declare a I2C_HandleTypeDef handle structure, for example:
- I2C_HandleTypeDef hi2c;
-
- (#)Initialize the I2C low level resources by implementing the HAL_I2C_MspInit() API:
- (##) Enable the I2Cx interface clock
- (##) I2C pins configuration
- (+++) Enable the clock for the I2C GPIOs
- (+++) Configure I2C pins as alternate function open-drain
- (##) NVIC configuration if you need to use interrupt process
- (+++) Configure the I2Cx interrupt priority
- (+++) Enable the NVIC I2C IRQ Channel
- (##) DMA Configuration if you need to use DMA process
- (+++) Declare a DMA_HandleTypeDef handle structure for
- the transmit or receive channel
- (+++) Enable the DMAx interface clock using
- (+++) Configure the DMA handle parameters
- (+++) Configure the DMA Tx or Rx channel
- (+++) Associate the initialized DMA handle to the hi2c DMA Tx or Rx handle
- (+++) Configure the priority and enable the NVIC for the transfer complete interrupt on
- the DMA Tx or Rx channel
-
- (#) Configure the Communication Clock Timing, Own Address1, Master Addressing mode, Dual Addressing mode,
- Own Address2, Own Address2 Mask, General call and Nostretch mode in the hi2c Init structure.
-
- (#) Initialize the I2C registers by calling the HAL_I2C_Init(), configures also the low level Hardware
- (GPIO, CLOCK, NVIC...etc) by calling the customized HAL_I2C_MspInit(&hi2c) API.
-
- (#) To check if target device is ready for communication, use the function HAL_I2C_IsDeviceReady()
-
- (#) For I2C IO and IO MEM operations, three operation modes are available within this driver :
-
- *** Polling mode IO operation ***
- =================================
- [..]
- (+) Transmit in master mode an amount of data in blocking mode using HAL_I2C_Master_Transmit()
- (+) Receive in master mode an amount of data in blocking mode using HAL_I2C_Master_Receive()
- (+) Transmit in slave mode an amount of data in blocking mode using HAL_I2C_Slave_Transmit()
- (+) Receive in slave mode an amount of data in blocking mode using HAL_I2C_Slave_Receive()
-
- *** Polling mode IO MEM operation ***
- =====================================
- [..]
- (+) Write an amount of data in blocking mode to a specific memory address using HAL_I2C_Mem_Write()
- (+) Read an amount of data in blocking mode from a specific memory address using HAL_I2C_Mem_Read()
-
-
- *** Interrupt mode IO operation ***
- ===================================
- [..]
- (+) Transmit in master mode an amount of data in non-blocking mode using HAL_I2C_Master_Transmit_IT()
- (+) At transmission end of transfer, HAL_I2C_MasterTxCpltCallback() is executed and users can
- add their own code by customization of function pointer HAL_I2C_MasterTxCpltCallback()
- (+) Receive in master mode an amount of data in non-blocking mode using HAL_I2C_Master_Receive_IT()
- (+) At reception end of transfer, HAL_I2C_MasterRxCpltCallback() is executed and users can
- add their own code by customization of function pointer HAL_I2C_MasterRxCpltCallback()
- (+) Transmit in slave mode an amount of data in non-blocking mode using HAL_I2C_Slave_Transmit_IT()
- (+) At transmission end of transfer, HAL_I2C_SlaveTxCpltCallback() is executed and users can
- add their own code by customization of function pointer HAL_I2C_SlaveTxCpltCallback()
- (+) Receive in slave mode an amount of data in non-blocking mode using HAL_I2C_Slave_Receive_IT()
- (+) At reception end of transfer, HAL_I2C_SlaveRxCpltCallback() is executed and users can
- add their own code by customization of function pointer HAL_I2C_SlaveRxCpltCallback()
- (+) In case of transfer Error, HAL_I2C_ErrorCallback() function is executed and users can
- add their own code by customization of function pointer HAL_I2C_ErrorCallback()
- (+) Abort a master I2C process communication with Interrupt using HAL_I2C_Master_Abort_IT()
- (+) End of abort process, HAL_I2C_AbortCpltCallback() is executed and users can
- add their own code by customization of function pointer HAL_I2C_AbortCpltCallback()
- (+) Discard a slave I2C process communication using __HAL_I2C_GENERATE_NACK() macro.
- This action will inform Master to generate a Stop condition to discard the communication.
-
-
- *** Interrupt mode or DMA mode IO sequential operation ***
- ==========================================================
- [..]
- (@) These interfaces allow to manage a sequential transfer with a repeated start condition
- when a direction change during transfer
- [..]
- (+) A specific option field manage the different steps of a sequential transfer
- (+) Option field values are defined through I2C_XFEROPTIONS and are listed below:
- (++) I2C_FIRST_AND_LAST_FRAME: No sequential usage, functional is same as associated interfaces in
- no sequential mode
- (++) I2C_FIRST_FRAME: Sequential usage, this option allow to manage a sequence with start condition, address
- and data to transfer without a final stop condition
- (++) I2C_FIRST_AND_NEXT_FRAME: Sequential usage (Master only), this option allow to manage a sequence with
- start condition, address and data to transfer without a final stop condition,
- an then permit a call the same master sequential interface several times
- (like HAL_I2C_Master_Seq_Transmit_IT() then HAL_I2C_Master_Seq_Transmit_IT()
- or HAL_I2C_Master_Seq_Transmit_DMA() then HAL_I2C_Master_Seq_Transmit_DMA())
- (++) I2C_NEXT_FRAME: Sequential usage, this option allow to manage a sequence with a restart condition, address
- and with new data to transfer if the direction change or manage only the new data to
- transfer
- if no direction change and without a final stop condition in both cases
- (++) I2C_LAST_FRAME: Sequential usage, this option allow to manage a sequance with a restart condition, address
- and with new data to transfer if the direction change or manage only the new data to
- transfer
- if no direction change and with a final stop condition in both cases
- (++) I2C_LAST_FRAME_NO_STOP: Sequential usage (Master only), this option allow to manage a restart condition
- after several call of the same master sequential interface several times
- (link with option I2C_FIRST_AND_NEXT_FRAME).
- Usage can, transfer several bytes one by one using
- HAL_I2C_Master_Seq_Transmit_IT
- or HAL_I2C_Master_Seq_Receive_IT
- or HAL_I2C_Master_Seq_Transmit_DMA
- or HAL_I2C_Master_Seq_Receive_DMA
- with option I2C_FIRST_AND_NEXT_FRAME then I2C_NEXT_FRAME.
- Then usage of this option I2C_LAST_FRAME_NO_STOP at the last Transmit or
- Receive sequence permit to call the opposite interface Receive or Transmit
- without stopping the communication and so generate a restart condition.
- (++) I2C_OTHER_FRAME: Sequential usage (Master only), this option allow to manage a restart condition after
- each call of the same master sequential
- interface.
- Usage can, transfer several bytes one by one with a restart with slave address between
- each bytes using
- HAL_I2C_Master_Seq_Transmit_IT
- or HAL_I2C_Master_Seq_Receive_IT
- or HAL_I2C_Master_Seq_Transmit_DMA
- or HAL_I2C_Master_Seq_Receive_DMA
- with option I2C_FIRST_FRAME then I2C_OTHER_FRAME.
- Then usage of this option I2C_OTHER_AND_LAST_FRAME at the last frame to help automatic
- generation of STOP condition.
-
- (+) Different sequential I2C interfaces are listed below:
- (++) Sequential transmit in master I2C mode an amount of data in non-blocking mode using
- HAL_I2C_Master_Seq_Transmit_IT() or using HAL_I2C_Master_Seq_Transmit_DMA()
- (+++) At transmission end of current frame transfer, HAL_I2C_MasterTxCpltCallback() is executed and
- users can add their own code by customization of function pointer HAL_I2C_MasterTxCpltCallback()
- (++) Sequential receive in master I2C mode an amount of data in non-blocking mode using
- HAL_I2C_Master_Seq_Receive_IT() or using HAL_I2C_Master_Seq_Receive_DMA()
- (+++) At reception end of current frame transfer, HAL_I2C_MasterRxCpltCallback() is executed and users can
- add their own code by customization of function pointer HAL_I2C_MasterRxCpltCallback()
- (++) Abort a master IT or DMA I2C process communication with Interrupt using HAL_I2C_Master_Abort_IT()
- (+++) End of abort process, HAL_I2C_AbortCpltCallback() is executed and users can
- add their own code by customization of function pointer HAL_I2C_AbortCpltCallback()
- (++) Enable/disable the Address listen mode in slave I2C mode using HAL_I2C_EnableListen_IT()
- HAL_I2C_DisableListen_IT()
- (+++) When address slave I2C match, HAL_I2C_AddrCallback() is executed and users can
- add their own code to check the Address Match Code and the transmission direction request by master
- (Write/Read).
- (+++) At Listen mode end HAL_I2C_ListenCpltCallback() is executed and users can
- add their own code by customization of function pointer HAL_I2C_ListenCpltCallback()
- (++) Sequential transmit in slave I2C mode an amount of data in non-blocking mode using
- HAL_I2C_Slave_Seq_Transmit_IT() or using HAL_I2C_Slave_Seq_Transmit_DMA()
- (+++) At transmission end of current frame transfer, HAL_I2C_SlaveTxCpltCallback() is executed and
- users can add their own code by customization of function pointer HAL_I2C_SlaveTxCpltCallback()
- (++) Sequential receive in slave I2C mode an amount of data in non-blocking mode using
- HAL_I2C_Slave_Seq_Receive_IT() or using HAL_I2C_Slave_Seq_Receive_DMA()
- (+++) At reception end of current frame transfer, HAL_I2C_SlaveRxCpltCallback() is executed and users can
- add their own code by customization of function pointer HAL_I2C_SlaveRxCpltCallback()
- (++) In case of transfer Error, HAL_I2C_ErrorCallback() function is executed and users can
- add their own code by customization of function pointer HAL_I2C_ErrorCallback()
- (++) Discard a slave I2C process communication using __HAL_I2C_GENERATE_NACK() macro.
- This action will inform Master to generate a Stop condition to discard the communication.
-
- *** Interrupt mode IO MEM operation ***
- =======================================
- [..]
- (+) Write an amount of data in non-blocking mode with Interrupt to a specific memory address using
- HAL_I2C_Mem_Write_IT()
- (+) At Memory end of write transfer, HAL_I2C_MemTxCpltCallback() is executed and users can
- add their own code by customization of function pointer HAL_I2C_MemTxCpltCallback()
- (+) Read an amount of data in non-blocking mode with Interrupt from a specific memory address using
- HAL_I2C_Mem_Read_IT()
- (+) At Memory end of read transfer, HAL_I2C_MemRxCpltCallback() is executed and users can
- add their own code by customization of function pointer HAL_I2C_MemRxCpltCallback()
- (+) In case of transfer Error, HAL_I2C_ErrorCallback() function is executed and users can
- add their own code by customization of function pointer HAL_I2C_ErrorCallback()
-
- *** DMA mode IO operation ***
- ==============================
- [..]
- (+) Transmit in master mode an amount of data in non-blocking mode (DMA) using
- HAL_I2C_Master_Transmit_DMA()
- (+) At transmission end of transfer, HAL_I2C_MasterTxCpltCallback() is executed and users can
- add their own code by customization of function pointer HAL_I2C_MasterTxCpltCallback()
- (+) Receive in master mode an amount of data in non-blocking mode (DMA) using
- HAL_I2C_Master_Receive_DMA()
- (+) At reception end of transfer, HAL_I2C_MasterRxCpltCallback() is executed and users can
- add their own code by customization of function pointer HAL_I2C_MasterRxCpltCallback()
- (+) Transmit in slave mode an amount of data in non-blocking mode (DMA) using
- HAL_I2C_Slave_Transmit_DMA()
- (+) At transmission end of transfer, HAL_I2C_SlaveTxCpltCallback() is executed and users can
- add their own code by customization of function pointer HAL_I2C_SlaveTxCpltCallback()
- (+) Receive in slave mode an amount of data in non-blocking mode (DMA) using
- HAL_I2C_Slave_Receive_DMA()
- (+) At reception end of transfer, HAL_I2C_SlaveRxCpltCallback() is executed and users can
- add their own code by customization of function pointer HAL_I2C_SlaveRxCpltCallback()
- (+) In case of transfer Error, HAL_I2C_ErrorCallback() function is executed and users can
- add their own code by customization of function pointer HAL_I2C_ErrorCallback()
- (+) Abort a master I2C process communication with Interrupt using HAL_I2C_Master_Abort_IT()
- (+) End of abort process, HAL_I2C_AbortCpltCallback() is executed and users can
- add their own code by customization of function pointer HAL_I2C_AbortCpltCallback()
- (+) Discard a slave I2C process communication using __HAL_I2C_GENERATE_NACK() macro.
- This action will inform Master to generate a Stop condition to discard the communication.
-
- *** DMA mode IO MEM operation ***
- =================================
- [..]
- (+) Write an amount of data in non-blocking mode with DMA to a specific memory address using
- HAL_I2C_Mem_Write_DMA()
- (+) At Memory end of write transfer, HAL_I2C_MemTxCpltCallback() is executed and users can
- add their own code by customization of function pointer HAL_I2C_MemTxCpltCallback()
- (+) Read an amount of data in non-blocking mode with DMA from a specific memory address using
- HAL_I2C_Mem_Read_DMA()
- (+) At Memory end of read transfer, HAL_I2C_MemRxCpltCallback() is executed and users can
- add their own code by customization of function pointer HAL_I2C_MemRxCpltCallback()
- (+) In case of transfer Error, HAL_I2C_ErrorCallback() function is executed and users can
- add their own code by customization of function pointer HAL_I2C_ErrorCallback()
-
-
- *** I2C HAL driver macros list ***
- ==================================
- [..]
- Below the list of most used macros in I2C HAL driver.
-
- (+) __HAL_I2C_ENABLE: Enable the I2C peripheral
- (+) __HAL_I2C_DISABLE: Disable the I2C peripheral
- (+) __HAL_I2C_GENERATE_NACK: Generate a Non-Acknowledge I2C peripheral in Slave mode
- (+) __HAL_I2C_GET_FLAG: Check whether the specified I2C flag is set or not
- (+) __HAL_I2C_CLEAR_FLAG: Clear the specified I2C pending flag
- (+) __HAL_I2C_ENABLE_IT: Enable the specified I2C interrupt
- (+) __HAL_I2C_DISABLE_IT: Disable the specified I2C interrupt
-
- *** Callback registration ***
- =============================================
- [..]
- The compilation flag USE_HAL_I2C_REGISTER_CALLBACKS when set to 1
- allows the user to configure dynamically the driver callbacks.
- Use Functions HAL_I2C_RegisterCallback() or HAL_I2C_RegisterAddrCallback()
- to register an interrupt callback.
- [..]
- Function HAL_I2C_RegisterCallback() allows to register following callbacks:
- (+) MasterTxCpltCallback : callback for Master transmission end of transfer.
- (+) MasterRxCpltCallback : callback for Master reception end of transfer.
- (+) SlaveTxCpltCallback : callback for Slave transmission end of transfer.
- (+) SlaveRxCpltCallback : callback for Slave reception end of transfer.
- (+) ListenCpltCallback : callback for end of listen mode.
- (+) MemTxCpltCallback : callback for Memory transmission end of transfer.
- (+) MemRxCpltCallback : callback for Memory reception end of transfer.
- (+) ErrorCallback : callback for error detection.
- (+) AbortCpltCallback : callback for abort completion process.
- (+) MspInitCallback : callback for Msp Init.
- (+) MspDeInitCallback : callback for Msp DeInit.
- This function takes as parameters the HAL peripheral handle, the Callback ID
- and a pointer to the user callback function.
- [..]
- For specific callback AddrCallback use dedicated register callbacks : HAL_I2C_RegisterAddrCallback().
- [..]
- Use function HAL_I2C_UnRegisterCallback to reset a callback to the default
- weak function.
- HAL_I2C_UnRegisterCallback takes as parameters the HAL peripheral handle,
- and the Callback ID.
- This function allows to reset following callbacks:
- (+) MasterTxCpltCallback : callback for Master transmission end of transfer.
- (+) MasterRxCpltCallback : callback for Master reception end of transfer.
- (+) SlaveTxCpltCallback : callback for Slave transmission end of transfer.
- (+) SlaveRxCpltCallback : callback for Slave reception end of transfer.
- (+) ListenCpltCallback : callback for end of listen mode.
- (+) MemTxCpltCallback : callback for Memory transmission end of transfer.
- (+) MemRxCpltCallback : callback for Memory reception end of transfer.
- (+) ErrorCallback : callback for error detection.
- (+) AbortCpltCallback : callback for abort completion process.
- (+) MspInitCallback : callback for Msp Init.
- (+) MspDeInitCallback : callback for Msp DeInit.
- [..]
- For callback AddrCallback use dedicated register callbacks : HAL_I2C_UnRegisterAddrCallback().
- [..]
- By default, after the HAL_I2C_Init() and when the state is HAL_I2C_STATE_RESET
- all callbacks are set to the corresponding weak functions:
- examples HAL_I2C_MasterTxCpltCallback(), HAL_I2C_MasterRxCpltCallback().
- Exception done for MspInit and MspDeInit functions that are
- reset to the legacy weak functions in the HAL_I2C_Init()/ HAL_I2C_DeInit() only when
- these callbacks are null (not registered beforehand).
- If MspInit or MspDeInit are not null, the HAL_I2C_Init()/ HAL_I2C_DeInit()
- keep and use the user MspInit/MspDeInit callbacks (registered beforehand) whatever the state.
- [..]
- Callbacks can be registered/unregistered in HAL_I2C_STATE_READY state only.
- Exception done MspInit/MspDeInit functions that can be registered/unregistered
- in HAL_I2C_STATE_READY or HAL_I2C_STATE_RESET state,
- thus registered (user) MspInit/DeInit callbacks can be used during the Init/DeInit.
- Then, the user first registers the MspInit/MspDeInit user callbacks
- using HAL_I2C_RegisterCallback() before calling HAL_I2C_DeInit()
- or HAL_I2C_Init() function.
- [..]
- When the compilation flag USE_HAL_I2C_REGISTER_CALLBACKS is set to 0 or
- not defined, the callback registration feature is not available and all callbacks
- are set to the corresponding weak functions.
-
- [..]
- (@) You can refer to the I2C HAL driver header file for more useful macros
-
- @endverbatim
- ******************************************************************************
- * @attention
- *
- *
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-#include "stm32l0xx_hal.h"
-
-/** @addtogroup STM32L0xx_HAL_Driver
- * @{
- */
-
-/** @defgroup I2CEx I2CEx
- * @brief I2C Extended HAL module driver
- * @{
- */
-
-#ifdef HAL_I2C_MODULE_ENABLED
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/** @defgroup I2CEx_Exported_Functions I2C Extended Exported Functions
- * @{
- */
-
-/** @defgroup I2CEx_Exported_Functions_Group1 Filter Mode Functions
- * @brief Filter Mode Functions
- *
-@verbatim
- ===============================================================================
- ##### Filter Mode Functions #####
- ===============================================================================
- [..] This section provides functions allowing to:
- (+) Configure Noise Filters
-
-@endverbatim
- * @{
- */
-
-/**
- * @brief Configure I2C Analog noise filter.
- * @param hi2c Pointer to a I2C_HandleTypeDef structure that contains
- * the configuration information for the specified I2Cx peripheral.
- * @param AnalogFilter New state of the Analog filter.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_I2CEx_ConfigAnalogFilter(I2C_HandleTypeDef *hi2c, uint32_t AnalogFilter)
-{
- /* Check the parameters */
- assert_param(IS_I2C_ALL_INSTANCE(hi2c->Instance));
- assert_param(IS_I2C_ANALOG_FILTER(AnalogFilter));
-
- if (hi2c->State == HAL_I2C_STATE_READY)
- {
- /* Process Locked */
- __HAL_LOCK(hi2c);
-
- hi2c->State = HAL_I2C_STATE_BUSY;
-
- /* Disable the selected I2C peripheral */
- __HAL_I2C_DISABLE(hi2c);
-
- /* Reset I2Cx ANOFF bit */
- hi2c->Instance->CR1 &= ~(I2C_CR1_ANFOFF);
-
- /* Set analog filter bit*/
- hi2c->Instance->CR1 |= AnalogFilter;
-
- __HAL_I2C_ENABLE(hi2c);
-
- hi2c->State = HAL_I2C_STATE_READY;
-
- /* Process Unlocked */
- __HAL_UNLOCK(hi2c);
-
- return HAL_OK;
- }
- else
- {
- return HAL_BUSY;
- }
-}
-
-/**
- * @brief Configure I2C Digital noise filter.
- * @param hi2c Pointer to a I2C_HandleTypeDef structure that contains
- * the configuration information for the specified I2Cx peripheral.
- * @param DigitalFilter Coefficient of digital noise filter between Min_Data=0x00 and Max_Data=0x0F.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_I2CEx_ConfigDigitalFilter(I2C_HandleTypeDef *hi2c, uint32_t DigitalFilter)
-{
- uint32_t tmpreg;
-
- /* Check the parameters */
- assert_param(IS_I2C_ALL_INSTANCE(hi2c->Instance));
- assert_param(IS_I2C_DIGITAL_FILTER(DigitalFilter));
-
- if (hi2c->State == HAL_I2C_STATE_READY)
- {
- /* Process Locked */
- __HAL_LOCK(hi2c);
-
- hi2c->State = HAL_I2C_STATE_BUSY;
-
- /* Disable the selected I2C peripheral */
- __HAL_I2C_DISABLE(hi2c);
-
- /* Get the old register value */
- tmpreg = hi2c->Instance->CR1;
-
- /* Reset I2Cx DNF bits [11:8] */
- tmpreg &= ~(I2C_CR1_DNF);
-
- /* Set I2Cx DNF coefficient */
- tmpreg |= DigitalFilter << 8U;
-
- /* Store the new register value */
- hi2c->Instance->CR1 = tmpreg;
-
- __HAL_I2C_ENABLE(hi2c);
-
- hi2c->State = HAL_I2C_STATE_READY;
-
- /* Process Unlocked */
- __HAL_UNLOCK(hi2c);
-
- return HAL_OK;
- }
- else
- {
- return HAL_BUSY;
- }
-}
-/**
- * @}
- */
-
-/** @defgroup I2CEx_Exported_Functions_Group2 WakeUp Mode Functions
- * @brief WakeUp Mode Functions
- *
-@verbatim
- ===============================================================================
- ##### WakeUp Mode Functions #####
- ===============================================================================
- [..] This section provides functions allowing to:
- (+) Configure Wake Up Feature
-
-@endverbatim
- * @{
- */
-
-/**
- * @brief Enable I2C wakeup from Stop mode(s).
- * @param hi2c Pointer to a I2C_HandleTypeDef structure that contains
- * the configuration information for the specified I2Cx peripheral.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_I2CEx_EnableWakeUp(I2C_HandleTypeDef *hi2c)
-{
- /* Check the parameters */
- assert_param(IS_I2C_WAKEUP_FROMSTOP_INSTANCE(hi2c->Instance));
-
- if (hi2c->State == HAL_I2C_STATE_READY)
- {
- /* Process Locked */
- __HAL_LOCK(hi2c);
-
- hi2c->State = HAL_I2C_STATE_BUSY;
-
- /* Disable the selected I2C peripheral */
- __HAL_I2C_DISABLE(hi2c);
-
- /* Enable wakeup from stop mode */
- hi2c->Instance->CR1 |= I2C_CR1_WUPEN;
-
- __HAL_I2C_ENABLE(hi2c);
-
- hi2c->State = HAL_I2C_STATE_READY;
-
- /* Process Unlocked */
- __HAL_UNLOCK(hi2c);
-
- return HAL_OK;
- }
- else
- {
- return HAL_BUSY;
- }
-}
-
-/**
- * @brief Disable I2C wakeup from Stop mode(s).
- * @param hi2c Pointer to a I2C_HandleTypeDef structure that contains
- * the configuration information for the specified I2Cx peripheral.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_I2CEx_DisableWakeUp(I2C_HandleTypeDef *hi2c)
-{
- /* Check the parameters */
- assert_param(IS_I2C_WAKEUP_FROMSTOP_INSTANCE(hi2c->Instance));
-
- if (hi2c->State == HAL_I2C_STATE_READY)
- {
- /* Process Locked */
- __HAL_LOCK(hi2c);
-
- hi2c->State = HAL_I2C_STATE_BUSY;
-
- /* Disable the selected I2C peripheral */
- __HAL_I2C_DISABLE(hi2c);
-
- /* Enable wakeup from stop mode */
- hi2c->Instance->CR1 &= ~(I2C_CR1_WUPEN);
-
- __HAL_I2C_ENABLE(hi2c);
-
- hi2c->State = HAL_I2C_STATE_READY;
-
- /* Process Unlocked */
- __HAL_UNLOCK(hi2c);
-
- return HAL_OK;
- }
- else
- {
- return HAL_BUSY;
- }
-}
-/**
- * @}
- */
-#if (defined(SYSCFG_CFGR2_I2C_PB6_FMP) || defined(SYSCFG_CFGR2_I2C_PB7_FMP)) || (defined(SYSCFG_CFGR2_I2C_PB8_FMP) || defined(SYSCFG_CFGR2_I2C_PB9_FMP)) || (defined(SYSCFG_CFGR2_I2C1_FMP)) || defined(SYSCFG_CFGR2_I2C2_FMP) || defined(SYSCFG_CFGR2_I2C3_FMP)
-
-/** @defgroup I2CEx_Exported_Functions_Group3 Fast Mode Plus Functions
- * @brief Fast Mode Plus Functions
- *
-@verbatim
- ===============================================================================
- ##### Fast Mode Plus Functions #####
- ===============================================================================
- [..] This section provides functions allowing to:
- (+) Configure Fast Mode Plus
-
-@endverbatim
- * @{
- */
-
-/**
- * @brief Enable the I2C fast mode plus driving capability.
- * @param ConfigFastModePlus Selects the pin.
- * This parameter can be one of the @ref I2CEx_FastModePlus values
- * @note For I2C1, fast mode plus driving capability can be enabled on all selected
- * I2C1 pins using I2C_FASTMODEPLUS_I2C1 parameter or independently
- * on each one of the following pins PB6, PB7, PB8 and PB9.
- * @note For remaining I2C1 pins (PA14, PA15...) fast mode plus driving capability
- * can be enabled only by using I2C_FASTMODEPLUS_I2C1 parameter.
- * @note For all I2C2 pins fast mode plus driving capability can be enabled
- * only by using I2C_FASTMODEPLUS_I2C2 parameter.
- * @note For all I2C3 pins fast mode plus driving capability can be enabled
- * only by using I2C_FASTMODEPLUS_I2C3 parameter.
- * @retval None
- */
-void HAL_I2CEx_EnableFastModePlus(uint32_t ConfigFastModePlus)
-{
- /* Check the parameter */
- assert_param(IS_I2C_FASTMODEPLUS(ConfigFastModePlus));
-
- /* Enable SYSCFG clock */
- __HAL_RCC_SYSCFG_CLK_ENABLE();
-
- /* Enable fast mode plus driving capability for selected pin */
- SET_BIT(SYSCFG->CFGR2, (uint32_t)ConfigFastModePlus);
-}
-
-/**
- * @brief Disable the I2C fast mode plus driving capability.
- * @param ConfigFastModePlus Selects the pin.
- * This parameter can be one of the @ref I2CEx_FastModePlus values
- * @note For I2C1, fast mode plus driving capability can be disabled on all selected
- * I2C1 pins using I2C_FASTMODEPLUS_I2C1 parameter or independently
- * on each one of the following pins PB6, PB7, PB8 and PB9.
- * @note For remaining I2C1 pins (PA14, PA15...) fast mode plus driving capability
- * can be disabled only by using I2C_FASTMODEPLUS_I2C1 parameter.
- * @note For all I2C2 pins fast mode plus driving capability can be disabled
- * only by using I2C_FASTMODEPLUS_I2C2 parameter.
- * @note For all I2C3 pins fast mode plus driving capability can be disabled
- * only by using I2C_FASTMODEPLUS_I2C3 parameter.
- * @retval None
- */
-void HAL_I2CEx_DisableFastModePlus(uint32_t ConfigFastModePlus)
-{
- /* Check the parameter */
- assert_param(IS_I2C_FASTMODEPLUS(ConfigFastModePlus));
-
- /* Enable SYSCFG clock */
- __HAL_RCC_SYSCFG_CLK_ENABLE();
-
- /* Disable fast mode plus driving capability for selected pin */
- CLEAR_BIT(SYSCFG->CFGR2, (uint32_t)ConfigFastModePlus);
-}
-/**
- * @}
- */
-#endif /* Fast Mode Plus Availability */
-/**
- * @}
- */
-
-#endif /* HAL_I2C_MODULE_ENABLED */
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_i2s.c b/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_i2s.c
deleted file mode 100644
index 39cad530dd..0000000000
--- a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_i2s.c
+++ /dev/null
@@ -1,1861 +0,0 @@
-/**
- ******************************************************************************
- * @file stm32l0xx_hal_i2s.c
- * @author MCD Application Team
- * @brief I2S HAL module driver.
- * This file provides firmware functions to manage the following
- * functionalities of the Integrated Interchip Sound (I2S) peripheral:
- * + Initialization and de-initialization functions
- * + IO operation functions
- * + Peripheral State and Errors functions
- @verbatim
- ===============================================================================
- ##### How to use this driver #####
- ===============================================================================
- [..]
- The I2S HAL driver can be used as follow:
-
- (#) Declare a I2S_HandleTypeDef handle structure.
- (#) Initialize the I2S low level resources by implement the HAL_I2S_MspInit() API:
- (##) Enable the SPIx interface clock.
- (##) I2S pins configuration:
- (+++) Enable the clock for the I2S GPIOs.
- (+++) Configure these I2S pins as alternate function pull-up.
- (##) NVIC configuration if you need to use interrupt process (HAL_I2S_Transmit_IT()
- and HAL_I2S_Receive_IT() APIs).
- (+++) Configure the I2Sx interrupt priority.
- (+++) Enable the NVIC I2S IRQ handle.
- (##) DMA Configuration if you need to use DMA process (HAL_I2S_Transmit_DMA()
- and HAL_I2S_Receive_DMA() APIs:
- (+++) Declare a DMA handle structure for the Tx/Rx Stream/Channel.
- (+++) Enable the DMAx interface clock.
- (+++) Configure the declared DMA handle structure with the required Tx/Rx parameters.
- (+++) Configure the DMA Tx/Rx Stream/Channel.
- (+++) Associate the initialized DMA handle to the I2S DMA Tx/Rx handle.
- (+++) Configure the priority and enable the NVIC for the transfer complete interrupt on the
- DMA Tx/Rx Stream/Channel.
-
- (#) Program the Mode, Standard, Data Format, MCLK Output, Audio frequency and Polarity
- using HAL_I2S_Init() function.
-
- -@- The specific I2S interrupts (Transmission complete interrupt,
- RXNE interrupt and Error Interrupts) will be managed using the macros
- __HAL_I2S_ENABLE_IT() and __HAL_I2S_DISABLE_IT() inside the transmit and receive process.
- -@- Make sure that either:
- (+@) External clock source is configured after setting correctly
- the define constant HSE_VALUE in the stm32l0xx_hal_conf.h file.
-
- (#) Three mode of operations are available within this driver :
-
- *** Polling mode IO operation ***
- =================================
- [..]
- (+) Send an amount of data in blocking mode using HAL_I2S_Transmit()
- (+) Receive an amount of data in blocking mode using HAL_I2S_Receive()
-
- *** Interrupt mode IO operation ***
- ===================================
- [..]
- (+) Send an amount of data in non blocking mode using HAL_I2S_Transmit_IT()
- (+) At transmission end of half transfer HAL_I2S_TxHalfCpltCallback is executed and user can
- add his own code by customization of function pointer HAL_I2S_TxHalfCpltCallback
- (+) At transmission end of transfer HAL_I2S_TxCpltCallback is executed and user can
- add his own code by customization of function pointer HAL_I2S_TxCpltCallback
- (+) Receive an amount of data in non blocking mode using HAL_I2S_Receive_IT()
- (+) At reception end of half transfer HAL_I2S_RxHalfCpltCallback is executed and user can
- add his own code by customization of function pointer HAL_I2S_RxHalfCpltCallback
- (+) At reception end of transfer HAL_I2S_RxCpltCallback is executed and user can
- add his own code by customization of function pointer HAL_I2S_RxCpltCallback
- (+) In case of transfer Error, HAL_I2S_ErrorCallback() function is executed and user can
- add his own code by customization of function pointer HAL_I2S_ErrorCallback
-
- *** DMA mode IO operation ***
- ==============================
- [..]
- (+) Send an amount of data in non blocking mode (DMA) using HAL_I2S_Transmit_DMA()
- (+) At transmission end of half transfer HAL_I2S_TxHalfCpltCallback is executed and user can
- add his own code by customization of function pointer HAL_I2S_TxHalfCpltCallback
- (+) At transmission end of transfer HAL_I2S_TxCpltCallback is executed and user can
- add his own code by customization of function pointer HAL_I2S_TxCpltCallback
- (+) Receive an amount of data in non blocking mode (DMA) using HAL_I2S_Receive_DMA()
- (+) At reception end of half transfer HAL_I2S_RxHalfCpltCallback is executed and user can
- add his own code by customization of function pointer HAL_I2S_RxHalfCpltCallback
- (+) At reception end of transfer HAL_I2S_RxCpltCallback is executed and user can
- add his own code by customization of function pointer HAL_I2S_RxCpltCallback
- (+) In case of transfer Error, HAL_I2S_ErrorCallback() function is executed and user can
- add his own code by customization of function pointer HAL_I2S_ErrorCallback
- (+) Pause the DMA Transfer using HAL_I2S_DMAPause()
- (+) Resume the DMA Transfer using HAL_I2S_DMAResume()
- (+) Stop the DMA Transfer using HAL_I2S_DMAStop()
- In Slave mode, if HAL_I2S_DMAStop is used to stop the communication, an error
- HAL_I2S_ERROR_BUSY_LINE_RX is raised as the master continue to transmit data.
- In this case __HAL_I2S_FLUSH_RX_DR macro must be used to flush the remaining data
- inside DR register and avoid using DeInit/Init process for the next transfer.
-
- *** I2S HAL driver macros list ***
- ===================================
- [..]
- Below the list of most used macros in I2S HAL driver.
-
- (+) __HAL_I2S_ENABLE: Enable the specified SPI peripheral (in I2S mode)
- (+) __HAL_I2S_DISABLE: Disable the specified SPI peripheral (in I2S mode)
- (+) __HAL_I2S_ENABLE_IT : Enable the specified I2S interrupts
- (+) __HAL_I2S_DISABLE_IT : Disable the specified I2S interrupts
- (+) __HAL_I2S_GET_FLAG: Check whether the specified I2S flag is set or not
- (+) __HAL_I2S_FLUSH_RX_DR: Read DR Register to Flush RX Data
-
- [..]
- (@) You can refer to the I2S HAL driver header file for more useful macros
-
- *** I2S HAL driver macros list ***
- ===================================
- [..]
- Callback registration:
-
- (#) The compilation flag USE_HAL_I2S_REGISTER_CALLBACKS when set to 1U
- allows the user to configure dynamically the driver callbacks.
- Use Functions HAL_I2S_RegisterCallback() to register an interrupt callback.
-
- Function HAL_I2S_RegisterCallback() allows to register following callbacks:
- (++) TxCpltCallback : I2S Tx Completed callback
- (++) RxCpltCallback : I2S Rx Completed callback
- (++) TxHalfCpltCallback : I2S Tx Half Completed callback
- (++) RxHalfCpltCallback : I2S Rx Half Completed callback
- (++) ErrorCallback : I2S Error callback
- (++) MspInitCallback : I2S Msp Init callback
- (++) MspDeInitCallback : I2S Msp DeInit callback
- This function takes as parameters the HAL peripheral handle, the Callback ID
- and a pointer to the user callback function.
-
-
- (#) Use function HAL_I2S_UnRegisterCallback to reset a callback to the default
- weak function.
- HAL_I2S_UnRegisterCallback takes as parameters the HAL peripheral handle,
- and the Callback ID.
- This function allows to reset following callbacks:
- (++) TxCpltCallback : I2S Tx Completed callback
- (++) RxCpltCallback : I2S Rx Completed callback
- (++) TxHalfCpltCallback : I2S Tx Half Completed callback
- (++) RxHalfCpltCallback : I2S Rx Half Completed callback
- (++) ErrorCallback : I2S Error callback
- (++) MspInitCallback : I2S Msp Init callback
- (++) MspDeInitCallback : I2S Msp DeInit callback
-
- [..]
- By default, after the HAL_I2S_Init() and when the state is HAL_I2S_STATE_RESET
- all callbacks are set to the corresponding weak functions:
- examples HAL_I2S_MasterTxCpltCallback(), HAL_I2S_MasterRxCpltCallback().
- Exception done for MspInit and MspDeInit functions that are
- reset to the legacy weak functions in the HAL_I2S_Init()/ HAL_I2S_DeInit() only when
- these callbacks are null (not registered beforehand).
- If MspInit or MspDeInit are not null, the HAL_I2S_Init()/ HAL_I2S_DeInit()
- keep and use the user MspInit/MspDeInit callbacks (registered beforehand) whatever the state.
-
- [..]
- Callbacks can be registered/unregistered in HAL_I2S_STATE_READY state only.
- Exception done MspInit/MspDeInit functions that can be registered/unregistered
- in HAL_I2S_STATE_READY or HAL_I2S_STATE_RESET state,
- thus registered (user) MspInit/DeInit callbacks can be used during the Init/DeInit.
- Then, the user first registers the MspInit/MspDeInit user callbacks
- using HAL_I2S_RegisterCallback() before calling HAL_I2S_DeInit()
- or HAL_I2S_Init() function.
-
- [..]
- When the compilation define USE_HAL_I2S_REGISTER_CALLBACKS is set to 0 or
- not defined, the callback registering feature is not available
- and weak (surcharged) callbacks are used.
-
- @endverbatim
- ******************************************************************************
- * @attention
- *
- *
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-#include "stm32l0xx_hal.h"
-
-#ifdef HAL_I2S_MODULE_ENABLED
-
-#if defined(SPI_I2S_SUPPORT)
-/** @addtogroup STM32L0xx_HAL_Driver
- * @{
- */
-
-/** @defgroup I2S I2S
- * @brief I2S HAL module driver
- * @{
- */
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-#define I2S_TIMEOUT_FLAG 100U /*!< Timeout 100 ms */
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/** @defgroup I2S_Private_Functions I2S Private Functions
- * @{
- */
-static void I2S_DMATxCplt(DMA_HandleTypeDef *hdma);
-static void I2S_DMATxHalfCplt(DMA_HandleTypeDef *hdma);
-static void I2S_DMARxCplt(DMA_HandleTypeDef *hdma);
-static void I2S_DMARxHalfCplt(DMA_HandleTypeDef *hdma);
-static void I2S_DMAError(DMA_HandleTypeDef *hdma);
-static void I2S_Transmit_IT(I2S_HandleTypeDef *hi2s);
-static void I2S_Receive_IT(I2S_HandleTypeDef *hi2s);
-static HAL_StatusTypeDef I2S_WaitFlagStateUntilTimeout(I2S_HandleTypeDef *hi2s, uint32_t Flag, FlagStatus State,
- uint32_t Timeout);
-/**
- * @}
- */
-
-/* Exported functions ---------------------------------------------------------*/
-
-/** @defgroup I2S_Exported_Functions I2S Exported Functions
- * @{
- */
-
-/** @defgroup I2S_Exported_Functions_Group1 Initialization and de-initialization functions
- * @brief Initialization and Configuration functions
- *
-@verbatim
- ===============================================================================
- ##### Initialization and de-initialization functions #####
- ===============================================================================
- [..] This subsection provides a set of functions allowing to initialize and
- de-initialize the I2Sx peripheral in simplex mode:
-
- (+) User must Implement HAL_I2S_MspInit() function in which he configures
- all related peripherals resources (CLOCK, GPIO, DMA, IT and NVIC ).
-
- (+) Call the function HAL_I2S_Init() to configure the selected device with
- the selected configuration:
- (++) Mode
- (++) Standard
- (++) Data Format
- (++) MCLK Output
- (++) Audio frequency
- (++) Polarity
-
- (+) Call the function HAL_I2S_DeInit() to restore the default configuration
- of the selected I2Sx peripheral.
- @endverbatim
- * @{
- */
-
-/**
- * @brief Initializes the I2S according to the specified parameters
- * in the I2S_InitTypeDef and create the associated handle.
- * @param hi2s pointer to a I2S_HandleTypeDef structure that contains
- * the configuration information for I2S module
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_I2S_Init(I2S_HandleTypeDef *hi2s)
-{
- uint32_t i2sdiv;
- uint32_t i2sodd;
- uint32_t packetlength;
- uint32_t tmp;
- uint32_t i2sclk;
-
- /* Check the I2S handle allocation */
- if (hi2s == NULL)
- {
- return HAL_ERROR;
- }
-
- /* Check the I2S parameters */
- assert_param(IS_I2S_ALL_INSTANCE(hi2s->Instance));
- assert_param(IS_I2S_MODE(hi2s->Init.Mode));
- assert_param(IS_I2S_STANDARD(hi2s->Init.Standard));
- assert_param(IS_I2S_DATA_FORMAT(hi2s->Init.DataFormat));
- assert_param(IS_I2S_MCLK_OUTPUT(hi2s->Init.MCLKOutput));
- assert_param(IS_I2S_AUDIO_FREQ(hi2s->Init.AudioFreq));
- assert_param(IS_I2S_CPOL(hi2s->Init.CPOL));
-
- if (hi2s->State == HAL_I2S_STATE_RESET)
- {
- /* Allocate lock resource and initialize it */
- hi2s->Lock = HAL_UNLOCKED;
-
-#if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
- /* Init the I2S Callback settings */
- hi2s->TxCpltCallback = HAL_I2S_TxCpltCallback; /* Legacy weak TxCpltCallback */
- hi2s->RxCpltCallback = HAL_I2S_RxCpltCallback; /* Legacy weak RxCpltCallback */
- hi2s->TxHalfCpltCallback = HAL_I2S_TxHalfCpltCallback; /* Legacy weak TxHalfCpltCallback */
- hi2s->RxHalfCpltCallback = HAL_I2S_RxHalfCpltCallback; /* Legacy weak RxHalfCpltCallback */
- hi2s->ErrorCallback = HAL_I2S_ErrorCallback; /* Legacy weak ErrorCallback */
-
- if (hi2s->MspInitCallback == NULL)
- {
- hi2s->MspInitCallback = HAL_I2S_MspInit; /* Legacy weak MspInit */
- }
-
- /* Init the low level hardware : GPIO, CLOCK, NVIC... */
- hi2s->MspInitCallback(hi2s);
-#else
- /* Init the low level hardware : GPIO, CLOCK, CORTEX...etc */
- HAL_I2S_MspInit(hi2s);
-#endif /* USE_HAL_I2S_REGISTER_CALLBACKS */
- }
-
- hi2s->State = HAL_I2S_STATE_BUSY;
-
- /*----------------------- SPIx I2SCFGR & I2SPR Configuration ----------------*/
- /* Clear I2SMOD, I2SE, I2SCFG, PCMSYNC, I2SSTD, CKPOL, DATLEN and CHLEN bits */
- CLEAR_BIT(hi2s->Instance->I2SCFGR, (SPI_I2SCFGR_CHLEN | SPI_I2SCFGR_DATLEN | SPI_I2SCFGR_CKPOL | \
- SPI_I2SCFGR_I2SSTD | SPI_I2SCFGR_PCMSYNC | SPI_I2SCFGR_I2SCFG | \
- SPI_I2SCFGR_I2SE | SPI_I2SCFGR_I2SMOD));
- hi2s->Instance->I2SPR = 0x0002U;
-
- /*----------------------- I2SPR: I2SDIV and ODD Calculation -----------------*/
- /* If the requested audio frequency is not the default, compute the prescaler */
- if (hi2s->Init.AudioFreq != I2S_AUDIOFREQ_DEFAULT)
- {
- /* Check the frame length (For the Prescaler computing) ********************/
- if (hi2s->Init.DataFormat == I2S_DATAFORMAT_16B)
- {
- /* Packet length is 16 bits */
- packetlength = 16U;
- }
- else
- {
- /* Packet length is 32 bits */
- packetlength = 32U;
- }
-
- /* I2S standard */
- if (hi2s->Init.Standard <= I2S_STANDARD_LSB)
- {
- /* In I2S standard packet length is multiplied by 2 */
- packetlength = packetlength * 2U;
- }
-
- /* Get the source clock value: based on System Clock value */
- i2sclk = HAL_RCC_GetSysClockFreq();
-
- /* Compute the Real divider depending on the MCLK output state, with a floating point */
- if (hi2s->Init.MCLKOutput == I2S_MCLKOUTPUT_ENABLE)
- {
- /* MCLK output is enabled */
- if (hi2s->Init.DataFormat != I2S_DATAFORMAT_16B)
- {
- tmp = (uint32_t)(((((i2sclk / (packetlength * 4U)) * 10U) / hi2s->Init.AudioFreq)) + 5U);
- }
- else
- {
- tmp = (uint32_t)(((((i2sclk / (packetlength * 8U)) * 10U) / hi2s->Init.AudioFreq)) + 5U);
- }
- }
- else
- {
- /* MCLK output is disabled */
- tmp = (uint32_t)(((((i2sclk / packetlength) * 10U) / hi2s->Init.AudioFreq)) + 5U);
- }
-
- /* Remove the flatting point */
- tmp = tmp / 10U;
-
- /* Check the parity of the divider */
- i2sodd = (uint32_t)(tmp & (uint32_t)1U);
-
- /* Compute the i2sdiv prescaler */
- i2sdiv = (uint32_t)((tmp - i2sodd) / 2U);
-
- /* Get the Mask for the Odd bit (SPI_I2SPR[8]) register */
- i2sodd = (uint32_t)(i2sodd << 8U);
- }
- else
- {
- /* Set the default values */
- i2sdiv = 2U;
- i2sodd = 0U;
- }
-
- /* Test if the divider is 1 or 0 or greater than 0xFF */
- if ((i2sdiv < 2U) || (i2sdiv > 0xFFU))
- {
- /* Set the error code and execute error callback*/
- SET_BIT(hi2s->ErrorCode, HAL_I2S_ERROR_PRESCALER);
- return HAL_ERROR;
- }
-
- /*----------------------- SPIx I2SCFGR & I2SPR Configuration ----------------*/
-
- /* Write to SPIx I2SPR register the computed value */
- hi2s->Instance->I2SPR = (uint32_t)((uint32_t)i2sdiv | (uint32_t)(i2sodd | (uint32_t)hi2s->Init.MCLKOutput));
-
- /* Clear I2SMOD, I2SE, I2SCFG, PCMSYNC, I2SSTD, CKPOL, DATLEN and CHLEN bits */
- /* And configure the I2S with the I2S_InitStruct values */
- MODIFY_REG(hi2s->Instance->I2SCFGR, (SPI_I2SCFGR_CHLEN | SPI_I2SCFGR_DATLEN | \
- SPI_I2SCFGR_CKPOL | SPI_I2SCFGR_I2SSTD | \
- SPI_I2SCFGR_PCMSYNC | SPI_I2SCFGR_I2SCFG | \
- SPI_I2SCFGR_I2SE | SPI_I2SCFGR_I2SMOD), \
- (SPI_I2SCFGR_I2SMOD | hi2s->Init.Mode | \
- hi2s->Init.Standard | hi2s->Init.DataFormat | \
- hi2s->Init.CPOL));
-
-#if defined(SPI_I2SCFGR_ASTRTEN)
- if ((hi2s->Init.Standard == I2S_STANDARD_PCM_SHORT) || ((hi2s->Init.Standard == I2S_STANDARD_PCM_LONG)))
- {
- /* Write to SPIx I2SCFGR */
- SET_BIT(hi2s->Instance->I2SCFGR, SPI_I2SCFGR_ASTRTEN);
- }
-#endif /* SPI_I2SCFGR_ASTRTEN */
-
- hi2s->ErrorCode = HAL_I2S_ERROR_NONE;
- hi2s->State = HAL_I2S_STATE_READY;
-
- return HAL_OK;
-}
-
-/**
- * @brief DeInitializes the I2S peripheral
- * @param hi2s pointer to a I2S_HandleTypeDef structure that contains
- * the configuration information for I2S module
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_I2S_DeInit(I2S_HandleTypeDef *hi2s)
-{
- /* Check the I2S handle allocation */
- if (hi2s == NULL)
- {
- return HAL_ERROR;
- }
-
- /* Check the parameters */
- assert_param(IS_I2S_ALL_INSTANCE(hi2s->Instance));
-
- hi2s->State = HAL_I2S_STATE_BUSY;
-
- /* Disable the I2S Peripheral Clock */
- __HAL_I2S_DISABLE(hi2s);
-
-#if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
- if (hi2s->MspDeInitCallback == NULL)
- {
- hi2s->MspDeInitCallback = HAL_I2S_MspDeInit; /* Legacy weak MspDeInit */
- }
-
- /* DeInit the low level hardware: GPIO, CLOCK, NVIC... */
- hi2s->MspDeInitCallback(hi2s);
-#else
- /* DeInit the low level hardware: GPIO, CLOCK, NVIC... */
- HAL_I2S_MspDeInit(hi2s);
-#endif /* USE_HAL_I2S_REGISTER_CALLBACKS */
-
- hi2s->ErrorCode = HAL_I2S_ERROR_NONE;
- hi2s->State = HAL_I2S_STATE_RESET;
-
- /* Release Lock */
- __HAL_UNLOCK(hi2s);
-
- return HAL_OK;
-}
-
-/**
- * @brief I2S MSP Init
- * @param hi2s pointer to a I2S_HandleTypeDef structure that contains
- * the configuration information for I2S module
- * @retval None
- */
-__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,
- the HAL_I2S_MspInit could be implemented in the user file
- */
-}
-
-/**
- * @brief I2S MSP DeInit
- * @param hi2s pointer to a I2S_HandleTypeDef structure that contains
- * the configuration information for I2S module
- * @retval None
- */
-__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,
- the HAL_I2S_MspDeInit could be implemented in the user file
- */
-}
-
-#if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
-/**
- * @brief Register a User I2S Callback
- * To be used instead of the weak predefined callback
- * @param hi2s Pointer to a I2S_HandleTypeDef structure that contains
- * the configuration information for the specified I2S.
- * @param CallbackID ID of the callback to be registered
- * @param pCallback pointer to the Callback function
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_I2S_RegisterCallback(I2S_HandleTypeDef *hi2s, HAL_I2S_CallbackIDTypeDef CallbackID,
- pI2S_CallbackTypeDef pCallback)
-{
- HAL_StatusTypeDef status = HAL_OK;
-
- if (pCallback == NULL)
- {
- /* Update the error code */
- hi2s->ErrorCode |= HAL_I2S_ERROR_INVALID_CALLBACK;
-
- return HAL_ERROR;
- }
- /* Process locked */
- __HAL_LOCK(hi2s);
-
- if (HAL_I2S_STATE_READY == hi2s->State)
- {
- switch (CallbackID)
- {
- case HAL_I2S_TX_COMPLETE_CB_ID :
- hi2s->TxCpltCallback = pCallback;
- break;
-
- case HAL_I2S_RX_COMPLETE_CB_ID :
- hi2s->RxCpltCallback = pCallback;
- break;
-
- case HAL_I2S_TX_HALF_COMPLETE_CB_ID :
- hi2s->TxHalfCpltCallback = pCallback;
- break;
-
- case HAL_I2S_RX_HALF_COMPLETE_CB_ID :
- hi2s->RxHalfCpltCallback = pCallback;
- break;
-
- case HAL_I2S_ERROR_CB_ID :
- hi2s->ErrorCallback = pCallback;
- break;
-
- case HAL_I2S_MSPINIT_CB_ID :
- hi2s->MspInitCallback = pCallback;
- break;
-
- case HAL_I2S_MSPDEINIT_CB_ID :
- hi2s->MspDeInitCallback = pCallback;
- break;
-
- default :
- /* Update the error code */
- SET_BIT(hi2s->ErrorCode, HAL_I2S_ERROR_INVALID_CALLBACK);
-
- /* Return error status */
- status = HAL_ERROR;
- break;
- }
- }
- else if (HAL_I2S_STATE_RESET == hi2s->State)
- {
- switch (CallbackID)
- {
- case HAL_I2S_MSPINIT_CB_ID :
- hi2s->MspInitCallback = pCallback;
- break;
-
- case HAL_I2S_MSPDEINIT_CB_ID :
- hi2s->MspDeInitCallback = pCallback;
- break;
-
- default :
- /* Update the error code */
- SET_BIT(hi2s->ErrorCode, HAL_I2S_ERROR_INVALID_CALLBACK);
-
- /* Return error status */
- status = HAL_ERROR;
- break;
- }
- }
- else
- {
- /* Update the error code */
- SET_BIT(hi2s->ErrorCode, HAL_I2S_ERROR_INVALID_CALLBACK);
-
- /* Return error status */
- status = HAL_ERROR;
- }
-
- /* Release Lock */
- __HAL_UNLOCK(hi2s);
- return status;
-}
-
-/**
- * @brief Unregister an I2S Callback
- * I2S callback is redirected to the weak predefined callback
- * @param hi2s Pointer to a I2S_HandleTypeDef structure that contains
- * the configuration information for the specified I2S.
- * @param CallbackID ID of the callback to be unregistered
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_I2S_UnRegisterCallback(I2S_HandleTypeDef *hi2s, HAL_I2S_CallbackIDTypeDef CallbackID)
-{
- HAL_StatusTypeDef status = HAL_OK;
-
- /* Process locked */
- __HAL_LOCK(hi2s);
-
- if (HAL_I2S_STATE_READY == hi2s->State)
- {
- switch (CallbackID)
- {
- case HAL_I2S_TX_COMPLETE_CB_ID :
- hi2s->TxCpltCallback = HAL_I2S_TxCpltCallback; /* Legacy weak TxCpltCallback */
- break;
-
- case HAL_I2S_RX_COMPLETE_CB_ID :
- hi2s->RxCpltCallback = HAL_I2S_RxCpltCallback; /* Legacy weak RxCpltCallback */
- break;
-
- case HAL_I2S_TX_HALF_COMPLETE_CB_ID :
- hi2s->TxHalfCpltCallback = HAL_I2S_TxHalfCpltCallback; /* Legacy weak TxHalfCpltCallback */
- break;
-
- case HAL_I2S_RX_HALF_COMPLETE_CB_ID :
- hi2s->RxHalfCpltCallback = HAL_I2S_RxHalfCpltCallback; /* Legacy weak RxHalfCpltCallback */
- break;
-
- case HAL_I2S_ERROR_CB_ID :
- hi2s->ErrorCallback = HAL_I2S_ErrorCallback; /* Legacy weak ErrorCallback */
- break;
-
- case HAL_I2S_MSPINIT_CB_ID :
- hi2s->MspInitCallback = HAL_I2S_MspInit; /* Legacy weak MspInit */
- break;
-
- case HAL_I2S_MSPDEINIT_CB_ID :
- hi2s->MspDeInitCallback = HAL_I2S_MspDeInit; /* Legacy weak MspDeInit */
- break;
-
- default :
- /* Update the error code */
- SET_BIT(hi2s->ErrorCode, HAL_I2S_ERROR_INVALID_CALLBACK);
-
- /* Return error status */
- status = HAL_ERROR;
- break;
- }
- }
- else if (HAL_I2S_STATE_RESET == hi2s->State)
- {
- switch (CallbackID)
- {
- case HAL_I2S_MSPINIT_CB_ID :
- hi2s->MspInitCallback = HAL_I2S_MspInit; /* Legacy weak MspInit */
- break;
-
- case HAL_I2S_MSPDEINIT_CB_ID :
- hi2s->MspDeInitCallback = HAL_I2S_MspDeInit; /* Legacy weak MspDeInit */
- break;
-
- default :
- /* Update the error code */
- SET_BIT(hi2s->ErrorCode, HAL_I2S_ERROR_INVALID_CALLBACK);
-
- /* Return error status */
- status = HAL_ERROR;
- break;
- }
- }
- else
- {
- /* Update the error code */
- SET_BIT(hi2s->ErrorCode, HAL_I2S_ERROR_INVALID_CALLBACK);
-
- /* Return error status */
- status = HAL_ERROR;
- }
-
- /* Release Lock */
- __HAL_UNLOCK(hi2s);
- return status;
-}
-#endif /* USE_HAL_I2S_REGISTER_CALLBACKS */
-/**
- * @}
- */
-
-/** @defgroup I2S_Exported_Functions_Group2 IO operation functions
- * @brief Data transfers functions
- *
-@verbatim
- ===============================================================================
- ##### IO operation functions #####
- ===============================================================================
- [..]
- This subsection provides a set of functions allowing to manage the I2S data
- transfers.
-
- (#) There are two modes of transfer:
- (++) Blocking mode : The communication is performed in the polling mode.
- The status of all data processing is returned by the same function
- after finishing transfer.
- (++) No-Blocking mode : The communication is performed using Interrupts
- or DMA. These functions return the status of the transfer startup.
- The end of the data processing will be indicated through the
- dedicated I2S IRQ when using Interrupt mode or the DMA IRQ when
- using DMA mode.
-
- (#) Blocking mode functions are :
- (++) HAL_I2S_Transmit()
- (++) HAL_I2S_Receive()
-
- (#) No-Blocking mode functions with Interrupt are :
- (++) HAL_I2S_Transmit_IT()
- (++) HAL_I2S_Receive_IT()
-
- (#) No-Blocking mode functions with DMA are :
- (++) HAL_I2S_Transmit_DMA()
- (++) HAL_I2S_Receive_DMA()
-
- (#) A set of Transfer Complete Callbacks are provided in non Blocking mode:
- (++) HAL_I2S_TxCpltCallback()
- (++) HAL_I2S_RxCpltCallback()
- (++) HAL_I2S_ErrorCallback()
-
-@endverbatim
- * @{
- */
-
-/**
- * @brief Transmit an amount of data in blocking mode
- * @param hi2s pointer to a I2S_HandleTypeDef structure that contains
- * the configuration information for I2S module
- * @param pData a 16-bit pointer to data buffer.
- * @param Size number of data sample to be sent:
- * @note When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S
- * configuration phase, the Size parameter means the number of 16-bit data length
- * in the transaction and when a 24-bit data frame or a 32-bit data frame is selected
- * the Size parameter means the number of 24-bit or 32-bit data length.
- * @param Timeout Timeout duration
- * @note The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization
- * between Master and Slave(example: audio streaming).
- * @note This function can use an Audio Frequency up to 48KHz when I2S Clock Source is 32MHz
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_I2S_Transmit(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size, uint32_t Timeout)
-{
- uint32_t tmpreg_cfgr;
-
- if ((pData == NULL) || (Size == 0U))
- {
- return HAL_ERROR;
- }
-
- /* Process Locked */
- __HAL_LOCK(hi2s);
-
- if (hi2s->State != HAL_I2S_STATE_READY)
- {
- __HAL_UNLOCK(hi2s);
- return HAL_BUSY;
- }
-
- /* Set state and reset error code */
- hi2s->State = HAL_I2S_STATE_BUSY_TX;
- hi2s->ErrorCode = HAL_I2S_ERROR_NONE;
- hi2s->pTxBuffPtr = pData;
-
- tmpreg_cfgr = hi2s->Instance->I2SCFGR & (SPI_I2SCFGR_DATLEN | SPI_I2SCFGR_CHLEN);
-
- if ((tmpreg_cfgr == I2S_DATAFORMAT_24B) || (tmpreg_cfgr == I2S_DATAFORMAT_32B))
- {
- hi2s->TxXferSize = (Size << 1U);
- hi2s->TxXferCount = (Size << 1U);
- }
- else
- {
- hi2s->TxXferSize = Size;
- hi2s->TxXferCount = Size;
- }
-
- tmpreg_cfgr = hi2s->Instance->I2SCFGR;
-
- /* Check if the I2S is already enabled */
- if ((hi2s->Instance->I2SCFGR & SPI_I2SCFGR_I2SE) != SPI_I2SCFGR_I2SE)
- {
- /* Enable I2S peripheral */
- __HAL_I2S_ENABLE(hi2s);
- }
-
- /* Wait until TXE flag is set */
- if (I2S_WaitFlagStateUntilTimeout(hi2s, I2S_FLAG_TXE, SET, Timeout) != HAL_OK)
- {
- /* Set the error code */
- SET_BIT(hi2s->ErrorCode, HAL_I2S_ERROR_TIMEOUT);
- hi2s->State = HAL_I2S_STATE_READY;
- __HAL_UNLOCK(hi2s);
- return HAL_ERROR;
- }
-
- while (hi2s->TxXferCount > 0U)
- {
- hi2s->Instance->DR = (*hi2s->pTxBuffPtr);
- hi2s->pTxBuffPtr++;
- hi2s->TxXferCount--;
-
- /* Wait until TXE flag is set */
- if (I2S_WaitFlagStateUntilTimeout(hi2s, I2S_FLAG_TXE, SET, Timeout) != HAL_OK)
- {
- /* Set the error code */
- SET_BIT(hi2s->ErrorCode, HAL_I2S_ERROR_TIMEOUT);
- hi2s->State = HAL_I2S_STATE_READY;
- __HAL_UNLOCK(hi2s);
- return HAL_ERROR;
- }
-
- /* Check if an underrun occurs */
- if (__HAL_I2S_GET_FLAG(hi2s, I2S_FLAG_UDR) == SET)
- {
- /* Clear underrun flag */
- __HAL_I2S_CLEAR_UDRFLAG(hi2s);
-
- /* Set the error code */
- SET_BIT(hi2s->ErrorCode, HAL_I2S_ERROR_UDR);
- }
- }
-
- /* Check if Slave mode is selected */
- if (((tmpreg_cfgr & SPI_I2SCFGR_I2SCFG) == I2S_MODE_SLAVE_TX)
- || ((tmpreg_cfgr & SPI_I2SCFGR_I2SCFG) == I2S_MODE_SLAVE_RX))
- {
- /* Wait until Busy flag is reset */
- if (I2S_WaitFlagStateUntilTimeout(hi2s, I2S_FLAG_BSY, RESET, Timeout) != HAL_OK)
- {
- /* Set the error code */
- SET_BIT(hi2s->ErrorCode, HAL_I2S_ERROR_TIMEOUT);
- hi2s->State = HAL_I2S_STATE_READY;
- __HAL_UNLOCK(hi2s);
- return HAL_ERROR;
- }
- }
-
- hi2s->State = HAL_I2S_STATE_READY;
- __HAL_UNLOCK(hi2s);
- return HAL_OK;
-}
-
-/**
- * @brief Receive an amount of data in blocking mode
- * @param hi2s pointer to a I2S_HandleTypeDef structure that contains
- * the configuration information for I2S module
- * @param pData a 16-bit pointer to data buffer.
- * @param Size number of data sample to be sent:
- * @note When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S
- * configuration phase, the Size parameter means the number of 16-bit data length
- * in the transaction and when a 24-bit data frame or a 32-bit data frame is selected
- * the Size parameter means the number of 24-bit or 32-bit data length.
- * @param Timeout Timeout duration
- * @note The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization
- * between Master and Slave(example: audio streaming).
- * @note In I2S Master Receiver mode, just after enabling the peripheral the clock will be generate
- * in continuous way and as the I2S is not disabled at the end of the I2S transaction.
- * @note This function can use an Audio Frequency up to 48KHz when I2S Clock Source is 32MHz
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_I2S_Receive(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size, uint32_t Timeout)
-{
- uint32_t tmpreg_cfgr;
-
- if ((pData == NULL) || (Size == 0U))
- {
- return HAL_ERROR;
- }
-
- /* Process Locked */
- __HAL_LOCK(hi2s);
-
- if (hi2s->State != HAL_I2S_STATE_READY)
- {
- __HAL_UNLOCK(hi2s);
- return HAL_BUSY;
- }
-
- /* Set state and reset error code */
- hi2s->State = HAL_I2S_STATE_BUSY_RX;
- hi2s->ErrorCode = HAL_I2S_ERROR_NONE;
- hi2s->pRxBuffPtr = pData;
-
- tmpreg_cfgr = hi2s->Instance->I2SCFGR & (SPI_I2SCFGR_DATLEN | SPI_I2SCFGR_CHLEN);
-
- if ((tmpreg_cfgr == I2S_DATAFORMAT_24B) || (tmpreg_cfgr == I2S_DATAFORMAT_32B))
- {
- hi2s->RxXferSize = (Size << 1U);
- hi2s->RxXferCount = (Size << 1U);
- }
- else
- {
- hi2s->RxXferSize = Size;
- hi2s->RxXferCount = Size;
- }
-
- /* Check if the I2S is already enabled */
- if ((hi2s->Instance->I2SCFGR & SPI_I2SCFGR_I2SE) != SPI_I2SCFGR_I2SE)
- {
- /* Enable I2S peripheral */
- __HAL_I2S_ENABLE(hi2s);
- }
-
- /* Check if Master Receiver mode is selected */
- if ((hi2s->Instance->I2SCFGR & SPI_I2SCFGR_I2SCFG) == I2S_MODE_MASTER_RX)
- {
- /* Clear the Overrun Flag by a read operation on the SPI_DR register followed by a read
- access to the SPI_SR register. */
- __HAL_I2S_CLEAR_OVRFLAG(hi2s);
- }
-
- /* Receive data */
- while (hi2s->RxXferCount > 0U)
- {
- /* Wait until RXNE flag is set */
- if (I2S_WaitFlagStateUntilTimeout(hi2s, I2S_FLAG_RXNE, SET, Timeout) != HAL_OK)
- {
- /* Set the error code */
- SET_BIT(hi2s->ErrorCode, HAL_I2S_ERROR_TIMEOUT);
- hi2s->State = HAL_I2S_STATE_READY;
- __HAL_UNLOCK(hi2s);
- return HAL_ERROR;
- }
-
- (*hi2s->pRxBuffPtr) = (uint16_t)hi2s->Instance->DR;
- hi2s->pRxBuffPtr++;
- hi2s->RxXferCount--;
-
- /* Check if an overrun occurs */
- if (__HAL_I2S_GET_FLAG(hi2s, I2S_FLAG_OVR) == SET)
- {
- /* Clear overrun flag */
- __HAL_I2S_CLEAR_OVRFLAG(hi2s);
-
- /* Set the error code */
- SET_BIT(hi2s->ErrorCode, HAL_I2S_ERROR_OVR);
- }
- }
-
- hi2s->State = HAL_I2S_STATE_READY;
- __HAL_UNLOCK(hi2s);
- return HAL_OK;
-}
-
-/**
- * @brief Transmit an amount of data in non-blocking mode with Interrupt
- * @param hi2s pointer to a I2S_HandleTypeDef structure that contains
- * the configuration information for I2S module
- * @param pData a 16-bit pointer to data buffer.
- * @param Size number of data sample to be sent:
- * @note When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S
- * configuration phase, the Size parameter means the number of 16-bit data length
- * in the transaction and when a 24-bit data frame or a 32-bit data frame is selected
- * the Size parameter means the number of 24-bit or 32-bit data length.
- * @note The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization
- * between Master and Slave(example: audio streaming).
- * @note This function can use an Audio Frequency up to 48KHz when I2S Clock Source is 32MHz
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_I2S_Transmit_IT(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size)
-{
- uint32_t tmpreg_cfgr;
-
- if ((pData == NULL) || (Size == 0U))
- {
- return HAL_ERROR;
- }
-
- /* Process Locked */
- __HAL_LOCK(hi2s);
-
- if (hi2s->State != HAL_I2S_STATE_READY)
- {
- __HAL_UNLOCK(hi2s);
- return HAL_BUSY;
- }
-
- /* Set state and reset error code */
- hi2s->State = HAL_I2S_STATE_BUSY_TX;
- hi2s->ErrorCode = HAL_I2S_ERROR_NONE;
- hi2s->pTxBuffPtr = pData;
-
- tmpreg_cfgr = hi2s->Instance->I2SCFGR & (SPI_I2SCFGR_DATLEN | SPI_I2SCFGR_CHLEN);
-
- if ((tmpreg_cfgr == I2S_DATAFORMAT_24B) || (tmpreg_cfgr == I2S_DATAFORMAT_32B))
- {
- hi2s->TxXferSize = (Size << 1U);
- hi2s->TxXferCount = (Size << 1U);
- }
- else
- {
- hi2s->TxXferSize = Size;
- hi2s->TxXferCount = Size;
- }
-
- /* Enable TXE and ERR interrupt */
- __HAL_I2S_ENABLE_IT(hi2s, (I2S_IT_TXE | I2S_IT_ERR));
-
- /* Check if the I2S is already enabled */
- if ((hi2s->Instance->I2SCFGR & SPI_I2SCFGR_I2SE) != SPI_I2SCFGR_I2SE)
- {
- /* Enable I2S peripheral */
- __HAL_I2S_ENABLE(hi2s);
- }
-
- __HAL_UNLOCK(hi2s);
- return HAL_OK;
-}
-
-/**
- * @brief Receive an amount of data in non-blocking mode with Interrupt
- * @param hi2s pointer to a I2S_HandleTypeDef structure that contains
- * the configuration information for I2S module
- * @param pData a 16-bit pointer to the Receive data buffer.
- * @param Size number of data sample to be sent:
- * @note When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S
- * configuration phase, the Size parameter means the number of 16-bit data length
- * in the transaction and when a 24-bit data frame or a 32-bit data frame is selected
- * the Size parameter means the number of 24-bit or 32-bit data length.
- * @note The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization
- * between Master and Slave(example: audio streaming).
- * @note It is recommended to use DMA for the I2S receiver to avoid de-synchronization
- * between Master and Slave otherwise the I2S interrupt should be optimized.
- * @note This function can use an Audio Frequency up to 48KHz when I2S Clock Source is 32MHz
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_I2S_Receive_IT(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size)
-{
- uint32_t tmpreg_cfgr;
-
- if ((pData == NULL) || (Size == 0U))
- {
- return HAL_ERROR;
- }
-
- /* Process Locked */
- __HAL_LOCK(hi2s);
-
- if (hi2s->State != HAL_I2S_STATE_READY)
- {
- __HAL_UNLOCK(hi2s);
- return HAL_BUSY;
- }
-
- /* Set state and reset error code */
- hi2s->State = HAL_I2S_STATE_BUSY_RX;
- hi2s->ErrorCode = HAL_I2S_ERROR_NONE;
- hi2s->pRxBuffPtr = pData;
-
- tmpreg_cfgr = hi2s->Instance->I2SCFGR & (SPI_I2SCFGR_DATLEN | SPI_I2SCFGR_CHLEN);
-
- if ((tmpreg_cfgr == I2S_DATAFORMAT_24B) || (tmpreg_cfgr == I2S_DATAFORMAT_32B))
- {
- hi2s->RxXferSize = (Size << 1U);
- hi2s->RxXferCount = (Size << 1U);
- }
- else
- {
- hi2s->RxXferSize = Size;
- hi2s->RxXferCount = Size;
- }
-
- /* Enable RXNE and ERR interrupt */
- __HAL_I2S_ENABLE_IT(hi2s, (I2S_IT_RXNE | I2S_IT_ERR));
-
- /* Check if the I2S is already enabled */
- if ((hi2s->Instance->I2SCFGR & SPI_I2SCFGR_I2SE) != SPI_I2SCFGR_I2SE)
- {
- /* Enable I2S peripheral */
- __HAL_I2S_ENABLE(hi2s);
- }
-
- __HAL_UNLOCK(hi2s);
- return HAL_OK;
-}
-
-/**
- * @brief Transmit an amount of data in non-blocking mode with DMA
- * @param hi2s pointer to a I2S_HandleTypeDef structure that contains
- * the configuration information for I2S module
- * @param pData a 16-bit pointer to the Transmit data buffer.
- * @param Size number of data sample to be sent:
- * @note When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S
- * configuration phase, the Size parameter means the number of 16-bit data length
- * in the transaction and when a 24-bit data frame or a 32-bit data frame is selected
- * the Size parameter means the number of 24-bit or 32-bit data length.
- * @note The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization
- * between Master and Slave(example: audio streaming).
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_I2S_Transmit_DMA(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size)
-{
- uint32_t tmpreg_cfgr;
-
- if ((pData == NULL) || (Size == 0U))
- {
- return HAL_ERROR;
- }
-
- /* Process Locked */
- __HAL_LOCK(hi2s);
-
- if (hi2s->State != HAL_I2S_STATE_READY)
- {
- __HAL_UNLOCK(hi2s);
- return HAL_BUSY;
- }
-
- /* Set state and reset error code */
- hi2s->State = HAL_I2S_STATE_BUSY_TX;
- hi2s->ErrorCode = HAL_I2S_ERROR_NONE;
- hi2s->pTxBuffPtr = pData;
-
- tmpreg_cfgr = hi2s->Instance->I2SCFGR & (SPI_I2SCFGR_DATLEN | SPI_I2SCFGR_CHLEN);
-
- if ((tmpreg_cfgr == I2S_DATAFORMAT_24B) || (tmpreg_cfgr == I2S_DATAFORMAT_32B))
- {
- hi2s->TxXferSize = (Size << 1U);
- hi2s->TxXferCount = (Size << 1U);
- }
- else
- {
- hi2s->TxXferSize = Size;
- hi2s->TxXferCount = Size;
- }
-
- /* Set the I2S Tx DMA Half transfer complete callback */
- hi2s->hdmatx->XferHalfCpltCallback = I2S_DMATxHalfCplt;
-
- /* Set the I2S Tx DMA transfer complete callback */
- hi2s->hdmatx->XferCpltCallback = I2S_DMATxCplt;
-
- /* Set the DMA error callback */
- hi2s->hdmatx->XferErrorCallback = I2S_DMAError;
-
- /* Enable the Tx DMA Stream/Channel */
- if (HAL_OK != HAL_DMA_Start_IT(hi2s->hdmatx,
- (uint32_t)hi2s->pTxBuffPtr,
- (uint32_t)&hi2s->Instance->DR,
- hi2s->TxXferSize))
- {
- /* Update SPI error code */
- SET_BIT(hi2s->ErrorCode, HAL_I2S_ERROR_DMA);
- hi2s->State = HAL_I2S_STATE_READY;
-
- __HAL_UNLOCK(hi2s);
- return HAL_ERROR;
- }
-
- /* Check if the I2S is already enabled */
- if (HAL_IS_BIT_CLR(hi2s->Instance->I2SCFGR, SPI_I2SCFGR_I2SE))
- {
- /* Enable I2S peripheral */
- __HAL_I2S_ENABLE(hi2s);
- }
-
- /* Check if the I2S Tx request is already enabled */
- if (HAL_IS_BIT_CLR(hi2s->Instance->CR2, SPI_CR2_TXDMAEN))
- {
- /* Enable Tx DMA Request */
- SET_BIT(hi2s->Instance->CR2, SPI_CR2_TXDMAEN);
- }
-
- __HAL_UNLOCK(hi2s);
- return HAL_OK;
-}
-
-/**
- * @brief Receive an amount of data in non-blocking mode with DMA
- * @param hi2s pointer to a I2S_HandleTypeDef structure that contains
- * the configuration information for I2S module
- * @param pData a 16-bit pointer to the Receive data buffer.
- * @param Size number of data sample to be sent:
- * @note When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S
- * configuration phase, the Size parameter means the number of 16-bit data length
- * in the transaction and when a 24-bit data frame or a 32-bit data frame is selected
- * the Size parameter means the number of 24-bit or 32-bit data length.
- * @note The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization
- * between Master and Slave(example: audio streaming).
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_I2S_Receive_DMA(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size)
-{
- uint32_t tmpreg_cfgr;
-
- if ((pData == NULL) || (Size == 0U))
- {
- return HAL_ERROR;
- }
-
- /* Process Locked */
- __HAL_LOCK(hi2s);
-
- if (hi2s->State != HAL_I2S_STATE_READY)
- {
- __HAL_UNLOCK(hi2s);
- return HAL_BUSY;
- }
-
- /* Set state and reset error code */
- hi2s->State = HAL_I2S_STATE_BUSY_RX;
- hi2s->ErrorCode = HAL_I2S_ERROR_NONE;
- hi2s->pRxBuffPtr = pData;
-
- tmpreg_cfgr = hi2s->Instance->I2SCFGR & (SPI_I2SCFGR_DATLEN | SPI_I2SCFGR_CHLEN);
-
- if ((tmpreg_cfgr == I2S_DATAFORMAT_24B) || (tmpreg_cfgr == I2S_DATAFORMAT_32B))
- {
- hi2s->RxXferSize = (Size << 1U);
- hi2s->RxXferCount = (Size << 1U);
- }
- else
- {
- hi2s->RxXferSize = Size;
- hi2s->RxXferCount = Size;
- }
-
- /* Set the I2S Rx DMA Half transfer complete callback */
- hi2s->hdmarx->XferHalfCpltCallback = I2S_DMARxHalfCplt;
-
- /* Set the I2S Rx DMA transfer complete callback */
- hi2s->hdmarx->XferCpltCallback = I2S_DMARxCplt;
-
- /* Set the DMA error callback */
- hi2s->hdmarx->XferErrorCallback = I2S_DMAError;
-
- /* Check if Master Receiver mode is selected */
- if ((hi2s->Instance->I2SCFGR & SPI_I2SCFGR_I2SCFG) == I2S_MODE_MASTER_RX)
- {
- /* Clear the Overrun Flag by a read operation to the SPI_DR register followed by a read
- access to the SPI_SR register. */
- __HAL_I2S_CLEAR_OVRFLAG(hi2s);
- }
-
- /* Enable the Rx DMA Stream/Channel */
- if (HAL_OK != HAL_DMA_Start_IT(hi2s->hdmarx, (uint32_t)&hi2s->Instance->DR, (uint32_t)hi2s->pRxBuffPtr,
- hi2s->RxXferSize))
- {
- /* Update SPI error code */
- SET_BIT(hi2s->ErrorCode, HAL_I2S_ERROR_DMA);
- hi2s->State = HAL_I2S_STATE_READY;
-
- __HAL_UNLOCK(hi2s);
- return HAL_ERROR;
- }
-
- /* Check if the I2S is already enabled */
- if (HAL_IS_BIT_CLR(hi2s->Instance->I2SCFGR, SPI_I2SCFGR_I2SE))
- {
- /* Enable I2S peripheral */
- __HAL_I2S_ENABLE(hi2s);
- }
-
- /* Check if the I2S Rx request is already enabled */
- if (HAL_IS_BIT_CLR(hi2s->Instance->CR2, SPI_CR2_RXDMAEN))
- {
- /* Enable Rx DMA Request */
- SET_BIT(hi2s->Instance->CR2, SPI_CR2_RXDMAEN);
- }
-
- __HAL_UNLOCK(hi2s);
- return HAL_OK;
-}
-
-/**
- * @brief Pauses the audio DMA Stream/Channel playing from the Media.
- * @param hi2s pointer to a I2S_HandleTypeDef structure that contains
- * the configuration information for I2S module
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_I2S_DMAPause(I2S_HandleTypeDef *hi2s)
-{
- /* Process Locked */
- __HAL_LOCK(hi2s);
-
- if (hi2s->State == HAL_I2S_STATE_BUSY_TX)
- {
- /* Disable the I2S DMA Tx request */
- CLEAR_BIT(hi2s->Instance->CR2, SPI_CR2_TXDMAEN);
- }
- else if (hi2s->State == HAL_I2S_STATE_BUSY_RX)
- {
- /* Disable the I2S DMA Rx request */
- CLEAR_BIT(hi2s->Instance->CR2, SPI_CR2_RXDMAEN);
- }
- else
- {
- /* nothing to do */
- }
-
- /* Process Unlocked */
- __HAL_UNLOCK(hi2s);
-
- return HAL_OK;
-}
-
-/**
- * @brief Resumes the audio DMA Stream/Channel playing from the Media.
- * @param hi2s pointer to a I2S_HandleTypeDef structure that contains
- * the configuration information for I2S module
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_I2S_DMAResume(I2S_HandleTypeDef *hi2s)
-{
- /* Process Locked */
- __HAL_LOCK(hi2s);
-
- if (hi2s->State == HAL_I2S_STATE_BUSY_TX)
- {
- /* Enable the I2S DMA Tx request */
- SET_BIT(hi2s->Instance->CR2, SPI_CR2_TXDMAEN);
- }
- else if (hi2s->State == HAL_I2S_STATE_BUSY_RX)
- {
- /* Enable the I2S DMA Rx request */
- SET_BIT(hi2s->Instance->CR2, SPI_CR2_RXDMAEN);
- }
- else
- {
- /* nothing to do */
- }
-
- /* If the I2S peripheral is still not enabled, enable it */
- if (HAL_IS_BIT_CLR(hi2s->Instance->I2SCFGR, SPI_I2SCFGR_I2SE))
- {
- /* Enable I2S peripheral */
- __HAL_I2S_ENABLE(hi2s);
- }
-
- /* Process Unlocked */
- __HAL_UNLOCK(hi2s);
-
- return HAL_OK;
-}
-
-/**
- * @brief Stops the audio DMA Stream/Channel playing from the Media.
- * @param hi2s pointer to a I2S_HandleTypeDef structure that contains
- * the configuration information for I2S module
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_I2S_DMAStop(I2S_HandleTypeDef *hi2s)
-{
- HAL_StatusTypeDef errorcode = HAL_OK;
- /* The Lock is not implemented on this API to allow the user application
- to call the HAL SPI API under callbacks HAL_I2S_TxCpltCallback() or HAL_I2S_RxCpltCallback()
- when calling HAL_DMA_Abort() API the DMA TX or RX Transfer complete interrupt is generated
- and the correspond call back is executed HAL_I2S_TxCpltCallback() or HAL_I2S_RxCpltCallback()
- */
-
- if ((hi2s->Init.Mode == I2S_MODE_MASTER_TX) || (hi2s->Init.Mode == I2S_MODE_SLAVE_TX))
- {
- /* Abort the I2S DMA tx Stream/Channel */
- if (hi2s->hdmatx != NULL)
- {
- /* Disable the I2S DMA tx Stream/Channel */
- if (HAL_OK != HAL_DMA_Abort(hi2s->hdmatx))
- {
- SET_BIT(hi2s->ErrorCode, HAL_I2S_ERROR_DMA);
- errorcode = HAL_ERROR;
- }
- }
-
- /* Wait until TXE flag is set */
- if (I2S_WaitFlagStateUntilTimeout(hi2s, I2S_FLAG_TXE, SET, I2S_TIMEOUT_FLAG) != HAL_OK)
- {
- /* Set the error code */
- SET_BIT(hi2s->ErrorCode, HAL_I2S_ERROR_TIMEOUT);
- hi2s->State = HAL_I2S_STATE_READY;
- errorcode = HAL_ERROR;
- }
-
- /* Wait until BSY flag is Reset */
- if (I2S_WaitFlagStateUntilTimeout(hi2s, I2S_FLAG_BSY, RESET, I2S_TIMEOUT_FLAG) != HAL_OK)
- {
- /* Set the error code */
- SET_BIT(hi2s->ErrorCode, HAL_I2S_ERROR_TIMEOUT);
- hi2s->State = HAL_I2S_STATE_READY;
- errorcode = HAL_ERROR;
- }
-
- /* Disable I2S peripheral */
- __HAL_I2S_DISABLE(hi2s);
-
- /* Clear UDR flag */
- __HAL_I2S_CLEAR_UDRFLAG(hi2s);
-
- /* Disable the I2S Tx DMA requests */
- CLEAR_BIT(hi2s->Instance->CR2, SPI_CR2_TXDMAEN);
-
- }
-
- else if ((hi2s->Init.Mode == I2S_MODE_MASTER_RX) || (hi2s->Init.Mode == I2S_MODE_SLAVE_RX))
- {
- /* Abort the I2S DMA rx Stream/Channel */
- if (hi2s->hdmarx != NULL)
- {
- /* Disable the I2S DMA rx Stream/Channel */
- if (HAL_OK != HAL_DMA_Abort(hi2s->hdmarx))
- {
- SET_BIT(hi2s->ErrorCode, HAL_I2S_ERROR_DMA);
- errorcode = HAL_ERROR;
- }
- }
-
- /* Disable I2S peripheral */
- __HAL_I2S_DISABLE(hi2s);
-
- /* Clear OVR flag */
- __HAL_I2S_CLEAR_OVRFLAG(hi2s);
-
- /* Disable the I2S Rx DMA request */
- CLEAR_BIT(hi2s->Instance->CR2, SPI_CR2_RXDMAEN);
-
- if (hi2s->Init.Mode == I2S_MODE_SLAVE_RX)
- {
- /* Set the error code */
- SET_BIT(hi2s->ErrorCode, HAL_I2S_ERROR_BUSY_LINE_RX);
-
- /* Set the I2S State ready */
- hi2s->State = HAL_I2S_STATE_READY;
- errorcode = HAL_ERROR;
- }
- else
- {
- /* Read DR to Flush RX Data */
- READ_REG((hi2s->Instance)->DR);
- }
- }
-
- hi2s->State = HAL_I2S_STATE_READY;
-
- return errorcode;
-}
-
-/**
- * @brief This function handles I2S interrupt request.
- * @param hi2s pointer to a I2S_HandleTypeDef structure that contains
- * the configuration information for I2S module
- * @retval None
- */
-void HAL_I2S_IRQHandler(I2S_HandleTypeDef *hi2s)
-{
- uint32_t itsource = hi2s->Instance->CR2;
- uint32_t itflag = hi2s->Instance->SR;
-
- /* I2S in mode Receiver ------------------------------------------------*/
- if ((I2S_CHECK_FLAG(itflag, I2S_FLAG_OVR) == RESET) &&
- (I2S_CHECK_FLAG(itflag, I2S_FLAG_RXNE) != RESET) && (I2S_CHECK_IT_SOURCE(itsource, I2S_IT_RXNE) != RESET))
- {
- I2S_Receive_IT(hi2s);
- return;
- }
-
- /* I2S in mode Tramitter -----------------------------------------------*/
- if ((I2S_CHECK_FLAG(itflag, I2S_FLAG_TXE) != RESET) && (I2S_CHECK_IT_SOURCE(itsource, I2S_IT_TXE) != RESET))
- {
- I2S_Transmit_IT(hi2s);
- return;
- }
-
- /* I2S interrupt error -------------------------------------------------*/
- if (I2S_CHECK_IT_SOURCE(itsource, I2S_IT_ERR) != RESET)
- {
- /* I2S Overrun error interrupt occurred ---------------------------------*/
- if (I2S_CHECK_FLAG(itflag, I2S_FLAG_OVR) != RESET)
- {
- /* Disable RXNE and ERR interrupt */
- __HAL_I2S_DISABLE_IT(hi2s, (I2S_IT_RXNE | I2S_IT_ERR));
-
- /* Set the error code and execute error callback*/
- SET_BIT(hi2s->ErrorCode, HAL_I2S_ERROR_OVR);
- }
-
- /* I2S Underrun error interrupt occurred --------------------------------*/
- if (I2S_CHECK_FLAG(itflag, I2S_FLAG_UDR) != RESET)
- {
- /* Disable TXE and ERR interrupt */
- __HAL_I2S_DISABLE_IT(hi2s, (I2S_IT_TXE | I2S_IT_ERR));
-
- /* Set the error code and execute error callback*/
- SET_BIT(hi2s->ErrorCode, HAL_I2S_ERROR_UDR);
- }
-
- /* Set the I2S State ready */
- hi2s->State = HAL_I2S_STATE_READY;
-
- /* Call user error callback */
-#if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
- hi2s->ErrorCallback(hi2s);
-#else
- HAL_I2S_ErrorCallback(hi2s);
-#endif /* USE_HAL_I2S_REGISTER_CALLBACKS */
- }
-}
-
-/**
- * @brief Tx Transfer Half completed callbacks
- * @param hi2s pointer to a I2S_HandleTypeDef structure that contains
- * the configuration information for I2S module
- * @retval None
- */
-__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,
- the HAL_I2S_TxHalfCpltCallback could be implemented in the user file
- */
-}
-
-/**
- * @brief Tx Transfer completed callbacks
- * @param hi2s pointer to a I2S_HandleTypeDef structure that contains
- * the configuration information for I2S module
- * @retval None
- */
-__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,
- the HAL_I2S_TxCpltCallback could be implemented in the user file
- */
-}
-
-/**
- * @brief Rx Transfer half completed callbacks
- * @param hi2s pointer to a I2S_HandleTypeDef structure that contains
- * the configuration information for I2S module
- * @retval None
- */
-__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,
- the HAL_I2S_RxHalfCpltCallback could be implemented in the user file
- */
-}
-
-/**
- * @brief Rx Transfer completed callbacks
- * @param hi2s pointer to a I2S_HandleTypeDef structure that contains
- * the configuration information for I2S module
- * @retval None
- */
-__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,
- the HAL_I2S_RxCpltCallback could be implemented in the user file
- */
-}
-
-/**
- * @brief I2S error callbacks
- * @param hi2s pointer to a I2S_HandleTypeDef structure that contains
- * the configuration information for I2S module
- * @retval None
- */
-__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,
- the HAL_I2S_ErrorCallback could be implemented in the user file
- */
-}
-
-/**
- * @}
- */
-
-/** @defgroup I2S_Exported_Functions_Group3 Peripheral State and Errors functions
- * @brief Peripheral State functions
- *
-@verbatim
- ===============================================================================
- ##### Peripheral State and Errors functions #####
- ===============================================================================
- [..]
- This subsection permits to get in run-time the status of the peripheral
- and the data flow.
-
-@endverbatim
- * @{
- */
-
-/**
- * @brief Return the I2S state
- * @param hi2s pointer to a I2S_HandleTypeDef structure that contains
- * the configuration information for I2S module
- * @retval HAL state
- */
-HAL_I2S_StateTypeDef HAL_I2S_GetState(I2S_HandleTypeDef *hi2s)
-{
- return hi2s->State;
-}
-
-/**
- * @brief Return the I2S error code
- * @param hi2s pointer to a I2S_HandleTypeDef structure that contains
- * the configuration information for I2S module
- * @retval I2S Error Code
- */
-uint32_t HAL_I2S_GetError(I2S_HandleTypeDef *hi2s)
-{
- return hi2s->ErrorCode;
-}
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/** @addtogroup I2S_Private_Functions I2S Private Functions
- * @{
- */
-/**
- * @brief DMA I2S transmit process complete callback
- * @param hdma pointer to a DMA_HandleTypeDef structure that contains
- * the configuration information for the specified DMA module.
- * @retval None
- */
-static void I2S_DMATxCplt(DMA_HandleTypeDef *hdma)
-{
- I2S_HandleTypeDef *hi2s = (I2S_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; /* Derogation MISRAC2012-Rule-11.5 */
-
- /* if DMA is configured in DMA_NORMAL Mode */
- if (hdma->Init.Mode == DMA_NORMAL)
- {
- /* Disable Tx DMA Request */
- CLEAR_BIT(hi2s->Instance->CR2, SPI_CR2_TXDMAEN);
-
- hi2s->TxXferCount = 0U;
- hi2s->State = HAL_I2S_STATE_READY;
- }
- /* Call user Tx complete callback */
-#if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
- hi2s->TxCpltCallback(hi2s);
-#else
- HAL_I2S_TxCpltCallback(hi2s);
-#endif /* USE_HAL_I2S_REGISTER_CALLBACKS */
-}
-
-/**
- * @brief DMA I2S transmit process half complete callback
- * @param hdma pointer to a DMA_HandleTypeDef structure that contains
- * the configuration information for the specified DMA module.
- * @retval None
- */
-static void I2S_DMATxHalfCplt(DMA_HandleTypeDef *hdma)
-{
- I2S_HandleTypeDef *hi2s = (I2S_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; /* Derogation MISRAC2012-Rule-11.5 */
-
- /* Call user Tx half complete callback */
-#if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
- hi2s->TxHalfCpltCallback(hi2s);
-#else
- HAL_I2S_TxHalfCpltCallback(hi2s);
-#endif /* USE_HAL_I2S_REGISTER_CALLBACKS */
-}
-
-/**
- * @brief DMA I2S receive process complete callback
- * @param hdma pointer to a DMA_HandleTypeDef structure that contains
- * the configuration information for the specified DMA module.
- * @retval None
- */
-static void I2S_DMARxCplt(DMA_HandleTypeDef *hdma)
-{
- I2S_HandleTypeDef *hi2s = (I2S_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; /* Derogation MISRAC2012-Rule-11.5 */
-
- /* if DMA is configured in DMA_NORMAL Mode */
- if (hdma->Init.Mode == DMA_NORMAL)
- {
- /* Disable Rx DMA Request */
- CLEAR_BIT(hi2s->Instance->CR2, SPI_CR2_RXDMAEN);
- hi2s->RxXferCount = 0U;
- hi2s->State = HAL_I2S_STATE_READY;
- }
- /* Call user Rx complete callback */
-#if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
- hi2s->RxCpltCallback(hi2s);
-#else
- HAL_I2S_RxCpltCallback(hi2s);
-#endif /* USE_HAL_I2S_REGISTER_CALLBACKS */
-}
-
-/**
- * @brief DMA I2S receive process half complete callback
- * @param hdma pointer to a DMA_HandleTypeDef structure that contains
- * the configuration information for the specified DMA module.
- * @retval None
- */
-static void I2S_DMARxHalfCplt(DMA_HandleTypeDef *hdma)
-{
- I2S_HandleTypeDef *hi2s = (I2S_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; /* Derogation MISRAC2012-Rule-11.5 */
-
- /* Call user Rx half complete callback */
-#if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
- hi2s->RxHalfCpltCallback(hi2s);
-#else
- HAL_I2S_RxHalfCpltCallback(hi2s);
-#endif /* USE_HAL_I2S_REGISTER_CALLBACKS */
-}
-
-/**
- * @brief DMA I2S communication error callback
- * @param hdma pointer to a DMA_HandleTypeDef structure that contains
- * the configuration information for the specified DMA module.
- * @retval None
- */
-static void I2S_DMAError(DMA_HandleTypeDef *hdma)
-{
- I2S_HandleTypeDef *hi2s = (I2S_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; /* Derogation MISRAC2012-Rule-11.5 */
-
- /* Disable Rx and Tx DMA Request */
- CLEAR_BIT(hi2s->Instance->CR2, (SPI_CR2_RXDMAEN | SPI_CR2_TXDMAEN));
- hi2s->TxXferCount = 0U;
- hi2s->RxXferCount = 0U;
-
- hi2s->State = HAL_I2S_STATE_READY;
-
- /* Set the error code and execute error callback*/
- SET_BIT(hi2s->ErrorCode, HAL_I2S_ERROR_DMA);
- /* Call user error callback */
-#if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
- hi2s->ErrorCallback(hi2s);
-#else
- HAL_I2S_ErrorCallback(hi2s);
-#endif /* USE_HAL_I2S_REGISTER_CALLBACKS */
-}
-
-/**
- * @brief Transmit an amount of data in non-blocking mode with Interrupt
- * @param hi2s pointer to a I2S_HandleTypeDef structure that contains
- * the configuration information for I2S module
- * @retval None
- */
-static void I2S_Transmit_IT(I2S_HandleTypeDef *hi2s)
-{
- /* Transmit data */
- hi2s->Instance->DR = (*hi2s->pTxBuffPtr);
- hi2s->pTxBuffPtr++;
- hi2s->TxXferCount--;
-
- if (hi2s->TxXferCount == 0U)
- {
- /* Disable TXE and ERR interrupt */
- __HAL_I2S_DISABLE_IT(hi2s, (I2S_IT_TXE | I2S_IT_ERR));
-
- hi2s->State = HAL_I2S_STATE_READY;
- /* Call user Tx complete callback */
-#if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
- hi2s->TxCpltCallback(hi2s);
-#else
- HAL_I2S_TxCpltCallback(hi2s);
-#endif /* USE_HAL_I2S_REGISTER_CALLBACKS */
- }
-}
-
-/**
- * @brief Receive an amount of data in non-blocking mode with Interrupt
- * @param hi2s pointer to a I2S_HandleTypeDef structure that contains
- * the configuration information for I2S module
- * @retval None
- */
-static void I2S_Receive_IT(I2S_HandleTypeDef *hi2s)
-{
- /* Receive data */
- (*hi2s->pRxBuffPtr) = (uint16_t)hi2s->Instance->DR;
- hi2s->pRxBuffPtr++;
- hi2s->RxXferCount--;
-
- if (hi2s->RxXferCount == 0U)
- {
- /* Disable RXNE and ERR interrupt */
- __HAL_I2S_DISABLE_IT(hi2s, (I2S_IT_RXNE | I2S_IT_ERR));
-
- hi2s->State = HAL_I2S_STATE_READY;
- /* Call user Rx complete callback */
-#if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
- hi2s->RxCpltCallback(hi2s);
-#else
- HAL_I2S_RxCpltCallback(hi2s);
-#endif /* USE_HAL_I2S_REGISTER_CALLBACKS */
- }
-}
-
-/**
- * @brief This function handles I2S Communication Timeout.
- * @param hi2s pointer to a I2S_HandleTypeDef structure that contains
- * the configuration information for I2S module
- * @param Flag Flag checked
- * @param State Value of the flag expected
- * @param Timeout Duration of the timeout
- * @retval HAL status
- */
-static HAL_StatusTypeDef I2S_WaitFlagStateUntilTimeout(I2S_HandleTypeDef *hi2s, uint32_t Flag, FlagStatus State,
- uint32_t Timeout)
-{
- uint32_t tickstart;
-
- /* Get tick */
- tickstart = HAL_GetTick();
-
- /* Wait until flag is set to status*/
- while (((__HAL_I2S_GET_FLAG(hi2s, Flag)) ? SET : RESET) != State)
- {
- if (Timeout != HAL_MAX_DELAY)
- {
- if (((HAL_GetTick() - tickstart) >= Timeout) || (Timeout == 0U))
- {
- /* Set the I2S State ready */
- hi2s->State = HAL_I2S_STATE_READY;
-
- /* Process Unlocked */
- __HAL_UNLOCK(hi2s);
-
- return HAL_TIMEOUT;
- }
- }
- }
- return HAL_OK;
-}
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-#endif /* SPI_I2S_SUPPORT */
-
-#endif /* HAL_I2S_MODULE_ENABLED */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_irda.c b/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_irda.c
deleted file mode 100644
index 2ee229e4fe..0000000000
--- a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_irda.c
+++ /dev/null
@@ -1,2992 +0,0 @@
-/**
- ******************************************************************************
- * @file stm32l0xx_hal_irda.c
- * @author MCD Application Team
- * @brief IRDA HAL module driver.
- * This file provides firmware functions to manage the following
- * functionalities of the IrDA (Infrared Data Association) Peripheral
- * (IRDA)
- * + Initialization and de-initialization functions
- * + IO operation functions
- * + Peripheral State and Errors functions
- * + Peripheral Control functions
- *
- @verbatim
- ==============================================================================
- ##### How to use this driver #####
- ==============================================================================
- [..]
- The IRDA HAL driver can be used as follows:
-
- (#) Declare a IRDA_HandleTypeDef handle structure (eg. IRDA_HandleTypeDef hirda).
- (#) Initialize the IRDA low level resources by implementing the HAL_IRDA_MspInit() API
- in setting the associated USART or UART in IRDA mode:
- (++) Enable the USARTx/UARTx interface clock.
- (++) USARTx/UARTx pins configuration:
- (+++) Enable the clock for the USARTx/UARTx GPIOs.
- (+++) Configure these USARTx/UARTx pins (TX as alternate function pull-up, RX as alternate function Input).
- (++) NVIC configuration if you need to use interrupt process (HAL_IRDA_Transmit_IT()
- and HAL_IRDA_Receive_IT() APIs):
- (+++) Configure the USARTx/UARTx interrupt priority.
- (+++) Enable the NVIC USARTx/UARTx IRQ handle.
- (+++) The specific IRDA interrupts (Transmission complete interrupt,
- RXNE interrupt and Error Interrupts) will be managed using the macros
- __HAL_IRDA_ENABLE_IT() and __HAL_IRDA_DISABLE_IT() inside the transmit and receive process.
-
- (++) DMA Configuration if you need to use DMA process (HAL_IRDA_Transmit_DMA()
- and HAL_IRDA_Receive_DMA() APIs):
- (+++) Declare a DMA handle structure for the Tx/Rx channel.
- (+++) Enable the DMAx interface clock.
- (+++) Configure the declared DMA handle structure with the required Tx/Rx parameters.
- (+++) Configure the DMA Tx/Rx channel.
- (+++) Associate the initialized DMA handle to the IRDA DMA Tx/Rx handle.
- (+++) Configure the priority and enable the NVIC for the transfer
- complete interrupt on the DMA Tx/Rx channel.
-
- (#) Program the Baud Rate, Word Length and Parity and Mode(Receiver/Transmitter),
- the normal or low power mode and the clock prescaler in the hirda handle Init structure.
-
- (#) Initialize the IRDA registers by calling the HAL_IRDA_Init() API:
- (++) This API configures also the low level Hardware GPIO, CLOCK, CORTEX...etc)
- by calling the customized HAL_IRDA_MspInit() API.
-
- -@@- The specific IRDA interrupts (Transmission complete interrupt,
- RXNE interrupt and Error Interrupts) will be managed using the macros
- __HAL_IRDA_ENABLE_IT() and __HAL_IRDA_DISABLE_IT() inside the transmit and receive process.
-
- (#) Three operation modes are available within this driver :
-
- *** Polling mode IO operation ***
- =================================
- [..]
- (+) Send an amount of data in blocking mode using HAL_IRDA_Transmit()
- (+) Receive an amount of data in blocking mode using HAL_IRDA_Receive()
-
- *** Interrupt mode IO operation ***
- ===================================
- [..]
- (+) Send an amount of data in non-blocking mode using HAL_IRDA_Transmit_IT()
- (+) At transmission end of transfer HAL_IRDA_TxCpltCallback() is executed and user can
- add his own code by customization of function pointer HAL_IRDA_TxCpltCallback()
- (+) Receive an amount of data in non-blocking mode using HAL_IRDA_Receive_IT()
- (+) At reception end of transfer HAL_IRDA_RxCpltCallback() is executed and user can
- add his own code by customization of function pointer HAL_IRDA_RxCpltCallback()
- (+) In case of transfer Error, HAL_IRDA_ErrorCallback() function is executed and user can
- add his own code by customization of function pointer HAL_IRDA_ErrorCallback()
-
- *** DMA mode IO operation ***
- ==============================
- [..]
- (+) Send an amount of data in non-blocking mode (DMA) using HAL_IRDA_Transmit_DMA()
- (+) At transmission half of transfer HAL_IRDA_TxHalfCpltCallback() is executed and user can
- add his own code by customization of function pointer HAL_IRDA_TxHalfCpltCallback()
- (+) At transmission end of transfer HAL_IRDA_TxCpltCallback() is executed and user can
- add his own code by customization of function pointer HAL_IRDA_TxCpltCallback()
- (+) Receive an amount of data in non-blocking mode (DMA) using HAL_IRDA_Receive_DMA()
- (+) At reception half of transfer HAL_IRDA_RxHalfCpltCallback() is executed and user can
- add his own code by customization of function pointer HAL_IRDA_RxHalfCpltCallback()
- (+) At reception end of transfer HAL_IRDA_RxCpltCallback() is executed and user can
- add his own code by customization of function pointer HAL_IRDA_RxCpltCallback()
- (+) In case of transfer Error, HAL_IRDA_ErrorCallback() function is executed and user can
- add his own code by customization of function pointer HAL_IRDA_ErrorCallback()
-
- *** IRDA HAL driver macros list ***
- ====================================
- [..]
- Below the list of most used macros in IRDA HAL driver.
-
- (+) __HAL_IRDA_ENABLE: Enable the IRDA peripheral
- (+) __HAL_IRDA_DISABLE: Disable the IRDA peripheral
- (+) __HAL_IRDA_GET_FLAG : Check whether the specified IRDA flag is set or not
- (+) __HAL_IRDA_CLEAR_FLAG : Clear the specified IRDA pending flag
- (+) __HAL_IRDA_ENABLE_IT: Enable the specified IRDA interrupt
- (+) __HAL_IRDA_DISABLE_IT: Disable the specified IRDA interrupt
- (+) __HAL_IRDA_GET_IT_SOURCE: Check whether or not the specified IRDA interrupt is enabled
-
- [..]
- (@) You can refer to the IRDA HAL driver header file for more useful macros
-
- ##### Callback registration #####
- ==================================
-
- [..]
- The compilation define USE_HAL_IRDA_REGISTER_CALLBACKS when set to 1
- allows the user to configure dynamically the driver callbacks.
-
- [..]
- Use Function HAL_IRDA_RegisterCallback() to register a user callback.
- Function HAL_IRDA_RegisterCallback() allows to register following callbacks:
- (+) TxHalfCpltCallback : Tx Half Complete Callback.
- (+) TxCpltCallback : Tx Complete Callback.
- (+) RxHalfCpltCallback : Rx Half Complete Callback.
- (+) RxCpltCallback : Rx Complete Callback.
- (+) ErrorCallback : Error Callback.
- (+) AbortCpltCallback : Abort Complete Callback.
- (+) AbortTransmitCpltCallback : Abort Transmit Complete Callback.
- (+) AbortReceiveCpltCallback : Abort Receive Complete Callback.
- (+) MspInitCallback : IRDA MspInit.
- (+) MspDeInitCallback : IRDA MspDeInit.
- This function takes as parameters the HAL peripheral handle, the Callback ID
- and a pointer to the user callback function.
-
- [..]
- Use function HAL_IRDA_UnRegisterCallback() to reset a callback to the default
- weak (surcharged) function.
- HAL_IRDA_UnRegisterCallback() takes as parameters the HAL peripheral handle,
- and the Callback ID.
- This function allows to reset following callbacks:
- (+) TxHalfCpltCallback : Tx Half Complete Callback.
- (+) TxCpltCallback : Tx Complete Callback.
- (+) RxHalfCpltCallback : Rx Half Complete Callback.
- (+) RxCpltCallback : Rx Complete Callback.
- (+) ErrorCallback : Error Callback.
- (+) AbortCpltCallback : Abort Complete Callback.
- (+) AbortTransmitCpltCallback : Abort Transmit Complete Callback.
- (+) AbortReceiveCpltCallback : Abort Receive Complete Callback.
- (+) MspInitCallback : IRDA MspInit.
- (+) MspDeInitCallback : IRDA MspDeInit.
-
- [..]
- By default, after the HAL_IRDA_Init() and when the state is HAL_IRDA_STATE_RESET
- all callbacks are set to the corresponding weak (surcharged) functions:
- examples HAL_IRDA_TxCpltCallback(), HAL_IRDA_RxHalfCpltCallback().
- Exception done for MspInit and MspDeInit functions that are respectively
- reset to the legacy weak (surcharged) functions in the HAL_IRDA_Init()
- and HAL_IRDA_DeInit() only when these callbacks are null (not registered beforehand).
- If not, MspInit or MspDeInit are not null, the HAL_IRDA_Init() and HAL_IRDA_DeInit()
- keep and use the user MspInit/MspDeInit callbacks (registered beforehand).
-
- [..]
- Callbacks can be registered/unregistered in HAL_IRDA_STATE_READY state only.
- Exception done MspInit/MspDeInit that can be registered/unregistered
- in HAL_IRDA_STATE_READY or HAL_IRDA_STATE_RESET state, thus registered (user)
- MspInit/DeInit callbacks can be used during the Init/DeInit.
- In that case first register the MspInit/MspDeInit user callbacks
- using HAL_IRDA_RegisterCallback() before calling HAL_IRDA_DeInit()
- or HAL_IRDA_Init() function.
-
- [..]
- When The compilation define USE_HAL_IRDA_REGISTER_CALLBACKS is set to 0 or
- not defined, the callback registration feature is not available
- and weak (surcharged) callbacks are used.
-
- @endverbatim
- ******************************************************************************
- * @attention
- *
- *
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- ******************************************************************************
- */
-
-#if !defined (STM32L010x4) && !defined (STM32L010x6) && !defined (STM32L010x8)
-/* Includes ------------------------------------------------------------------*/
-#include "stm32l0xx_hal.h"
-
-/** @addtogroup STM32L0xx_HAL_Driver
- * @{
- */
-
-/** @defgroup IRDA IRDA
- * @brief HAL IRDA module driver
- * @{
- */
-
-#ifdef HAL_IRDA_MODULE_ENABLED
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/** @defgroup IRDA_Private_Constants IRDA Private Constants
- * @{
- */
-#define IRDA_TEACK_REACK_TIMEOUT 1000U /*!< IRDA TX or RX enable acknowledge time-out value */
-
-#define IRDA_CR1_FIELDS ((uint32_t)(USART_CR1_M | USART_CR1_PCE \
- | USART_CR1_PS | USART_CR1_TE | USART_CR1_RE)) /*!< UART or USART CR1 fields of parameters set by IRDA_SetConfig API */
-
-#define USART_BRR_MIN 0x10U /*!< USART BRR minimum authorized value */
-
-#define USART_BRR_MAX 0x0000FFFFU /*!< USART BRR maximum authorized value */
-/**
- * @}
- */
-
-/* Private macros ------------------------------------------------------------*/
-/** @defgroup IRDA_Private_Macros IRDA Private Macros
- * @{
- */
-/** @brief BRR division operation to set BRR register in 16-bit oversampling mode.
- * @param __PCLK__ IRDA clock source.
- * @param __BAUD__ Baud rate set by the user.
- * @retval Division result
- */
-#define IRDA_DIV_SAMPLING16(__PCLK__, __BAUD__) (((__PCLK__) + ((__BAUD__)/2U)) / (__BAUD__))
-/**
- * @}
- */
-
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/** @addtogroup IRDA_Private_Functions
- * @{
- */
-#if (USE_HAL_IRDA_REGISTER_CALLBACKS == 1)
-void IRDA_InitCallbacksToDefault(IRDA_HandleTypeDef *hirda);
-#endif /* USE_HAL_IRDA_REGISTER_CALLBACKS */
-static HAL_StatusTypeDef IRDA_SetConfig(IRDA_HandleTypeDef *hirda);
-static HAL_StatusTypeDef IRDA_CheckIdleState(IRDA_HandleTypeDef *hirda);
-static HAL_StatusTypeDef IRDA_WaitOnFlagUntilTimeout(IRDA_HandleTypeDef *hirda, uint32_t Flag, FlagStatus Status,
- uint32_t Tickstart, uint32_t Timeout);
-static void IRDA_EndTxTransfer(IRDA_HandleTypeDef *hirda);
-static void IRDA_EndRxTransfer(IRDA_HandleTypeDef *hirda);
-static void IRDA_DMATransmitCplt(DMA_HandleTypeDef *hdma);
-static void IRDA_DMATransmitHalfCplt(DMA_HandleTypeDef *hdma);
-static void IRDA_DMAReceiveCplt(DMA_HandleTypeDef *hdma);
-static void IRDA_DMAReceiveHalfCplt(DMA_HandleTypeDef *hdma);
-static void IRDA_DMAError(DMA_HandleTypeDef *hdma);
-static void IRDA_DMAAbortOnError(DMA_HandleTypeDef *hdma);
-static void IRDA_DMATxAbortCallback(DMA_HandleTypeDef *hdma);
-static void IRDA_DMARxAbortCallback(DMA_HandleTypeDef *hdma);
-static void IRDA_DMATxOnlyAbortCallback(DMA_HandleTypeDef *hdma);
-static void IRDA_DMARxOnlyAbortCallback(DMA_HandleTypeDef *hdma);
-static void IRDA_Transmit_IT(IRDA_HandleTypeDef *hirda);
-static void IRDA_EndTransmit_IT(IRDA_HandleTypeDef *hirda);
-static void IRDA_Receive_IT(IRDA_HandleTypeDef *hirda);
-/**
- * @}
- */
-
-/* Exported functions --------------------------------------------------------*/
-
-/** @defgroup IRDA_Exported_Functions IRDA Exported Functions
- * @{
- */
-
-/** @defgroup IRDA_Exported_Functions_Group1 Initialization and de-initialization functions
- * @brief Initialization and Configuration functions
- *
-@verbatim
- ==============================================================================
- ##### Initialization and Configuration functions #####
- ==============================================================================
- [..]
- This subsection provides a set of functions allowing to initialize the USARTx
- in asynchronous IRDA mode.
- (+) For the asynchronous mode only these parameters can be configured:
- (++) Baud Rate
- (++) Word Length
- (++) Parity: If the parity is enabled, then the MSB bit of the data written
- in the data register is transmitted but is changed by the parity bit.
- (++) Power mode
- (++) Prescaler setting
- (++) Receiver/transmitter modes
-
- [..]
- The HAL_IRDA_Init() API follows the USART asynchronous configuration procedures
- (details for the procedures are available in reference manual).
-
-@endverbatim
-
- Depending on the frame length defined by the M1 and M0 bits (7-bit,
- 8-bit or 9-bit), the possible IRDA frame formats are listed in the
- following table.
-
- Table 1. IRDA frame format.
- +-----------------------------------------------------------------------+
- | M1 bit | M0 bit | PCE bit | IRDA frame |
- |---------|---------|-----------|---------------------------------------|
- | 0 | 0 | 0 | | SB | 8 bit data | STB | |
- |---------|---------|-----------|---------------------------------------|
- | 0 | 0 | 1 | | SB | 7 bit data | PB | STB | |
- |---------|---------|-----------|---------------------------------------|
- | 0 | 1 | 0 | | SB | 9 bit data | STB | |
- |---------|---------|-----------|---------------------------------------|
- | 0 | 1 | 1 | | SB | 8 bit data | PB | STB | |
- |---------|---------|-----------|---------------------------------------|
- | 1 | 0 | 0 | | SB | 7 bit data | STB | |
- |---------|---------|-----------|---------------------------------------|
- | 1 | 0 | 1 | | SB | 6 bit data | PB | STB | |
- +-----------------------------------------------------------------------+
-
- * @{
- */
-
-/**
- * @brief Initialize the IRDA mode according to the specified
- * parameters in the IRDA_InitTypeDef and initialize the associated handle.
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified IRDA module.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_IRDA_Init(IRDA_HandleTypeDef *hirda)
-{
- /* Check the IRDA handle allocation */
- if (hirda == NULL)
- {
- return HAL_ERROR;
- }
-
- /* Check the USART/UART associated to the IRDA handle */
- assert_param(IS_IRDA_INSTANCE(hirda->Instance));
-
- if (hirda->gState == HAL_IRDA_STATE_RESET)
- {
- /* Allocate lock resource and initialize it */
- hirda->Lock = HAL_UNLOCKED;
-
-#if USE_HAL_IRDA_REGISTER_CALLBACKS == 1
- IRDA_InitCallbacksToDefault(hirda);
-
- if (hirda->MspInitCallback == NULL)
- {
- hirda->MspInitCallback = HAL_IRDA_MspInit;
- }
-
- /* Init the low level hardware */
- hirda->MspInitCallback(hirda);
-#else
- /* Init the low level hardware : GPIO, CLOCK */
- HAL_IRDA_MspInit(hirda);
-#endif /* USE_HAL_IRDA_REGISTER_CALLBACKS */
- }
-
- hirda->gState = HAL_IRDA_STATE_BUSY;
-
- /* Disable the Peripheral to update the configuration registers */
- __HAL_IRDA_DISABLE(hirda);
-
- /* Set the IRDA Communication parameters */
- if (IRDA_SetConfig(hirda) == HAL_ERROR)
- {
- return HAL_ERROR;
- }
-
- /* In IRDA mode, the following bits must be kept cleared:
- - LINEN, STOP and CLKEN bits in the USART_CR2 register,
- - SCEN and HDSEL bits in the USART_CR3 register.*/
- CLEAR_BIT(hirda->Instance->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN | USART_CR2_STOP));
- CLEAR_BIT(hirda->Instance->CR3, (USART_CR3_SCEN | USART_CR3_HDSEL));
-
- /* set the UART/USART in IRDA mode */
- hirda->Instance->CR3 |= USART_CR3_IREN;
-
- /* Enable the Peripheral */
- __HAL_IRDA_ENABLE(hirda);
-
- /* TEACK and/or REACK to check before moving hirda->gState and hirda->RxState to Ready */
- return (IRDA_CheckIdleState(hirda));
-}
-
-/**
- * @brief DeInitialize the IRDA peripheral.
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified IRDA module.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_IRDA_DeInit(IRDA_HandleTypeDef *hirda)
-{
- /* Check the IRDA handle allocation */
- if (hirda == NULL)
- {
- return HAL_ERROR;
- }
-
- /* Check the USART/UART associated to the IRDA handle */
- assert_param(IS_IRDA_INSTANCE(hirda->Instance));
-
- hirda->gState = HAL_IRDA_STATE_BUSY;
-
- /* DeInit the low level hardware */
-#if USE_HAL_IRDA_REGISTER_CALLBACKS == 1
- if (hirda->MspDeInitCallback == NULL)
- {
- hirda->MspDeInitCallback = HAL_IRDA_MspDeInit;
- }
- /* DeInit the low level hardware */
- hirda->MspDeInitCallback(hirda);
-#else
- HAL_IRDA_MspDeInit(hirda);
-#endif /* USE_HAL_IRDA_REGISTER_CALLBACKS */
- /* Disable the Peripheral */
- __HAL_IRDA_DISABLE(hirda);
-
- hirda->ErrorCode = HAL_IRDA_ERROR_NONE;
- hirda->gState = HAL_IRDA_STATE_RESET;
- hirda->RxState = HAL_IRDA_STATE_RESET;
-
- /* Process Unlock */
- __HAL_UNLOCK(hirda);
-
- return HAL_OK;
-}
-
-/**
- * @brief Initialize the IRDA MSP.
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified IRDA module.
- * @retval None
- */
-__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,
- the HAL_IRDA_MspInit can be implemented in the user file
- */
-}
-
-/**
- * @brief DeInitialize the IRDA MSP.
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified IRDA module.
- * @retval None
- */
-__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,
- the HAL_IRDA_MspDeInit can be implemented in the user file
- */
-}
-
-#if (USE_HAL_IRDA_REGISTER_CALLBACKS == 1)
-/**
- * @brief Register a User IRDA Callback
- * To be used instead of the weak predefined callback
- * @param hirda irda handle
- * @param CallbackID ID of the callback to be registered
- * This parameter can be one of the following values:
- * @arg @ref HAL_IRDA_TX_HALFCOMPLETE_CB_ID Tx Half Complete Callback ID
- * @arg @ref HAL_IRDA_TX_COMPLETE_CB_ID Tx Complete Callback ID
- * @arg @ref HAL_IRDA_RX_HALFCOMPLETE_CB_ID Rx Half Complete Callback ID
- * @arg @ref HAL_IRDA_RX_COMPLETE_CB_ID Rx Complete Callback ID
- * @arg @ref HAL_IRDA_ERROR_CB_ID Error Callback ID
- * @arg @ref HAL_IRDA_ABORT_COMPLETE_CB_ID Abort Complete Callback ID
- * @arg @ref HAL_IRDA_ABORT_TRANSMIT_COMPLETE_CB_ID Abort Transmit Complete Callback ID
- * @arg @ref HAL_IRDA_ABORT_RECEIVE_COMPLETE_CB_ID Abort Receive Complete Callback ID
- * @arg @ref HAL_IRDA_MSPINIT_CB_ID MspInit Callback ID
- * @arg @ref HAL_IRDA_MSPDEINIT_CB_ID MspDeInit Callback ID
- * @param pCallback pointer to the Callback function
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_IRDA_RegisterCallback(IRDA_HandleTypeDef *hirda, HAL_IRDA_CallbackIDTypeDef CallbackID,
- pIRDA_CallbackTypeDef pCallback)
-{
- HAL_StatusTypeDef status = HAL_OK;
-
- if (pCallback == NULL)
- {
- /* Update the error code */
- hirda->ErrorCode |= HAL_IRDA_ERROR_INVALID_CALLBACK;
-
- return HAL_ERROR;
- }
- /* Process locked */
- __HAL_LOCK(hirda);
-
- if (hirda->gState == HAL_IRDA_STATE_READY)
- {
- switch (CallbackID)
- {
- case HAL_IRDA_TX_HALFCOMPLETE_CB_ID :
- hirda->TxHalfCpltCallback = pCallback;
- break;
-
- case HAL_IRDA_TX_COMPLETE_CB_ID :
- hirda->TxCpltCallback = pCallback;
- break;
-
- case HAL_IRDA_RX_HALFCOMPLETE_CB_ID :
- hirda->RxHalfCpltCallback = pCallback;
- break;
-
- case HAL_IRDA_RX_COMPLETE_CB_ID :
- hirda->RxCpltCallback = pCallback;
- break;
-
- case HAL_IRDA_ERROR_CB_ID :
- hirda->ErrorCallback = pCallback;
- break;
-
- case HAL_IRDA_ABORT_COMPLETE_CB_ID :
- hirda->AbortCpltCallback = pCallback;
- break;
-
- case HAL_IRDA_ABORT_TRANSMIT_COMPLETE_CB_ID :
- hirda->AbortTransmitCpltCallback = pCallback;
- break;
-
- case HAL_IRDA_ABORT_RECEIVE_COMPLETE_CB_ID :
- hirda->AbortReceiveCpltCallback = pCallback;
- break;
-
- case HAL_IRDA_MSPINIT_CB_ID :
- hirda->MspInitCallback = pCallback;
- break;
-
- case HAL_IRDA_MSPDEINIT_CB_ID :
- hirda->MspDeInitCallback = pCallback;
- break;
-
- default :
- /* Update the error code */
- hirda->ErrorCode |= HAL_IRDA_ERROR_INVALID_CALLBACK;
-
- /* Return error status */
- status = HAL_ERROR;
- break;
- }
- }
- else if (hirda->gState == HAL_IRDA_STATE_RESET)
- {
- switch (CallbackID)
- {
- case HAL_IRDA_MSPINIT_CB_ID :
- hirda->MspInitCallback = pCallback;
- break;
-
- case HAL_IRDA_MSPDEINIT_CB_ID :
- hirda->MspDeInitCallback = pCallback;
- break;
-
- default :
- /* Update the error code */
- hirda->ErrorCode |= HAL_IRDA_ERROR_INVALID_CALLBACK;
-
- /* Return error status */
- status = HAL_ERROR;
- break;
- }
- }
- else
- {
- /* Update the error code */
- hirda->ErrorCode |= HAL_IRDA_ERROR_INVALID_CALLBACK;
-
- /* Return error status */
- status = HAL_ERROR;
- }
-
- /* Release Lock */
- __HAL_UNLOCK(hirda);
-
- return status;
-}
-
-/**
- * @brief Unregister an IRDA callback
- * IRDA callback is redirected to the weak predefined callback
- * @param hirda irda handle
- * @param CallbackID ID of the callback to be unregistered
- * This parameter can be one of the following values:
- * @arg @ref HAL_IRDA_TX_HALFCOMPLETE_CB_ID Tx Half Complete Callback ID
- * @arg @ref HAL_IRDA_TX_COMPLETE_CB_ID Tx Complete Callback ID
- * @arg @ref HAL_IRDA_RX_HALFCOMPLETE_CB_ID Rx Half Complete Callback ID
- * @arg @ref HAL_IRDA_RX_COMPLETE_CB_ID Rx Complete Callback ID
- * @arg @ref HAL_IRDA_ERROR_CB_ID Error Callback ID
- * @arg @ref HAL_IRDA_ABORT_COMPLETE_CB_ID Abort Complete Callback ID
- * @arg @ref HAL_IRDA_ABORT_TRANSMIT_COMPLETE_CB_ID Abort Transmit Complete Callback ID
- * @arg @ref HAL_IRDA_ABORT_RECEIVE_COMPLETE_CB_ID Abort Receive Complete Callback ID
- * @arg @ref HAL_IRDA_MSPINIT_CB_ID MspInit Callback ID
- * @arg @ref HAL_IRDA_MSPDEINIT_CB_ID MspDeInit Callback ID
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_IRDA_UnRegisterCallback(IRDA_HandleTypeDef *hirda, HAL_IRDA_CallbackIDTypeDef CallbackID)
-{
- HAL_StatusTypeDef status = HAL_OK;
-
- /* Process locked */
- __HAL_LOCK(hirda);
-
- if (HAL_IRDA_STATE_READY == hirda->gState)
- {
- switch (CallbackID)
- {
- case HAL_IRDA_TX_HALFCOMPLETE_CB_ID :
- hirda->TxHalfCpltCallback = HAL_IRDA_TxHalfCpltCallback; /* Legacy weak TxHalfCpltCallback */
- break;
-
- case HAL_IRDA_TX_COMPLETE_CB_ID :
- hirda->TxCpltCallback = HAL_IRDA_TxCpltCallback; /* Legacy weak TxCpltCallback */
- break;
-
- case HAL_IRDA_RX_HALFCOMPLETE_CB_ID :
- hirda->RxHalfCpltCallback = HAL_IRDA_RxHalfCpltCallback; /* Legacy weak RxHalfCpltCallback */
- break;
-
- case HAL_IRDA_RX_COMPLETE_CB_ID :
- hirda->RxCpltCallback = HAL_IRDA_RxCpltCallback; /* Legacy weak RxCpltCallback */
- break;
-
- case HAL_IRDA_ERROR_CB_ID :
- hirda->ErrorCallback = HAL_IRDA_ErrorCallback; /* Legacy weak ErrorCallback */
- break;
-
- case HAL_IRDA_ABORT_COMPLETE_CB_ID :
- hirda->AbortCpltCallback = HAL_IRDA_AbortCpltCallback; /* Legacy weak AbortCpltCallback */
- break;
-
- case HAL_IRDA_ABORT_TRANSMIT_COMPLETE_CB_ID :
- hirda->AbortTransmitCpltCallback = HAL_IRDA_AbortTransmitCpltCallback; /* Legacy weak
- AbortTransmitCpltCallback */
- break;
-
- case HAL_IRDA_ABORT_RECEIVE_COMPLETE_CB_ID :
- hirda->AbortReceiveCpltCallback = HAL_IRDA_AbortReceiveCpltCallback; /* Legacy weak
- AbortReceiveCpltCallback */
- break;
-
- case HAL_IRDA_MSPINIT_CB_ID :
- hirda->MspInitCallback = HAL_IRDA_MspInit; /* Legacy weak MspInitCallback */
- break;
-
- case HAL_IRDA_MSPDEINIT_CB_ID :
- hirda->MspDeInitCallback = HAL_IRDA_MspDeInit; /* Legacy weak MspDeInitCallback */
- break;
-
- default :
- /* Update the error code */
- hirda->ErrorCode |= HAL_IRDA_ERROR_INVALID_CALLBACK;
-
- /* Return error status */
- status = HAL_ERROR;
- break;
- }
- }
- else if (HAL_IRDA_STATE_RESET == hirda->gState)
- {
- switch (CallbackID)
- {
- case HAL_IRDA_MSPINIT_CB_ID :
- hirda->MspInitCallback = HAL_IRDA_MspInit;
- break;
-
- case HAL_IRDA_MSPDEINIT_CB_ID :
- hirda->MspDeInitCallback = HAL_IRDA_MspDeInit;
- break;
-
- default :
- /* Update the error code */
- hirda->ErrorCode |= HAL_IRDA_ERROR_INVALID_CALLBACK;
-
- /* Return error status */
- status = HAL_ERROR;
- break;
- }
- }
- else
- {
- /* Update the error code */
- hirda->ErrorCode |= HAL_IRDA_ERROR_INVALID_CALLBACK;
-
- /* Return error status */
- status = HAL_ERROR;
- }
-
- /* Release Lock */
- __HAL_UNLOCK(hirda);
-
- return status;
-}
-#endif /* USE_HAL_IRDA_REGISTER_CALLBACKS */
-
-/**
- * @}
- */
-
-/** @defgroup IRDA_Exported_Functions_Group2 IO operation functions
- * @brief IRDA Transmit and Receive functions
- *
-@verbatim
- ===============================================================================
- ##### IO operation functions #####
- ===============================================================================
- [..]
- This subsection provides a set of functions allowing to manage the IRDA data transfers.
-
- [..]
- IrDA is a half duplex communication protocol. If the Transmitter is busy, any data
- on the IrDA receive line will be ignored by the IrDA decoder and if the Receiver
- is busy, data on the TX from the USART to IrDA will not be encoded by IrDA.
- While receiving data, transmission should be avoided as the data to be transmitted
- could be corrupted.
-
- [..]
- (#) There are two modes of transfer:
- (++) Blocking mode: the communication is performed in polling mode.
- The HAL status of all data processing is returned by the same function
- after finishing transfer.
- (++) Non-Blocking mode: the communication is performed using Interrupts
- or DMA, these API's return the HAL status.
- The end of the data processing will be indicated through the
- dedicated IRDA IRQ when using Interrupt mode or the DMA IRQ when
- using DMA mode.
- The HAL_IRDA_TxCpltCallback(), HAL_IRDA_RxCpltCallback() user callbacks
- will be executed respectively at the end of the Transmit or Receive process
- The HAL_IRDA_ErrorCallback() user callback will be executed when a communication error is detected
-
- (#) Blocking mode APIs are :
- (++) HAL_IRDA_Transmit()
- (++) HAL_IRDA_Receive()
-
- (#) Non Blocking mode APIs with Interrupt are :
- (++) HAL_IRDA_Transmit_IT()
- (++) HAL_IRDA_Receive_IT()
- (++) HAL_IRDA_IRQHandler()
-
- (#) Non Blocking mode functions with DMA are :
- (++) HAL_IRDA_Transmit_DMA()
- (++) HAL_IRDA_Receive_DMA()
- (++) HAL_IRDA_DMAPause()
- (++) HAL_IRDA_DMAResume()
- (++) HAL_IRDA_DMAStop()
-
- (#) A set of Transfer Complete Callbacks are provided in Non Blocking mode:
- (++) HAL_IRDA_TxHalfCpltCallback()
- (++) HAL_IRDA_TxCpltCallback()
- (++) HAL_IRDA_RxHalfCpltCallback()
- (++) HAL_IRDA_RxCpltCallback()
- (++) HAL_IRDA_ErrorCallback()
-
- (#) Non-Blocking mode transfers could be aborted using Abort API's :
- (++) HAL_IRDA_Abort()
- (++) HAL_IRDA_AbortTransmit()
- (++) HAL_IRDA_AbortReceive()
- (++) HAL_IRDA_Abort_IT()
- (++) HAL_IRDA_AbortTransmit_IT()
- (++) HAL_IRDA_AbortReceive_IT()
-
- (#) For Abort services based on interrupts (HAL_IRDA_Abortxxx_IT), a set of Abort Complete Callbacks are provided:
- (++) HAL_IRDA_AbortCpltCallback()
- (++) HAL_IRDA_AbortTransmitCpltCallback()
- (++) HAL_IRDA_AbortReceiveCpltCallback()
-
- (#) In Non-Blocking mode transfers, possible errors are split into 2 categories.
- Errors are handled as follows :
- (++) Error is considered as Recoverable and non blocking : Transfer could go till end, but error severity is
- to be evaluated by user : this concerns Frame Error, Parity Error or Noise Error
- in Interrupt mode reception .
- Received character is then retrieved and stored in Rx buffer, Error code is set to allow user
- to identify error type, and HAL_IRDA_ErrorCallback() user callback is executed.
- Transfer is kept ongoing on IRDA side.
- If user wants to abort it, Abort services should be called by user.
- (++) Error is considered as Blocking : Transfer could not be completed properly and is aborted.
- This concerns Overrun Error In Interrupt mode reception and all errors in DMA mode.
- Error code is set to allow user to identify error type, and
- HAL_IRDA_ErrorCallback() user callback is executed.
-
-@endverbatim
- * @{
- */
-
-/**
- * @brief Send an amount of data in blocking mode.
- * @note When UART parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01),
- * the sent data is handled as a set of u16. In this case, Size must reflect the number
- * of u16 available through pData.
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified IRDA module.
- * @param pData Pointer to data buffer (u8 or u16 data elements).
- * @param Size Amount of data elements (u8 or u16) to be sent.
- * @param Timeout Specify timeout value.
- * @retval HAL status
- */
-/**
- * @note When IRDA parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01),
- * address of user data buffer containing data to be sent, should be aligned on a half word frontier (16 bits)
- * (as sent data will be handled using u16 pointer cast). Depending on compilation chain,
- * use of specific alignment compilation directives or pragmas might be required to ensure proper alignment for pData.
- */
-HAL_StatusTypeDef HAL_IRDA_Transmit(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size, uint32_t Timeout)
-{
- uint8_t *pdata8bits;
- uint16_t *pdata16bits;
- uint32_t tickstart;
-
- /* Check that a Tx process is not already ongoing */
- if (hirda->gState == HAL_IRDA_STATE_READY)
- {
- if ((pData == NULL) || (Size == 0U))
- {
- return HAL_ERROR;
- }
-
- /* In case of 9bits/No Parity transfer, pData buffer provided as input parameter
- should be aligned on a u16 frontier, as data to be filled into TDR will be
- handled through a u16 cast. */
- if ((hirda->Init.WordLength == IRDA_WORDLENGTH_9B) && (hirda->Init.Parity == IRDA_PARITY_NONE))
- {
- if ((((uint32_t)pData) & 1U) != 0U)
- {
- return HAL_ERROR;
- }
- }
-
- /* Process Locked */
- __HAL_LOCK(hirda);
-
- hirda->ErrorCode = HAL_IRDA_ERROR_NONE;
- hirda->gState = HAL_IRDA_STATE_BUSY_TX;
-
- /* Init tickstart for timeout management */
- tickstart = HAL_GetTick();
-
- hirda->TxXferSize = Size;
- hirda->TxXferCount = Size;
-
- /* In case of 9bits/No Parity transfer, pData needs to be handled as a uint16_t pointer */
- if ((hirda->Init.WordLength == IRDA_WORDLENGTH_9B) && (hirda->Init.Parity == IRDA_PARITY_NONE))
- {
- pdata8bits = NULL;
- pdata16bits = (uint16_t *) pData; /* Derogation R.11.3 */
- }
- else
- {
- pdata8bits = pData;
- pdata16bits = NULL;
- }
-
- while (hirda->TxXferCount > 0U)
- {
- hirda->TxXferCount--;
-
- if (IRDA_WaitOnFlagUntilTimeout(hirda, IRDA_FLAG_TXE, RESET, tickstart, Timeout) != HAL_OK)
- {
- return HAL_TIMEOUT;
- }
- if (pdata8bits == NULL)
- {
- hirda->Instance->TDR = (uint16_t)(*pdata16bits & 0x01FFU);
- pdata16bits++;
- }
- else
- {
- hirda->Instance->TDR = (uint8_t)(*pdata8bits & 0xFFU);
- pdata8bits++;
- }
- }
-
- if (IRDA_WaitOnFlagUntilTimeout(hirda, IRDA_FLAG_TC, RESET, tickstart, Timeout) != HAL_OK)
- {
- return HAL_TIMEOUT;
- }
-
- /* At end of Tx process, restore hirda->gState to Ready */
- hirda->gState = HAL_IRDA_STATE_READY;
-
- /* Process Unlocked */
- __HAL_UNLOCK(hirda);
-
- return HAL_OK;
- }
- else
- {
- return HAL_BUSY;
- }
-}
-
-/**
- * @brief Receive an amount of data in blocking mode.
- * @note When UART parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01),
- * the received data is handled as a set of u16. In this case, Size must reflect the number
- * of u16 available through pData.
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified IRDA module.
- * @param pData Pointer to data buffer (u8 or u16 data elements).
- * @param Size Amount of data elements (u8 or u16) to be received.
- * @param Timeout Specify timeout value.
- * @retval HAL status
- */
-/**
- * @note When IRDA parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01),
- * address of user data buffer for storing data to be received, should be aligned on a half word frontier (16 bits)
- * (as received data will be handled using u16 pointer cast). Depending on compilation chain,
- * use of specific alignment compilation directives or pragmas might be required to ensure proper alignment for pData.
- */
-HAL_StatusTypeDef HAL_IRDA_Receive(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size, uint32_t Timeout)
-{
- uint8_t *pdata8bits;
- uint16_t *pdata16bits;
- uint16_t uhMask;
- uint32_t tickstart;
-
- /* Check that a Rx process is not already ongoing */
- if (hirda->RxState == HAL_IRDA_STATE_READY)
- {
- if ((pData == NULL) || (Size == 0U))
- {
- return HAL_ERROR;
- }
-
- /* In case of 9bits/No Parity transfer, pData buffer provided as input parameter
- should be aligned on a u16 frontier, as data to be received from RDR will be
- handled through a u16 cast. */
- if ((hirda->Init.WordLength == IRDA_WORDLENGTH_9B) && (hirda->Init.Parity == IRDA_PARITY_NONE))
- {
- if ((((uint32_t)pData) & 1U) != 0U)
- {
- return HAL_ERROR;
- }
- }
-
- /* Process Locked */
- __HAL_LOCK(hirda);
-
- hirda->ErrorCode = HAL_IRDA_ERROR_NONE;
- hirda->RxState = HAL_IRDA_STATE_BUSY_RX;
-
- /* Init tickstart for timeout management */
- tickstart = HAL_GetTick();
-
- hirda->RxXferSize = Size;
- hirda->RxXferCount = Size;
-
- /* Computation of the mask to apply to RDR register
- of the UART associated to the IRDA */
- IRDA_MASK_COMPUTATION(hirda);
- uhMask = hirda->Mask;
-
- /* In case of 9bits/No Parity transfer, pRxData needs to be handled as a uint16_t pointer */
- if ((hirda->Init.WordLength == IRDA_WORDLENGTH_9B) && (hirda->Init.Parity == IRDA_PARITY_NONE))
- {
- pdata8bits = NULL;
- pdata16bits = (uint16_t *) pData; /* Derogation R.11.3 */
- }
- else
- {
- pdata8bits = pData;
- pdata16bits = NULL;
- }
-
- /* Check data remaining to be received */
- while (hirda->RxXferCount > 0U)
- {
- hirda->RxXferCount--;
-
- if (IRDA_WaitOnFlagUntilTimeout(hirda, IRDA_FLAG_RXNE, RESET, tickstart, Timeout) != HAL_OK)
- {
- return HAL_TIMEOUT;
- }
- if (pdata8bits == NULL)
- {
- *pdata16bits = (uint16_t)(hirda->Instance->RDR & uhMask);
- pdata16bits++;
- }
- else
- {
- *pdata8bits = (uint8_t)(hirda->Instance->RDR & (uint8_t)uhMask);
- pdata8bits++;
- }
- }
-
- /* At end of Rx process, restore hirda->RxState to Ready */
- hirda->RxState = HAL_IRDA_STATE_READY;
-
- /* Process Unlocked */
- __HAL_UNLOCK(hirda);
-
- return HAL_OK;
- }
- else
- {
- return HAL_BUSY;
- }
-}
-
-/**
- * @brief Send an amount of data in interrupt mode.
- * @note When UART parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01),
- * the sent data is handled as a set of u16. In this case, Size must reflect the number
- * of u16 available through pData.
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified IRDA module.
- * @param pData Pointer to data buffer (u8 or u16 data elements).
- * @param Size Amount of data elements (u8 or u16) to be sent.
- * @retval HAL status
- */
-/**
- * @note When IRDA parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01),
- * address of user data buffer containing data to be sent, should be aligned on a half word frontier (16 bits)
- * (as sent data will be handled using u16 pointer cast). Depending on compilation chain,
- * use of specific alignment compilation directives or pragmas might be required to ensure proper alignment for pData.
- */
-HAL_StatusTypeDef HAL_IRDA_Transmit_IT(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size)
-{
- /* Check that a Tx process is not already ongoing */
- if (hirda->gState == HAL_IRDA_STATE_READY)
- {
- if ((pData == NULL) || (Size == 0U))
- {
- return HAL_ERROR;
- }
-
- /* In case of 9bits/No Parity transfer, pData buffer provided as input parameter
- should be aligned on a u16 frontier, as data to be filled into TDR will be
- handled through a u16 cast. */
- if ((hirda->Init.WordLength == IRDA_WORDLENGTH_9B) && (hirda->Init.Parity == IRDA_PARITY_NONE))
- {
- if ((((uint32_t)pData) & 1U) != 0U)
- {
- return HAL_ERROR;
- }
- }
-
- /* Process Locked */
- __HAL_LOCK(hirda);
-
- hirda->pTxBuffPtr = pData;
- hirda->TxXferSize = Size;
- hirda->TxXferCount = Size;
-
- hirda->ErrorCode = HAL_IRDA_ERROR_NONE;
- hirda->gState = HAL_IRDA_STATE_BUSY_TX;
-
- /* Process Unlocked */
- __HAL_UNLOCK(hirda);
-
- /* Enable the IRDA Transmit Data Register Empty Interrupt */
- SET_BIT(hirda->Instance->CR1, USART_CR1_TXEIE);
-
- return HAL_OK;
- }
- else
- {
- return HAL_BUSY;
- }
-}
-
-/**
- * @brief Receive an amount of data in interrupt mode.
- * @note When UART parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01),
- * the received data is handled as a set of u16. In this case, Size must reflect the number
- * of u16 available through pData.
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified IRDA module.
- * @param pData Pointer to data buffer (u8 or u16 data elements).
- * @param Size Amount of data elements (u8 or u16) to be received.
- * @retval HAL status
- */
-/**
- * @note When IRDA parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01),
- * address of user data buffer for storing data to be received, should be aligned on a half word frontier (16 bits)
- * (as received data will be handled using u16 pointer cast). Depending on compilation chain,
- * use of specific alignment compilation directives or pragmas might be required to ensure proper alignment for pData.
- */
-HAL_StatusTypeDef HAL_IRDA_Receive_IT(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size)
-{
- /* Check that a Rx process is not already ongoing */
- if (hirda->RxState == HAL_IRDA_STATE_READY)
- {
- if ((pData == NULL) || (Size == 0U))
- {
- return HAL_ERROR;
- }
-
- /* In case of 9bits/No Parity transfer, pData buffer provided as input parameter
- should be aligned on a u16 frontier, as data to be received from RDR will be
- handled through a u16 cast. */
- if ((hirda->Init.WordLength == IRDA_WORDLENGTH_9B) && (hirda->Init.Parity == IRDA_PARITY_NONE))
- {
- if ((((uint32_t)pData) & 1U) != 0U)
- {
- return HAL_ERROR;
- }
- }
-
- /* Process Locked */
- __HAL_LOCK(hirda);
-
- hirda->pRxBuffPtr = pData;
- hirda->RxXferSize = Size;
- hirda->RxXferCount = Size;
-
- /* Computation of the mask to apply to the RDR register
- of the UART associated to the IRDA */
- IRDA_MASK_COMPUTATION(hirda);
-
- hirda->ErrorCode = HAL_IRDA_ERROR_NONE;
- hirda->RxState = HAL_IRDA_STATE_BUSY_RX;
-
- /* Process Unlocked */
- __HAL_UNLOCK(hirda);
-
- /* Enable the IRDA Parity Error and Data Register not empty Interrupts */
- SET_BIT(hirda->Instance->CR1, USART_CR1_PEIE | USART_CR1_RXNEIE);
-
- /* Enable the IRDA Error Interrupt: (Frame error, noise error, overrun error) */
- SET_BIT(hirda->Instance->CR3, USART_CR3_EIE);
-
- return HAL_OK;
- }
- else
- {
- return HAL_BUSY;
- }
-}
-
-/**
- * @brief Send an amount of data in DMA mode.
- * @note When UART parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01),
- * the sent data is handled as a set of u16. In this case, Size must reflect the number
- * of u16 available through pData.
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified IRDA module.
- * @param pData pointer to data buffer (u8 or u16 data elements).
- * @param Size Amount of data elements (u8 or u16) to be sent.
- * @retval HAL status
- */
-/**
- * @note When IRDA parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01),
- * address of user data buffer containing data to be sent, should be aligned on a half word frontier (16 bits)
- * (as sent data will be handled by DMA from halfword frontier). Depending on compilation chain,
- * use of specific alignment compilation directives or pragmas might be required to ensure proper alignment for pData.
- */
-HAL_StatusTypeDef HAL_IRDA_Transmit_DMA(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size)
-{
- /* Check that a Tx process is not already ongoing */
- if (hirda->gState == HAL_IRDA_STATE_READY)
- {
- if ((pData == NULL) || (Size == 0U))
- {
- return HAL_ERROR;
- }
-
- /* In case of 9bits/No Parity transfer, pData buffer provided as input parameter
- should be aligned on a u16 frontier, as data copy into TDR will be
- handled by DMA from a u16 frontier. */
- if ((hirda->Init.WordLength == IRDA_WORDLENGTH_9B) && (hirda->Init.Parity == IRDA_PARITY_NONE))
- {
- if ((((uint32_t)pData) & 1U) != 0U)
- {
- return HAL_ERROR;
- }
- }
-
- /* Process Locked */
- __HAL_LOCK(hirda);
-
- hirda->pTxBuffPtr = pData;
- hirda->TxXferSize = Size;
- hirda->TxXferCount = Size;
-
- hirda->ErrorCode = HAL_IRDA_ERROR_NONE;
- hirda->gState = HAL_IRDA_STATE_BUSY_TX;
-
- /* Set the IRDA DMA transfer complete callback */
- hirda->hdmatx->XferCpltCallback = IRDA_DMATransmitCplt;
-
- /* Set the IRDA DMA half transfer complete callback */
- hirda->hdmatx->XferHalfCpltCallback = IRDA_DMATransmitHalfCplt;
-
- /* Set the DMA error callback */
- hirda->hdmatx->XferErrorCallback = IRDA_DMAError;
-
- /* Set the DMA abort callback */
- hirda->hdmatx->XferAbortCallback = NULL;
-
- /* Enable the IRDA transmit DMA channel */
- if (HAL_DMA_Start_IT(hirda->hdmatx, (uint32_t)hirda->pTxBuffPtr, (uint32_t)&hirda->Instance->TDR, Size) == HAL_OK)
- {
- /* Clear the TC flag in the ICR register */
- __HAL_IRDA_CLEAR_FLAG(hirda, IRDA_CLEAR_TCF);
-
- /* Process Unlocked */
- __HAL_UNLOCK(hirda);
-
- /* Enable the DMA transfer for transmit request by setting the DMAT bit
- in the USART CR3 register */
- SET_BIT(hirda->Instance->CR3, USART_CR3_DMAT);
-
- return HAL_OK;
- }
- else
- {
- /* Set error code to DMA */
- hirda->ErrorCode = HAL_IRDA_ERROR_DMA;
-
- /* Process Unlocked */
- __HAL_UNLOCK(hirda);
-
- /* Restore hirda->gState to ready */
- hirda->gState = HAL_IRDA_STATE_READY;
-
- return HAL_ERROR;
- }
- }
- else
- {
- return HAL_BUSY;
- }
-}
-
-/**
- * @brief Receive an amount of data in DMA mode.
- * @note When UART parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01),
- * the received data is handled as a set of u16. In this case, Size must reflect the number
- * of u16 available through pData.
- * @note When the IRDA parity is enabled (PCE = 1), the received data contains
- * the parity bit (MSB position).
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified IRDA module.
- * @param pData Pointer to data buffer (u8 or u16 data elements).
- * @param Size Amount of data elements (u8 or u16) to be received.
- * @retval HAL status
- */
-/**
- * @note When IRDA parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01),
- * address of user data buffer for storing data to be received, should be aligned on a half word frontier (16 bits)
- * (as received data will be handled by DMA from halfword frontier). Depending on compilation chain,
- * use of specific alignment compilation directives or pragmas might be required to ensure proper alignment for pData.
- */
-HAL_StatusTypeDef HAL_IRDA_Receive_DMA(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size)
-{
- /* Check that a Rx process is not already ongoing */
- if (hirda->RxState == HAL_IRDA_STATE_READY)
- {
- if ((pData == NULL) || (Size == 0U))
- {
- return HAL_ERROR;
- }
-
- /* In case of 9bits/No Parity transfer, pData buffer provided as input parameter
- should be aligned on a u16 frontier, as data copy from RDR will be
- handled by DMA from a u16 frontier. */
- if ((hirda->Init.WordLength == IRDA_WORDLENGTH_9B) && (hirda->Init.Parity == IRDA_PARITY_NONE))
- {
- if ((((uint32_t)pData) & 1U) != 0U)
- {
- return HAL_ERROR;
- }
- }
-
- /* Process Locked */
- __HAL_LOCK(hirda);
-
- hirda->pRxBuffPtr = pData;
- hirda->RxXferSize = Size;
-
- hirda->ErrorCode = HAL_IRDA_ERROR_NONE;
- hirda->RxState = HAL_IRDA_STATE_BUSY_RX;
-
- /* Set the IRDA DMA transfer complete callback */
- hirda->hdmarx->XferCpltCallback = IRDA_DMAReceiveCplt;
-
- /* Set the IRDA DMA half transfer complete callback */
- hirda->hdmarx->XferHalfCpltCallback = IRDA_DMAReceiveHalfCplt;
-
- /* Set the DMA error callback */
- hirda->hdmarx->XferErrorCallback = IRDA_DMAError;
-
- /* Set the DMA abort callback */
- hirda->hdmarx->XferAbortCallback = NULL;
-
- /* Enable the DMA channel */
- if (HAL_DMA_Start_IT(hirda->hdmarx, (uint32_t)&hirda->Instance->RDR, (uint32_t)hirda->pRxBuffPtr, Size) == HAL_OK)
- {
- /* Process Unlocked */
- __HAL_UNLOCK(hirda);
-
- /* Enable the UART Parity Error Interrupt */
- SET_BIT(hirda->Instance->CR1, USART_CR1_PEIE);
-
- /* Enable the UART Error Interrupt: (Frame error, noise error, overrun error) */
- SET_BIT(hirda->Instance->CR3, USART_CR3_EIE);
-
- /* Enable the DMA transfer for the receiver request by setting the DMAR bit
- in the USART CR3 register */
- SET_BIT(hirda->Instance->CR3, USART_CR3_DMAR);
-
- return HAL_OK;
- }
- else
- {
- /* Set error code to DMA */
- hirda->ErrorCode = HAL_IRDA_ERROR_DMA;
-
- /* Process Unlocked */
- __HAL_UNLOCK(hirda);
-
- /* Restore hirda->RxState to ready */
- hirda->RxState = HAL_IRDA_STATE_READY;
-
- return HAL_ERROR;
- }
- }
- else
- {
- return HAL_BUSY;
- }
-}
-
-
-/**
- * @brief Pause the DMA Transfer.
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified IRDA module.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_IRDA_DMAPause(IRDA_HandleTypeDef *hirda)
-{
- /* Process Locked */
- __HAL_LOCK(hirda);
-
- if (hirda->gState == HAL_IRDA_STATE_BUSY_TX)
- {
- if (HAL_IS_BIT_SET(hirda->Instance->CR3, USART_CR3_DMAT))
- {
- /* Disable the IRDA DMA Tx request */
- CLEAR_BIT(hirda->Instance->CR3, USART_CR3_DMAT);
- }
- }
- if (hirda->RxState == HAL_IRDA_STATE_BUSY_RX)
- {
- if (HAL_IS_BIT_SET(hirda->Instance->CR3, USART_CR3_DMAR))
- {
- /* Disable PE and ERR (Frame error, noise error, overrun error) interrupts */
- CLEAR_BIT(hirda->Instance->CR1, USART_CR1_PEIE);
- CLEAR_BIT(hirda->Instance->CR3, USART_CR3_EIE);
-
- /* Disable the IRDA DMA Rx request */
- CLEAR_BIT(hirda->Instance->CR3, USART_CR3_DMAR);
- }
- }
-
- /* Process Unlocked */
- __HAL_UNLOCK(hirda);
-
- return HAL_OK;
-}
-
-/**
- * @brief Resume the DMA Transfer.
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified UART module.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_IRDA_DMAResume(IRDA_HandleTypeDef *hirda)
-{
- /* Process Locked */
- __HAL_LOCK(hirda);
-
- if (hirda->gState == HAL_IRDA_STATE_BUSY_TX)
- {
- /* Enable the IRDA DMA Tx request */
- SET_BIT(hirda->Instance->CR3, USART_CR3_DMAT);
- }
- if (hirda->RxState == HAL_IRDA_STATE_BUSY_RX)
- {
- /* Clear the Overrun flag before resuming the Rx transfer*/
- __HAL_IRDA_CLEAR_OREFLAG(hirda);
-
- /* Re-enable PE and ERR (Frame error, noise error, overrun error) interrupts */
- SET_BIT(hirda->Instance->CR1, USART_CR1_PEIE);
- SET_BIT(hirda->Instance->CR3, USART_CR3_EIE);
-
- /* Enable the IRDA DMA Rx request */
- SET_BIT(hirda->Instance->CR3, USART_CR3_DMAR);
- }
-
- /* Process Unlocked */
- __HAL_UNLOCK(hirda);
-
- return HAL_OK;
-}
-
-/**
- * @brief Stop the DMA Transfer.
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified UART module.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_IRDA_DMAStop(IRDA_HandleTypeDef *hirda)
-{
- /* The Lock is not implemented on this API to allow the user application
- to call the HAL IRDA API under callbacks HAL_IRDA_TxCpltCallback() / HAL_IRDA_RxCpltCallback() /
- HAL_IRDA_TxHalfCpltCallback / HAL_IRDA_RxHalfCpltCallback:
- indeed, when HAL_DMA_Abort() API is called, the DMA TX/RX Transfer or Half Transfer complete
- interrupt is generated if the DMA transfer interruption occurs at the middle or at the end of
- the stream and the corresponding call back is executed. */
-
- /* Stop IRDA DMA Tx request if ongoing */
- if (hirda->gState == HAL_IRDA_STATE_BUSY_TX)
- {
- if (HAL_IS_BIT_SET(hirda->Instance->CR3, USART_CR3_DMAT))
- {
- CLEAR_BIT(hirda->Instance->CR3, USART_CR3_DMAT);
-
- /* Abort the IRDA DMA Tx channel */
- if (hirda->hdmatx != NULL)
- {
- if (HAL_DMA_Abort(hirda->hdmatx) != HAL_OK)
- {
- if (HAL_DMA_GetError(hirda->hdmatx) == HAL_DMA_ERROR_TIMEOUT)
- {
- /* Set error code to DMA */
- hirda->ErrorCode = HAL_IRDA_ERROR_DMA;
-
- return HAL_TIMEOUT;
- }
- }
- }
-
- IRDA_EndTxTransfer(hirda);
- }
- }
-
- /* Stop IRDA DMA Rx request if ongoing */
- if (hirda->RxState == HAL_IRDA_STATE_BUSY_RX)
- {
- if (HAL_IS_BIT_SET(hirda->Instance->CR3, USART_CR3_DMAR))
- {
- CLEAR_BIT(hirda->Instance->CR3, USART_CR3_DMAR);
-
- /* Abort the IRDA DMA Rx channel */
- if (hirda->hdmarx != NULL)
- {
- if (HAL_DMA_Abort(hirda->hdmarx) != HAL_OK)
- {
- if (HAL_DMA_GetError(hirda->hdmarx) == HAL_DMA_ERROR_TIMEOUT)
- {
- /* Set error code to DMA */
- hirda->ErrorCode = HAL_IRDA_ERROR_DMA;
-
- return HAL_TIMEOUT;
- }
- }
- }
-
- IRDA_EndRxTransfer(hirda);
- }
- }
-
- return HAL_OK;
-}
-
-/**
- * @brief Abort ongoing transfers (blocking mode).
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified UART module.
- * @note This procedure could be used for aborting any ongoing transfer started in Interrupt or DMA mode.
- * This procedure performs following operations :
- * - Disable IRDA Interrupts (Tx and Rx)
- * - Disable the DMA transfer in the peripheral register (if enabled)
- * - Abort DMA transfer by calling HAL_DMA_Abort (in case of transfer in DMA mode)
- * - Set handle State to READY
- * @note This procedure is executed in blocking mode : when exiting function, Abort is considered as completed.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_IRDA_Abort(IRDA_HandleTypeDef *hirda)
-{
- /* Disable TXEIE, TCIE, RXNE, PE and ERR (Frame error, noise error, overrun error) interrupts */
- CLEAR_BIT(hirda->Instance->CR1, (USART_CR1_RXNEIE | USART_CR1_PEIE | USART_CR1_TXEIE | USART_CR1_TCIE));
- CLEAR_BIT(hirda->Instance->CR3, USART_CR3_EIE);
-
- /* Disable the IRDA DMA Tx request if enabled */
- if (HAL_IS_BIT_SET(hirda->Instance->CR3, USART_CR3_DMAT))
- {
- CLEAR_BIT(hirda->Instance->CR3, USART_CR3_DMAT);
-
- /* Abort the IRDA DMA Tx channel : use blocking DMA Abort API (no callback) */
- if (hirda->hdmatx != NULL)
- {
- /* Set the IRDA DMA Abort callback to Null.
- No call back execution at end of DMA abort procedure */
- hirda->hdmatx->XferAbortCallback = NULL;
-
- if (HAL_DMA_Abort(hirda->hdmatx) != HAL_OK)
- {
- if (HAL_DMA_GetError(hirda->hdmatx) == HAL_DMA_ERROR_TIMEOUT)
- {
- /* Set error code to DMA */
- hirda->ErrorCode = HAL_IRDA_ERROR_DMA;
-
- return HAL_TIMEOUT;
- }
- }
- }
- }
-
- /* Disable the IRDA DMA Rx request if enabled */
- if (HAL_IS_BIT_SET(hirda->Instance->CR3, USART_CR3_DMAR))
- {
- CLEAR_BIT(hirda->Instance->CR3, USART_CR3_DMAR);
-
- /* Abort the IRDA DMA Rx channel : use blocking DMA Abort API (no callback) */
- if (hirda->hdmarx != NULL)
- {
- /* Set the IRDA DMA Abort callback to Null.
- No call back execution at end of DMA abort procedure */
- hirda->hdmarx->XferAbortCallback = NULL;
-
- if (HAL_DMA_Abort(hirda->hdmarx) != HAL_OK)
- {
- if (HAL_DMA_GetError(hirda->hdmarx) == HAL_DMA_ERROR_TIMEOUT)
- {
- /* Set error code to DMA */
- hirda->ErrorCode = HAL_IRDA_ERROR_DMA;
-
- return HAL_TIMEOUT;
- }
- }
- }
- }
-
- /* Reset Tx and Rx transfer counters */
- hirda->TxXferCount = 0U;
- hirda->RxXferCount = 0U;
-
- /* Clear the Error flags in the ICR register */
- __HAL_IRDA_CLEAR_FLAG(hirda, IRDA_CLEAR_OREF | IRDA_CLEAR_NEF | IRDA_CLEAR_PEF | IRDA_CLEAR_FEF);
-
- /* Restore hirda->gState and hirda->RxState to Ready */
- hirda->gState = HAL_IRDA_STATE_READY;
- hirda->RxState = HAL_IRDA_STATE_READY;
-
- /* Reset Handle ErrorCode to No Error */
- hirda->ErrorCode = HAL_IRDA_ERROR_NONE;
-
- return HAL_OK;
-}
-
-/**
- * @brief Abort ongoing Transmit transfer (blocking mode).
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified UART module.
- * @note This procedure could be used for aborting any ongoing Tx transfer started in Interrupt or DMA mode.
- * This procedure performs following operations :
- * - Disable IRDA Interrupts (Tx)
- * - Disable the DMA transfer in the peripheral register (if enabled)
- * - Abort DMA transfer by calling HAL_DMA_Abort (in case of transfer in DMA mode)
- * - Set handle State to READY
- * @note This procedure is executed in blocking mode : when exiting function, Abort is considered as completed.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_IRDA_AbortTransmit(IRDA_HandleTypeDef *hirda)
-{
- /* Disable TXEIE and TCIE interrupts */
- CLEAR_BIT(hirda->Instance->CR1, (USART_CR1_TXEIE | USART_CR1_TCIE));
-
- /* Disable the IRDA DMA Tx request if enabled */
- if (HAL_IS_BIT_SET(hirda->Instance->CR3, USART_CR3_DMAT))
- {
- CLEAR_BIT(hirda->Instance->CR3, USART_CR3_DMAT);
-
- /* Abort the IRDA DMA Tx channel : use blocking DMA Abort API (no callback) */
- if (hirda->hdmatx != NULL)
- {
- /* Set the IRDA DMA Abort callback to Null.
- No call back execution at end of DMA abort procedure */
- hirda->hdmatx->XferAbortCallback = NULL;
-
- if (HAL_DMA_Abort(hirda->hdmatx) != HAL_OK)
- {
- if (HAL_DMA_GetError(hirda->hdmatx) == HAL_DMA_ERROR_TIMEOUT)
- {
- /* Set error code to DMA */
- hirda->ErrorCode = HAL_IRDA_ERROR_DMA;
-
- return HAL_TIMEOUT;
- }
- }
- }
- }
-
- /* Reset Tx transfer counter */
- hirda->TxXferCount = 0U;
-
- /* Restore hirda->gState to Ready */
- hirda->gState = HAL_IRDA_STATE_READY;
-
- return HAL_OK;
-}
-
-/**
- * @brief Abort ongoing Receive transfer (blocking mode).
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified UART module.
- * @note This procedure could be used for aborting any ongoing Rx transfer started in Interrupt or DMA mode.
- * This procedure performs following operations :
- * - Disable IRDA Interrupts (Rx)
- * - Disable the DMA transfer in the peripheral register (if enabled)
- * - Abort DMA transfer by calling HAL_DMA_Abort (in case of transfer in DMA mode)
- * - Set handle State to READY
- * @note This procedure is executed in blocking mode : when exiting function, Abort is considered as completed.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_IRDA_AbortReceive(IRDA_HandleTypeDef *hirda)
-{
- /* Disable RXNE, PE and ERR (Frame error, noise error, overrun error) interrupts */
- CLEAR_BIT(hirda->Instance->CR1, (USART_CR1_RXNEIE | USART_CR1_PEIE));
- CLEAR_BIT(hirda->Instance->CR3, USART_CR3_EIE);
-
- /* Disable the IRDA DMA Rx request if enabled */
- if (HAL_IS_BIT_SET(hirda->Instance->CR3, USART_CR3_DMAR))
- {
- CLEAR_BIT(hirda->Instance->CR3, USART_CR3_DMAR);
-
- /* Abort the IRDA DMA Rx channel : use blocking DMA Abort API (no callback) */
- if (hirda->hdmarx != NULL)
- {
- /* Set the IRDA DMA Abort callback to Null.
- No call back execution at end of DMA abort procedure */
- hirda->hdmarx->XferAbortCallback = NULL;
-
- if (HAL_DMA_Abort(hirda->hdmarx) != HAL_OK)
- {
- if (HAL_DMA_GetError(hirda->hdmarx) == HAL_DMA_ERROR_TIMEOUT)
- {
- /* Set error code to DMA */
- hirda->ErrorCode = HAL_IRDA_ERROR_DMA;
-
- return HAL_TIMEOUT;
- }
- }
- }
- }
-
- /* Reset Rx transfer counter */
- hirda->RxXferCount = 0U;
-
- /* Clear the Error flags in the ICR register */
- __HAL_IRDA_CLEAR_FLAG(hirda, IRDA_CLEAR_OREF | IRDA_CLEAR_NEF | IRDA_CLEAR_PEF | IRDA_CLEAR_FEF);
-
- /* Restore hirda->RxState to Ready */
- hirda->RxState = HAL_IRDA_STATE_READY;
-
- return HAL_OK;
-}
-
-/**
- * @brief Abort ongoing transfers (Interrupt mode).
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified UART module.
- * @note This procedure could be used for aborting any ongoing transfer started in Interrupt or DMA mode.
- * This procedure performs following operations :
- * - Disable IRDA Interrupts (Tx and Rx)
- * - Disable the DMA transfer in the peripheral register (if enabled)
- * - Abort DMA transfer by calling HAL_DMA_Abort_IT (in case of transfer in DMA mode)
- * - Set handle State to READY
- * - At abort completion, call user abort complete callback
- * @note This procedure is executed in Interrupt mode, meaning that abort procedure could be
- * considered as completed only when user abort complete callback is executed (not when exiting function).
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_IRDA_Abort_IT(IRDA_HandleTypeDef *hirda)
-{
- uint32_t abortcplt = 1U;
-
- /* Disable TXEIE, TCIE, RXNE, PE and ERR (Frame error, noise error, overrun error) interrupts */
- CLEAR_BIT(hirda->Instance->CR1, (USART_CR1_RXNEIE | USART_CR1_PEIE | USART_CR1_TXEIE | USART_CR1_TCIE));
- CLEAR_BIT(hirda->Instance->CR3, USART_CR3_EIE);
-
- /* If DMA Tx and/or DMA Rx Handles are associated to IRDA Handle, DMA Abort complete callbacks should be initialised
- before any call to DMA Abort functions */
- /* DMA Tx Handle is valid */
- if (hirda->hdmatx != NULL)
- {
- /* Set DMA Abort Complete callback if IRDA DMA Tx request if enabled.
- Otherwise, set it to NULL */
- if (HAL_IS_BIT_SET(hirda->Instance->CR3, USART_CR3_DMAT))
- {
- hirda->hdmatx->XferAbortCallback = IRDA_DMATxAbortCallback;
- }
- else
- {
- hirda->hdmatx->XferAbortCallback = NULL;
- }
- }
- /* DMA Rx Handle is valid */
- if (hirda->hdmarx != NULL)
- {
- /* Set DMA Abort Complete callback if IRDA DMA Rx request if enabled.
- Otherwise, set it to NULL */
- if (HAL_IS_BIT_SET(hirda->Instance->CR3, USART_CR3_DMAR))
- {
- hirda->hdmarx->XferAbortCallback = IRDA_DMARxAbortCallback;
- }
- else
- {
- hirda->hdmarx->XferAbortCallback = NULL;
- }
- }
-
- /* Disable the IRDA DMA Tx request if enabled */
- if (HAL_IS_BIT_SET(hirda->Instance->CR3, USART_CR3_DMAT))
- {
- /* Disable DMA Tx at UART level */
- CLEAR_BIT(hirda->Instance->CR3, USART_CR3_DMAT);
-
- /* Abort the IRDA DMA Tx channel : use non blocking DMA Abort API (callback) */
- if (hirda->hdmatx != NULL)
- {
- /* IRDA Tx DMA Abort callback has already been initialised :
- will lead to call HAL_IRDA_AbortCpltCallback() at end of DMA abort procedure */
-
- /* Abort DMA TX */
- if (HAL_DMA_Abort_IT(hirda->hdmatx) != HAL_OK)
- {
- hirda->hdmatx->XferAbortCallback = NULL;
- }
- else
- {
- abortcplt = 0U;
- }
- }
- }
-
- /* Disable the IRDA DMA Rx request if enabled */
- if (HAL_IS_BIT_SET(hirda->Instance->CR3, USART_CR3_DMAR))
- {
- CLEAR_BIT(hirda->Instance->CR3, USART_CR3_DMAR);
-
- /* Abort the IRDA DMA Rx channel : use non blocking DMA Abort API (callback) */
- if (hirda->hdmarx != NULL)
- {
- /* IRDA Rx DMA Abort callback has already been initialised :
- will lead to call HAL_IRDA_AbortCpltCallback() at end of DMA abort procedure */
-
- /* Abort DMA RX */
- if (HAL_DMA_Abort_IT(hirda->hdmarx) != HAL_OK)
- {
- hirda->hdmarx->XferAbortCallback = NULL;
- abortcplt = 1U;
- }
- else
- {
- abortcplt = 0U;
- }
- }
- }
-
- /* if no DMA abort complete callback execution is required => call user Abort Complete callback */
- if (abortcplt == 1U)
- {
- /* Reset Tx and Rx transfer counters */
- hirda->TxXferCount = 0U;
- hirda->RxXferCount = 0U;
-
- /* Reset errorCode */
- hirda->ErrorCode = HAL_IRDA_ERROR_NONE;
-
- /* Clear the Error flags in the ICR register */
- __HAL_IRDA_CLEAR_FLAG(hirda, IRDA_CLEAR_OREF | IRDA_CLEAR_NEF | IRDA_CLEAR_PEF | IRDA_CLEAR_FEF);
-
- /* Restore hirda->gState and hirda->RxState to Ready */
- hirda->gState = HAL_IRDA_STATE_READY;
- hirda->RxState = HAL_IRDA_STATE_READY;
-
- /* As no DMA to be aborted, call directly user Abort complete callback */
-#if (USE_HAL_IRDA_REGISTER_CALLBACKS == 1)
- /* Call registered Abort complete callback */
- hirda->AbortCpltCallback(hirda);
-#else
- /* Call legacy weak Abort complete callback */
- HAL_IRDA_AbortCpltCallback(hirda);
-#endif /* USE_HAL_IRDA_REGISTER_CALLBACK */
- }
-
- return HAL_OK;
-}
-
-/**
- * @brief Abort ongoing Transmit transfer (Interrupt mode).
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified UART module.
- * @note This procedure could be used for aborting any ongoing Tx transfer started in Interrupt or DMA mode.
- * This procedure performs following operations :
- * - Disable IRDA Interrupts (Tx)
- * - Disable the DMA transfer in the peripheral register (if enabled)
- * - Abort DMA transfer by calling HAL_DMA_Abort_IT (in case of transfer in DMA mode)
- * - Set handle State to READY
- * - At abort completion, call user abort complete callback
- * @note This procedure is executed in Interrupt mode, meaning that abort procedure could be
- * considered as completed only when user abort complete callback is executed (not when exiting function).
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_IRDA_AbortTransmit_IT(IRDA_HandleTypeDef *hirda)
-{
- /* Disable TXEIE and TCIE interrupts */
- CLEAR_BIT(hirda->Instance->CR1, (USART_CR1_TXEIE | USART_CR1_TCIE));
-
- /* Disable the IRDA DMA Tx request if enabled */
- if (HAL_IS_BIT_SET(hirda->Instance->CR3, USART_CR3_DMAT))
- {
- CLEAR_BIT(hirda->Instance->CR3, USART_CR3_DMAT);
-
- /* Abort the IRDA DMA Tx channel : use non blocking DMA Abort API (callback) */
- if (hirda->hdmatx != NULL)
- {
- /* Set the IRDA DMA Abort callback :
- will lead to call HAL_IRDA_AbortCpltCallback() at end of DMA abort procedure */
- hirda->hdmatx->XferAbortCallback = IRDA_DMATxOnlyAbortCallback;
-
- /* Abort DMA TX */
- if (HAL_DMA_Abort_IT(hirda->hdmatx) != HAL_OK)
- {
- /* Call Directly hirda->hdmatx->XferAbortCallback function in case of error */
- hirda->hdmatx->XferAbortCallback(hirda->hdmatx);
- }
- }
- else
- {
- /* Reset Tx transfer counter */
- hirda->TxXferCount = 0U;
-
- /* Restore hirda->gState to Ready */
- hirda->gState = HAL_IRDA_STATE_READY;
-
- /* As no DMA to be aborted, call directly user Abort complete callback */
-#if (USE_HAL_IRDA_REGISTER_CALLBACKS == 1)
- /* Call registered Abort Transmit Complete Callback */
- hirda->AbortTransmitCpltCallback(hirda);
-#else
- /* Call legacy weak Abort Transmit Complete Callback */
- HAL_IRDA_AbortTransmitCpltCallback(hirda);
-#endif /* USE_HAL_IRDA_REGISTER_CALLBACK */
- }
- }
- else
- {
- /* Reset Tx transfer counter */
- hirda->TxXferCount = 0U;
-
- /* Restore hirda->gState to Ready */
- hirda->gState = HAL_IRDA_STATE_READY;
-
- /* As no DMA to be aborted, call directly user Abort complete callback */
-#if (USE_HAL_IRDA_REGISTER_CALLBACKS == 1)
- /* Call registered Abort Transmit Complete Callback */
- hirda->AbortTransmitCpltCallback(hirda);
-#else
- /* Call legacy weak Abort Transmit Complete Callback */
- HAL_IRDA_AbortTransmitCpltCallback(hirda);
-#endif /* USE_HAL_IRDA_REGISTER_CALLBACK */
- }
-
- return HAL_OK;
-}
-
-/**
- * @brief Abort ongoing Receive transfer (Interrupt mode).
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified UART module.
- * @note This procedure could be used for aborting any ongoing Rx transfer started in Interrupt or DMA mode.
- * This procedure performs following operations :
- * - Disable IRDA Interrupts (Rx)
- * - Disable the DMA transfer in the peripheral register (if enabled)
- * - Abort DMA transfer by calling HAL_DMA_Abort_IT (in case of transfer in DMA mode)
- * - Set handle State to READY
- * - At abort completion, call user abort complete callback
- * @note This procedure is executed in Interrupt mode, meaning that abort procedure could be
- * considered as completed only when user abort complete callback is executed (not when exiting function).
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_IRDA_AbortReceive_IT(IRDA_HandleTypeDef *hirda)
-{
- /* Disable RXNE, PE and ERR (Frame error, noise error, overrun error) interrupts */
- CLEAR_BIT(hirda->Instance->CR1, (USART_CR1_RXNEIE | USART_CR1_PEIE));
- CLEAR_BIT(hirda->Instance->CR3, USART_CR3_EIE);
-
- /* Disable the IRDA DMA Rx request if enabled */
- if (HAL_IS_BIT_SET(hirda->Instance->CR3, USART_CR3_DMAR))
- {
- CLEAR_BIT(hirda->Instance->CR3, USART_CR3_DMAR);
-
- /* Abort the IRDA DMA Rx channel : use non blocking DMA Abort API (callback) */
- if (hirda->hdmarx != NULL)
- {
- /* Set the IRDA DMA Abort callback :
- will lead to call HAL_IRDA_AbortCpltCallback() at end of DMA abort procedure */
- hirda->hdmarx->XferAbortCallback = IRDA_DMARxOnlyAbortCallback;
-
- /* Abort DMA RX */
- if (HAL_DMA_Abort_IT(hirda->hdmarx) != HAL_OK)
- {
- /* Call Directly hirda->hdmarx->XferAbortCallback function in case of error */
- hirda->hdmarx->XferAbortCallback(hirda->hdmarx);
- }
- }
- else
- {
- /* Reset Rx transfer counter */
- hirda->RxXferCount = 0U;
-
- /* Clear the Error flags in the ICR register */
- __HAL_IRDA_CLEAR_FLAG(hirda, IRDA_CLEAR_OREF | IRDA_CLEAR_NEF | IRDA_CLEAR_PEF | IRDA_CLEAR_FEF);
-
- /* Restore hirda->RxState to Ready */
- hirda->RxState = HAL_IRDA_STATE_READY;
-
- /* As no DMA to be aborted, call directly user Abort complete callback */
-#if (USE_HAL_IRDA_REGISTER_CALLBACKS == 1)
- /* Call registered Abort Receive Complete Callback */
- hirda->AbortReceiveCpltCallback(hirda);
-#else
- /* Call legacy weak Abort Receive Complete Callback */
- HAL_IRDA_AbortReceiveCpltCallback(hirda);
-#endif /* USE_HAL_IRDA_REGISTER_CALLBACK */
- }
- }
- else
- {
- /* Reset Rx transfer counter */
- hirda->RxXferCount = 0U;
-
- /* Clear the Error flags in the ICR register */
- __HAL_IRDA_CLEAR_FLAG(hirda, IRDA_CLEAR_OREF | IRDA_CLEAR_NEF | IRDA_CLEAR_PEF | IRDA_CLEAR_FEF);
-
- /* Restore hirda->RxState to Ready */
- hirda->RxState = HAL_IRDA_STATE_READY;
-
- /* As no DMA to be aborted, call directly user Abort complete callback */
-#if (USE_HAL_IRDA_REGISTER_CALLBACKS == 1)
- /* Call registered Abort Receive Complete Callback */
- hirda->AbortReceiveCpltCallback(hirda);
-#else
- /* Call legacy weak Abort Receive Complete Callback */
- HAL_IRDA_AbortReceiveCpltCallback(hirda);
-#endif /* USE_HAL_IRDA_REGISTER_CALLBACK */
- }
-
- return HAL_OK;
-}
-
-/**
- * @brief Handle IRDA interrupt request.
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified IRDA module.
- * @retval None
- */
-void HAL_IRDA_IRQHandler(IRDA_HandleTypeDef *hirda)
-{
- uint32_t isrflags = READ_REG(hirda->Instance->ISR);
- uint32_t cr1its = READ_REG(hirda->Instance->CR1);
- uint32_t cr3its;
- uint32_t errorflags;
- uint32_t errorcode;
-
- /* If no error occurs */
- errorflags = (isrflags & (uint32_t)(USART_ISR_PE | USART_ISR_FE | USART_ISR_ORE | USART_ISR_NE));
- if (errorflags == 0U)
- {
- /* IRDA in mode Receiver ---------------------------------------------------*/
- if (((isrflags & USART_ISR_RXNE) != 0U) && ((cr1its & USART_CR1_RXNEIE) != 0U))
- {
- IRDA_Receive_IT(hirda);
- return;
- }
- }
-
- /* If some errors occur */
- cr3its = READ_REG(hirda->Instance->CR3);
- if ((errorflags != 0U)
- && (((cr3its & USART_CR3_EIE) != 0U)
- || ((cr1its & (USART_CR1_RXNEIE | USART_CR1_PEIE)) != 0U)))
- {
- /* IRDA parity error interrupt occurred -------------------------------------*/
- if (((isrflags & USART_ISR_PE) != 0U) && ((cr1its & USART_CR1_PEIE) != 0U))
- {
- __HAL_IRDA_CLEAR_IT(hirda, IRDA_CLEAR_PEF);
-
- hirda->ErrorCode |= HAL_IRDA_ERROR_PE;
- }
-
- /* IRDA frame error interrupt occurred --------------------------------------*/
- if (((isrflags & USART_ISR_FE) != 0U) && ((cr3its & USART_CR3_EIE) != 0U))
- {
- __HAL_IRDA_CLEAR_IT(hirda, IRDA_CLEAR_FEF);
-
- hirda->ErrorCode |= HAL_IRDA_ERROR_FE;
- }
-
- /* IRDA noise error interrupt occurred --------------------------------------*/
- if (((isrflags & USART_ISR_NE) != 0U) && ((cr3its & USART_CR3_EIE) != 0U))
- {
- __HAL_IRDA_CLEAR_IT(hirda, IRDA_CLEAR_NEF);
-
- hirda->ErrorCode |= HAL_IRDA_ERROR_NE;
- }
-
- /* IRDA Over-Run interrupt occurred -----------------------------------------*/
- if (((isrflags & USART_ISR_ORE) != 0U) &&
- (((cr1its & USART_CR1_RXNEIE) != 0U) || ((cr3its & USART_CR3_EIE) != 0U)))
- {
- __HAL_IRDA_CLEAR_IT(hirda, IRDA_CLEAR_OREF);
-
- hirda->ErrorCode |= HAL_IRDA_ERROR_ORE;
- }
-
- /* Call IRDA Error Call back function if need be --------------------------*/
- if (hirda->ErrorCode != HAL_IRDA_ERROR_NONE)
- {
- /* IRDA in mode Receiver ---------------------------------------------------*/
- if (((isrflags & USART_ISR_RXNE) != 0U) && ((cr1its & USART_CR1_RXNEIE) != 0U))
- {
- IRDA_Receive_IT(hirda);
- }
-
- /* If Overrun error occurs, or if any error occurs in DMA mode reception,
- consider error as blocking */
- errorcode = hirda->ErrorCode;
- if ((HAL_IS_BIT_SET(hirda->Instance->CR3, USART_CR3_DMAR)) ||
- ((errorcode & HAL_IRDA_ERROR_ORE) != 0U))
- {
- /* Blocking error : transfer is aborted
- Set the IRDA state ready to be able to start again the process,
- Disable Rx Interrupts, and disable Rx DMA request, if ongoing */
- IRDA_EndRxTransfer(hirda);
-
- /* Disable the IRDA DMA Rx request if enabled */
- if (HAL_IS_BIT_SET(hirda->Instance->CR3, USART_CR3_DMAR))
- {
- CLEAR_BIT(hirda->Instance->CR3, USART_CR3_DMAR);
-
- /* Abort the IRDA DMA Rx channel */
- if (hirda->hdmarx != NULL)
- {
- /* Set the IRDA DMA Abort callback :
- will lead to call HAL_IRDA_ErrorCallback() at end of DMA abort procedure */
- hirda->hdmarx->XferAbortCallback = IRDA_DMAAbortOnError;
-
- /* Abort DMA RX */
- if (HAL_DMA_Abort_IT(hirda->hdmarx) != HAL_OK)
- {
- /* Call Directly hirda->hdmarx->XferAbortCallback function in case of error */
- hirda->hdmarx->XferAbortCallback(hirda->hdmarx);
- }
- }
- else
- {
-#if (USE_HAL_IRDA_REGISTER_CALLBACKS == 1)
- /* Call registered user error callback */
- hirda->ErrorCallback(hirda);
-#else
- /* Call legacy weak user error callback */
- HAL_IRDA_ErrorCallback(hirda);
-#endif /* USE_HAL_IRDA_REGISTER_CALLBACK */
- }
- }
- else
- {
-#if (USE_HAL_IRDA_REGISTER_CALLBACKS == 1)
- /* Call registered user error callback */
- hirda->ErrorCallback(hirda);
-#else
- /* Call legacy weak user error callback */
- HAL_IRDA_ErrorCallback(hirda);
-#endif /* USE_HAL_IRDA_REGISTER_CALLBACK */
- }
- }
- else
- {
- /* Non Blocking error : transfer could go on.
- Error is notified to user through user error callback */
-#if (USE_HAL_IRDA_REGISTER_CALLBACKS == 1)
- /* Call registered user error callback */
- hirda->ErrorCallback(hirda);
-#else
- /* Call legacy weak user error callback */
- HAL_IRDA_ErrorCallback(hirda);
-#endif /* USE_HAL_IRDA_REGISTER_CALLBACK */
- hirda->ErrorCode = HAL_IRDA_ERROR_NONE;
- }
- }
- return;
-
- } /* End if some error occurs */
-
- /* IRDA in mode Transmitter ------------------------------------------------*/
- if (((isrflags & USART_ISR_TXE) != 0U) && ((cr1its & USART_CR1_TXEIE) != 0U))
- {
- IRDA_Transmit_IT(hirda);
- return;
- }
-
- /* IRDA in mode Transmitter (transmission end) -----------------------------*/
- if (((isrflags & USART_ISR_TC) != 0U) && ((cr1its & USART_CR1_TCIE) != 0U))
- {
- IRDA_EndTransmit_IT(hirda);
- return;
- }
-
-}
-
-/**
- * @brief Tx Transfer completed callback.
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified IRDA module.
- * @retval None
- */
-__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,
- the HAL_IRDA_TxCpltCallback can be implemented in the user file.
- */
-}
-
-/**
- * @brief Tx Half Transfer completed callback.
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified USART module.
- * @retval None
- */
-__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,
- the HAL_IRDA_TxHalfCpltCallback can be implemented in the user file.
- */
-}
-
-/**
- * @brief Rx Transfer completed callback.
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified IRDA module.
- * @retval None
- */
-__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,
- the HAL_IRDA_RxCpltCallback can be implemented in the user file.
- */
-}
-
-/**
- * @brief Rx Half Transfer complete callback.
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified IRDA module.
- * @retval None
- */
-__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,
- the HAL_IRDA_RxHalfCpltCallback can be implemented in the user file.
- */
-}
-
-/**
- * @brief IRDA error callback.
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified IRDA module.
- * @retval None
- */
-__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,
- the HAL_IRDA_ErrorCallback can be implemented in the user file.
- */
-}
-
-/**
- * @brief IRDA Abort Complete callback.
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified IRDA module.
- * @retval None
- */
-__weak void HAL_IRDA_AbortCpltCallback(IRDA_HandleTypeDef *hirda)
-{
- /* Prevent unused argument(s) compilation warning */
- UNUSED(hirda);
-
- /* NOTE : This function should not be modified, when the callback is needed,
- the HAL_IRDA_AbortCpltCallback can be implemented in the user file.
- */
-}
-
-/**
- * @brief IRDA Abort Complete callback.
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified IRDA module.
- * @retval None
- */
-__weak void HAL_IRDA_AbortTransmitCpltCallback(IRDA_HandleTypeDef *hirda)
-{
- /* Prevent unused argument(s) compilation warning */
- UNUSED(hirda);
-
- /* NOTE : This function should not be modified, when the callback is needed,
- the HAL_IRDA_AbortTransmitCpltCallback can be implemented in the user file.
- */
-}
-
-/**
- * @brief IRDA Abort Receive Complete callback.
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified IRDA module.
- * @retval None
- */
-__weak void HAL_IRDA_AbortReceiveCpltCallback(IRDA_HandleTypeDef *hirda)
-{
- /* Prevent unused argument(s) compilation warning */
- UNUSED(hirda);
-
- /* NOTE : This function should not be modified, when the callback is needed,
- the HAL_IRDA_AbortReceiveCpltCallback can be implemented in the user file.
- */
-}
-
-/**
- * @}
- */
-
-/** @defgroup IRDA_Exported_Functions_Group4 Peripheral State and Error functions
- * @brief IRDA State and Errors functions
- *
-@verbatim
- ==============================================================================
- ##### Peripheral State and Error functions #####
- ==============================================================================
- [..]
- This subsection provides a set of functions allowing to return the State of IrDA
- communication process and also return Peripheral Errors occurred during communication process
- (+) HAL_IRDA_GetState() API can be helpful to check in run-time the state
- of the IRDA peripheral handle.
- (+) HAL_IRDA_GetError() checks in run-time errors that could occur during
- communication.
-
-@endverbatim
- * @{
- */
-
-/**
- * @brief Return the IRDA handle state.
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified IRDA module.
- * @retval HAL state
- */
-HAL_IRDA_StateTypeDef HAL_IRDA_GetState(IRDA_HandleTypeDef *hirda)
-{
- /* Return IRDA handle state */
- uint32_t temp1;
- uint32_t temp2;
- temp1 = (uint32_t)hirda->gState;
- temp2 = (uint32_t)hirda->RxState;
-
- return (HAL_IRDA_StateTypeDef)(temp1 | temp2);
-}
-
-/**
- * @brief Return the IRDA handle error code.
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified IRDA module.
- * @retval IRDA Error Code
- */
-uint32_t HAL_IRDA_GetError(IRDA_HandleTypeDef *hirda)
-{
- return hirda->ErrorCode;
-}
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/** @defgroup IRDA_Private_Functions IRDA Private Functions
- * @{
- */
-
-#if (USE_HAL_IRDA_REGISTER_CALLBACKS == 1)
-/**
- * @brief Initialize the callbacks to their default values.
- * @param hirda IRDA handle.
- * @retval none
- */
-void IRDA_InitCallbacksToDefault(IRDA_HandleTypeDef *hirda)
-{
- /* Init the IRDA Callback settings */
- hirda->TxHalfCpltCallback = HAL_IRDA_TxHalfCpltCallback; /* Legacy weak TxHalfCpltCallback */
- hirda->TxCpltCallback = HAL_IRDA_TxCpltCallback; /* Legacy weak TxCpltCallback */
- hirda->RxHalfCpltCallback = HAL_IRDA_RxHalfCpltCallback; /* Legacy weak RxHalfCpltCallback */
- hirda->RxCpltCallback = HAL_IRDA_RxCpltCallback; /* Legacy weak RxCpltCallback */
- hirda->ErrorCallback = HAL_IRDA_ErrorCallback; /* Legacy weak ErrorCallback */
- hirda->AbortCpltCallback = HAL_IRDA_AbortCpltCallback; /* Legacy weak AbortCpltCallback */
- hirda->AbortTransmitCpltCallback = HAL_IRDA_AbortTransmitCpltCallback; /* Legacy weak AbortTransmitCpltCallback */
- hirda->AbortReceiveCpltCallback = HAL_IRDA_AbortReceiveCpltCallback; /* Legacy weak AbortReceiveCpltCallback */
-
-}
-#endif /* USE_HAL_IRDA_REGISTER_CALLBACKS */
-
-/**
- * @brief Configure the IRDA peripheral.
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified IRDA module.
- * @retval HAL status
- */
-static HAL_StatusTypeDef IRDA_SetConfig(IRDA_HandleTypeDef *hirda)
-{
- uint32_t tmpreg;
- IRDA_ClockSourceTypeDef clocksource;
- HAL_StatusTypeDef ret = HAL_OK;
- uint32_t pclk;
-
- /* Check the communication parameters */
- assert_param(IS_IRDA_BAUDRATE(hirda->Init.BaudRate));
- assert_param(IS_IRDA_WORD_LENGTH(hirda->Init.WordLength));
- assert_param(IS_IRDA_PARITY(hirda->Init.Parity));
- assert_param(IS_IRDA_TX_RX_MODE(hirda->Init.Mode));
- assert_param(IS_IRDA_PRESCALER(hirda->Init.Prescaler));
- assert_param(IS_IRDA_POWERMODE(hirda->Init.PowerMode));
-
- /*-------------------------- USART CR1 Configuration -----------------------*/
- /* Configure the IRDA Word Length, Parity and transfer Mode:
- Set the M bits according to hirda->Init.WordLength value
- Set PCE and PS bits according to hirda->Init.Parity value
- Set TE and RE bits according to hirda->Init.Mode value */
- tmpreg = (uint32_t)hirda->Init.WordLength | hirda->Init.Parity | hirda->Init.Mode ;
-
- MODIFY_REG(hirda->Instance->CR1, IRDA_CR1_FIELDS, tmpreg);
-
- /*-------------------------- USART CR3 Configuration -----------------------*/
- MODIFY_REG(hirda->Instance->CR3, USART_CR3_IRLP, hirda->Init.PowerMode);
-
-
- /*-------------------------- USART GTPR Configuration ----------------------*/
- MODIFY_REG(hirda->Instance->GTPR, (uint16_t)USART_GTPR_PSC, (uint16_t)hirda->Init.Prescaler);
-
- /*-------------------------- USART BRR Configuration -----------------------*/
- IRDA_GETCLOCKSOURCE(hirda, clocksource);
- tmpreg = 0U;
- switch (clocksource)
- {
- case IRDA_CLOCKSOURCE_PCLK1:
- pclk = HAL_RCC_GetPCLK1Freq();
- tmpreg = (uint16_t)(IRDA_DIV_SAMPLING16(pclk, hirda->Init.BaudRate));
- break;
- case IRDA_CLOCKSOURCE_PCLK2:
- pclk = HAL_RCC_GetPCLK2Freq();
- tmpreg = (uint16_t)(IRDA_DIV_SAMPLING16(pclk, hirda->Init.BaudRate));
- break;
- case IRDA_CLOCKSOURCE_HSI:
- tmpreg = (uint16_t)(IRDA_DIV_SAMPLING16(HSI_VALUE, hirda->Init.BaudRate));
- break;
- case IRDA_CLOCKSOURCE_SYSCLK:
- pclk = HAL_RCC_GetSysClockFreq();
- tmpreg = (uint16_t)(IRDA_DIV_SAMPLING16(pclk, hirda->Init.BaudRate));
- break;
- case IRDA_CLOCKSOURCE_LSE:
- tmpreg = (uint16_t)(IRDA_DIV_SAMPLING16((uint32_t)LSE_VALUE, hirda->Init.BaudRate));
- break;
- default:
- ret = HAL_ERROR;
- break;
- }
-
- /* USARTDIV must be greater than or equal to 0d16 */
- if ((tmpreg >= USART_BRR_MIN) && (tmpreg <= USART_BRR_MAX))
- {
- hirda->Instance->BRR = tmpreg;
- }
- else
- {
- ret = HAL_ERROR;
- }
-
- return ret;
-}
-
-/**
- * @brief Check the IRDA Idle State.
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified IRDA module.
- * @retval HAL status
- */
-static HAL_StatusTypeDef IRDA_CheckIdleState(IRDA_HandleTypeDef *hirda)
-{
- uint32_t tickstart;
-
- /* Initialize the IRDA ErrorCode */
- hirda->ErrorCode = HAL_IRDA_ERROR_NONE;
-
- /* Init tickstart for timeout management */
- tickstart = HAL_GetTick();
-
- /* Check if the Transmitter is enabled */
- if ((hirda->Instance->CR1 & USART_CR1_TE) == USART_CR1_TE)
- {
- /* Wait until TEACK flag is set */
- if (IRDA_WaitOnFlagUntilTimeout(hirda, USART_ISR_TEACK, RESET, tickstart, IRDA_TEACK_REACK_TIMEOUT) != HAL_OK)
- {
- /* Timeout occurred */
- return HAL_TIMEOUT;
- }
- }
- /* Check if the Receiver is enabled */
- if ((hirda->Instance->CR1 & USART_CR1_RE) == USART_CR1_RE)
- {
- /* Wait until REACK flag is set */
- if (IRDA_WaitOnFlagUntilTimeout(hirda, USART_ISR_REACK, RESET, tickstart, IRDA_TEACK_REACK_TIMEOUT) != HAL_OK)
- {
- /* Timeout occurred */
- return HAL_TIMEOUT;
- }
- }
-
- /* Initialize the IRDA state*/
- hirda->gState = HAL_IRDA_STATE_READY;
- hirda->RxState = HAL_IRDA_STATE_READY;
-
- /* Process Unlocked */
- __HAL_UNLOCK(hirda);
-
- return HAL_OK;
-}
-
-/**
- * @brief Handle IRDA Communication Timeout.
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified IRDA module.
- * @param Flag Specifies the IRDA flag to check.
- * @param Status Flag status (SET or RESET)
- * @param Tickstart Tick start value
- * @param Timeout Timeout duration
- * @retval HAL status
- */
-static HAL_StatusTypeDef IRDA_WaitOnFlagUntilTimeout(IRDA_HandleTypeDef *hirda, uint32_t Flag, FlagStatus Status,
- uint32_t Tickstart, uint32_t Timeout)
-{
- /* Wait until flag is set */
- while ((__HAL_IRDA_GET_FLAG(hirda, Flag) ? SET : RESET) == Status)
- {
- /* Check for the Timeout */
- if (Timeout != HAL_MAX_DELAY)
- {
- if (((HAL_GetTick() - Tickstart) > Timeout) || (Timeout == 0U))
- {
- /* Disable TXE, RXNE, PE and ERR (Frame error, noise error, overrun error)
- interrupts for the interrupt process */
- CLEAR_BIT(hirda->Instance->CR1, (USART_CR1_RXNEIE | USART_CR1_PEIE | USART_CR1_TXEIE));
- CLEAR_BIT(hirda->Instance->CR3, USART_CR3_EIE);
-
- hirda->gState = HAL_IRDA_STATE_READY;
- hirda->RxState = HAL_IRDA_STATE_READY;
-
- /* Process Unlocked */
- __HAL_UNLOCK(hirda);
- return HAL_TIMEOUT;
- }
- }
- }
- return HAL_OK;
-}
-
-
-/**
- * @brief End ongoing Tx transfer on IRDA peripheral (following error detection or Transmit completion).
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified IRDA module.
- * @retval None
- */
-static void IRDA_EndTxTransfer(IRDA_HandleTypeDef *hirda)
-{
- /* Disable TXEIE and TCIE interrupts */
- CLEAR_BIT(hirda->Instance->CR1, (USART_CR1_TXEIE | USART_CR1_TCIE));
-
- /* At end of Tx process, restore hirda->gState to Ready */
- hirda->gState = HAL_IRDA_STATE_READY;
-}
-
-
-/**
- * @brief End ongoing Rx transfer on UART peripheral (following error detection or Reception completion).
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified IRDA module.
- * @retval None
- */
-static void IRDA_EndRxTransfer(IRDA_HandleTypeDef *hirda)
-{
- /* Disable RXNE, PE and ERR (Frame error, noise error, overrun error) interrupts */
- CLEAR_BIT(hirda->Instance->CR1, (USART_CR1_RXNEIE | USART_CR1_PEIE));
- CLEAR_BIT(hirda->Instance->CR3, USART_CR3_EIE);
-
- /* At end of Rx process, restore hirda->RxState to Ready */
- hirda->RxState = HAL_IRDA_STATE_READY;
-}
-
-
-/**
- * @brief DMA IRDA transmit process complete callback.
- * @param hdma Pointer to a DMA_HandleTypeDef structure that contains
- * the configuration information for the specified DMA module.
- * @retval None
- */
-static void IRDA_DMATransmitCplt(DMA_HandleTypeDef *hdma)
-{
- IRDA_HandleTypeDef *hirda = (IRDA_HandleTypeDef *)(hdma->Parent);
-
- /* DMA Normal mode */
- if (HAL_IS_BIT_CLR(hdma->Instance->CCR, DMA_CCR_CIRC))
- {
- hirda->TxXferCount = 0U;
-
- /* Disable the DMA transfer for transmit request by resetting the DMAT bit
- in the IRDA CR3 register */
- CLEAR_BIT(hirda->Instance->CR3, USART_CR3_DMAT);
-
- /* Enable the IRDA Transmit Complete Interrupt */
- SET_BIT(hirda->Instance->CR1, USART_CR1_TCIE);
- }
- /* DMA Circular mode */
- else
- {
-#if (USE_HAL_IRDA_REGISTER_CALLBACKS == 1)
- /* Call registered Tx complete callback */
- hirda->TxCpltCallback(hirda);
-#else
- /* Call legacy weak Tx complete callback */
- HAL_IRDA_TxCpltCallback(hirda);
-#endif /* USE_HAL_IRDA_REGISTER_CALLBACK */
- }
-
-}
-
-/**
- * @brief DMA IRDA transmit process half complete callback.
- * @param hdma Pointer to a DMA_HandleTypeDef structure that contains
- * the configuration information for the specified DMA module.
- * @retval None
- */
-static void IRDA_DMATransmitHalfCplt(DMA_HandleTypeDef *hdma)
-{
- IRDA_HandleTypeDef *hirda = (IRDA_HandleTypeDef *)(hdma->Parent);
-
-#if (USE_HAL_IRDA_REGISTER_CALLBACKS == 1)
- /* Call registered Tx Half complete callback */
- hirda->TxHalfCpltCallback(hirda);
-#else
- /* Call legacy weak Tx complete callback */
- HAL_IRDA_TxHalfCpltCallback(hirda);
-#endif /* USE_HAL_IRDA_REGISTER_CALLBACK */
-}
-
-/**
- * @brief DMA IRDA receive process complete callback.
- * @param hdma Pointer to a DMA_HandleTypeDef structure that contains
- * the configuration information for the specified DMA module.
- * @retval None
- */
-static void IRDA_DMAReceiveCplt(DMA_HandleTypeDef *hdma)
-{
- IRDA_HandleTypeDef *hirda = (IRDA_HandleTypeDef *)(hdma->Parent);
-
- /* DMA Normal mode */
- if (HAL_IS_BIT_CLR(hdma->Instance->CCR, DMA_CCR_CIRC))
- {
- hirda->RxXferCount = 0U;
-
- /* Disable PE and ERR (Frame error, noise error, overrun error) interrupts */
- CLEAR_BIT(hirda->Instance->CR1, USART_CR1_PEIE);
- CLEAR_BIT(hirda->Instance->CR3, USART_CR3_EIE);
-
- /* Disable the DMA transfer for the receiver request by resetting the DMAR bit
- in the IRDA CR3 register */
- CLEAR_BIT(hirda->Instance->CR3, USART_CR3_DMAR);
-
- /* At end of Rx process, restore hirda->RxState to Ready */
- hirda->RxState = HAL_IRDA_STATE_READY;
- }
-
-#if (USE_HAL_IRDA_REGISTER_CALLBACKS == 1)
- /* Call registered Rx complete callback */
- hirda->RxCpltCallback(hirda);
-#else
- /* Call legacy weak Rx complete callback */
- HAL_IRDA_RxCpltCallback(hirda);
-#endif /* USE_HAL_IRDA_REGISTER_CALLBACKS */
-}
-
-/**
- * @brief DMA IRDA receive process half complete callback.
- * @param hdma Pointer to a DMA_HandleTypeDef structure that contains
- * the configuration information for the specified DMA module.
- * @retval None
- */
-static void IRDA_DMAReceiveHalfCplt(DMA_HandleTypeDef *hdma)
-{
- IRDA_HandleTypeDef *hirda = (IRDA_HandleTypeDef *)(hdma->Parent);
-
-#if (USE_HAL_IRDA_REGISTER_CALLBACKS == 1)
- /*Call registered Rx Half complete callback*/
- hirda->RxHalfCpltCallback(hirda);
-#else
- /* Call legacy weak Rx Half complete callback */
- HAL_IRDA_RxHalfCpltCallback(hirda);
-#endif /* USE_HAL_IRDA_REGISTER_CALLBACK */
-}
-
-/**
- * @brief DMA IRDA communication error callback.
- * @param hdma Pointer to a DMA_HandleTypeDef structure that contains
- * the configuration information for the specified DMA module.
- * @retval None
- */
-static void IRDA_DMAError(DMA_HandleTypeDef *hdma)
-{
- IRDA_HandleTypeDef *hirda = (IRDA_HandleTypeDef *)(hdma->Parent);
-
- /* Stop IRDA DMA Tx request if ongoing */
- if (hirda->gState == HAL_IRDA_STATE_BUSY_TX)
- {
- if (HAL_IS_BIT_SET(hirda->Instance->CR3, USART_CR3_DMAT))
- {
- hirda->TxXferCount = 0U;
- IRDA_EndTxTransfer(hirda);
- }
- }
-
- /* Stop IRDA DMA Rx request if ongoing */
- if (hirda->RxState == HAL_IRDA_STATE_BUSY_RX)
- {
- if (HAL_IS_BIT_SET(hirda->Instance->CR3, USART_CR3_DMAR))
- {
- hirda->RxXferCount = 0U;
- IRDA_EndRxTransfer(hirda);
- }
- }
-
- hirda->ErrorCode |= HAL_IRDA_ERROR_DMA;
-#if (USE_HAL_IRDA_REGISTER_CALLBACKS == 1)
- /* Call registered user error callback */
- hirda->ErrorCallback(hirda);
-#else
- /* Call legacy weak user error callback */
- HAL_IRDA_ErrorCallback(hirda);
-#endif /* USE_HAL_IRDA_REGISTER_CALLBACK */
-}
-
-/**
- * @brief DMA IRDA communication abort callback, when initiated by HAL services on Error
- * (To be called at end of DMA Abort procedure following error occurrence).
- * @param hdma DMA handle.
- * @retval None
- */
-static void IRDA_DMAAbortOnError(DMA_HandleTypeDef *hdma)
-{
- IRDA_HandleTypeDef *hirda = (IRDA_HandleTypeDef *)(hdma->Parent);
- hirda->RxXferCount = 0U;
- hirda->TxXferCount = 0U;
-
-#if (USE_HAL_IRDA_REGISTER_CALLBACKS == 1)
- /* Call registered user error callback */
- hirda->ErrorCallback(hirda);
-#else
- /* Call legacy weak user error callback */
- HAL_IRDA_ErrorCallback(hirda);
-#endif /* USE_HAL_IRDA_REGISTER_CALLBACK */
-}
-
-/**
- * @brief DMA IRDA Tx communication abort callback, when initiated by user
- * (To be called at end of DMA Tx Abort procedure following user abort request).
- * @note When this callback is executed, User Abort complete call back is called only if no
- * Abort still ongoing for Rx DMA Handle.
- * @param hdma DMA handle.
- * @retval None
- */
-static void IRDA_DMATxAbortCallback(DMA_HandleTypeDef *hdma)
-{
- IRDA_HandleTypeDef *hirda = (IRDA_HandleTypeDef *)(hdma->Parent);
-
- hirda->hdmatx->XferAbortCallback = NULL;
-
- /* Check if an Abort process is still ongoing */
- if (hirda->hdmarx != NULL)
- {
- if (hirda->hdmarx->XferAbortCallback != NULL)
- {
- return;
- }
- }
-
- /* No Abort process still ongoing : All DMA channels are aborted, call user Abort Complete callback */
- hirda->TxXferCount = 0U;
- hirda->RxXferCount = 0U;
-
- /* Reset errorCode */
- hirda->ErrorCode = HAL_IRDA_ERROR_NONE;
-
- /* Clear the Error flags in the ICR register */
- __HAL_IRDA_CLEAR_FLAG(hirda, IRDA_CLEAR_OREF | IRDA_CLEAR_NEF | IRDA_CLEAR_PEF | IRDA_CLEAR_FEF);
-
- /* Restore hirda->gState and hirda->RxState to Ready */
- hirda->gState = HAL_IRDA_STATE_READY;
- hirda->RxState = HAL_IRDA_STATE_READY;
-
- /* Call user Abort complete callback */
-#if (USE_HAL_IRDA_REGISTER_CALLBACKS == 1)
- /* Call registered Abort complete callback */
- hirda->AbortCpltCallback(hirda);
-#else
- /* Call legacy weak Abort complete callback */
- HAL_IRDA_AbortCpltCallback(hirda);
-#endif /* USE_HAL_IRDA_REGISTER_CALLBACK */
-}
-
-
-/**
- * @brief DMA IRDA Rx communication abort callback, when initiated by user
- * (To be called at end of DMA Rx Abort procedure following user abort request).
- * @note When this callback is executed, User Abort complete call back is called only if no
- * Abort still ongoing for Tx DMA Handle.
- * @param hdma DMA handle.
- * @retval None
- */
-static void IRDA_DMARxAbortCallback(DMA_HandleTypeDef *hdma)
-{
- IRDA_HandleTypeDef *hirda = (IRDA_HandleTypeDef *)(hdma->Parent);
-
- hirda->hdmarx->XferAbortCallback = NULL;
-
- /* Check if an Abort process is still ongoing */
- if (hirda->hdmatx != NULL)
- {
- if (hirda->hdmatx->XferAbortCallback != NULL)
- {
- return;
- }
- }
-
- /* No Abort process still ongoing : All DMA channels are aborted, call user Abort Complete callback */
- hirda->TxXferCount = 0U;
- hirda->RxXferCount = 0U;
-
- /* Reset errorCode */
- hirda->ErrorCode = HAL_IRDA_ERROR_NONE;
-
- /* Clear the Error flags in the ICR register */
- __HAL_IRDA_CLEAR_FLAG(hirda, IRDA_CLEAR_OREF | IRDA_CLEAR_NEF | IRDA_CLEAR_PEF | IRDA_CLEAR_FEF);
-
- /* Restore hirda->gState and hirda->RxState to Ready */
- hirda->gState = HAL_IRDA_STATE_READY;
- hirda->RxState = HAL_IRDA_STATE_READY;
-
- /* Call user Abort complete callback */
-#if (USE_HAL_IRDA_REGISTER_CALLBACKS == 1)
- /* Call registered Abort complete callback */
- hirda->AbortCpltCallback(hirda);
-#else
- /* Call legacy weak Abort complete callback */
- HAL_IRDA_AbortCpltCallback(hirda);
-#endif /* USE_HAL_IRDA_REGISTER_CALLBACK */
-}
-
-
-/**
- * @brief DMA IRDA Tx communication abort callback, when initiated by user by a call to
- * HAL_IRDA_AbortTransmit_IT API (Abort only Tx transfer)
- * (This callback is executed at end of DMA Tx Abort procedure following user abort request,
- * and leads to user Tx Abort Complete callback execution).
- * @param hdma DMA handle.
- * @retval None
- */
-static void IRDA_DMATxOnlyAbortCallback(DMA_HandleTypeDef *hdma)
-{
- IRDA_HandleTypeDef *hirda = (IRDA_HandleTypeDef *)(hdma->Parent);
-
- hirda->TxXferCount = 0U;
-
- /* Restore hirda->gState to Ready */
- hirda->gState = HAL_IRDA_STATE_READY;
-
- /* Call user Abort complete callback */
-#if (USE_HAL_IRDA_REGISTER_CALLBACKS == 1)
- /* Call registered Abort Transmit Complete Callback */
- hirda->AbortTransmitCpltCallback(hirda);
-#else
- /* Call legacy weak Abort Transmit Complete Callback */
- HAL_IRDA_AbortTransmitCpltCallback(hirda);
-#endif /* USE_HAL_IRDA_REGISTER_CALLBACK */
-}
-
-/**
- * @brief DMA IRDA Rx communication abort callback, when initiated by user by a call to
- * HAL_IRDA_AbortReceive_IT API (Abort only Rx transfer)
- * (This callback is executed at end of DMA Rx Abort procedure following user abort request,
- * and leads to user Rx Abort Complete callback execution).
- * @param hdma DMA handle.
- * @retval None
- */
-static void IRDA_DMARxOnlyAbortCallback(DMA_HandleTypeDef *hdma)
-{
- IRDA_HandleTypeDef *hirda = (IRDA_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
-
- hirda->RxXferCount = 0U;
-
- /* Clear the Error flags in the ICR register */
- __HAL_IRDA_CLEAR_FLAG(hirda, IRDA_CLEAR_OREF | IRDA_CLEAR_NEF | IRDA_CLEAR_PEF | IRDA_CLEAR_FEF);
-
- /* Restore hirda->RxState to Ready */
- hirda->RxState = HAL_IRDA_STATE_READY;
-
- /* Call user Abort complete callback */
-#if (USE_HAL_IRDA_REGISTER_CALLBACKS == 1)
- /* Call registered Abort Receive Complete Callback */
- hirda->AbortReceiveCpltCallback(hirda);
-#else
- /* Call legacy weak Abort Receive Complete Callback */
- HAL_IRDA_AbortReceiveCpltCallback(hirda);
-#endif /* USE_HAL_IRDA_REGISTER_CALLBACK */
-}
-
-/**
- * @brief Send an amount of data in interrupt mode.
- * @note Function is called under interruption only, once
- * interruptions have been enabled by HAL_IRDA_Transmit_IT().
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified IRDA module.
- * @retval None
- */
-static void IRDA_Transmit_IT(IRDA_HandleTypeDef *hirda)
-{
- uint16_t *tmp;
-
- /* Check that a Tx process is ongoing */
- if (hirda->gState == HAL_IRDA_STATE_BUSY_TX)
- {
- if (hirda->TxXferCount == 0U)
- {
- /* Disable the IRDA Transmit Data Register Empty Interrupt */
- CLEAR_BIT(hirda->Instance->CR1, USART_CR1_TXEIE);
-
- /* Enable the IRDA Transmit Complete Interrupt */
- SET_BIT(hirda->Instance->CR1, USART_CR1_TCIE);
- }
- else
- {
- if ((hirda->Init.WordLength == IRDA_WORDLENGTH_9B) && (hirda->Init.Parity == IRDA_PARITY_NONE))
- {
- tmp = (uint16_t *) hirda->pTxBuffPtr; /* Derogation R.11.3 */
- hirda->Instance->TDR = (uint16_t)(*tmp & 0x01FFU);
- hirda->pTxBuffPtr += 2U;
- }
- else
- {
- hirda->Instance->TDR = (uint8_t)(*hirda->pTxBuffPtr & 0xFFU);
- hirda->pTxBuffPtr++;
- }
- hirda->TxXferCount--;
- }
- }
-}
-
-/**
- * @brief Wrap up transmission in non-blocking mode.
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified IRDA module.
- * @retval None
- */
-static void IRDA_EndTransmit_IT(IRDA_HandleTypeDef *hirda)
-{
- /* Disable the IRDA Transmit Complete Interrupt */
- CLEAR_BIT(hirda->Instance->CR1, USART_CR1_TCIE);
-
- /* Tx process is ended, restore hirda->gState to Ready */
- hirda->gState = HAL_IRDA_STATE_READY;
-
-#if (USE_HAL_IRDA_REGISTER_CALLBACKS == 1)
- /* Call registered Tx complete callback */
- hirda->TxCpltCallback(hirda);
-#else
- /* Call legacy weak Tx complete callback */
- HAL_IRDA_TxCpltCallback(hirda);
-#endif /* USE_HAL_IRDA_REGISTER_CALLBACK */
-}
-
-/**
- * @brief Receive an amount of data in interrupt mode.
- * @note Function is called under interruption only, once
- * interruptions have been enabled by HAL_IRDA_Receive_IT()
- * @param hirda Pointer to a IRDA_HandleTypeDef structure that contains
- * the configuration information for the specified IRDA module.
- * @retval None
- */
-static void IRDA_Receive_IT(IRDA_HandleTypeDef *hirda)
-{
- uint16_t *tmp;
- uint16_t uhMask = hirda->Mask;
- uint16_t uhdata;
-
- /* Check that a Rx process is ongoing */
- if (hirda->RxState == HAL_IRDA_STATE_BUSY_RX)
- {
- uhdata = (uint16_t) READ_REG(hirda->Instance->RDR);
- if ((hirda->Init.WordLength == IRDA_WORDLENGTH_9B) && (hirda->Init.Parity == IRDA_PARITY_NONE))
- {
- tmp = (uint16_t *) hirda->pRxBuffPtr; /* Derogation R.11.3 */
- *tmp = (uint16_t)(uhdata & uhMask);
- hirda->pRxBuffPtr += 2U;
- }
- else
- {
- *hirda->pRxBuffPtr = (uint8_t)(uhdata & (uint8_t)uhMask);
- hirda->pRxBuffPtr++;
- }
-
- hirda->RxXferCount--;
- if (hirda->RxXferCount == 0U)
- {
- /* Disable the IRDA Parity Error Interrupt and RXNE interrupt */
- CLEAR_BIT(hirda->Instance->CR1, (USART_CR1_RXNEIE | USART_CR1_PEIE));
-
- /* Disable the IRDA Error Interrupt: (Frame error, noise error, overrun error) */
- CLEAR_BIT(hirda->Instance->CR3, USART_CR3_EIE);
-
- /* Rx process is completed, restore hirda->RxState to Ready */
- hirda->RxState = HAL_IRDA_STATE_READY;
-
-#if (USE_HAL_IRDA_REGISTER_CALLBACKS == 1)
- /* Call registered Rx complete callback */
- hirda->RxCpltCallback(hirda);
-#else
- /* Call legacy weak Rx complete callback */
- HAL_IRDA_RxCpltCallback(hirda);
-#endif /* USE_HAL_IRDA_REGISTER_CALLBACKS */
- }
- }
- else
- {
- /* Clear RXNE interrupt flag */
- __HAL_IRDA_SEND_REQ(hirda, IRDA_RXDATA_FLUSH_REQUEST);
- }
-}
-
-/**
- * @}
- */
-
-#endif /* HAL_IRDA_MODULE_ENABLED */
-/**
- * @}
- */
-
-/**
- * @}
- */
-#endif /* !defined (STM32L010x4) && !defined (STM32L010x6) && !defined (STM32L010x8) */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_iwdg.c b/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_iwdg.c
deleted file mode 100644
index 7179ec5314..0000000000
--- a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_iwdg.c
+++ /dev/null
@@ -1,285 +0,0 @@
-/**
- ******************************************************************************
- * @file stm32l0xx_hal_iwdg.c
- * @author MCD Application Team
- * @brief IWDG HAL module driver.
- * This file provides firmware functions to manage the following
- * functionalities of the Independent Watchdog (IWDG) peripheral:
- * + Initialization and Start functions
- * + IO operation functions
- *
- @verbatim
- ==============================================================================
- ##### IWDG Generic features #####
- ==============================================================================
- [..]
- (+) The IWDG can be started by either software or hardware (configurable
- through option byte).
-
- (+) The IWDG is clocked by the Low-Speed Internal clock (LSI) and thus stays
- active even if the main clock fails.
-
- (+) Once the IWDG is started, the LSI is forced ON and both cannot be
- disabled. The counter starts counting down from the reset value (0xFFF).
- When it reaches the end of count value (0x000) a reset signal is
- generated (IWDG reset).
-
- (+) Whenever the key value 0x0000 AAAA is written in the IWDG_KR register,
- the IWDG_RLR value is reloaded into the counter and the watchdog reset
- is prevented.
-
- (+) The IWDG is implemented in the VDD voltage domain that is still functional
- in STOP and STANDBY mode (IWDG reset can wake up the CPU from STANDBY).
- IWDGRST flag in RCC_CSR register can be used to inform when an IWDG
- reset occurs.
-
- (+) Debug mode: When the microcontroller enters debug mode (core halted),
- the IWDG counter either continues to work normally or stops, depending
- on DBG_IWDG_STOP configuration bit in DBG module, accessible through
- __HAL_DBGMCU_FREEZE_IWDG() and __HAL_DBGMCU_UNFREEZE_IWDG() macros.
-
- [..] Min-max timeout value @37KHz (LSI): ~144us / ~37.8s
- The IWDG timeout may vary due to LSI clock frequency dispersion.
- STM32L0xx devices provide the capability to measure the LSI clock
- frequency (LSI clock is internally connected to TIM16 CH1 input capture).
- The measured value can be used to have an IWDG timeout with an
- acceptable accuracy.
-
- [..] Default timeout value (necessary for IWDG_SR status register update):
- Constant LSI_VALUE is defined based on the nominal LSI clock frequency.
- This frequency being subject to variations as mentioned above, the
- default timeout value (defined through constant HAL_IWDG_DEFAULT_TIMEOUT
- below) may become too short or too long.
- In such cases, this default timeout value can be tuned by redefining
- the constant LSI_VALUE at user-application level (based, for instance,
- on the measured LSI clock frequency as explained above).
-
- ##### How to use this driver #####
- ==============================================================================
- [..]
- (#) Use IWDG using HAL_IWDG_Init() function to :
- (++) Enable instance by writing Start keyword in IWDG_KEY register. LSI
- clock is forced ON and IWDG counter starts counting down.
- (++) Enable write access to configuration registers:
- IWDG_PR, IWDG_RLR and IWDG_WINR.
- (++) Configure the IWDG prescaler and counter reload value. This reload
- value will be loaded in the IWDG counter each time the watchdog is
- reloaded, then the IWDG will start counting down from this value.
- (++) Depending on window parameter:
- (+++) If Window Init parameter is same as Window register value,
- nothing more is done but reload counter value in order to exit
- function with exact time base.
- (+++) Else modify Window register. This will automatically reload
- watchdog counter.
- (++) Wait for status flags to be reset.
-
- (#) Then the application program must refresh the IWDG counter at regular
- intervals during normal operation to prevent an MCU reset, using
- HAL_IWDG_Refresh() function.
-
- *** IWDG HAL driver macros list ***
- ====================================
- [..]
- Below the list of most used macros in IWDG HAL driver:
- (+) __HAL_IWDG_START: Enable the IWDG peripheral
- (+) __HAL_IWDG_RELOAD_COUNTER: Reloads IWDG counter with value defined in
- the reload register
-
- @endverbatim
- ******************************************************************************
- * @attention
- *
- *
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-#include "stm32l0xx_hal.h"
-
-/** @addtogroup STM32L0xx_HAL_Driver
- * @{
- */
-
-#ifdef HAL_IWDG_MODULE_ENABLED
-/** @addtogroup IWDG
- * @brief IWDG HAL module driver.
- * @{
- */
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/** @defgroup IWDG_Private_Defines IWDG Private Defines
- * @{
- */
-/* Status register needs up to 5 LSI clock periods divided by the clock
- prescaler to be updated. The number of LSI clock periods is upper-rounded to
- 6 for the timeout value calculation.
- The timeout value is calculated using the highest prescaler (256) and
- the LSI_VALUE constant. The value of this constant can be changed by the user
- to take into account possible LSI clock period variations.
- The timeout value is multiplied by 1000 to be converted in milliseconds.
- LSI startup time is also considered here by adding LSI_STARTUP_TIMEOUT
- converted in milliseconds. */
-#define HAL_IWDG_DEFAULT_TIMEOUT (((6UL * 256UL * 1000UL) / LSI_VALUE) + ((LSI_STARTUP_TIME / 1000UL) + 1UL))
-#define IWDG_KERNEL_UPDATE_FLAGS (IWDG_SR_WVU | IWDG_SR_RVU | IWDG_SR_PVU)
-/**
- * @}
- */
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Exported functions --------------------------------------------------------*/
-
-/** @addtogroup IWDG_Exported_Functions
- * @{
- */
-
-/** @addtogroup IWDG_Exported_Functions_Group1
- * @brief Initialization and Start functions.
- *
-@verbatim
- ===============================================================================
- ##### Initialization and Start functions #####
- ===============================================================================
- [..] This section provides functions allowing to:
- (+) Initialize the IWDG according to the specified parameters in the
- IWDG_InitTypeDef of associated handle.
- (+) Manage Window option.
- (+) Once initialization is performed in HAL_IWDG_Init function, Watchdog
- is reloaded in order to exit function with correct time base.
-
-@endverbatim
- * @{
- */
-
-/**
- * @brief Initialize the IWDG according to the specified parameters in the
- * IWDG_InitTypeDef and start watchdog. Before exiting function,
- * watchdog is refreshed in order to have correct time base.
- * @param hiwdg pointer to a IWDG_HandleTypeDef structure that contains
- * the configuration information for the specified IWDG module.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_IWDG_Init(IWDG_HandleTypeDef *hiwdg)
-{
- uint32_t tickstart;
-
- /* Check the IWDG handle allocation */
- if (hiwdg == NULL)
- {
- return HAL_ERROR;
- }
-
- /* Check the parameters */
- assert_param(IS_IWDG_ALL_INSTANCE(hiwdg->Instance));
- assert_param(IS_IWDG_PRESCALER(hiwdg->Init.Prescaler));
- assert_param(IS_IWDG_RELOAD(hiwdg->Init.Reload));
- assert_param(IS_IWDG_WINDOW(hiwdg->Init.Window));
-
- /* Enable IWDG. LSI is turned on automatically */
- __HAL_IWDG_START(hiwdg);
-
- /* Enable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers by writing
- 0x5555 in KR */
- IWDG_ENABLE_WRITE_ACCESS(hiwdg);
-
- /* Write to IWDG registers the Prescaler & Reload values to work with */
- hiwdg->Instance->PR = hiwdg->Init.Prescaler;
- hiwdg->Instance->RLR = hiwdg->Init.Reload;
-
- /* Check pending flag, if previous update not done, return timeout */
- tickstart = HAL_GetTick();
-
- /* Wait for register to be updated */
- while ((hiwdg->Instance->SR & IWDG_KERNEL_UPDATE_FLAGS) != 0x00u)
- {
- if ((HAL_GetTick() - tickstart) > HAL_IWDG_DEFAULT_TIMEOUT)
- {
- if ((hiwdg->Instance->SR & IWDG_KERNEL_UPDATE_FLAGS) != 0x00u)
- {
- return HAL_TIMEOUT;
- }
- }
- }
-
- /* If window parameter is different than current value, modify window
- register */
- if (hiwdg->Instance->WINR != hiwdg->Init.Window)
- {
- /* Write to IWDG WINR the IWDG_Window value to compare with. In any case,
- even if window feature is disabled, Watchdog will be reloaded by writing
- windows register */
- hiwdg->Instance->WINR = hiwdg->Init.Window;
- }
- else
- {
- /* Reload IWDG counter with value defined in the reload register */
- __HAL_IWDG_RELOAD_COUNTER(hiwdg);
- }
-
- /* Return function status */
- return HAL_OK;
-}
-
-
-/**
- * @}
- */
-
-
-/** @addtogroup IWDG_Exported_Functions_Group2
- * @brief IO operation functions
- *
-@verbatim
- ===============================================================================
- ##### IO operation functions #####
- ===============================================================================
- [..] This section provides functions allowing to:
- (+) Refresh the IWDG.
-
-@endverbatim
- * @{
- */
-
-/**
- * @brief Refresh the IWDG.
- * @param hiwdg pointer to a IWDG_HandleTypeDef structure that contains
- * the configuration information for the specified IWDG module.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_IWDG_Refresh(IWDG_HandleTypeDef *hiwdg)
-{
- /* Reload IWDG counter with value defined in the reload register */
- __HAL_IWDG_RELOAD_COUNTER(hiwdg);
-
- /* Return function status */
- return HAL_OK;
-}
-
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-#endif /* HAL_IWDG_MODULE_ENABLED */
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_lcd.c b/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_lcd.c
deleted file mode 100644
index 62c405dd5d..0000000000
--- a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_lcd.c
+++ /dev/null
@@ -1,609 +0,0 @@
-/**
- ******************************************************************************
- * @file stm32l0xx_hal_lcd.c
- * @author MCD Application Team
- * @brief LCD Controller HAL module driver.
- * This file provides firmware functions to manage the following
- * functionalities of the LCD Controller (LCD) peripheral:
- * + Initialization/de-initialization methods
- * + I/O operation methods
- * + Peripheral State methods
- *
- @verbatim
- ==============================================================================
- ##### How to use this driver #####
- ==============================================================================
- [..] The LCD HAL driver can be used as follow:
-
- (#) Declare a LCD_HandleTypeDef handle structure.
-
- (#) Prepare the initialization of the LCD low level resources by implementing your HAL_LCD_MspInit() API:
- (##) Enable the LCDCLK (same as RTCCLK): to configure the RTCCLK/LCDCLK, use the RCC function
- HAL_RCCEx_PeriphCLKConfig, indicating here RCC_PERIPHCLK_LCD and the selected clock
- source (HSE, LSI or LSE)
- (##) The frequency generator allows you to achieve various LCD frame rates starting from an
- LCD input clock frequency (LCDCLK) which can vary from 32 kHz up to 1 MHz.
- (##) LCD pins configuration:
- - Enable the clock for the LCD GPIOs
- - Configure these LCD pins as alternate function no-pull.
- (##) Enable the LCD interface clock.
-
- (#) Set the Prescaler, Divider, Blink mode, Blink Frequency Duty, Bias, Voltage Source,
- Dead Time, Pulse On Duration and Contrast in the hlcd Init structure.
-
- (#) Initialize the LCD registers by calling the HAL_LCD_Init() API.
- (##) The HAL_LCD_Init() API configures the low level Hardware (GPIO, CLOCK, ...etc)
- by calling the user customized HAL_LCD_MspInit() API.
- (#) After calling the HAL_LCD_Init() the LCD RAM memory is cleared
-
- (#) Optionally you can update the LCD configuration using these macros:
- (##) LCD High Drive using the __HAL_LCD_HIGHDRIVER_ENABLE() and __HAL_LCD_HIGHDRIVER_DISABLE() macros
- (##) LCD Pulse ON Duration using the __HAL_LCD_PULSEONDURATION_CONFIG() macro
- (##) LCD Dead Time using the __HAL_LCD_DEADTIME_CONFIG() macro
- (##) The LCD Blink mode and frequency using the __HAL_LCD_BLINK_CONFIG() macro
- (##) The LCD Contrast using the __HAL_LCD_CONTRAST_CONFIG() macro
-
- (#) Write to the LCD RAM memory using the HAL_LCD_Write() API, this API can be called
- several times to update the different LCD RAM registers before calling
- HAL_LCD_UpdateDisplayRequest() API.
-
- (#) The HAL_LCD_Clear() API can be used to clear the LCD RAM memory.
-
- (#) When the LCD RAM memory is updated, enable the update display request calling
- the HAL_LCD_UpdateDisplayRequest() API.
-
- [..] LCD and low power modes: The LCD remain active during STOP mode.
-
- @endverbatim
- ******************************************************************************
- * @attention
- *
- *
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-#include "stm32l0xx_hal.h"
-
-#if defined (STM32L053xx) || defined (STM32L063xx) || defined (STM32L073xx) || defined (STM32L083xx)
-
-/** @addtogroup STM32L0xx_HAL_Driver
- * @{
- */
-
-#ifdef HAL_LCD_MODULE_ENABLED
-
-/** @addtogroup LCD
- * @brief LCD HAL module driver
- * @{
- */
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/** @addtogroup LCD_Private
- * @{
- */
-#define LCD_TIMEOUT_VALUE 1000U
-/**
- * @}
- */
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/** @addtogroup LCD_Exported_Functions
- * @{
- */
-
-/** @addtogroup LCD_Exported_Functions_Group1
- * @brief Initialization and Configuration functions
- *
-@verbatim
-===============================================================================
- ##### Initialization and Configuration functions #####
- ===============================================================================
- [..]
-
-@endverbatim
- * @{
- */
-
-/**
- * @brief DeInitializes the LCD peripheral.
- * @param hlcd LCD handle
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_LCD_DeInit(LCD_HandleTypeDef *hlcd)
-{
- /* Check the LCD handle allocation */
- if(hlcd == NULL)
- {
- return HAL_ERROR;
- }
-
- /* Check the parameters */
- assert_param(IS_LCD_ALL_INSTANCE(hlcd->Instance));
-
- /* Check the LCD peripheral state */
- if(hlcd->State == HAL_LCD_STATE_BUSY)
- {
- return HAL_BUSY;
- }
-
- hlcd->State = HAL_LCD_STATE_BUSY;
-
- /* Disable the peripheral */
- __HAL_LCD_DISABLE(hlcd);
-
- /*Disable Highdrive by default*/
- __HAL_LCD_HIGHDRIVER_DISABLE(hlcd);
-
- /* DeInit the low level hardware */
- HAL_LCD_MspDeInit(hlcd);
-
- hlcd->ErrorCode = HAL_LCD_ERROR_NONE;
- hlcd->State = HAL_LCD_STATE_RESET;
-
- /* Release Lock */
- __HAL_UNLOCK(hlcd);
-
- return HAL_OK;
-}
-
-/**
- * @brief Initializes the LCD peripheral according to the specified parameters
- * in the LCD_InitStruct.
- * @note This function can be used only when the LCD is disabled.
- * The LCD HighDrive can be enabled/disabled using related macros up to user.
- * @param hlcd LCD handle
- * @retval None
- */
-HAL_StatusTypeDef HAL_LCD_Init(LCD_HandleTypeDef *hlcd)
-{
- uint32_t tickstart = 0x00U;
- uint8_t counter = 0U;
-
- /* Check the LCD handle allocation */
- if(hlcd == NULL)
- {
- return HAL_ERROR;
- }
-
- /* Check function parameters */
- assert_param(IS_LCD_ALL_INSTANCE(hlcd->Instance));
- assert_param(IS_LCD_PRESCALER(hlcd->Init.Prescaler));
- assert_param(IS_LCD_DIVIDER(hlcd->Init.Divider));
- assert_param(IS_LCD_DUTY(hlcd->Init.Duty));
- assert_param(IS_LCD_BIAS(hlcd->Init.Bias));
- assert_param(IS_LCD_VOLTAGE_SOURCE(hlcd->Init.VoltageSource));
- assert_param(IS_LCD_PULSE_ON_DURATION(hlcd->Init.PulseOnDuration));
- assert_param(IS_LCD_HIGHDRIVE(hlcd->Init.HighDrive));
- assert_param(IS_LCD_DEAD_TIME(hlcd->Init.DeadTime));
- assert_param(IS_LCD_CONTRAST(hlcd->Init.Contrast));
- assert_param(IS_LCD_BLINK_FREQUENCY(hlcd->Init.BlinkFrequency));
- assert_param(IS_LCD_BLINK_MODE(hlcd->Init.BlinkMode));
- assert_param(IS_LCD_MUXSEGMENT(hlcd->Init.MuxSegment));
-
- if(hlcd->State == HAL_LCD_STATE_RESET)
- {
- /* Allocate lock resource and initialize it */
- __HAL_UNLOCK(hlcd);
-
- /* Initialize the low level hardware (MSP) */
- HAL_LCD_MspInit(hlcd);
- }
-
- hlcd->State = HAL_LCD_STATE_BUSY;
-
- /* Disable the peripheral */
- __HAL_LCD_DISABLE(hlcd);
-
- /* Clear the LCD_RAM registers and enable the display request by setting the UDR bit
- in the LCD_SR register */
- for(counter = LCD_RAM_REGISTER0; counter <= LCD_RAM_REGISTER15; counter++)
- {
- hlcd->Instance->RAM[counter] = 0U;
- }
- /* Enable the display request */
- SET_BIT(hlcd->Instance->SR, LCD_SR_UDR);
-
- /* Configure the LCD Prescaler, Divider, Blink mode and Blink Frequency:
- Set PS[3:0] bits according to hlcd->Init.Prescaler value
- Set DIV[3:0] bits according to hlcd->Init.Divider value
- Set BLINK[1:0] bits according to hlcd->Init.BlinkMode value
- Set BLINKF[2:0] bits according to hlcd->Init.BlinkFrequency value
- Set DEAD[2:0] bits according to hlcd->Init.DeadTime value
- Set PON[2:0] bits according to hlcd->Init.PulseOnDuration value
- Set CC[2:0] bits according to hlcd->Init.Contrast value
- Set HD[0] bit according to hlcd->Init.HighDrive value*/
-
- MODIFY_REG(hlcd->Instance->FCR, \
- (LCD_FCR_PS | LCD_FCR_DIV | LCD_FCR_BLINK| LCD_FCR_BLINKF | \
- LCD_FCR_DEAD | LCD_FCR_PON | LCD_FCR_CC), \
- (hlcd->Init.Prescaler | hlcd->Init.Divider | hlcd->Init.BlinkMode | hlcd->Init.BlinkFrequency | \
- hlcd->Init.DeadTime | hlcd->Init.PulseOnDuration | hlcd->Init.Contrast | hlcd->Init.HighDrive));
-
- /* Wait until LCD Frame Control Register Synchronization flag (FCRSF) is set in the LCD_SR register
- This bit is set by hardware each time the LCD_FCR register is updated in the LCDCLK
- domain. It is cleared by hardware when writing to the LCD_FCR register.*/
- LCD_WaitForSynchro(hlcd);
-
- /* Configure the LCD Duty, Bias, Voltage Source, Dead Time:
- Set DUTY[2:0] bits according to hlcd->Init.Duty value
- Set BIAS[1:0] bits according to hlcd->Init.Bias value
- Set VSEL bit according to hlcd->Init.VoltageSource value
- Set MUX_SEG bit according to hlcd->Init.MuxSegment value */
- MODIFY_REG(hlcd->Instance->CR, \
- (LCD_CR_DUTY | LCD_CR_BIAS | LCD_CR_VSEL | LCD_CR_MUX_SEG), \
- (hlcd->Init.Duty | hlcd->Init.Bias | hlcd->Init.VoltageSource | hlcd->Init.MuxSegment));
-
- /* Enable the peripheral */
- __HAL_LCD_ENABLE(hlcd);
-
- /* Get timeout */
- tickstart = HAL_GetTick();
-
- /* Wait Until the LCD is enabled */
- while(__HAL_LCD_GET_FLAG(hlcd, LCD_FLAG_ENS) == RESET)
- {
- if((HAL_GetTick() - tickstart ) > LCD_TIMEOUT_VALUE)
- {
- hlcd->ErrorCode = HAL_LCD_ERROR_ENS;
- return HAL_TIMEOUT;
- }
- }
-
- /* Get timeout */
- tickstart = HAL_GetTick();
-
- /*!< Wait Until the LCD Booster is ready */
- while(__HAL_LCD_GET_FLAG(hlcd, LCD_FLAG_RDY) == RESET)
- {
- if((HAL_GetTick() - tickstart ) > LCD_TIMEOUT_VALUE)
- {
- hlcd->ErrorCode = HAL_LCD_ERROR_RDY;
- return HAL_TIMEOUT;
- }
- }
-
- /* Initialize the LCD state */
- hlcd->ErrorCode = HAL_LCD_ERROR_NONE;
- hlcd->State= HAL_LCD_STATE_READY;
-
- return HAL_OK;
-}
-
-/**
- * @brief LCD MSP DeInit.
- * @param hlcd LCD handle
- * @retval None
- */
- __weak void HAL_LCD_MspDeInit(LCD_HandleTypeDef *hlcd)
-{
- /* Prevent unused argument(s) compilation warning */
- UNUSED(hlcd);
-
- /* NOTE: This function Should not be modified, when the callback is needed,
- the HAL_LCD_MspDeInit could be implemented in the user file
- */
-}
-
-/**
- * @brief LCD MSP Init.
- * @param hlcd LCD handle
- * @retval None
- */
- __weak void HAL_LCD_MspInit(LCD_HandleTypeDef *hlcd)
-{
- /* Prevent unused argument(s) compilation warning */
- UNUSED(hlcd);
-
- /* NOTE: This function Should not be modified, when the callback is needed,
- the HAL_LCD_MspInit could be implemented in the user file
- */
-}
-
-/**
- * @}
- */
-
-/** @addtogroup LCD_Exported_Functions_Group2
- * @brief LCD RAM functions
- *
-@verbatim
- ===============================================================================
- ##### IO operation functions #####
- ===============================================================================
- [..] Using its double buffer memory the LCD controller ensures the coherency of the
- displayed information without having to use interrupts to control LCD_RAM
- modification.
- The application software can access the first buffer level (LCD_RAM) through
- the APB interface. Once it has modified the LCD_RAM using the HAL_LCD_Write() API,
- it sets the UDR flag in the LCD_SR register using the HAL_LCD_UpdateDisplayRequest() API.
- This UDR flag (update display request) requests the updated information to be
- moved into the second buffer level (LCD_DISPLAY).
- This operation is done synchronously with the frame (at the beginning of the
- next frame), until the update is completed, the LCD_RAM is write protected and
- the UDR flag stays high.
- Once the update is completed another flag (UDD - Update Display Done) is set and
- generates an interrupt if the UDDIE bit in the LCD_FCR register is set.
- The time it takes to update LCD_DISPLAY is, in the worst case, one odd and one
- even frame.
- The update will not occur (UDR = 1 and UDD = 0) until the display is
- enabled (LCDEN = 1).
-
-@endverbatim
- * @{
- */
-
-/**
- * @brief Writes a word in the specific LCD RAM.
- * @param hlcd LCD handle
- * @param RAMRegisterIndex specifies the LCD RAM Register.
- * This parameter can be one of the following values:
- * @arg LCD_RAM_REGISTER0: LCD RAM Register 0
- * @arg LCD_RAM_REGISTER1: LCD RAM Register 1
- * @arg LCD_RAM_REGISTER2: LCD RAM Register 2
- * @arg LCD_RAM_REGISTER3: LCD RAM Register 3
- * @arg LCD_RAM_REGISTER4: LCD RAM Register 4
- * @arg LCD_RAM_REGISTER5: LCD RAM Register 5
- * @arg LCD_RAM_REGISTER6: LCD RAM Register 6
- * @arg LCD_RAM_REGISTER7: LCD RAM Register 7
- * @arg LCD_RAM_REGISTER8: LCD RAM Register 8
- * @arg LCD_RAM_REGISTER9: LCD RAM Register 9
- * @arg LCD_RAM_REGISTER10: LCD RAM Register 10
- * @arg LCD_RAM_REGISTER11: LCD RAM Register 11
- * @arg LCD_RAM_REGISTER12: LCD RAM Register 12
- * @arg LCD_RAM_REGISTER13: LCD RAM Register 13
- * @arg LCD_RAM_REGISTER14: LCD RAM Register 14
- * @arg LCD_RAM_REGISTER15: LCD RAM Register 15
- * @param RAMRegisterMask specifies the LCD RAM Register Data Mask.
- * @param Data specifies LCD Data Value to be written.
- * @note For LCD glass COM*SEG as 8*40 for example, the LCD common terminals COM[0,7]
- * are mapped on 32bits LCD_RAM_REGISTER[0,14] according to rules: COM(n) spread
- * on LCD_RAM_REGISTER(2*n) and LCD_RAM_REGISTER(2*n+1).The segment terminals
- * SEG[0,39] of COM(n) correspond to LSB bits of related LCD_RAM_REGISTER(2*n)[0,31]
- * and LCD_RAM_REGISTER(2*n+1)[0,7]
- * @retval None
- */
-HAL_StatusTypeDef HAL_LCD_Write(LCD_HandleTypeDef *hlcd, uint32_t RAMRegisterIndex, uint32_t RAMRegisterMask, uint32_t Data)
-{
- uint32_t tickstart = 0x00U;
-
- if((hlcd->State == HAL_LCD_STATE_READY) || (hlcd->State == HAL_LCD_STATE_BUSY))
- {
- /* Check the parameters */
- assert_param(IS_LCD_RAM_REGISTER(RAMRegisterIndex));
-
- if(hlcd->State == HAL_LCD_STATE_READY)
- {
- /* Process Locked */
- __HAL_LOCK(hlcd);
- hlcd->State = HAL_LCD_STATE_BUSY;
-
- /* Get timeout */
- tickstart = HAL_GetTick();
-
- /*!< Wait Until the LCD is ready */
- while(__HAL_LCD_GET_FLAG(hlcd, LCD_FLAG_UDR) != RESET)
- {
- if((HAL_GetTick() - tickstart) > LCD_TIMEOUT_VALUE)
- {
- hlcd->ErrorCode = HAL_LCD_ERROR_UDR;
- /* Process Unlocked */
- __HAL_UNLOCK(hlcd);
- return HAL_TIMEOUT;
- }
- }
- }
-/* Copy the new Data bytes to LCD RAM register */
- MODIFY_REG(hlcd->Instance->RAM[RAMRegisterIndex], ~(RAMRegisterMask), Data);
-
- return HAL_OK;
- }
- else
- {
- return HAL_ERROR;
- }
-}
-
-/**
- * @brief Clears the LCD RAM registers.
- * @param hlcd: LCD handle
- * @retval None
- */
-HAL_StatusTypeDef HAL_LCD_Clear(LCD_HandleTypeDef *hlcd)
-{
- uint32_t tickstart = 0x00U;
- uint32_t counter = 0U;
-
- if((hlcd->State == HAL_LCD_STATE_READY) || (hlcd->State == HAL_LCD_STATE_BUSY))
- {
- /* Process Locked */
- __HAL_LOCK(hlcd);
-
- hlcd->State = HAL_LCD_STATE_BUSY;
-
- /* Get timeout */
- tickstart = HAL_GetTick();
-
- /*!< Wait Until the LCD is ready */
- while(__HAL_LCD_GET_FLAG(hlcd, LCD_FLAG_UDR) != RESET)
- {
- if( (HAL_GetTick() - tickstart) > LCD_TIMEOUT_VALUE)
- {
- hlcd->ErrorCode = HAL_LCD_ERROR_UDR;
-
- /* Process Unlocked */
- __HAL_UNLOCK(hlcd);
-
- return HAL_TIMEOUT;
- }
- }
- /* Clear the LCD_RAM registers */
- for(counter = LCD_RAM_REGISTER0; counter <= LCD_RAM_REGISTER15; counter++)
- {
- hlcd->Instance->RAM[counter] = 0U;
- }
-
- /* Update the LCD display */
- HAL_LCD_UpdateDisplayRequest(hlcd);
-
- return HAL_OK;
- }
- else
- {
- return HAL_ERROR;
- }
-}
-
-/**
- * @brief Enables the Update Display Request.
- * @param hlcd LCD handle
- * @note Each time software modifies the LCD_RAM it must set the UDR bit to
- * transfer the updated data to the second level buffer.
- * The UDR bit stays set until the end of the update and during this
- * time the LCD_RAM is write protected.
- * @note When the display is disabled, the update is performed for all
- * LCD_DISPLAY locations.
- * When the display is enabled, the update is performed only for locations
- * for which commons are active (depending on DUTY). For example if
- * DUTY = 1/2, only the LCD_DISPLAY of COM0 and COM1 will be updated.
- * @retval None
- */
-HAL_StatusTypeDef HAL_LCD_UpdateDisplayRequest(LCD_HandleTypeDef *hlcd)
-{
- uint32_t tickstart = 0x00U;
-
- /* Clear the Update Display Done flag before starting the update display request */
- __HAL_LCD_CLEAR_FLAG(hlcd, LCD_FLAG_UDD);
-
- /* Enable the display request */
- hlcd->Instance->SR |= LCD_SR_UDR;
-
- /* Get timeout */
- tickstart = HAL_GetTick();
-
- /*!< Wait Until the LCD display is done */
- while(__HAL_LCD_GET_FLAG(hlcd, LCD_FLAG_UDD) == RESET)
- {
- if((HAL_GetTick() - tickstart ) > LCD_TIMEOUT_VALUE)
- {
- hlcd->ErrorCode = HAL_LCD_ERROR_UDD;
-
- /* Process Unlocked */
- __HAL_UNLOCK(hlcd);
-
- return HAL_TIMEOUT;
- }
- }
-
- hlcd->State = HAL_LCD_STATE_READY;
-
- /* Process Unlocked */
- __HAL_UNLOCK(hlcd);
-
- return HAL_OK;
-}
-
-/**
- * @}
- */
-
-/** @addtogroup LCD_Exported_Functions_Group3
- * @brief LCD State functions
- *
-@verbatim
- ===============================================================================
- ##### Peripheral State functions #####
- ===============================================================================
- [..]
- This subsection provides a set of functions allowing to control the LCD:
- (+) HAL_LCD_GetState() API can be helpful to check in run-time the state of the LCD peripheral State.
- (+) HAL_LCD_GetError() API to return the LCD error code.
-@endverbatim
- * @{
- */
-
-/**
- * @brief Returns the LCD state.
- * @param hlcd: LCD handle
- * @retval HAL state
- */
-HAL_LCD_StateTypeDef HAL_LCD_GetState(LCD_HandleTypeDef *hlcd)
-{
- return hlcd->State;
-}
-
-/**
- * @brief Return the LCD error code
- * @param hlcd: LCD handle
- * @retval LCD Error Code
- */
-uint32_t HAL_LCD_GetError(LCD_HandleTypeDef *hlcd)
-{
- return hlcd->ErrorCode;
-}
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/** @addtogroup LCD_Private
- * @{
- */
-
-/**
- * @brief Waits until the LCD FCR register is synchronized in the LCDCLK domain.
- * This function must be called after any write operation to LCD_FCR register.
- * @param hlcd LCD handle
- * @retval None
- */
-HAL_StatusTypeDef LCD_WaitForSynchro(LCD_HandleTypeDef *hlcd)
-{
- uint32_t tickstart = 0x00U;
-
- /* Get timeout */
- tickstart = HAL_GetTick();
-
- /* Loop until FCRSF flag is set */
- while(__HAL_LCD_GET_FLAG(hlcd, LCD_FLAG_FCRSF) == RESET)
- {
- if((HAL_GetTick() - tickstart) > LCD_TIMEOUT_VALUE)
- {
- hlcd->ErrorCode = HAL_LCD_ERROR_FCRSF;
- return HAL_TIMEOUT;
- }
- }
-
- return HAL_OK;
-}
-
-/**
- * @}
- */
-
-
-/**
- * @}
- */
-
-#endif /* HAL_LCD_MODULE_ENABLED */
-/**
- * @}
- */
-#endif /* #if defined (STM32L053xx) || defined (STM32L063xx) || defined (STM32L073xx) || defined (STM32L083xx) */
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
-
diff --git a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_lptim.c b/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_lptim.c
deleted file mode 100644
index d6bbc98931..0000000000
--- a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_lptim.c
+++ /dev/null
@@ -1,2457 +0,0 @@
-/**
- ******************************************************************************
- * @file stm32l0xx_hal_lptim.c
- * @author MCD Application Team
- * @brief LPTIM HAL module driver.
- * This file provides firmware functions to manage the following
- * functionalities of the Low Power Timer (LPTIM) peripheral:
- * + Initialization and de-initialization functions.
- * + Start/Stop operation functions in polling mode.
- * + Start/Stop operation functions in interrupt mode.
- * + Reading operation functions.
- * + Peripheral State functions.
- *
- @verbatim
- ==============================================================================
- ##### How to use this driver #####
- ==============================================================================
- [..]
- The LPTIM HAL driver can be used as follows:
-
- (#)Initialize the LPTIM low level resources by implementing the
- HAL_LPTIM_MspInit():
- (++) Enable the LPTIM interface clock using __HAL_RCC_LPTIMx_CLK_ENABLE().
- (++) In case of using interrupts (e.g. HAL_LPTIM_PWM_Start_IT()):
- (+++) Configure the LPTIM interrupt priority using HAL_NVIC_SetPriority().
- (+++) Enable the LPTIM IRQ handler using HAL_NVIC_EnableIRQ().
- (+++) In LPTIM IRQ handler, call HAL_LPTIM_IRQHandler().
-
- (#)Initialize the LPTIM HAL using HAL_LPTIM_Init(). This function
- configures mainly:
- (++) The instance: LPTIM1.
- (++) Clock: the counter clock.
- (+++) Source : it can be either the ULPTIM input (IN1) or one of
- the internal clock; (APB, LSE, LSI or MSI).
- (+++) Prescaler: select the clock divider.
- (++) UltraLowPowerClock : To be used only if the ULPTIM is selected
- as counter clock source.
- (+++) Polarity: polarity of the active edge for the counter unit
- if the ULPTIM input is selected.
- (+++) SampleTime: clock sampling time to configure the clock glitch
- filter.
- (++) Trigger: How the counter start.
- (+++) Source: trigger can be software or one of the hardware triggers.
- (+++) ActiveEdge : only for hardware trigger.
- (+++) SampleTime : trigger sampling time to configure the trigger
- glitch filter.
- (++) OutputPolarity : 2 opposite polarities are possible.
- (++) UpdateMode: specifies whether the update of the autoreload and
- the compare values is done immediately or after the end of current
- period.
-
- (#)Six modes are available:
-
- (++) PWM Mode: To generate a PWM signal with specified period and pulse,
- call HAL_LPTIM_PWM_Start() or HAL_LPTIM_PWM_Start_IT() for interruption
- mode.
-
- (++) One Pulse Mode: To generate pulse with specified width in response
- to a stimulus, call HAL_LPTIM_OnePulse_Start() or
- HAL_LPTIM_OnePulse_Start_IT() for interruption mode.
-
- (++) Set once Mode: In this mode, the output changes the level (from
- low level to high level if the output polarity is configured high, else
- the opposite) when a compare match occurs. To start this mode, call
- HAL_LPTIM_SetOnce_Start() or HAL_LPTIM_SetOnce_Start_IT() for
- interruption mode.
-
- (++) Encoder Mode: To use the encoder interface call
- HAL_LPTIM_Encoder_Start() or HAL_LPTIM_Encoder_Start_IT() for
- interruption mode. Only available for LPTIM1 instance.
-
- (++) Time out Mode: an active edge on one selected trigger input rests
- the counter. The first trigger event will start the timer, any
- successive trigger event will reset the counter and the timer will
- restart. To start this mode call HAL_LPTIM_TimeOut_Start_IT() or
- HAL_LPTIM_TimeOut_Start_IT() for interruption mode.
-
- (++) Counter Mode: counter can be used to count external events on
- the LPTIM Input1 or it can be used to count internal clock cycles.
- To start this mode, call HAL_LPTIM_Counter_Start() or
- HAL_LPTIM_Counter_Start_IT() for interruption mode.
-
-
- (#) User can stop any process by calling the corresponding API:
- HAL_LPTIM_Xxx_Stop() or HAL_LPTIM_Xxx_Stop_IT() if the process is
- already started in interruption mode.
-
- (#) De-initialize the LPTIM peripheral using HAL_LPTIM_DeInit().
-
- *** Callback registration ***
- =============================================
- [..]
- The compilation define USE_HAL_LPTIM_REGISTER_CALLBACKS when set to 1
- allows the user to configure dynamically the driver callbacks.
- [..]
- Use Function HAL_LPTIM_RegisterCallback() to register a callback.
- HAL_LPTIM_RegisterCallback() takes as parameters the HAL peripheral handle,
- the Callback ID and a pointer to the user callback function.
- [..]
- Use function HAL_LPTIM_UnRegisterCallback() to reset a callback to the
- default weak function.
- HAL_LPTIM_UnRegisterCallback takes as parameters the HAL peripheral handle,
- and the Callback ID.
- [..]
- These functions allow to register/unregister following callbacks:
-
- (+) MspInitCallback : LPTIM Base Msp Init Callback.
- (+) MspDeInitCallback : LPTIM Base Msp DeInit Callback.
- (+) CompareMatchCallback : Compare match Callback.
- (+) AutoReloadMatchCallback : Auto-reload match Callback.
- (+) TriggerCallback : External trigger event detection Callback.
- (+) CompareWriteCallback : Compare register write complete Callback.
- (+) AutoReloadWriteCallback : Auto-reload register write complete Callback.
- (+) DirectionUpCallback : Up-counting direction change Callback.
- (+) DirectionDownCallback : Down-counting direction change Callback.
-
- [..]
- By default, after the Init and when the state is HAL_LPTIM_STATE_RESET
- all interrupt callbacks are set to the corresponding weak functions:
- examples HAL_LPTIM_TriggerCallback(), HAL_LPTIM_CompareMatchCallback().
-
- [..]
- Exception done for MspInit and MspDeInit functions that are reset to the legacy weak
- functionalities in the Init/DeInit only when these callbacks are null
- (not registered beforehand). If not, MspInit or MspDeInit are not null, the Init/DeInit
- keep and use the user MspInit/MspDeInit callbacks (registered beforehand)
-
- [..]
- Callbacks can be registered/unregistered in HAL_LPTIM_STATE_READY state only.
- Exception done MspInit/MspDeInit that can be registered/unregistered
- in HAL_LPTIM_STATE_READY or HAL_LPTIM_STATE_RESET state,
- thus registered (user) MspInit/DeInit callbacks can be used during the Init/DeInit.
- In that case first register the MspInit/MspDeInit user callbacks
- using HAL_LPTIM_RegisterCallback() before calling DeInit or Init function.
-
- [..]
- When The compilation define USE_HAL_LPTIM_REGISTER_CALLBACKS is set to 0 or
- not defined, the callback registration feature is not available and all callbacks
- are set to the corresponding weak functions.
-
- @endverbatim
- ******************************************************************************
- * @attention
- *
- *
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-#include "stm32l0xx_hal.h"
-
-#ifdef HAL_PWR_MODULE_ENABLED
-/** @addtogroup STM32L0xx_HAL_Driver
- * @{
- */
-
-/** @addtogroup PWR
- * @{
- */
-
-/** @addtogroup PWR_Private
- * @{
- */
-
-#if defined(PWR_PVD_SUPPORT)
-/** @defgroup PWR_PVD_Mode_Mask PWR PVD Mode Mask
- * @{
- */
-#define PVD_MODE_IT (0x00010000U)
-#define PVD_MODE_EVT (0x00020000U)
-#define PVD_RISING_EDGE (0x00000001U)
-#define PVD_FALLING_EDGE (0x00000002U)
-/**
- * @}
- */
-#endif
-
-/**
- * @}
- */
-
-
-/** @addtogroup PWR_Exported_Functions
- * @{
- */
-
-/** @addtogroup PWR_Exported_Functions_Group1
- * @brief Initialization and de-initialization functions
- *
-@verbatim
- ===============================================================================
- ##### Initialization and de-initialization functions #####
- ===============================================================================
-
-@endverbatim
- * @{
- */
-
-/**
- * @brief Deinitializes the HAL PWR peripheral registers to their default reset values.
- * @retval None
- */
-void HAL_PWR_DeInit(void)
-{
- __HAL_RCC_PWR_FORCE_RESET();
- __HAL_RCC_PWR_RELEASE_RESET();
-}
-
-/**
- * @}
- */
-
-/** @addtogroup PWR_Exported_Functions_Group2
- * @brief Low Power modes configuration functions
- *
-@verbatim
-
- ===============================================================================
- ##### Peripheral Control functions #####
- ===============================================================================
-
- *** Backup domain ***
- =========================
- [..]
- After reset, the backup domain (RTC registers, RTC backup data
- registers) is protected against possible unwanted
- write accesses.
- To enable access to the RTC Domain and RTC registers, proceed as follows:
- (+) Enable the Power Controller (PWR) APB1 interface clock using the
- __HAL_RCC_PWR_CLK_ENABLE() macro.
- (+) Enable access to RTC domain using the HAL_PWR_EnableBkUpAccess() function.
-
- *** PVD configuration ***
- =========================
- [..]
- (+) The PVD is used to monitor the VDD power supply by comparing it to a
- threshold selected by the PVD Level (PLS[2:0] bits in the PWR_CR).
- (+) The PVD can use an external input analog voltage (PVD_IN) which is compared
- internally to VREFINT. The PVD_IN (PB7) has to be configured in Analog mode
- when PWR_PVDLevel_7 is selected (PLS[2:0] = 111).
-
- (+) A PVDO flag is available to indicate if VDD/VDDA is higher or lower
- than the PVD threshold. This event is internally connected to the EXTI
- line16 and can generate an interrupt if enabled. This is done through
- __HAL_PWR_PVD_EXTI_ENABLE_IT() macro.
- (+) The PVD is stopped in Standby mode.
- (+) The PVD feature is not supported on L0 Value line.
-
- *** WakeUp pin configuration ***
- ================================
- [..]
- (+) WakeUp pin is used to wake up the system from Standby mode. This pin is
- forced in input pull-down configuration and is active on rising edges.
- (+) There are two WakeUp pins:
- WakeUp Pin 1 on PA.00.
- WakeUp Pin 2 on PC.13.
- WakeUp Pin 3 on PE.06 .
-
-
- [..]
- *** Main and Backup Regulators configuration ***
- ================================================
-
- (+) The main internal regulator can be configured to have a tradeoff between
- performance and power consumption when the device does not operate at
- the maximum frequency. This is done through __HAL_PWR_VOLTAGESCALING_CONFIG()
- macro which configures the two VOS bits in PWR_CR register:
- (++) PWR_REGULATOR_VOLTAGE_SCALE1 (VOS bits = 01), the regulator voltage output Scale 1 mode selected and
- the System frequency can go up to 32 MHz.
- (++) PWR_REGULATOR_VOLTAGE_SCALE2 (VOS bits = 10), the regulator voltage output Scale 2 mode selected and
- the System frequency can go up to 16 MHz.
- (++) PWR_REGULATOR_VOLTAGE_SCALE3 (VOS bits = 11), the regulator voltage output Scale 3 mode selected and
- the System frequency can go up to 4.2 MHz.
-
- Refer to the datasheets for more details.
-
- *** Low Power modes configuration ***
- =====================================
- [..]
- The device features 5 low-power modes:
- (+) Low power run mode: regulator in low power mode, limited clock frequency,
- limited number of peripherals running.
- (+) Sleep mode: Cortex-M0+ core stopped, peripherals kept running.
- (+) Low power sleep mode: Cortex-M0+ core stopped, limited clock frequency,
- limited number of peripherals running, regulator in low power mode.
- (+) Stop mode: All clocks are stopped, regulator running, regulator in low power mode.
- (+) Standby mode: VCORE domain powered off
-
- *** Low power run mode ***
- =========================
- [..]
- To further reduce the consumption when the system is in Run mode, the regulator can be
- configured in low power mode. In this mode, the system frequency should not exceed
- MSI frequency range1.
- In Low power run mode, all I/O pins keep the same state as in Run mode.
-
- (+) Entry:
- (++) VCORE in range2
- (++) Decrease the system frequency not to exceed the frequency of MSI frequency range1.
- (++) The regulator is forced in low power mode using the HAL_PWREx_EnableLowPowerRunMode()
- function.
- (+) Exit:
- (++) The regulator is forced in Main regulator mode using the HAL_PWREx_DisableLowPowerRunMode()
- function.
- (++) Increase the system frequency if needed.
-
- *** Sleep mode ***
- ==================
- [..]
- (+) Entry:
- The Sleep mode is entered by using the HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFx)
- functions with
- (++) PWR_SLEEPENTRY_WFI: enter SLEEP mode with WFI instruction
- (++) PWR_SLEEPENTRY_WFE: enter SLEEP mode with WFE instruction
-
- (+) Exit:
- (++) Any peripheral interrupt acknowledged by the nested vectored interrupt
- controller (NVIC) can wake up the device from Sleep mode. If the WFE instruction was used to enter sleep mode,
- the MCU exits Sleep mode as soon as an event occurs.
-
- *** Low power sleep mode ***
- ============================
- [..]
- (+) Entry:
- The Low power sleep mode is entered by using the HAL_PWR_EnterSLEEPMode(PWR_LOWPOWERREGULATOR_ON, PWR_SLEEPENTRY_WFx)
- functions with
- (++) PWR_SLEEPENTRY_WFI: enter SLEEP mode with WFI instruction
- (++) PWR_SLEEPENTRY_WFE: enter SLEEP mode with WFE instruction
- (+) The Flash memory can be switched off by using the control bits (SLEEP_PD in the FLASH_ACR register.
- This reduces power consumption but increases the wake-up time.
-
- (+) Exit:
- (++) If the WFI instruction was used to enter Low power sleep mode, any peripheral interrupt
- acknowledged by the nested vectored interrupt controller (NVIC) can wake up the device
- from Low power sleep mode. If the WFE instruction was used to enter Low power sleep mode,
- the MCU exits Sleep mode as soon as an event occurs.
-
- *** Stop mode ***
- =================
- [..]
- The Stop mode is based on the Cortex-M0+ deepsleep mode combined with peripheral
- clock gating. The voltage regulator can be configured either in normal or low-power mode.
- In Stop mode, all clocks in the VCORE domain are stopped, the PLL, the MSI, the HSI and
- the HSE RC oscillators are disabled. Internal SRAM and register contents are preserved.
- To get the lowest consumption in Stop mode, the internal Flash memory also enters low
- power mode. When the Flash memory is in power-down mode, an additional startup delay is
- incurred when waking up from Stop mode.
- To minimize the consumption In Stop mode, VREFINT, the BOR, PVD, and temperature
- sensor can be switched off before entering Stop mode. They can be switched on again by
- software after exiting Stop mode using the ULP bit in the PWR_CR register.
- In Stop mode, all I/O pins keep the same state as in Run mode.
-
- (+) Entry:
- The Stop mode is entered using the HAL_PWR_EnterSTOPMode
- function with:
- (++) Main regulator ON.
- (++) Low Power regulator ON.
- (++) PWR_SLEEPENTRY_WFI: enter SLEEP mode with WFI instruction
- (++) PWR_SLEEPENTRY_WFE: enter SLEEP mode with WFE instruction
- (+) Exit:
- (++) By issuing an interrupt or a wakeup event, the MSI or HSI16 RC
- oscillator is selected as system clock depending the bit STOPWUCK in the RCC_CFGR
- register
-
- *** Standby mode ***
- ====================
- [..]
- The Standby mode allows to achieve the lowest power consumption. It is based on the
- Cortex-M0+ deepsleep mode, with the voltage regulator disabled. The VCORE domain is
- consequently powered off. The PLL, the MSI, the HSI oscillator and the HSE oscillator are
- also switched off. SRAM and register contents are lost except for the RTC registers, RTC
- backup registers and Standby circuitry.
-
- To minimize the consumption In Standby mode, VREFINT, the BOR, PVD, and temperature
- sensor can be switched off before entering the Standby mode. They can be switched
- on again by software after exiting the Standby mode.
- function.
-
- (+) Entry:
- (++) The Standby mode is entered using the HAL_PWR_EnterSTANDBYMode() function.
- (+) Exit:
- (++) WKUP pin rising edge, RTC alarm (Alarm A and Alarm B), RTC wakeup,
- tamper event, time-stamp event, external reset in NRST pin, IWDG reset.
-
- *** Auto-wakeup (AWU) from low-power mode ***
- =============================================
- [..]
- The MCU can be woken up from low-power mode by an RTC Alarm event, an RTC
- Wakeup event, a tamper event, a time-stamp event, or a comparator event,
- without depending on an external interrupt (Auto-wakeup mode).
-
- (+) RTC auto-wakeup (AWU) from the Stop mode
- (++) To wake up from the Stop mode with an RTC alarm event, it is necessary to:
- (+++) Configure the EXTI Line 17 to be sensitive to rising edges (Interrupt
- or Event modes) using the EXTI_Init() function.
- (+++) Enable the RTC Alarm Interrupt using the RTC_ITConfig() function
- (+++) Configure the RTC to generate the RTC alarm using the RTC_SetAlarm()
- and RTC_AlarmCmd() functions.
- (++) To wake up from the Stop mode with an RTC Tamper or time stamp event, it
- is necessary to:
- (+++) Configure the EXTI Line 19 to be sensitive to rising edges (Interrupt
- or Event modes) using the EXTI_Init() function.
- (+++) Enable the RTC Tamper or time stamp Interrupt using the RTC_ITConfig()
- function.
- (+++) Configure the RTC to detect the tamper or time stamp event using the
- RTC_TimeStampConfig(), RTC_TamperTriggerConfig() and RTC_TamperCmd()
- functions.
- (++) To wake up from the Stop mode with an RTC WakeUp event, it is necessary to:
- (+++) Configure the EXTI Line 20 to be sensitive to rising edges (Interrupt
- or Event modes) using the EXTI_Init() function.
- (+++) Enable the RTC WakeUp Interrupt using the RTC_ITConfig() function.
- (+++) Configure the RTC to generate the RTC WakeUp event using the RTC_WakeUpClockConfig(),
- RTC_SetWakeUpCounter() and RTC_WakeUpCmd() functions.
-
- (+) RTC auto-wakeup (AWU) from the Standby mode
- (++) To wake up from the Standby mode with an RTC alarm event, it is necessary to:
- (+++) Enable the RTC Alarm Interrupt using the RTC_ITConfig() function.
- (+++) Configure the RTC to generate the RTC alarm using the RTC_SetAlarm()
- and RTC_AlarmCmd() functions.
- (++) To wake up from the Standby mode with an RTC Tamper or time stamp event, it
- is necessary to:
- (+++) Enable the RTC Tamper or time stamp Interrupt using the RTC_ITConfig()
- function.
- (+++) Configure the RTC to detect the tamper or time stamp event using the
- RTC_TimeStampConfig(), RTC_TamperTriggerConfig() and RTC_TamperCmd()
- functions.
- (++) To wake up from the Standby mode with an RTC WakeUp event, it is necessary to:
- (+++) Enable the RTC WakeUp Interrupt using the RTC_ITConfig() function
- (+++) Configure the RTC to generate the RTC WakeUp event using the RTC_WakeUpClockConfig(),
- RTC_SetWakeUpCounter() and RTC_WakeUpCmd() functions.
-
- (+) Comparator auto-wakeup (AWU) from the Stop mode
- (++) To wake up from the Stop mode with an comparator 1 or comparator 2 wakeup
- event, it is necessary to:
- (+++) Configure the EXTI Line 21 for comparator 1 or EXTI Line 22 for comparator 2
- to be sensitive to to the selected edges (falling, rising or falling
- and rising) (Interrupt or Event modes) using the EXTI_Init() function.
- (+++) Configure the comparator to generate the event.
-@endverbatim
- * @{
- */
-
-/**
- * @brief Enables access to the backup domain (RTC registers, RTC
- * backup data registers ).
- * @note If the HSE divided by 2, 4, 8 or 16 is used as the RTC clock, the
- * Backup Domain Access should be kept enabled.
- * @retval None
- */
-void HAL_PWR_EnableBkUpAccess(void)
-{
- /* Enable access to RTC and backup registers */
- SET_BIT(PWR->CR, PWR_CR_DBP);
-}
-
-/**
- * @brief Disables access to the backup domain
- * @note Applies to RTC registers, RTC backup data registers.
- * @note If the HSE divided by 2, 4, 8 or 16 is used as the RTC clock, the
- * Backup Domain Access should be kept enabled.
- * @retval None
- */
-void HAL_PWR_DisableBkUpAccess(void)
-{
- /* Disable access to RTC and backup registers */
- CLEAR_BIT(PWR->CR, PWR_CR_DBP);
-}
-
-#if defined(PWR_PVD_SUPPORT)
-/**
- * @brief Configures the voltage threshold detected by the Power Voltage Detector(PVD).
- * @param sConfigPVD pointer to an PWR_PVDTypeDef structure that contains the configuration
- * information for the PVD.
- * @note Refer to the electrical characteristics of your device datasheet for
- * more details about the voltage threshold corresponding to each
- * detection level.
- * @retval None
- */
-void HAL_PWR_ConfigPVD(PWR_PVDTypeDef *sConfigPVD)
-{
- /* Check the parameters */
- assert_param(IS_PWR_PVD_LEVEL(sConfigPVD->PVDLevel));
- assert_param(IS_PWR_PVD_MODE(sConfigPVD->Mode));
-
- /* Set PLS[7:5] bits according to PVDLevel value */
- MODIFY_REG(PWR->CR, PWR_CR_PLS, sConfigPVD->PVDLevel);
-
- /* Clear any previous config. Keep it clear if no event or IT mode is selected */
- __HAL_PWR_PVD_EXTI_DISABLE_EVENT();
- __HAL_PWR_PVD_EXTI_DISABLE_IT();
- __HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE();
- __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE();
-
- /* Configure interrupt mode */
- if((sConfigPVD->Mode & PVD_MODE_IT) == PVD_MODE_IT)
- {
- __HAL_PWR_PVD_EXTI_ENABLE_IT();
- }
-
- /* Configure event mode */
- if((sConfigPVD->Mode & PVD_MODE_EVT) == PVD_MODE_EVT)
- {
- __HAL_PWR_PVD_EXTI_ENABLE_EVENT();
- }
-
- /* Configure the edge */
- if((sConfigPVD->Mode & PVD_RISING_EDGE) == PVD_RISING_EDGE)
- {
- __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE();
- }
-
- if((sConfigPVD->Mode & PVD_FALLING_EDGE) == PVD_FALLING_EDGE)
- {
- __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE();
- }
-}
-
-/**
- * @brief Enables the Power Voltage Detector(PVD).
- * @retval None
- */
-void HAL_PWR_EnablePVD(void)
-{
- /* Enable the power voltage detector */
- SET_BIT(PWR->CR, PWR_CR_PVDE);
-}
-
-/**
- * @brief Disables the Power Voltage Detector(PVD).
- * @retval None
- */
-void HAL_PWR_DisablePVD(void)
-{
- /* Disable the power voltage detector */
- CLEAR_BIT(PWR->CR, PWR_CR_PVDE);
-}
-#endif /* PWR_PVD_SUPPORT */
-
-/**
- * @brief Enables the WakeUp PINx functionality.
- * @param WakeUpPinx: Specifies the Power Wake-Up pin to enable.
- * This parameter can be one of the following values:
- * @arg PWR_WAKEUP_PIN1
- * @arg PWR_WAKEUP_PIN2
- * @arg PWR_WAKEUP_PIN3 for stm32l07xxx and stm32l08xxx devices only.
- * @retval None
- */
-void HAL_PWR_EnableWakeUpPin(uint32_t WakeUpPinx)
-{
- /* Check the parameter */
- assert_param(IS_PWR_WAKEUP_PIN(WakeUpPinx));
- /* Enable the EWUPx pin */
- SET_BIT(PWR->CSR, WakeUpPinx);
-}
-
-/**
- * @brief Disables the WakeUp PINx functionality.
- * @param WakeUpPinx: Specifies the Power Wake-Up pin to disable.
- * This parameter can be one of the following values:
- * @arg PWR_WAKEUP_PIN1
- * @arg PWR_WAKEUP_PIN2
- * @arg PWR_WAKEUP_PIN3 for stm32l07xxx and stm32l08xxx devices only.
- * @retval None
- */
-void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx)
-{
- /* Check the parameter */
- assert_param(IS_PWR_WAKEUP_PIN(WakeUpPinx));
- /* Disable the EWUPx pin */
- CLEAR_BIT(PWR->CSR, WakeUpPinx);
-}
-
-/**
- * @brief Enters Sleep mode.
- * @note In Sleep mode, all I/O pins keep the same state as in Run mode.
- * @param Regulator: Specifies the regulator state in SLEEP mode.
- * This parameter can be one of the following values:
- * @arg PWR_MAINREGULATOR_ON: SLEEP mode with regulator ON
- * @arg PWR_LOWPOWERREGULATOR_ON: SLEEP mode with low power regulator ON
- * @param SLEEPEntry: Specifies if SLEEP mode is entered with WFI or WFE instruction.
- * When WFI entry is used, tick interrupt have to be disabled if not desired as
- * the interrupt wake up source.
- * This parameter can be one of the following values:
- * @arg PWR_SLEEPENTRY_WFI: enter SLEEP mode with WFI instruction
- * @arg PWR_SLEEPENTRY_WFE: enter SLEEP mode with WFE instruction
- * @retval None
- */
-void HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry)
-{
- uint32_t tmpreg = 0U;
- uint32_t ulpbit, vrefinbit;
-
- /* Check the parameters */
- assert_param(IS_PWR_REGULATOR(Regulator));
- assert_param(IS_PWR_SLEEP_ENTRY(SLEEPEntry));
-
- /* It is forbidden to configure both EN_VREFINT=1 and ULP=1 if the device is
- in Stop mode or in Sleep/Low-power sleep mode */
- ulpbit = READ_BIT(PWR->CR, PWR_CR_ULP);
- vrefinbit = READ_BIT(SYSCFG->CFGR3, SYSCFG_CFGR3_EN_VREFINT);
- if((ulpbit != 0) && (vrefinbit != 0))
- {
- CLEAR_BIT(PWR->CR, PWR_CR_ULP);
- }
-
- /* Select the regulator state in Sleep mode ---------------------------------*/
- tmpreg = PWR->CR;
-
- /* Clear PDDS and LPDS bits */
- CLEAR_BIT(tmpreg, (PWR_CR_PDDS | PWR_CR_LPSDSR));
-
- /* Set LPSDSR bit according to PWR_Regulator value */
- SET_BIT(tmpreg, Regulator);
-
- /* Store the new value */
- PWR->CR = tmpreg;
-
- /* Clear SLEEPDEEP bit of Cortex System Control Register */
- CLEAR_BIT(SCB->SCR, SCB_SCR_SLEEPDEEP_Msk);
-
- /* Select SLEEP mode entry -------------------------------------------------*/
- if(SLEEPEntry == PWR_SLEEPENTRY_WFI)
- {
- /* Request Wait For Interrupt */
- __WFI();
- }
- else
- {
- /* Request Wait For Event */
- __SEV();
- __WFE();
- __WFE();
- }
-
- if((ulpbit != 0) && (vrefinbit != 0))
- {
- SET_BIT(PWR->CR, PWR_CR_ULP);
- }
-
- /* Additional NOP to ensure all pending instructions are flushed before entering low power mode */
- __NOP();
-
-}
-
-/**
- * @brief Enters Stop mode.
- * @note In Stop mode, all I/O pins keep the same state as in Run mode.
- * @note When exiting Stop mode by issuing an interrupt or a wakeup event,
- * MSI or HSI16 RCoscillator is selected as system clock depending
- * the bit STOPWUCK in the RCC_CFGR register.
- * @note When the voltage regulator operates in low power mode, an additional
- * startup delay is incurred when waking up from Stop mode.
- * By keeping the internal regulator ON during Stop mode, the consumption
- * is higher although the startup time is reduced.
- * @note Before entering in this function, it is important to ensure that the WUF
- * wakeup flag is cleared. To perform this action, it is possible to call the
- * following macro : __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU)
- *
- * @param Regulator: Specifies the regulator state in Stop mode.
- * This parameter can be one of the following values:
- * @arg PWR_MAINREGULATOR_ON: Stop mode with regulator ON
- * @arg PWR_LOWPOWERREGULATOR_ON: Stop mode with low power regulator ON
- * @param STOPEntry: Specifies if Stop mode in entered with WFI or WFE instruction.
- * This parameter can be one of the following values:
- * @arg PWR_STOPENTRY_WFI: Enter Stop mode with WFI instruction
- * @arg PWR_STOPENTRY_WFE: Enter Stop mode with WFE instruction
- * @retval None
- */
-void HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry)
-{
- uint32_t tmpreg = 0U;
- uint32_t ulpbit, vrefinbit;
-
- /* Check the parameters */
- assert_param(IS_PWR_REGULATOR(Regulator));
- assert_param(IS_PWR_STOP_ENTRY(STOPEntry));
-
- /* It is forbidden to configure both EN_VREFINT=1 and ULP=1 if the device is
- in Stop mode or in Sleep/Low-power sleep mode */
- ulpbit = READ_BIT(PWR->CR, PWR_CR_ULP);
- vrefinbit = READ_BIT(SYSCFG->CFGR3, SYSCFG_CFGR3_EN_VREFINT);
- if((ulpbit != 0) && (vrefinbit != 0))
- {
- CLEAR_BIT(PWR->CR, PWR_CR_ULP);
- }
-
- /* Select the regulator state in Stop mode ---------------------------------*/
- tmpreg = PWR->CR;
-
- /* Clear PDDS and LPDS bits */
- CLEAR_BIT(tmpreg, (PWR_CR_PDDS | PWR_CR_LPSDSR));
-
- /* Set LPSDSR bit according to PWR_Regulator value */
- SET_BIT(tmpreg, Regulator);
-
- /* Store the new value */
- PWR->CR = tmpreg;
-
- /* Set SLEEPDEEP bit of Cortex System Control Register */
- SET_BIT(SCB->SCR, SCB_SCR_SLEEPDEEP_Msk);
-
- /* Select Stop mode entry --------------------------------------------------*/
- if(STOPEntry == PWR_STOPENTRY_WFI)
- {
- /* Request Wait For Interrupt */
- __WFI();
- }
- else
- {
- /* Request Wait For Event */
- __SEV();
- __WFE();
- __WFE();
- }
-
- /* Reset SLEEPDEEP bit of Cortex System Control Register */
- CLEAR_BIT(SCB->SCR, SCB_SCR_SLEEPDEEP_Msk);
-
- if((ulpbit != 0) && (vrefinbit != 0))
- {
- SET_BIT(PWR->CR, PWR_CR_ULP);
- }
-}
-
-/**
- * @brief Enters Standby mode.
- * @note In Standby mode, all I/O pins are high impedance except for:
- * - Reset pad (still available)
- * - RTC_AF1 pin (PC13) if configured for tamper, time-stamp, RTC
- * Alarm out, or RTC clock calibration out.
- * - RTC_AF2 pin (PC13) if configured for tamper.
- * - WKUP pin 1 (PA00) if enabled.
- * - WKUP pin 2 (PC13) if enabled.
- * - WKUP pin 3 (PE06) if enabled, for stm32l07xxx and stm32l08xxx devices only.
- * - WKUP pin 3 (PA02) if enabled, for stm32l031xx devices only.
- * @retval None
- */
-void HAL_PWR_EnterSTANDBYMode(void)
-{
- /* Select Standby mode */
- SET_BIT(PWR->CR, PWR_CR_PDDS);
-
- /* Set SLEEPDEEP bit of Cortex System Control Register */
- SET_BIT(SCB->SCR, SCB_SCR_SLEEPDEEP_Msk);
-
- /* This option is used to ensure that store operations are completed */
-#if defined ( __CC_ARM)
- __force_stores();
-#endif
- /* Request Wait For Interrupt */
- __WFI();
-}
-
-/**
- * @brief Indicates Sleep-On-Exit when returning from Handler mode to Thread mode.
- * @note Set SLEEPONEXIT bit of SCR register. When this bit is set, the processor
- * re-enters SLEEP mode when an interruption handling is over.
- * Setting this bit is useful when the processor is expected to run only on
- * interruptions handling.
- * @retval None
- */
-void HAL_PWR_EnableSleepOnExit(void)
-{
- /* Set SLEEPONEXIT bit of Cortex System Control Register */
- SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPONEXIT_Msk));
-}
-
-
-/**
- * @brief Disables Sleep-On-Exit feature when returning from Handler mode to Thread mode.
- * @note Clears SLEEPONEXIT bit of SCR register. When this bit is set, the processor
- * re-enters SLEEP mode when an interruption handling is over.
- * @retval None
- */
-void HAL_PWR_DisableSleepOnExit(void)
-{
- /* Clear SLEEPONEXIT bit of Cortex System Control Register */
- CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPONEXIT_Msk));
-}
-
-
-/**
- * @brief Enables CORTEX M0+ SEVONPEND bit.
- * @note Sets SEVONPEND bit of SCR register. When this bit is set, this causes
- * WFE to wake up when an interrupt moves from inactive to pended.
- * @retval None
- */
-void HAL_PWR_EnableSEVOnPend(void)
-{
- /* Set SEVONPEND bit of Cortex System Control Register */
- SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SEVONPEND_Msk));
-}
-
-
-/**
- * @brief Disables CORTEX M0+ SEVONPEND bit.
- * @note Clears SEVONPEND bit of SCR register. When this bit is set, this causes
- * WFE to wake up when an interrupt moves from inactive to pended.
- * @retval None
- */
-void HAL_PWR_DisableSEVOnPend(void)
-{
- /* Clear SEVONPEND bit of Cortex System Control Register */
- CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SEVONPEND_Msk));
-}
-
-#if defined(PWR_PVD_SUPPORT)
-/**
- * @brief This function handles the PWR PVD interrupt request.
- * @note This API should be called under the PVD_IRQHandler().
- * @retval None
- */
-void HAL_PWR_PVD_IRQHandler(void)
-{
- /* Check PWR exti flag */
- if(__HAL_PWR_PVD_EXTI_GET_FLAG() != RESET)
- {
- /* PWR PVD interrupt user callback */
- HAL_PWR_PVDCallback();
-
- /* Clear PWR Exti pending bit */
- __HAL_PWR_PVD_EXTI_CLEAR_FLAG();
- }
-}
-
-/**
- * @brief PWR PVD interrupt callback
- * @retval None
- */
-__weak void HAL_PWR_PVDCallback(void)
-{
- /* NOTE : This function Should not be modified, when the callback is needed,
- the HAL_PWR_PVDCallback could be implemented in the user file
- */
-}
-#endif /* PWR_PVD_SUPPORT */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-#endif /* HAL_PWR_MODULE_ENABLED */
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
-
diff --git a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_pwr_ex.c b/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_pwr_ex.c
deleted file mode 100644
index 311e59eb58..0000000000
--- a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_pwr_ex.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/**
- ******************************************************************************
- * @file stm32l0xx_hal_pwr_ex.c
- * @author MCD Application Team
- * @brief Extended PWR HAL module driver.
- * This file provides firmware functions to manage the following
- * functionalities of the Power Controller (PWR) peripheral:
- * + Extended Initialization and de-initialization functions
- * + Extended Peripheral Control functions
- *
- ******************************************************************************
- * @attention
- *
- *
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-#include "stm32l0xx_hal.h"
-
-#ifdef HAL_PWR_MODULE_ENABLED
-/** @addtogroup STM32L0xx_HAL_Driver
- * @{
- */
-
-/** @addtogroup PWREx
- * @{
- */
-
-/** @addtogroup PWREx_Private
- * @{
- */
-
-/** @defgroup PWR_Extended_TimeOut_Value PWREx Flag Setting Time Out Value
- * @{
- */
-#define PWR_FLAG_SETTING_DELAY_US 50U
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-
-/** @addtogroup PWREx_Exported_Functions
- * @brief Low Power modes configuration functions
- *
-@verbatim
-
- ===============================================================================
- ##### Peripheral extended features functions #####
- ===============================================================================
-@endverbatim
- * @{
- */
-
-/**
- * @brief Return Voltage Scaling Range.
- * @retval VOS bit field (PWR_REGULATOR_VOLTAGE_SCALE1, PWR_REGULATOR_VOLTAGE_SCALE2 or PWR_REGULATOR_VOLTAGE_SCALE3)
- */
-uint32_t HAL_PWREx_GetVoltageRange(void)
-{
- return (PWR->CR & PWR_CR_VOS);
-}
-
-
-/**
- * @brief Enables the Fast WakeUp from Ultra Low Power mode.
- * @note This bit works in conjunction with ULP bit.
- * Means, when ULP = 1 and FWU = 1 :VREFINT startup time is ignored when
- * exiting from low power mode.
- * @retval None
- */
-void HAL_PWREx_EnableFastWakeUp(void)
-{
- /* Enable the fast wake up */
- SET_BIT(PWR->CR, PWR_CR_FWU);
-}
-
-/**
- * @brief Disables the Fast WakeUp from Ultra Low Power mode.
- * @retval None
- */
-void HAL_PWREx_DisableFastWakeUp(void)
-{
- /* Disable the fast wake up */
- CLEAR_BIT(PWR->CR, PWR_CR_FWU);
-}
-
-/**
- * @brief Enables the Ultra Low Power mode
- * @retval None
- */
-void HAL_PWREx_EnableUltraLowPower(void)
-{
- /* Enable the Ultra Low Power mode */
- SET_BIT(PWR->CR, PWR_CR_ULP);
-}
-
-/**
- * @brief Disables the Ultra Low Power mode
- * @retval None
- */
-void HAL_PWREx_DisableUltraLowPower(void)
-{
- /* Disable the Ultra Low Power mode */
- CLEAR_BIT(PWR->CR, PWR_CR_ULP);
-}
-
-/**
- * @brief Enable the Low Power Run mode.
- * @note Low power run mode can only be entered when VCORE is in range 2.
- * In addition, the dynamic voltage scaling must not be used when Low
- * power run mode is selected. Only Stop and Sleep modes with regulator
- * configured in Low power mode is allowed when Low power run mode is
- * selected.
- * @note The frequency of the system clock must be decreased to not exceed the
- * frequency of RCC_MSIRANGE_1.
- * @note In Low power run mode, all I/O pins keep the same state as in Run mode.
- * @retval None
- */
-void HAL_PWREx_EnableLowPowerRunMode(void)
-{
- /* Enters the Low Power Run mode */
- SET_BIT(PWR->CR, PWR_CR_LPSDSR);
- SET_BIT(PWR->CR, PWR_CR_LPRUN);
-}
-
-/**
- * @brief Disable the Low Power Run mode.
- * @note Before HAL_PWREx_DisableLowPowerRunMode() completion, the function checks that
- * REGLPF has been properly reset (otherwise, HAL_PWREx_DisableLowPowerRunMode
- * returns HAL_TIMEOUT status). The system clock frequency can then be
- * increased above 2 MHz.
- * @retval HAL_StatusTypeDef
- */
-HAL_StatusTypeDef HAL_PWREx_DisableLowPowerRunMode(void)
-{
- uint32_t wait_loop_index = 0U;
-
- /* Exit the Low Power Run mode */
- CLEAR_BIT(PWR->CR, PWR_CR_LPRUN);
- CLEAR_BIT(PWR->CR, PWR_CR_LPSDSR);
-
- /* Wait until REGLPF is reset */
- wait_loop_index = (PWR_FLAG_SETTING_DELAY_US * (SystemCoreClock / 1000000U));
-
- while ((wait_loop_index != 0U) && (HAL_IS_BIT_SET(PWR->CSR, PWR_CSR_REGLPF)))
- {
- wait_loop_index--;
- }
-
- if (HAL_IS_BIT_SET(PWR->CSR, PWR_CSR_REGLPF))
- {
- return HAL_TIMEOUT;
- }
-
- return HAL_OK;
-}
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-#endif /* HAL_PWR_MODULE_ENABLED */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
-
diff --git a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_rcc.c b/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_rcc.c
deleted file mode 100644
index 23dd7235fd..0000000000
--- a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_rcc.c
+++ /dev/null
@@ -1,1504 +0,0 @@
-/**
- ******************************************************************************
- * @file stm32l0xx_hal_rcc.c
- * @author MCD Application Team
- * @brief RCC HAL module driver.
- * This file provides firmware functions to manage the following
- * functionalities of the Reset and Clock Control (RCC) peripheral:
- * + Initialization and de-initialization functions
- * + Peripheral Control functions
- *
- @verbatim
- ==============================================================================
- ##### RCC specific features #####
- ==============================================================================
- [..]
- After reset the device is running from multispeed internal oscillator clock
- (MSI 2.097MHz) with Flash 0 wait state and Flash prefetch buffer is disabled,
- and all peripherals are off except internal SRAM, Flash and JTAG.
- (+) There is no prescaler on High speed (AHB) and Low speed (APB) buses;
- all peripherals mapped on these buses are running at MSI speed.
- (+) 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
- are assigned to be used for debug purpose.
- [..] Once the device started from reset, the user application has to:
- (+) Configure the clock source to be used to drive the System clock
- (if the application needs higher frequency/performance)
- (+) Configure the System clock frequency and Flash settings
- (+) Configure the AHB and APB buses prescalers
- (+) Enable the clock for the peripheral(s) to be used
- (+) Configure the clock source(s) for peripherals whose clocks are not
- derived from the System clock (I2S, RTC, ADC, USB OTG FS/SDIO/RNG)
- (*) SDIO only for STM32L0xxxD devices
-
- ##### RCC Limitations #####
- ==============================================================================
- [..]
- A delay between an RCC peripheral clock enable and the effective peripheral
- enabling should be taken into account in order to manage the peripheral read/write
- from/to registers.
- (+) This delay depends on the peripheral mapping.
- (++) AHB & APB peripherals, 1 dummy read is necessary
-
- [..]
- Workarounds:
- (#) For AHB & APB peripherals, a dummy read to the peripheral register has been
- inserted in each __HAL_RCC_PPP_CLK_ENABLE() macro.
-
- @endverbatim
- ******************************************************************************
- * @attention
- *
- *
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-#include "stm32l0xx_hal.h"
-
-/** @addtogroup STM32L0xx_HAL_Driver
- * @{
- */
-
-#if defined (RNG)
-
-/** @addtogroup RNG
- * @brief RNG HAL module driver.
- * @{
- */
-
-#ifdef HAL_RNG_MODULE_ENABLED
-
-/* Private types -------------------------------------------------------------*/
-/* Private defines -----------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private constants ---------------------------------------------------------*/
-/** @defgroup RNG_Private_Constants RNG Private Constants
- * @{
- */
-#define RNG_TIMEOUT_VALUE 2U
-/**
- * @}
- */
-/* Private macros ------------------------------------------------------------*/
-/* Private functions prototypes ----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions --------------------------------------------------------*/
-
-/** @addtogroup RNG_Exported_Functions
- * @{
- */
-
-/** @addtogroup RNG_Exported_Functions_Group1
- * @brief Initialization and configuration functions
- *
-@verbatim
- ===============================================================================
- ##### Initialization and configuration functions #####
- ===============================================================================
- [..] This section provides functions allowing to:
- (+) Initialize the RNG according to the specified parameters
- in the RNG_InitTypeDef and create the associated handle
- (+) DeInitialize the RNG peripheral
- (+) Initialize the RNG MSP
- (+) DeInitialize RNG MSP
-
-@endverbatim
- * @{
- */
-
-/**
- * @brief Initializes the RNG peripheral and creates the associated handle.
- * @param hrng pointer to a RNG_HandleTypeDef structure that contains
- * the configuration information for RNG.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_RNG_Init(RNG_HandleTypeDef *hrng)
-{
- /* Check the RNG handle allocation */
- if (hrng == NULL)
- {
- return HAL_ERROR;
- }
- /* Check the parameters */
- assert_param(IS_RNG_ALL_INSTANCE(hrng->Instance));
-
-#if (USE_HAL_RNG_REGISTER_CALLBACKS == 1)
- if (hrng->State == HAL_RNG_STATE_RESET)
- {
- /* Allocate lock resource and initialize it */
- hrng->Lock = HAL_UNLOCKED;
-
- hrng->ReadyDataCallback = HAL_RNG_ReadyDataCallback; /* Legacy weak ReadyDataCallback */
- hrng->ErrorCallback = HAL_RNG_ErrorCallback; /* Legacy weak ErrorCallback */
-
- if (hrng->MspInitCallback == NULL)
- {
- hrng->MspInitCallback = HAL_RNG_MspInit; /* Legacy weak MspInit */
- }
-
- /* Init the low level hardware */
- hrng->MspInitCallback(hrng);
- }
-#else
- if (hrng->State == HAL_RNG_STATE_RESET)
- {
- /* Allocate lock resource and initialize it */
- hrng->Lock = HAL_UNLOCKED;
-
- /* Init the low level hardware */
- HAL_RNG_MspInit(hrng);
- }
-#endif /* USE_HAL_RNG_REGISTER_CALLBACKS */
-
- /* Change RNG peripheral state */
- hrng->State = HAL_RNG_STATE_BUSY;
-
-
- /* Enable the RNG Peripheral */
- __HAL_RNG_ENABLE(hrng);
-
- /* Initialize the RNG state */
- hrng->State = HAL_RNG_STATE_READY;
-
- /* Initialise the error code */
- hrng->ErrorCode = HAL_RNG_ERROR_NONE;
-
- /* Return function status */
- return HAL_OK;
-}
-
-/**
- * @brief DeInitializes the RNG peripheral.
- * @param hrng pointer to a RNG_HandleTypeDef structure that contains
- * the configuration information for RNG.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_RNG_DeInit(RNG_HandleTypeDef *hrng)
-{
- /* Check the RNG handle allocation */
- if (hrng == NULL)
- {
- return HAL_ERROR;
- }
-
- /* Disable the RNG Peripheral */
- CLEAR_BIT(hrng->Instance->CR, RNG_CR_IE | RNG_CR_RNGEN);
-
- /* Clear RNG interrupt status flags */
- CLEAR_BIT(hrng->Instance->SR, RNG_SR_CEIS | RNG_SR_SEIS);
-
-#if (USE_HAL_RNG_REGISTER_CALLBACKS == 1)
- if (hrng->MspDeInitCallback == NULL)
- {
- hrng->MspDeInitCallback = HAL_RNG_MspDeInit; /* Legacy weak MspDeInit */
- }
-
- /* DeInit the low level hardware */
- hrng->MspDeInitCallback(hrng);
-#else
- /* DeInit the low level hardware */
- HAL_RNG_MspDeInit(hrng);
-#endif /* USE_HAL_RNG_REGISTER_CALLBACKS */
-
- /* Update the RNG state */
- hrng->State = HAL_RNG_STATE_RESET;
-
- /* Initialise the error code */
- hrng->ErrorCode = HAL_RNG_ERROR_NONE;
-
- /* Release Lock */
- __HAL_UNLOCK(hrng);
-
- /* Return the function status */
- return HAL_OK;
-}
-
-/**
- * @brief Initializes the RNG MSP.
- * @param hrng pointer to a RNG_HandleTypeDef structure that contains
- * the configuration information for RNG.
- * @retval None
- */
-__weak void HAL_RNG_MspInit(RNG_HandleTypeDef *hrng)
-{
- /* Prevent unused argument(s) compilation warning */
- UNUSED(hrng);
- /* NOTE : This function should not be modified. When the callback is needed,
- function HAL_RNG_MspInit must be implemented in the user file.
- */
-}
-
-/**
- * @brief DeInitializes the RNG MSP.
- * @param hrng pointer to a RNG_HandleTypeDef structure that contains
- * the configuration information for RNG.
- * @retval None
- */
-__weak void HAL_RNG_MspDeInit(RNG_HandleTypeDef *hrng)
-{
- /* Prevent unused argument(s) compilation warning */
- UNUSED(hrng);
- /* NOTE : This function should not be modified. When the callback is needed,
- function HAL_RNG_MspDeInit must be implemented in the user file.
- */
-}
-
-#if (USE_HAL_RNG_REGISTER_CALLBACKS == 1)
-/**
- * @brief Register a User RNG Callback
- * To be used instead of the weak predefined callback
- * @param hrng RNG handle
- * @param CallbackID ID of the callback to be registered
- * This parameter can be one of the following values:
- * @arg @ref HAL_RNG_ERROR_CB_ID Error callback ID
- * @arg @ref HAL_RNG_MSPINIT_CB_ID MspInit callback ID
- * @arg @ref HAL_RNG_MSPDEINIT_CB_ID MspDeInit callback ID
- * @param pCallback pointer to the Callback function
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_RNG_RegisterCallback(RNG_HandleTypeDef *hrng, HAL_RNG_CallbackIDTypeDef CallbackID,
- pRNG_CallbackTypeDef pCallback)
-{
- HAL_StatusTypeDef status = HAL_OK;
-
- if (pCallback == NULL)
- {
- /* Update the error code */
- hrng->ErrorCode = HAL_RNG_ERROR_INVALID_CALLBACK;
- return HAL_ERROR;
- }
- /* Process locked */
- __HAL_LOCK(hrng);
-
- if (HAL_RNG_STATE_READY == hrng->State)
- {
- switch (CallbackID)
- {
- case HAL_RNG_ERROR_CB_ID :
- hrng->ErrorCallback = pCallback;
- break;
-
- case HAL_RNG_MSPINIT_CB_ID :
- hrng->MspInitCallback = pCallback;
- break;
-
- case HAL_RNG_MSPDEINIT_CB_ID :
- hrng->MspDeInitCallback = pCallback;
- break;
-
- default :
- /* Update the error code */
- hrng->ErrorCode = HAL_RNG_ERROR_INVALID_CALLBACK;
- /* Return error status */
- status = HAL_ERROR;
- break;
- }
- }
- else if (HAL_RNG_STATE_RESET == hrng->State)
- {
- switch (CallbackID)
- {
- case HAL_RNG_MSPINIT_CB_ID :
- hrng->MspInitCallback = pCallback;
- break;
-
- case HAL_RNG_MSPDEINIT_CB_ID :
- hrng->MspDeInitCallback = pCallback;
- break;
-
- default :
- /* Update the error code */
- hrng->ErrorCode = HAL_RNG_ERROR_INVALID_CALLBACK;
- /* Return error status */
- status = HAL_ERROR;
- break;
- }
- }
- else
- {
- /* Update the error code */
- hrng->ErrorCode = HAL_RNG_ERROR_INVALID_CALLBACK;
- /* Return error status */
- status = HAL_ERROR;
- }
-
- /* Release Lock */
- __HAL_UNLOCK(hrng);
- return status;
-}
-
-/**
- * @brief Unregister an RNG Callback
- * RNG callabck is redirected to the weak predefined callback
- * @param hrng RNG handle
- * @param CallbackID ID of the callback to be unregistered
- * This parameter can be one of the following values:
- * @arg @ref HAL_RNG_ERROR_CB_ID Error callback ID
- * @arg @ref HAL_RNG_MSPINIT_CB_ID MspInit callback ID
- * @arg @ref HAL_RNG_MSPDEINIT_CB_ID MspDeInit callback ID
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_RNG_UnRegisterCallback(RNG_HandleTypeDef *hrng, HAL_RNG_CallbackIDTypeDef CallbackID)
-{
- HAL_StatusTypeDef status = HAL_OK;
-
- /* Process locked */
- __HAL_LOCK(hrng);
-
- if (HAL_RNG_STATE_READY == hrng->State)
- {
- switch (CallbackID)
- {
- case HAL_RNG_ERROR_CB_ID :
- hrng->ErrorCallback = HAL_RNG_ErrorCallback; /* Legacy weak ErrorCallback */
- break;
-
- case HAL_RNG_MSPINIT_CB_ID :
- hrng->MspInitCallback = HAL_RNG_MspInit; /* Legacy weak MspInit */
- break;
-
- case HAL_RNG_MSPDEINIT_CB_ID :
- hrng->MspDeInitCallback = HAL_RNG_MspDeInit; /* Legacy weak MspDeInit */
- break;
-
- default :
- /* Update the error code */
- hrng->ErrorCode = HAL_RNG_ERROR_INVALID_CALLBACK;
- /* Return error status */
- status = HAL_ERROR;
- break;
- }
- }
- else if (HAL_RNG_STATE_RESET == hrng->State)
- {
- switch (CallbackID)
- {
- case HAL_RNG_MSPINIT_CB_ID :
- hrng->MspInitCallback = HAL_RNG_MspInit; /* Legacy weak MspInit */
- break;
-
- case HAL_RNG_MSPDEINIT_CB_ID :
- hrng->MspDeInitCallback = HAL_RNG_MspDeInit; /* Legacy weak MspInit */
- break;
-
- default :
- /* Update the error code */
- hrng->ErrorCode = HAL_RNG_ERROR_INVALID_CALLBACK;
- /* Return error status */
- status = HAL_ERROR;
- break;
- }
- }
- else
- {
- /* Update the error code */
- hrng->ErrorCode = HAL_RNG_ERROR_INVALID_CALLBACK;
- /* Return error status */
- status = HAL_ERROR;
- }
-
- /* Release Lock */
- __HAL_UNLOCK(hrng);
- return status;
-}
-
-/**
- * @brief Register Data Ready RNG Callback
- * To be used instead of the weak HAL_RNG_ReadyDataCallback() predefined callback
- * @param hrng RNG handle
- * @param pCallback pointer to the Data Ready Callback function
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_RNG_RegisterReadyDataCallback(RNG_HandleTypeDef *hrng, pRNG_ReadyDataCallbackTypeDef pCallback)
-{
- HAL_StatusTypeDef status = HAL_OK;
-
- if (pCallback == NULL)
- {
- /* Update the error code */
- hrng->ErrorCode = HAL_RNG_ERROR_INVALID_CALLBACK;
- return HAL_ERROR;
- }
- /* Process locked */
- __HAL_LOCK(hrng);
-
- if (HAL_RNG_STATE_READY == hrng->State)
- {
- hrng->ReadyDataCallback = pCallback;
- }
- else
- {
- /* Update the error code */
- hrng->ErrorCode = HAL_RNG_ERROR_INVALID_CALLBACK;
- /* Return error status */
- status = HAL_ERROR;
- }
-
- /* Release Lock */
- __HAL_UNLOCK(hrng);
- return status;
-}
-
-/**
- * @brief UnRegister the Data Ready RNG Callback
- * Data Ready RNG Callback is redirected to the weak HAL_RNG_ReadyDataCallback() predefined callback
- * @param hrng RNG handle
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_RNG_UnRegisterReadyDataCallback(RNG_HandleTypeDef *hrng)
-{
- HAL_StatusTypeDef status = HAL_OK;
-
- /* Process locked */
- __HAL_LOCK(hrng);
-
- if (HAL_RNG_STATE_READY == hrng->State)
- {
- hrng->ReadyDataCallback = HAL_RNG_ReadyDataCallback; /* Legacy weak ReadyDataCallback */
- }
- else
- {
- /* Update the error code */
- hrng->ErrorCode = HAL_RNG_ERROR_INVALID_CALLBACK;
- /* Return error status */
- status = HAL_ERROR;
- }
-
- /* Release Lock */
- __HAL_UNLOCK(hrng);
- return status;
-}
-
-#endif /* USE_HAL_RNG_REGISTER_CALLBACKS */
-
-/**
- * @}
- */
-
-/** @addtogroup RNG_Exported_Functions_Group2
- * @brief Peripheral Control functions
- *
-@verbatim
- ===============================================================================
- ##### Peripheral Control functions #####
- ===============================================================================
- [..] This section provides functions allowing to:
- (+) Get the 32 bit Random number
- (+) Get the 32 bit Random number with interrupt enabled
- (+) Handle RNG interrupt request
-
-@endverbatim
- * @{
- */
-
-/**
- * @brief Generates a 32-bit random number.
- * @note Each time the random number data is read the RNG_FLAG_DRDY flag
- * is automatically cleared.
- * @param hrng pointer to a RNG_HandleTypeDef structure that contains
- * the configuration information for RNG.
- * @param random32bit pointer to generated random number variable if successful.
- * @retval HAL status
- */
-
-HAL_StatusTypeDef HAL_RNG_GenerateRandomNumber(RNG_HandleTypeDef *hrng, uint32_t *random32bit)
-{
- uint32_t tickstart;
- HAL_StatusTypeDef status = HAL_OK;
-
- /* Process Locked */
- __HAL_LOCK(hrng);
-
- /* Check RNG peripheral state */
- if (hrng->State == HAL_RNG_STATE_READY)
- {
- /* Change RNG peripheral state */
- hrng->State = HAL_RNG_STATE_BUSY;
-
- /* Get tick */
- tickstart = HAL_GetTick();
-
- /* Check if data register contains valid random data */
- while (__HAL_RNG_GET_FLAG(hrng, RNG_FLAG_DRDY) == RESET)
- {
- if ((HAL_GetTick() - tickstart) > RNG_TIMEOUT_VALUE)
- {
- /* New check to avoid false timeout detection in case of preemption */
- if (__HAL_RNG_GET_FLAG(hrng, RNG_FLAG_DRDY) == RESET)
- {
- hrng->State = HAL_RNG_STATE_READY;
- hrng->ErrorCode = HAL_RNG_ERROR_TIMEOUT;
- /* Process Unlocked */
- __HAL_UNLOCK(hrng);
- return HAL_ERROR;
- }
- }
- }
-
- /* Get a 32bit Random number */
- hrng->RandomNumber = hrng->Instance->DR;
- *random32bit = hrng->RandomNumber;
-
- hrng->State = HAL_RNG_STATE_READY;
- }
- else
- {
- hrng->ErrorCode = HAL_RNG_ERROR_BUSY;
- status = HAL_ERROR;
- }
-
- /* Process Unlocked */
- __HAL_UNLOCK(hrng);
-
- return status;
-}
-
-/**
- * @brief Generates a 32-bit random number in interrupt mode.
- * @param hrng pointer to a RNG_HandleTypeDef structure that contains
- * the configuration information for RNG.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_RNG_GenerateRandomNumber_IT(RNG_HandleTypeDef *hrng)
-{
- HAL_StatusTypeDef status = HAL_OK;
-
- /* Process Locked */
- __HAL_LOCK(hrng);
-
- /* Check RNG peripheral state */
- if (hrng->State == HAL_RNG_STATE_READY)
- {
- /* Change RNG peripheral state */
- hrng->State = HAL_RNG_STATE_BUSY;
-
- /* Enable the RNG Interrupts: Data Ready, Clock error, Seed error */
- __HAL_RNG_ENABLE_IT(hrng);
- }
- else
- {
- /* Process Unlocked */
- __HAL_UNLOCK(hrng);
-
- hrng->ErrorCode = HAL_RNG_ERROR_BUSY;
- status = HAL_ERROR;
- }
-
- return status;
-}
-
-/**
- * @brief Returns generated random number in polling mode (Obsolete)
- * Use HAL_RNG_GenerateRandomNumber() API instead.
- * @param hrng pointer to a RNG_HandleTypeDef structure that contains
- * the configuration information for RNG.
- * @retval Random value
- */
-uint32_t HAL_RNG_GetRandomNumber(RNG_HandleTypeDef *hrng)
-{
- if (HAL_RNG_GenerateRandomNumber(hrng, &(hrng->RandomNumber)) == HAL_OK)
- {
- return hrng->RandomNumber;
- }
- else
- {
- return 0U;
- }
-}
-
-/**
- * @brief Returns a 32-bit random number with interrupt enabled (Obsolete),
- * Use HAL_RNG_GenerateRandomNumber_IT() API instead.
- * @param hrng pointer to a RNG_HandleTypeDef structure that contains
- * the configuration information for RNG.
- * @retval 32-bit random number
- */
-uint32_t HAL_RNG_GetRandomNumber_IT(RNG_HandleTypeDef *hrng)
-{
- uint32_t random32bit = 0U;
-
- /* Process locked */
- __HAL_LOCK(hrng);
-
- /* Change RNG peripheral state */
- hrng->State = HAL_RNG_STATE_BUSY;
-
- /* Get a 32bit Random number */
- random32bit = hrng->Instance->DR;
-
- /* Enable the RNG Interrupts: Data Ready, Clock error, Seed error */
- __HAL_RNG_ENABLE_IT(hrng);
-
- /* Return the 32 bit random number */
- return random32bit;
-}
-
-/**
- * @brief Handles RNG interrupt request.
- * @note In the case of a clock error, the RNG is no more able to generate
- * random numbers because the PLL48CLK clock is not correct. User has
- * to check that the clock controller is correctly configured to provide
- * the RNG clock and clear the CEIS bit using __HAL_RNG_CLEAR_IT().
- * The clock error has no impact on the previously generated
- * random numbers, and the RNG_DR register contents can be used.
- * @note In the case of a seed error, the generation of random numbers is
- * interrupted as long as the SECS bit is '1'. If a number is
- * available in the RNG_DR register, it must not be used because it may
- * not have enough entropy. In this case, it is recommended to clear the
- * SEIS bit using __HAL_RNG_CLEAR_IT(), then disable and enable
- * the RNG peripheral to reinitialize and restart the RNG.
- * @note User-written HAL_RNG_ErrorCallback() API is called once whether SEIS
- * or CEIS are set.
- * @param hrng pointer to a RNG_HandleTypeDef structure that contains
- * the configuration information for RNG.
- * @retval None
-
- */
-void HAL_RNG_IRQHandler(RNG_HandleTypeDef *hrng)
-{
- uint32_t rngclockerror = 0U;
-
- /* RNG clock error interrupt occurred */
- if (__HAL_RNG_GET_IT(hrng, RNG_IT_CEI) != RESET)
- {
- /* Update the error code */
- hrng->ErrorCode = HAL_RNG_ERROR_CLOCK;
- rngclockerror = 1U;
- }
- else if (__HAL_RNG_GET_IT(hrng, RNG_IT_SEI) != RESET)
- {
- /* Update the error code */
- hrng->ErrorCode = HAL_RNG_ERROR_SEED;
- rngclockerror = 1U;
- }
- else
- {
- /* Nothing to do */
- }
-
- if (rngclockerror == 1U)
- {
- /* Change RNG peripheral state */
- hrng->State = HAL_RNG_STATE_ERROR;
-
-#if (USE_HAL_RNG_REGISTER_CALLBACKS == 1)
- /* Call registered Error callback */
- hrng->ErrorCallback(hrng);
-#else
- /* Call legacy weak Error callback */
- HAL_RNG_ErrorCallback(hrng);
-#endif /* USE_HAL_RNG_REGISTER_CALLBACKS */
-
- /* Clear the clock error flag */
- __HAL_RNG_CLEAR_IT(hrng, RNG_IT_CEI | RNG_IT_SEI);
-
- return;
- }
-
- /* Check RNG data ready interrupt occurred */
- if (__HAL_RNG_GET_IT(hrng, RNG_IT_DRDY) != RESET)
- {
- /* Generate random number once, so disable the IT */
- __HAL_RNG_DISABLE_IT(hrng);
-
- /* Get the 32bit Random number (DRDY flag automatically cleared) */
- hrng->RandomNumber = hrng->Instance->DR;
-
- if (hrng->State != HAL_RNG_STATE_ERROR)
- {
- /* Change RNG peripheral state */
- hrng->State = HAL_RNG_STATE_READY;
- /* Process Unlocked */
- __HAL_UNLOCK(hrng);
-
-#if (USE_HAL_RNG_REGISTER_CALLBACKS == 1)
- /* Call registered Data Ready callback */
- hrng->ReadyDataCallback(hrng, hrng->RandomNumber);
-#else
- /* Call legacy weak Data Ready callback */
- HAL_RNG_ReadyDataCallback(hrng, hrng->RandomNumber);
-#endif /* USE_HAL_RNG_REGISTER_CALLBACKS */
- }
- }
-}
-
-/**
- * @brief Read latest generated random number.
- * @param hrng pointer to a RNG_HandleTypeDef structure that contains
- * the configuration information for RNG.
- * @retval random value
- */
-uint32_t HAL_RNG_ReadLastRandomNumber(RNG_HandleTypeDef *hrng)
-{
- return (hrng->RandomNumber);
-}
-
-/**
- * @brief Data Ready callback in non-blocking mode.
- * @param hrng pointer to a RNG_HandleTypeDef structure that contains
- * the configuration information for RNG.
- * @param random32bit generated random number.
- * @retval None
- */
-__weak void HAL_RNG_ReadyDataCallback(RNG_HandleTypeDef *hrng, uint32_t random32bit)
-{
- /* Prevent unused argument(s) compilation warning */
- UNUSED(hrng);
- UNUSED(random32bit);
- /* NOTE : This function should not be modified. When the callback is needed,
- function HAL_RNG_ReadyDataCallback must be implemented in the user file.
- */
-}
-
-/**
- * @brief RNG error callbacks.
- * @param hrng pointer to a RNG_HandleTypeDef structure that contains
- * the configuration information for RNG.
- * @retval None
- */
-__weak void HAL_RNG_ErrorCallback(RNG_HandleTypeDef *hrng)
-{
- /* Prevent unused argument(s) compilation warning */
- UNUSED(hrng);
- /* NOTE : This function should not be modified. When the callback is needed,
- function HAL_RNG_ErrorCallback must be implemented in the user file.
- */
-}
-/**
- * @}
- */
-
-
-/** @addtogroup RNG_Exported_Functions_Group3
- * @brief Peripheral State functions
- *
-@verbatim
- ===============================================================================
- ##### Peripheral State functions #####
- ===============================================================================
- [..]
- This subsection permits to get in run-time the status of the peripheral
- and the data flow.
-
-@endverbatim
- * @{
- */
-
-/**
- * @brief Returns the RNG state.
- * @param hrng pointer to a RNG_HandleTypeDef structure that contains
- * the configuration information for RNG.
- * @retval HAL state
- */
-HAL_RNG_StateTypeDef HAL_RNG_GetState(RNG_HandleTypeDef *hrng)
-{
- return hrng->State;
-}
-
-/**
- * @brief Return the RNG handle error code.
- * @param hrng: pointer to a RNG_HandleTypeDef structure.
- * @retval RNG Error Code
- */
-uint32_t HAL_RNG_GetError(RNG_HandleTypeDef *hrng)
-{
- /* Return RNG Error Code */
- return hrng->ErrorCode;
-}
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-
-#endif /* HAL_RNG_MODULE_ENABLED */
-/**
- * @}
- */
-
-#endif /* RNG */
-
-/**
- * @}
- */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_rtc.c b/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_rtc.c
deleted file mode 100644
index 556452a31a..0000000000
--- a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_rtc.c
+++ /dev/null
@@ -1,1925 +0,0 @@
-/**
- ******************************************************************************
- * @file stm32l0xx_hal_rtc.c
- * @author MCD Application Team
- * @brief RTC HAL module driver.
- * This file provides firmware functions to manage the following
- * functionalities of the Real-Time Clock (RTC) peripheral:
- * + Initialization
- * + Calendar (Time and Date) configuration
- * + Alarms (Alarm A and Alarm B) configuration
- * + WakeUp Timer configuration
- * + TimeStamp configuration
- * + Tampers configuration
- * + Backup Data Registers configuration
- * + RTC Tamper and TimeStamp Pins Selection
- * + Interrupts and flags management
- *
- @verbatim
- ===============================================================================
- ##### RTC Operating Condition #####
- ===============================================================================
- [..] The real-time clock (RTC) and the RTC backup registers can be powered
- from the VBAT voltage when the main VDD supply is powered off.
- To retain the content of the RTC backup registers and supply the RTC
- when VDD is turned off, VBAT pin can be connected to an optional
- standby voltage supplied by a battery or by another source.
-
- ##### Backup Domain Reset #####
- ===============================================================================
- [..] The backup domain reset sets all RTC registers and the RCC_BDCR register
- to their reset values.
- A backup domain reset is generated when one of the following events occurs:
- (+) Software reset, triggered by setting the BDRST bit in the
- RCC Backup domain control register (RCC_BDCR).
- (+) VDD or VBAT power on, if both supplies have previously been powered off.
- (+) Tamper detection event resets all data backup registers.
-
- ##### Backup Domain Access #####
- ===================================================================
- [..] After reset, the backup domain (RTC registers, RTC backup data
- registers and backup SRAM) is protected against possible unwanted write
- accesses.
-
- [..] To enable access to the RTC Domain and RTC registers, proceed as follows:
- (+) Call the function HAL_RCCEx_PeriphCLKConfig with RCC_PERIPHCLK_RTC for
- PeriphClockSelection and select RTCClockSelection (LSE, LSI or HSEdiv32)
- (+) Enable RTC Clock using the __HAL_RCC_RTC_ENABLE() macro.
-
- ##### How to use RTC Driver #####
- ===================================================================
- [..]
- (+) Enable the RTC domain access (see description in the section above).
- (+) Configure the RTC Prescaler (Asynchronous and Synchronous) and RTC hour
- format using the HAL_RTC_Init() function.
-
- *** Time and Date configuration ***
- ===================================
- [..]
- (+) To configure the RTC Calendar (Time and Date) use the HAL_RTC_SetTime()
- and HAL_RTC_SetDate() functions.
- (+) To read the RTC Calendar, use the HAL_RTC_GetTime() and HAL_RTC_GetDate() functions.
-
- *** Alarm configuration ***
- ===========================
- [..]
- (+) To configure the RTC Alarm use the HAL_RTC_SetAlarm() function.
- You can also configure the RTC Alarm with interrupt mode using the
- HAL_RTC_SetAlarm_IT() function.
- (+) To read the RTC Alarm, use the HAL_RTC_GetAlarm() function.
-
- ##### RTC and low power modes #####
- ==================================================================
- [..] The MCU can be woken up from a low power mode by an RTC alternate
- function.
- [..] The RTC alternate functions are the RTC alarms (Alarm A and Alarm B),
- RTC wakeup, RTC tamper event detection and RTC time stamp event detection.
- These RTC alternate functions can wake up the system from the Stop and
- Standby low power modes.
- [..] The system can also wake up from low power modes without depending
- on an external interrupt (Auto-wakeup mode), by using the RTC alarm
- or the RTC wakeup events.
- [..] The RTC provides a programmable time base for waking up from the
- Stop or Standby mode at regular intervals.
- Wakeup from STOP and STANDBY modes is possible only when the RTC clock source
- is LSE or LSI.
-
- *** Callback registration ***
- =============================================
-
- [..]
- The compilation define USE_RTC_REGISTER_CALLBACKS when set to 1
- allows the user to configure dynamically the driver callbacks.
- Use Function HAL_RTC_RegisterCallback() to register an interrupt callback.
-
- [..]
- Function HAL_RTC_RegisterCallback() allows to register following callbacks:
- (+) AlarmAEventCallback : RTC Alarm A Event callback.
- (+) AlarmBEventCallback : RTC Alarm B Event callback.
- (+) TimeStampEventCallback : RTC TimeStamp Event callback.
- (+) WakeUpTimerEventCallback : RTC WakeUpTimer Event callback.
- (+) Tamper1EventCallback : RTC Tamper 1 Event callback.
- (+) Tamper2EventCallback : RTC Tamper 2 Event callback.
- (+) Tamper3EventCallback : RTC Tamper 3 Event callback.
- (+) MspInitCallback : RTC MspInit callback.
- (+) MspDeInitCallback : RTC MspDeInit callback.
- [..]
- This function takes as parameters the HAL peripheral handle, the Callback ID
- and a pointer to the user callback function.
-
- [..]
- Use function HAL_RTC_UnRegisterCallback() to reset a callback to the default
- weak function.
- HAL_RTC_UnRegisterCallback() takes as parameters the HAL peripheral handle,
- and the Callback ID.
- This function allows to reset following callbacks:
- (+) AlarmAEventCallback : RTC Alarm A Event callback.
- (+) AlarmBEventCallback : RTC Alarm B Event callback.
- (+) TimeStampEventCallback : RTC TimeStamp Event callback.
- (+) WakeUpTimerEventCallback : RTC WakeUpTimer Event callback.
- (+) Tamper1EventCallback : RTC Tamper 1 Event callback.
- (+) Tamper2EventCallback : RTC Tamper 2 Event callback.
- (+) Tamper3EventCallback : RTC Tamper 3 Event callback.
- (+) MspInitCallback : RTC MspInit callback.
- (+) MspDeInitCallback : RTC MspDeInit callback.
-
- [..]
- By default, after the HAL_RTC_Init() and when the state is HAL_RTC_STATE_RESET,
- all callbacks are set to the corresponding weak functions :
- examples AlarmAEventCallback(), WakeUpTimerEventCallback().
- Exception done for MspInit and MspDeInit callbacks that are reset to the legacy weak function
- in the HAL_RTC_Init()/HAL_RTC_DeInit() only when these callbacks are null
- (not registered beforehand).
- If not, MspInit or MspDeInit are not null, HAL_RTC_Init()/HAL_RTC_DeInit()
- keep and use the user MspInit/MspDeInit callbacks (registered beforehand)
-
- [..]
- Callbacks can be registered/unregistered in HAL_RTC_STATE_READY state only.
- Exception done MspInit/MspDeInit that can be registered/unregistered
- in HAL_RTC_STATE_READY or HAL_RTC_STATE_RESET state,
- thus registered (user) MspInit/DeInit callbacks can be used during the Init/DeInit.
- In that case first register the MspInit/MspDeInit user callbacks
- using HAL_RTC_RegisterCallback() before calling HAL_RTC_DeInit()
- or HAL_RTC_Init() function.
-
- [..]
- When The compilation define USE_HAL_RTC_REGISTER_CALLBACKS is set to 0 or
- not defined, the callback registration feature is not available and all callbacks
- are set to the corresponding weak functions.
-
- @endverbatim
-
- ******************************************************************************
- * @attention
- *
- *
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- ******************************************************************************
- */
-
-#if !defined (STM32L010x4) && !defined (STM32L010x6)
-/* Includes ------------------------------------------------------------------*/
-#include "stm32l0xx_hal.h"
-
-/** @addtogroup STM32L0xx_HAL_Driver
- * @{
- */
-
-/** @defgroup SMARTCARDEx SMARTCARDEx
- * @brief SMARTCARD Extended HAL module driver
- * @{
- */
-#ifdef HAL_SMARTCARD_MODULE_ENABLED
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macros ------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Exported functions --------------------------------------------------------*/
-/** @defgroup SMARTCARDEx_Exported_Functions SMARTCARD Extended Exported Functions
- * @{
- */
-
-/** @defgroup SMARTCARDEx_Exported_Functions_Group1 Extended Peripheral Control functions
- * @brief Extended control functions
- *
-@verbatim
- ===============================================================================
- ##### Peripheral Control functions #####
- ===============================================================================
- [..]
- This subsection provides a set of functions allowing to initialize the SMARTCARD.
- (+) HAL_SMARTCARDEx_BlockLength_Config() API allows to configure the Block Length on the fly
- (+) HAL_SMARTCARDEx_TimeOut_Config() API allows to configure the receiver timeout value on the fly
- (+) HAL_SMARTCARDEx_EnableReceiverTimeOut() API enables the receiver timeout feature
- (+) HAL_SMARTCARDEx_DisableReceiverTimeOut() API disables the receiver timeout feature
-
-@endverbatim
- * @{
- */
-
-/** @brief Update on the fly the SMARTCARD block length in RTOR register.
- * @param hsmartcard Pointer to a SMARTCARD_HandleTypeDef structure that contains
- * the configuration information for the specified SMARTCARD module.
- * @param BlockLength SMARTCARD block length (8-bit long at most)
- * @retval None
- */
-void HAL_SMARTCARDEx_BlockLength_Config(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t BlockLength)
-{
- MODIFY_REG(hsmartcard->Instance->RTOR, USART_RTOR_BLEN, ((uint32_t)BlockLength << USART_RTOR_BLEN_Pos));
-}
-
-/** @brief Update on the fly the receiver timeout value in RTOR register.
- * @param hsmartcard Pointer to a SMARTCARD_HandleTypeDef structure that contains
- * the configuration information for the specified SMARTCARD module.
- * @param TimeOutValue receiver timeout value in number of baud blocks. The timeout
- * value must be less or equal to 0x0FFFFFFFF.
- * @retval None
- */
-void HAL_SMARTCARDEx_TimeOut_Config(SMARTCARD_HandleTypeDef *hsmartcard, uint32_t TimeOutValue)
-{
- assert_param(IS_SMARTCARD_TIMEOUT_VALUE(hsmartcard->Init.TimeOutValue));
- MODIFY_REG(hsmartcard->Instance->RTOR, USART_RTOR_RTO, TimeOutValue);
-}
-
-/** @brief Enable the SMARTCARD receiver timeout feature.
- * @param hsmartcard Pointer to a SMARTCARD_HandleTypeDef structure that contains
- * the configuration information for the specified SMARTCARD module.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_SMARTCARDEx_EnableReceiverTimeOut(SMARTCARD_HandleTypeDef *hsmartcard)
-{
- if (hsmartcard->gState == HAL_SMARTCARD_STATE_READY)
- {
- /* Process Locked */
- __HAL_LOCK(hsmartcard);
-
- hsmartcard->gState = HAL_SMARTCARD_STATE_BUSY;
-
- /* Set the USART RTOEN bit */
- SET_BIT(hsmartcard->Instance->CR2, USART_CR2_RTOEN);
-
- hsmartcard->gState = HAL_SMARTCARD_STATE_READY;
-
- /* Process Unlocked */
- __HAL_UNLOCK(hsmartcard);
-
- return HAL_OK;
- }
- else
- {
- return HAL_BUSY;
- }
-}
-
-/** @brief Disable the SMARTCARD receiver timeout feature.
- * @param hsmartcard Pointer to a SMARTCARD_HandleTypeDef structure that contains
- * the configuration information for the specified SMARTCARD module.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_SMARTCARDEx_DisableReceiverTimeOut(SMARTCARD_HandleTypeDef *hsmartcard)
-{
- if (hsmartcard->gState == HAL_SMARTCARD_STATE_READY)
- {
- /* Process Locked */
- __HAL_LOCK(hsmartcard);
-
- hsmartcard->gState = HAL_SMARTCARD_STATE_BUSY;
-
- /* Clear the USART RTOEN bit */
- CLEAR_BIT(hsmartcard->Instance->CR2, USART_CR2_RTOEN);
-
- hsmartcard->gState = HAL_SMARTCARD_STATE_READY;
-
- /* Process Unlocked */
- __HAL_UNLOCK(hsmartcard);
-
- return HAL_OK;
- }
- else
- {
- return HAL_BUSY;
- }
-}
-
-/**
- * @}
- */
-
-/** @defgroup SMARTCARDEx_Exported_Functions_Group2 Extended Peripheral IO operation functions
- * @brief SMARTCARD Transmit and Receive functions
- *
- * @{
- */
-
-/**
- * @}
- */
-
-
-/**
- * @}
- */
-
-/** @defgroup SMARTCARDEx_Private_Functions SMARTCARD Extended Private Functions
- * @{
- */
-
-/**
- * @}
- */
-
-#endif /* HAL_SMARTCARD_MODULE_ENABLED */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-#endif /* !defined (STM32L010x4) && !defined (STM32L010x6) */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_smbus.c b/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_smbus.c
deleted file mode 100644
index e88a7c420e..0000000000
--- a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_smbus.c
+++ /dev/null
@@ -1,2750 +0,0 @@
-/**
- ******************************************************************************
- * @file stm32l0xx_hal_smbus.c
- * @author MCD Application Team
- * @brief SMBUS HAL module driver.
- * This file provides firmware functions to manage the following
- * functionalities of the System Management Bus (SMBus) peripheral,
- * based on I2C principles of operation :
- * + Initialization and de-initialization functions
- * + IO operation functions
- * + Peripheral State and Errors functions
- *
- @verbatim
- ==============================================================================
- ##### How to use this driver #####
- ==============================================================================
- [..]
- The SMBUS HAL driver can be used as follows:
-
- (#) Declare a SMBUS_HandleTypeDef handle structure, for example:
- SMBUS_HandleTypeDef hsmbus;
-
- (#)Initialize the SMBUS low level resources by implementing the HAL_SMBUS_MspInit() API:
- (##) Enable the SMBUSx interface clock
- (##) SMBUS pins configuration
- (+++) Enable the clock for the SMBUS GPIOs
- (+++) Configure SMBUS pins as alternate function open-drain
- (##) NVIC configuration if you need to use interrupt process
- (+++) Configure the SMBUSx interrupt priority
- (+++) Enable the NVIC SMBUS IRQ Channel
-
- (#) Configure the Communication Clock Timing, Bus Timeout, Own Address1, Master Addressing 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.
-
- (#) Initialize the SMBUS registers by calling the HAL_SMBUS_Init() API:
- (++) These API's configures also the low level Hardware GPIO, CLOCK, CORTEX...etc)
- by calling the customized HAL_SMBUS_MspInit(&hsmbus) API.
-
- (#) 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
-
- *** Interrupt mode IO operation ***
- ===================================
- [..]
- (+) Transmit in master/host SMBUS mode an amount of data in non-blocking mode
- using HAL_SMBUS_Master_Transmit_IT()
- (++) At transmission end of transfer HAL_SMBUS_MasterTxCpltCallback() is executed and users can
- add their own code by customization of function pointer HAL_SMBUS_MasterTxCpltCallback()
- (+) Receive in master/host SMBUS mode an amount of data in non-blocking mode
- using HAL_SMBUS_Master_Receive_IT()
- (++) At reception end of transfer HAL_SMBUS_MasterRxCpltCallback() is executed and users can
- add their own code by customization of function pointer HAL_SMBUS_MasterRxCpltCallback()
- (+) Abort a master/host SMBUS process communication with Interrupt using HAL_SMBUS_Master_Abort_IT()
- (++) The associated previous transfer callback is called at the end of abort process
- (++) mean HAL_SMBUS_MasterTxCpltCallback() in case of previous state was master transmit
- (++) mean HAL_SMBUS_MasterRxCpltCallback() in case of previous state was master receive
- (+) Enable/disable the Address listen mode in slave/device or host/slave SMBUS mode
- using HAL_SMBUS_EnableListen_IT() HAL_SMBUS_DisableListen_IT()
- (++) When address slave/device SMBUS match, HAL_SMBUS_AddrCallback() is executed and users can
- add their own code to check the Address Match Code and the transmission direction
- request by master/host (Write/Read).
- (++) At Listen mode end HAL_SMBUS_ListenCpltCallback() is executed and users can
- add their own code by customization of function pointer HAL_SMBUS_ListenCpltCallback()
- (+) Transmit in slave/device SMBUS mode an amount of data in non-blocking mode
- using HAL_SMBUS_Slave_Transmit_IT()
- (++) At transmission end of transfer HAL_SMBUS_SlaveTxCpltCallback() is executed and users can
- add their own code by customization of function pointer HAL_SMBUS_SlaveTxCpltCallback()
- (+) Receive in slave/device SMBUS mode an amount of data in non-blocking mode
- using HAL_SMBUS_Slave_Receive_IT()
- (++) At reception end of transfer HAL_SMBUS_SlaveRxCpltCallback() is executed and users can
- add their own code by customization of function pointer HAL_SMBUS_SlaveRxCpltCallback()
- (+) Enable/Disable the SMBUS alert mode using
- HAL_SMBUS_EnableAlert_IT() or HAL_SMBUS_DisableAlert_IT()
- (++) When SMBUS Alert is generated HAL_SMBUS_ErrorCallback() is executed and users can
- add their own code by customization of function pointer HAL_SMBUS_ErrorCallback()
- to check the Alert Error Code using function HAL_SMBUS_GetError()
- (+) Get HAL state machine or error values using HAL_SMBUS_GetState() or HAL_SMBUS_GetError()
- (+) In case of transfer Error, HAL_SMBUS_ErrorCallback() function is executed and users can
- add their own code by customization of function pointer HAL_SMBUS_ErrorCallback()
- to check the Error Code using function HAL_SMBUS_GetError()
-
- *** SMBUS HAL driver macros list ***
- ==================================
- [..]
- Below the list of most used macros in SMBUS HAL driver.
-
- (+) __HAL_SMBUS_ENABLE: Enable the SMBUS peripheral
- (+) __HAL_SMBUS_DISABLE: Disable the SMBUS peripheral
- (+) __HAL_SMBUS_GET_FLAG: Check whether the specified SMBUS flag is set or not
- (+) __HAL_SMBUS_CLEAR_FLAG: Clear the specified SMBUS pending flag
- (+) __HAL_SMBUS_ENABLE_IT: Enable the specified SMBUS interrupt
- (+) __HAL_SMBUS_DISABLE_IT: Disable the specified SMBUS interrupt
-
- *** Callback registration ***
- =============================================
- [..]
- The compilation flag USE_HAL_SMBUS_REGISTER_CALLBACKS when set to 1
- allows the user to configure dynamically the driver callbacks.
- Use Functions HAL_SMBUS_RegisterCallback() or HAL_SMBUS_RegisterAddrCallback()
- to register an interrupt callback.
- [..]
- Function HAL_SMBUS_RegisterCallback() allows to register following callbacks:
- (+) MasterTxCpltCallback : callback for Master transmission end of transfer.
- (+) MasterRxCpltCallback : callback for Master reception end of transfer.
- (+) SlaveTxCpltCallback : callback for Slave transmission end of transfer.
- (+) SlaveRxCpltCallback : callback for Slave reception end of transfer.
- (+) ListenCpltCallback : callback for end of listen mode.
- (+) ErrorCallback : callback for error detection.
- (+) MspInitCallback : callback for Msp Init.
- (+) MspDeInitCallback : callback for Msp DeInit.
- This function takes as parameters the HAL peripheral handle, the Callback ID
- and a pointer to the user callback function.
- [..]
- For specific callback AddrCallback use dedicated register callbacks : HAL_SMBUS_RegisterAddrCallback.
- [..]
- Use function HAL_SMBUS_UnRegisterCallback to reset a callback to the default
- weak function.
- HAL_SMBUS_UnRegisterCallback takes as parameters the HAL peripheral handle,
- and the Callback ID.
- This function allows to reset following callbacks:
- (+) MasterTxCpltCallback : callback for Master transmission end of transfer.
- (+) MasterRxCpltCallback : callback for Master reception end of transfer.
- (+) SlaveTxCpltCallback : callback for Slave transmission end of transfer.
- (+) SlaveRxCpltCallback : callback for Slave reception end of transfer.
- (+) ListenCpltCallback : callback for end of listen mode.
- (+) ErrorCallback : callback for error detection.
- (+) MspInitCallback : callback for Msp Init.
- (+) MspDeInitCallback : callback for Msp DeInit.
- [..]
- For callback AddrCallback use dedicated register callbacks : HAL_SMBUS_UnRegisterAddrCallback.
- [..]
- By default, after the HAL_SMBUS_Init() and when the state is HAL_I2C_STATE_RESET
- all callbacks are set to the corresponding weak functions:
- examples HAL_SMBUS_MasterTxCpltCallback(), HAL_SMBUS_MasterRxCpltCallback().
- Exception done for MspInit and MspDeInit functions that are
- reset to the legacy weak functions in the HAL_SMBUS_Init()/ HAL_SMBUS_DeInit() only when
- these callbacks are null (not registered beforehand).
- If MspInit or MspDeInit are not null, the HAL_SMBUS_Init()/ HAL_SMBUS_DeInit()
- keep and use the user MspInit/MspDeInit callbacks (registered beforehand) whatever the state.
- [..]
- Callbacks can be registered/unregistered in HAL_I2C_STATE_READY state only.
- Exception done MspInit/MspDeInit functions that can be registered/unregistered
- in HAL_I2C_STATE_READY or HAL_I2C_STATE_RESET state,
- thus registered (user) MspInit/DeInit callbacks can be used during the Init/DeInit.
- Then, the user first registers the MspInit/MspDeInit user callbacks
- using HAL_SMBUS_RegisterCallback() before calling HAL_SMBUS_DeInit()
- or HAL_SMBUS_Init() function.
- [..]
- When the compilation flag USE_HAL_SMBUS_REGISTER_CALLBACKS is set to 0 or
- not defined, the callback registration feature is not available and all callbacks
- are set to the corresponding weak functions.
-
- [..]
- (@) You can refer to the SMBUS HAL driver header file for more useful macros
-
- @endverbatim
- ******************************************************************************
- * @attention
- *
- *
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-#include "stm32l0xx_hal.h"
-
-/** @addtogroup STM32L0xx_HAL_Driver
- * @{
- */
-
-/** @defgroup SMBUSEx SMBUSEx
- * @brief SMBUS Extended HAL module driver
- * @{
- */
-
-#ifdef HAL_SMBUS_MODULE_ENABLED
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/** @defgroup SMBUSEx_Exported_Functions SMBUS Extended Exported Functions
- * @{
- */
-
-/** @defgroup SMBUSEx_Exported_Functions_Group2 WakeUp Mode Functions
- * @brief WakeUp Mode Functions
- *
-@verbatim
- ===============================================================================
- ##### WakeUp Mode Functions #####
- ===============================================================================
- [..] This section provides functions allowing to:
- (+) Configure Wake Up Feature
-
-@endverbatim
- * @{
- */
-
-/**
- * @brief Enable SMBUS wakeup from Stop mode(s).
- * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
- * the configuration information for the specified SMBUSx peripheral.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_SMBUSEx_EnableWakeUp(SMBUS_HandleTypeDef *hsmbus)
-{
- /* Check the parameters */
- assert_param(IS_I2C_WAKEUP_FROMSTOP_INSTANCE(hsmbus->Instance));
-
- if (hsmbus->State == HAL_SMBUS_STATE_READY)
- {
- /* Process Locked */
- __HAL_LOCK(hsmbus);
-
- hsmbus->State = HAL_SMBUS_STATE_BUSY;
-
- /* Disable the selected SMBUS peripheral */
- __HAL_SMBUS_DISABLE(hsmbus);
-
- /* Enable wakeup from stop mode */
- hsmbus->Instance->CR1 |= I2C_CR1_WUPEN;
-
- __HAL_SMBUS_ENABLE(hsmbus);
-
- hsmbus->State = HAL_SMBUS_STATE_READY;
-
- /* Process Unlocked */
- __HAL_UNLOCK(hsmbus);
-
- return HAL_OK;
- }
- else
- {
- return HAL_BUSY;
- }
-}
-
-/**
- * @brief Disable SMBUS wakeup from Stop mode(s).
- * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains
- * the configuration information for the specified SMBUSx peripheral.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_SMBUSEx_DisableWakeUp(SMBUS_HandleTypeDef *hsmbus)
-{
- /* Check the parameters */
- assert_param(IS_I2C_WAKEUP_FROMSTOP_INSTANCE(hsmbus->Instance));
-
- if (hsmbus->State == HAL_SMBUS_STATE_READY)
- {
- /* Process Locked */
- __HAL_LOCK(hsmbus);
-
- hsmbus->State = HAL_SMBUS_STATE_BUSY;
-
- /* Disable the selected SMBUS peripheral */
- __HAL_SMBUS_DISABLE(hsmbus);
-
- /* Disable wakeup from stop mode */
- hsmbus->Instance->CR1 &= ~(I2C_CR1_WUPEN);
-
- __HAL_SMBUS_ENABLE(hsmbus);
-
- hsmbus->State = HAL_SMBUS_STATE_READY;
-
- /* Process Unlocked */
- __HAL_UNLOCK(hsmbus);
-
- return HAL_OK;
- }
- else
- {
- return HAL_BUSY;
- }
-}
-/**
- * @}
- */
-#if (defined(SYSCFG_CFGR2_I2C_PB6_FMP) || defined(SYSCFG_CFGR2_I2C_PB7_FMP)) || (defined(SYSCFG_CFGR2_I2C_PB8_FMP) || defined(SYSCFG_CFGR2_I2C_PB9_FMP)) || (defined(SYSCFG_CFGR2_I2C1_FMP)) || defined(SYSCFG_CFGR2_I2C2_FMP) || defined(SYSCFG_CFGR2_I2C3_FMP)
-
-/** @defgroup SMBUSEx_Exported_Functions_Group3 Fast Mode Plus Functions
- * @brief Fast Mode Plus Functions
- *
-@verbatim
- ===============================================================================
- ##### Fast Mode Plus Functions #####
- ===============================================================================
- [..] This section provides functions allowing to:
- (+) Configure Fast Mode Plus
-
-@endverbatim
- * @{
- */
-
-/**
- * @brief Enable the SMBUS fast mode plus driving capability.
- * @param ConfigFastModePlus Selects the pin.
- * This parameter can be one of the @ref SMBUSEx_FastModePlus values
- * @note For I2C1, fast mode plus driving capability can be enabled on all selected
- * I2C1 pins using SMBUS_FASTMODEPLUS_I2C1 parameter or independently
- * on each one of the following pins PB6, PB7, PB8 and PB9.
- * @note For remaining I2C1 pins (PA14, PA15...) fast mode plus driving capability
- * can be enabled only by using SMBUS_FASTMODEPLUS_I2C1 parameter.
- * @note For all I2C2 pins fast mode plus driving capability can be enabled
- * only by using SMBUS_FASTMODEPLUS_I2C2 parameter.
- * @note For all I2C3 pins fast mode plus driving capability can be enabled
- * only by using SMBUS_FASTMODEPLUS_I2C3 parameter.
- * @retval None
- */
-void HAL_SMBUSEx_EnableFastModePlus(uint32_t ConfigFastModePlus)
-{
- /* Check the parameter */
- assert_param(IS_SMBUS_FASTMODEPLUS(ConfigFastModePlus));
-
- /* Enable SYSCFG clock */
- __HAL_RCC_SYSCFG_CLK_ENABLE();
-
- /* Enable fast mode plus driving capability for selected pin */
- SET_BIT(SYSCFG->CFGR2, (uint32_t)ConfigFastModePlus);
-}
-
-/**
- * @brief Disable the SMBUS fast mode plus driving capability.
- * @param ConfigFastModePlus Selects the pin.
- * This parameter can be one of the @ref SMBUSEx_FastModePlus values
- * @note For I2C1, fast mode plus driving capability can be disabled on all selected
- * I2C1 pins using SMBUS_FASTMODEPLUS_I2C1 parameter or independently
- * on each one of the following pins PB6, PB7, PB8 and PB9.
- * @note For remaining I2C1 pins (PA14, PA15...) fast mode plus driving capability
- * can be disabled only by using SMBUS_FASTMODEPLUS_I2C1 parameter.
- * @note For all I2C2 pins fast mode plus driving capability can be disabled
- * only by using SMBUS_FASTMODEPLUS_I2C2 parameter.
- * @note For all I2C3 pins fast mode plus driving capability can be disabled
- * only by using SMBUS_FASTMODEPLUS_I2C3 parameter.
- * @retval None
- */
-void HAL_SMBUSEx_DisableFastModePlus(uint32_t ConfigFastModePlus)
-{
- /* Check the parameter */
- assert_param(IS_SMBUS_FASTMODEPLUS(ConfigFastModePlus));
-
- /* Enable SYSCFG clock */
- __HAL_RCC_SYSCFG_CLK_ENABLE();
-
- /* Disable fast mode plus driving capability for selected pin */
- CLEAR_BIT(SYSCFG->CFGR2, (uint32_t)ConfigFastModePlus);
-}
-
-/**
- * @}
- */
-
-#endif /* Fast Mode Plus Availability */
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-#endif /* HAL_SMBUS_MODULE_ENABLED */
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_spi.c b/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_spi.c
deleted file mode 100644
index 8caa16fd44..0000000000
--- a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_spi.c
+++ /dev/null
@@ -1,3970 +0,0 @@
-/**
- ******************************************************************************
- * @file stm32l0xx_hal_spi.c
- * @author MCD Application Team
- * @brief SPI HAL module driver.
- * This file provides firmware functions to manage the following
- * functionalities of the Serial Peripheral Interface (SPI) peripheral:
- * + Initialization and de-initialization functions
- * + IO operation functions
- * + Peripheral Control functions
- * + Peripheral State functions
- *
- @verbatim
- ==============================================================================
- ##### How to use this driver #####
- ==============================================================================
- [..]
- The SPI HAL driver can be used as follows:
-
- (#) Declare a SPI_HandleTypeDef handle structure, for example:
- SPI_HandleTypeDef hspi;
-
- (#)Initialize the SPI low level resources by implementing the HAL_SPI_MspInit() API:
- (##) Enable the SPIx interface clock
- (##) SPI pins configuration
- (+++) Enable the clock for the SPI GPIOs
- (+++) Configure these SPI pins as alternate function push-pull
- (##) NVIC configuration if you need to use interrupt process
- (+++) Configure the SPIx interrupt priority
- (+++) Enable the NVIC SPI IRQ handle
- (##) DMA Configuration if you need to use DMA process
- (+++) Declare a DMA_HandleTypeDef handle structure for the transmit or receive Stream/Channel
- (+++) Enable the DMAx clock
- (+++) Configure the DMA handle parameters
- (+++) Configure the DMA Tx or Rx Stream/Channel
- (+++) Associate the initialized hdma_tx(or _rx) handle to the hspi DMA Tx or Rx handle
- (+++) Configure the priority and enable the NVIC for the transfer complete interrupt on the DMA Tx or Rx Stream/Channel
-
- (#) Program the Mode, BidirectionalMode , Data size, Baudrate Prescaler, NSS
- management, Clock polarity and phase, FirstBit and CRC configuration in the hspi Init structure.
-
- (#) Initialize the SPI registers by calling the HAL_SPI_Init() API:
- (++) This API configures also the low level Hardware GPIO, CLOCK, CORTEX...etc)
- by calling the customized HAL_SPI_MspInit() API.
- [..]
- Circular mode restriction:
- (#) The DMA circular mode cannot be used when the SPI is configured in these modes:
- (##) Master 2Lines RxOnly
- (##) Master 1Line Rx
- (#) The CRC feature is not managed when the DMA circular mode is enabled
- (#) When the SPI DMA Pause/Stop features are used, we must use the following APIs
- the HAL_SPI_DMAPause()/ HAL_SPI_DMAStop() only under the SPI callbacks
- [..]
- Master Receive mode restriction:
- (#) In Master unidirectional receive-only mode (MSTR =1, BIDIMODE=0, RXONLY=1) or
- bidirectional receive mode (MSTR=1, BIDIMODE=1, BIDIOE=0), to ensure that the SPI
- does not initiate a new transfer the following procedure has to be respected:
- (##) HAL_SPI_DeInit()
- (##) HAL_SPI_Init()
- [..]
- Data buffer address alignment restriction:
- (#) There is no support for unaligned accesses on the Cortex-M0 processor.
- If the user wants to transfer in 16Bit data mode, it shall ensure that 16-bit aligned address is used for:
- (##) pData parameter in HAL_SPI_Transmit(), HAL_SPI_Transmit_IT(), HAL_SPI_Receive() and HAL_SPI_Receive_IT()
- (##) pTxData and pRxData parameters in HAL_SPI_TransmitReceive() and HAL_SPI_TransmitReceive_IT()
- (#) There is no such restriction when going through DMA by using HAL_SPI_Transmit_DMA(), HAL_SPI_Receive_DMA()
- and HAL_SPI_TransmitReceive_DMA().
- [..]
- Callback registration:
-
- (#) The compilation flag USE_HAL_SPI_REGISTER_CALLBACKS when set to 1U
- allows the user to configure dynamically the driver callbacks.
- Use Functions HAL_SPI_RegisterCallback() to register an interrupt callback.
-
- Function HAL_SPI_RegisterCallback() allows to register following callbacks:
- (++) TxCpltCallback : SPI Tx Completed callback
- (++) RxCpltCallback : SPI Rx Completed callback
- (++) TxRxCpltCallback : SPI TxRx Completed callback
- (++) TxHalfCpltCallback : SPI Tx Half Completed callback
- (++) RxHalfCpltCallback : SPI Rx Half Completed callback
- (++) TxRxHalfCpltCallback : SPI TxRx Half Completed callback
- (++) ErrorCallback : SPI Error callback
- (++) AbortCpltCallback : SPI Abort callback
- (++) MspInitCallback : SPI Msp Init callback
- (++) MspDeInitCallback : SPI Msp DeInit callback
- This function takes as parameters the HAL peripheral handle, the Callback ID
- and a pointer to the user callback function.
-
-
- (#) Use function HAL_SPI_UnRegisterCallback to reset a callback to the default
- weak function.
- HAL_SPI_UnRegisterCallback takes as parameters the HAL peripheral handle,
- and the Callback ID.
- This function allows to reset following callbacks:
- (++) TxCpltCallback : SPI Tx Completed callback
- (++) RxCpltCallback : SPI Rx Completed callback
- (++) TxRxCpltCallback : SPI TxRx Completed callback
- (++) TxHalfCpltCallback : SPI Tx Half Completed callback
- (++) RxHalfCpltCallback : SPI Rx Half Completed callback
- (++) TxRxHalfCpltCallback : SPI TxRx Half Completed callback
- (++) ErrorCallback : SPI Error callback
- (++) AbortCpltCallback : SPI Abort callback
- (++) MspInitCallback : SPI Msp Init callback
- (++) MspDeInitCallback : SPI Msp DeInit callback
-
- [..]
- By default, after the HAL_SPI_Init() and when the state is HAL_SPI_STATE_RESET
- all callbacks are set to the corresponding weak functions:
- examples HAL_SPI_MasterTxCpltCallback(), HAL_SPI_MasterRxCpltCallback().
- Exception done for MspInit and MspDeInit functions that are
- reset to the legacy weak functions in the HAL_SPI_Init()/ HAL_SPI_DeInit() only when
- these callbacks are null (not registered beforehand).
- If MspInit or MspDeInit are not null, the HAL_SPI_Init()/ HAL_SPI_DeInit()
- keep and use the user MspInit/MspDeInit callbacks (registered beforehand) whatever the state.
-
- [..]
- Callbacks can be registered/unregistered in HAL_SPI_STATE_READY state only.
- Exception done MspInit/MspDeInit functions that can be registered/unregistered
- in HAL_SPI_STATE_READY or HAL_SPI_STATE_RESET state,
- thus registered (user) MspInit/DeInit callbacks can be used during the Init/DeInit.
- Then, the user first registers the MspInit/MspDeInit user callbacks
- using HAL_SPI_RegisterCallback() before calling HAL_SPI_DeInit()
- or HAL_SPI_Init() function.
-
- [..]
- When the compilation define USE_HAL_PPP_REGISTER_CALLBACKS is set to 0 or
- not defined, the callback registering feature is not available
- and weak (surcharged) callbacks are used.
-
- [..]
- Using the HAL it is not possible to reach all supported SPI frequency with the different SPI Modes,
- the following table resume the max SPI frequency reached with data size 8bits/16bits,
- according to frequency of the APBx Peripheral Clock (fPCLK) used by the SPI instance.
-
- @endverbatim
-
- Additional table :
-
- DataSize = SPI_DATASIZE_8BIT:
- +----------------------------------------------------------------------------------------------+
- | | | 2Lines Fullduplex | 2Lines RxOnly | 1Line |
- | Process | Transfer mode |---------------------|----------------------|----------------------|
- | | | Master | Slave | Master | Slave | Master | Slave |
- |==============================================================================================|
- | T | Polling | Fpclk/2 | Fpclk/2 | NA | NA | NA | NA |
- | X |----------------|----------|----------|-----------|----------|-----------|----------|
- | / | Interrupt | Fpclk/4 | Fpclk/8 | NA | NA | NA | NA |
- | R |----------------|----------|----------|-----------|----------|-----------|----------|
- | X | DMA | Fpclk/2 | Fpclk/2 | NA | NA | NA | NA |
- |=========|================|==========|==========|===========|==========|===========|==========|
- | | Polling | Fpclk/2 | Fpclk/2 | Fpclk/64 | Fpclk/2 | Fpclk/64 | Fpclk/2 |
- | |----------------|----------|----------|-----------|----------|-----------|----------|
- | R | Interrupt | Fpclk/8 | Fpclk/8 | Fpclk/64 | Fpclk/2 | Fpclk/64 | Fpclk/2 |
- | X |----------------|----------|----------|-----------|----------|-----------|----------|
- | | DMA | Fpclk/2 | Fpclk/2 | Fpclk/64 | Fpclk/2 | Fpclk/128 | Fpclk/2 |
- |=========|================|==========|==========|===========|==========|===========|==========|
- | | Polling | Fpclk/2 | Fpclk/4 | NA | NA | Fpclk/2 | Fpclk/64 |
- | |----------------|----------|----------|-----------|----------|-----------|----------|
- | T | Interrupt | Fpclk/2 | Fpclk/4 | NA | NA | Fpclk/2 | Fpclk/64 |
- | X |----------------|----------|----------|-----------|----------|-----------|----------|
- | | DMA | Fpclk/2 | Fpclk/2 | NA | NA | Fpclk/2 | Fpclk/128|
- +----------------------------------------------------------------------------------------------+
-
- DataSize = SPI_DATASIZE_16BIT:
- +----------------------------------------------------------------------------------------------+
- | | | 2Lines Fullduplex | 2Lines RxOnly | 1Line |
- | Process | Transfer mode |---------------------|----------------------|----------------------|
- | | | Master | Slave | Master | Slave | Master | Slave |
- |==============================================================================================|
- | T | Polling | Fpclk/2 | Fpclk/2 | NA | NA | NA | NA |
- | X |----------------|----------|----------|-----------|----------|-----------|----------|
- | / | Interrupt | Fpclk/4 | Fpclk/4 | NA | NA | NA | NA |
- | R |----------------|----------|----------|-----------|----------|-----------|----------|
- | X | DMA | Fpclk/2 | Fpclk/2 | NA | NA | NA | NA |
- |=========|================|==========|==========|===========|==========|===========|==========|
- | | Polling | Fpclk/2 | Fpclk/2 | Fpclk/64 | Fpclk/2 | Fpclk/32 | Fpclk/2 |
- | |----------------|----------|----------|-----------|----------|-----------|----------|
- | R | Interrupt | Fpclk/4 | Fpclk/4 | Fpclk/64 | Fpclk/2 | Fpclk/64 | Fpclk/2 |
- | X |----------------|----------|----------|-----------|----------|-----------|----------|
- | | DMA | Fpclk/2 | Fpclk/2 | Fpclk/64 | Fpclk/2 | Fpclk/128 | Fpclk/2 |
- |=========|================|==========|==========|===========|==========|===========|==========|
- | | Polling | Fpclk/2 | Fpclk/2 | NA | NA | Fpclk/2 | Fpclk/32 |
- | |----------------|----------|----------|-----------|----------|-----------|----------|
- | T | Interrupt | Fpclk/2 | Fpclk/2 | NA | NA | Fpclk/2 | Fpclk/64 |
- | X |----------------|----------|----------|-----------|----------|-----------|----------|
- | | DMA | Fpclk/2 | Fpclk/2 | NA | NA | Fpclk/2 | Fpclk/128|
- +----------------------------------------------------------------------------------------------+
- @note The max SPI frequency depend on SPI data size (8bits, 16bits),
- SPI mode(2 Lines fullduplex, 2 lines RxOnly, 1 line TX/RX) and Process mode (Polling, IT, DMA).
- @note
- (#) TX/RX processes are HAL_SPI_TransmitReceive(), HAL_SPI_TransmitReceive_IT() and HAL_SPI_TransmitReceive_DMA()
- (#) RX processes are HAL_SPI_Receive(), HAL_SPI_Receive_IT() and HAL_SPI_Receive_DMA()
- (#) TX processes are HAL_SPI_Transmit(), HAL_SPI_Transmit_IT() and HAL_SPI_Transmit_DMA()
-
- ******************************************************************************
- * @attention
- *
- *
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-#include "stm32l0xx_hal.h"
-
-/** @addtogroup STM32L0xx_HAL_Driver
- * @{
- */
-
-/** @addtogroup HAL_TimeBase
- * @{
- */
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-TIM_HandleTypeDef TimHandle;
-/* Private function prototypes -----------------------------------------------*/
-void TIM21_IRQHandler(void);
-/* Private functions ---------------------------------------------------------*/
-
-/**
- * @brief This function configures the TIM21 as a time base source.
- * The time source is configured to have 1ms time base with a dedicated
- * Tick interrupt priority.
- * @note This function is called automatically at the beginning of program after
- * reset by HAL_Init() or at any time when clock is configured, by HAL_RCC_ClockConfig().
- * @param TickPriority: Tick interrupt priority.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
-{
- RCC_ClkInitTypeDef clkconfig;
- uint32_t uwTimclock;
- uint32_t uwAPB2Prescaler;
- uint32_t uwPrescalerValue;
- uint32_t pFLatency;
- HAL_StatusTypeDef status;
-
- /* Configure the TIM21 IRQ priority */
- HAL_NVIC_SetPriority(TIM21_IRQn, TickPriority, 0U);
-
- /* Enable the TIM21 global Interrupt */
- HAL_NVIC_EnableIRQ(TIM21_IRQn);
-
- /* Enable TIM21 clock */
- __HAL_RCC_TIM21_CLK_ENABLE();
-
- /* Get clock configuration */
- HAL_RCC_GetClockConfig(&clkconfig, &pFLatency);
-
- /* Get APB2 prescaler */
- uwAPB2Prescaler = clkconfig.APB2CLKDivider;
-
- /* Compute TIM21 clock */
- if (uwAPB2Prescaler == RCC_HCLK_DIV1)
- {
- uwTimclock = HAL_RCC_GetPCLK2Freq();
- }
- else
- {
- uwTimclock = 2U * HAL_RCC_GetPCLK2Freq();
- }
-
- /* Compute the prescaler value to have TIM21 counter clock equal to 1MHz */
- uwPrescalerValue = (uint32_t)((uwTimclock / 1000000U) - 1U);
-
- /* Initialize TIM21 */
- TimHandle.Instance = TIM21;
-
- /* Initialize TIMx peripheral as follow:
- + Period = [(TIM21CLK/1000) - 1]. to have a (1/1000) s time base.
- + Prescaler = (uwTimclock/1000000 - 1) to have a 1MHz counter clock.
- + ClockDivision = 0
- + Counter direction = Up
- */
- TimHandle.Init.Period = (1000000U / 1000U) - 1U;
- TimHandle.Init.Prescaler = uwPrescalerValue;
- TimHandle.Init.ClockDivision = 0;
- TimHandle.Init.CounterMode = TIM_COUNTERMODE_UP;
- status = HAL_TIM_Base_Init(&TimHandle);
- if (status == HAL_OK)
- {
- /* Start the TIM time Base generation in interrupt mode */
- status = HAL_TIM_Base_Start_IT(&TimHandle);
- if (status == HAL_OK)
- {
- /* Configure the SysTick IRQ priority */
- if (TickPriority < (1UL << __NVIC_PRIO_BITS))
- {
- /* Configure the TIM IRQ priority */
- HAL_NVIC_SetPriority(TIM21_IRQn, TickPriority, 0U);
- uwTickPrio = TickPriority;
- }
- else
- {
- status = HAL_ERROR;
- }
- }
- }
-
- /* Return function status */
- return status;
-}
-
-/**
- * @brief Suspend Tick increment.
- * @note Disable the tick increment by disabling TIM21 update interrupt.
- * @param None
- * @retval None
- */
-void HAL_SuspendTick(void)
-{
- /* Disable TIM21 update interrupt */
- __HAL_TIM_DISABLE_IT(&TimHandle, TIM_IT_UPDATE);
-}
-
-/**
- * @brief Resume Tick increment.
- * @note Enable the tick increment by enabling TIM21 update interrupt.
- * @param None
- * @retval None
- */
-void HAL_ResumeTick(void)
-{
- /* Enable TIM21 update interrupt */
- __HAL_TIM_ENABLE_IT(&TimHandle, TIM_IT_UPDATE);
-}
-
-/**
- * @brief Period elapsed callback in non blocking mode
- * @note This function is called when TIM21 interrupt took place, inside
- * HAL_TIM_IRQHandler(). It makes a direct call to HAL_IncTick() to increment
- * a global variable "uwTick" used as application time base.
- * @param htim : TIM handle
- * @retval None
- */
-void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
-{
- HAL_IncTick();
-}
-
-/**
- * @brief This function handles TIM interrupt request.
- * @param None
- * @retval None
- */
-void TIM21_IRQHandler(void)
-{
- HAL_TIM_IRQHandler(&TimHandle);
-}
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_tsc.c b/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_tsc.c
deleted file mode 100644
index 6e6d43d6ff..0000000000
--- a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_tsc.c
+++ /dev/null
@@ -1,1080 +0,0 @@
-/**
- ******************************************************************************
- * @file stm32l0xx_hal_tsc.c
- * @author MCD Application Team
- * @brief This file provides firmware functions to manage the following
- * functionalities of the Touch Sensing Controller (TSC) peripheral:
- * + Initialization and De-initialization
- * + Channel IOs, Shield IOs and Sampling IOs configuration
- * + Start and Stop an acquisition
- * + Read acquisition result
- * + Interrupts and flags management
- *
- @verbatim
-================================================================================
- ##### TSC specific features #####
-================================================================================
- [..]
- (#) Proven and robust surface charge transfer acquisition principle
-
- (#) Supports up to 3 capacitive sensing channels per group
-
- (#) Capacitive sensing channels can be acquired in parallel offering a very good
- response time
-
- (#) Spread spectrum feature to improve system robustness in noisy environments
-
- (#) Full hardware management of the charge transfer acquisition sequence
-
- (#) Programmable charge transfer frequency
-
- (#) Programmable sampling capacitor I/O pin
-
- (#) Programmable channel I/O pin
-
- (#) Programmable max count value to avoid long acquisition when a channel is faulty
-
- (#) Dedicated end of acquisition and max count error flags with interrupt capability
-
- (#) One sampling capacitor for up to 3 capacitive sensing channels to reduce the system
- components
-
- (#) Compatible with proximity, touchkey, linear and rotary touch sensor implementation
-
- ##### How to use this driver #####
-================================================================================
- [..]
- (#) Enable the TSC interface clock using __HAL_RCC_TSC_CLK_ENABLE() macro.
-
- (#) GPIO pins configuration
- (++) Enable the clock for the TSC GPIOs using __HAL_RCC_GPIOx_CLK_ENABLE() macro.
- (++) Configure the TSC pins used as sampling IOs in alternate function output Open-Drain mode,
- and TSC pins used as channel/shield IOs in alternate function output Push-Pull mode
- using HAL_GPIO_Init() function.
-
- (#) Interrupts configuration
- (++) Configure the NVIC (if the interrupt model is used) using HAL_NVIC_SetPriority()
- and HAL_NVIC_EnableIRQ() and function.
-
- (#) TSC configuration
- (++) Configure all TSC parameters and used TSC IOs using HAL_TSC_Init() function.
-
- [..] TSC peripheral alternate functions are mapped on AF3.
-
- *** Acquisition sequence ***
- ===================================
- [..]
- (+) Discharge all IOs using HAL_TSC_IODischarge() function.
- (+) Wait a certain time allowing a good discharge of all capacitors. This delay depends
- of the sampling capacitor and electrodes design.
- (+) Select the channel IOs to be acquired using HAL_TSC_IOConfig() function.
- (+) Launch the acquisition using either HAL_TSC_Start() or HAL_TSC_Start_IT() function.
- If the synchronized mode is selected, the acquisition will start as soon as the signal
- is received on the synchro pin.
- (+) Wait the end of acquisition using either HAL_TSC_PollForAcquisition() or
- HAL_TSC_GetState() function or using WFI instruction for example.
- (+) Check the group acquisition status using HAL_TSC_GroupGetStatus() function.
- (+) Read the acquisition value using HAL_TSC_GroupGetValue() function.
-
- *** Callback registration ***
- =============================================
-
- [..]
- The compilation flag USE_HAL_TSC_REGISTER_CALLBACKS when set to 1
- allows the user to configure dynamically the driver callbacks.
- Use Functions HAL_TSC_RegisterCallback() to register an interrupt callback.
-
- [..]
- Function HAL_TSC_RegisterCallback() allows to register following callbacks:
- (+) ConvCpltCallback : callback for conversion complete process.
- (+) ErrorCallback : callback for error detection.
- (+) MspInitCallback : callback for Msp Init.
- (+) MspDeInitCallback : callback for Msp DeInit.
- [..]
- This function takes as parameters the HAL peripheral handle, the Callback ID
- and a pointer to the user callback function.
-
- [..]
- Use function HAL_TSC_UnRegisterCallback to reset a callback to the default
- weak function.
- HAL_TSC_UnRegisterCallback takes as parameters the HAL peripheral handle,
- and the Callback ID.
- [..]
- This function allows to reset following callbacks:
- (+) ConvCpltCallback : callback for conversion complete process.
- (+) ErrorCallback : callback for error detection.
- (+) MspInitCallback : callback for Msp Init.
- (+) MspDeInitCallback : callback for Msp DeInit.
-
- [..]
- By default, after the HAL_TSC_Init() and when the state is HAL_TSC_STATE_RESET
- all callbacks are set to the corresponding weak functions:
- examples HAL_TSC_ConvCpltCallback(), HAL_TSC_ErrorCallback().
- Exception done for MspInit and MspDeInit functions that are
- reset to the legacy weak functions in the HAL_TSC_Init()/ HAL_TSC_DeInit() only when
- these callbacks are null (not registered beforehand).
- If MspInit or MspDeInit are not null, the HAL_TSC_Init()/ HAL_TSC_DeInit()
- keep and use the user MspInit/MspDeInit callbacks (registered beforehand) whatever the state.
-
- [..]
- Callbacks can be registered/unregistered in HAL_TSC_STATE_READY state only.
- Exception done MspInit/MspDeInit functions that can be registered/unregistered
- in HAL_TSC_STATE_READY or HAL_TSC_STATE_RESET state,
- thus registered (user) MspInit/DeInit callbacks can be used during the Init/DeInit.
- Then, the user first registers the MspInit/MspDeInit user callbacks
- using HAL_TSC_RegisterCallback() before calling HAL_TSC_DeInit()
- or HAL_TSC_Init() function.
-
- [..]
- When the compilation flag USE_HAL_TSC_REGISTER_CALLBACKS is set to 0 or
- not defined, the callback registration feature is not available and all callbacks
- are set to the corresponding weak functions.
-
- @endverbatim
- ******************************************************************************
- ******************************************************************************
- * @attention
- *
- *
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-#include "stm32l0xx_hal.h"
-
-/** @addtogroup STM32L0xx_HAL_Driver
- * @{
- */
-
-/** @defgroup UARTEx UARTEx
- * @brief UART Extended HAL module driver
- * @{
- */
-
-#ifdef HAL_UART_MODULE_ENABLED
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-/* Private macros ------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/** @defgroup UARTEx_Private_Functions UARTEx Private Functions
- * @{
- */
-static void UARTEx_Wakeup_AddressConfig(UART_HandleTypeDef *huart, UART_WakeUpTypeDef WakeUpSelection);
-/**
- * @}
- */
-
-/* Exported functions --------------------------------------------------------*/
-
-/** @defgroup UARTEx_Exported_Functions UARTEx Exported Functions
- * @{
- */
-
-/** @defgroup UARTEx_Exported_Functions_Group1 Initialization and de-initialization functions
- * @brief Extended Initialization and Configuration Functions
- *
-@verbatim
-===============================================================================
- ##### Initialization and Configuration functions #####
- ===============================================================================
- [..]
- This subsection provides a set of functions allowing to initialize the USARTx or the UARTy
- in asynchronous mode.
- (+) For the asynchronous mode the parameters below can be configured:
- (++) Baud Rate
- (++) Word Length
- (++) Stop Bit
- (++) Parity: If the parity is enabled, then the MSB bit of the data written
- in the data register is transmitted but is changed by the parity bit.
- (++) Hardware flow control
- (++) Receiver/transmitter modes
- (++) Over Sampling Method
- (++) One-Bit Sampling Method
- (+) For the asynchronous mode, the following advanced features can be configured as well:
- (++) TX and/or RX pin level inversion
- (++) data logical level inversion
- (++) RX and TX pins swap
- (++) RX overrun detection disabling
- (++) DMA disabling on RX error
- (++) MSB first on communication line
- (++) auto Baud rate detection
- [..]
- The HAL_RS485Ex_Init() API follows the UART RS485 mode configuration
- procedures (details for the procedures are available in reference manual).
-
-@endverbatim
-
- Depending on the frame length defined by the M1 and M0 bits (7-bit,
- 8-bit or 9-bit), the possible UART formats are listed in the
- following table.
-
- Table 1. UART frame format.
- +-----------------------------------------------------------------------+
- | M1 bit | M0 bit | PCE bit | UART frame |
- |---------|---------|-----------|---------------------------------------|
- | 0 | 0 | 0 | | SB | 8 bit data | STB | |
- |---------|---------|-----------|---------------------------------------|
- | 0 | 0 | 1 | | SB | 7 bit data | PB | STB | |
- |---------|---------|-----------|---------------------------------------|
- | 0 | 1 | 0 | | SB | 9 bit data | STB | |
- |---------|---------|-----------|---------------------------------------|
- | 0 | 1 | 1 | | SB | 8 bit data | PB | STB | |
- |---------|---------|-----------|---------------------------------------|
- | 1 | 0 | 0 | | SB | 7 bit data | STB | |
- |---------|---------|-----------|---------------------------------------|
- | 1 | 0 | 1 | | SB | 6 bit data | PB | STB | |
- +-----------------------------------------------------------------------+
-
- * @{
- */
-
-/**
- * @brief Initialize the RS485 Driver enable feature according to the specified
- * parameters in the UART_InitTypeDef and creates the associated handle.
- * @param huart UART handle.
- * @param Polarity Select the driver enable polarity.
- * This parameter can be one of the following values:
- * @arg @ref UART_DE_POLARITY_HIGH DE signal is active high
- * @arg @ref UART_DE_POLARITY_LOW DE signal is active low
- * @param AssertionTime Driver Enable assertion time:
- * 5-bit value defining the time between the activation of the DE (Driver Enable)
- * signal and the beginning of the start bit. It is expressed in sample time
- * units (1/8 or 1/16 bit time, depending on the oversampling rate)
- * @param DeassertionTime Driver Enable deassertion time:
- * 5-bit value defining the time between the end of the last stop bit, in a
- * transmitted message, and the de-activation of the DE (Driver Enable) signal.
- * It is expressed in sample time units (1/8 or 1/16 bit time, depending on the
- * oversampling rate).
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_RS485Ex_Init(UART_HandleTypeDef *huart, uint32_t Polarity, uint32_t AssertionTime,
- uint32_t DeassertionTime)
-{
- uint32_t temp;
-
- /* Check the UART handle allocation */
- if (huart == NULL)
- {
- return HAL_ERROR;
- }
- /* Check the Driver Enable UART instance */
- assert_param(IS_UART_DRIVER_ENABLE_INSTANCE(huart->Instance));
-
- /* Check the Driver Enable polarity */
- assert_param(IS_UART_DE_POLARITY(Polarity));
-
- /* Check the Driver Enable assertion time */
- assert_param(IS_UART_ASSERTIONTIME(AssertionTime));
-
- /* Check the Driver Enable deassertion time */
- assert_param(IS_UART_DEASSERTIONTIME(DeassertionTime));
-
- if (huart->gState == HAL_UART_STATE_RESET)
- {
- /* Allocate lock resource and initialize it */
- huart->Lock = HAL_UNLOCKED;
-
-#if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
- UART_InitCallbacksToDefault(huart);
-
- if (huart->MspInitCallback == NULL)
- {
- huart->MspInitCallback = HAL_UART_MspInit;
- }
-
- /* Init the low level hardware */
- huart->MspInitCallback(huart);
-#else
- /* Init the low level hardware : GPIO, CLOCK, CORTEX */
- HAL_UART_MspInit(huart);
-#endif /* (USE_HAL_UART_REGISTER_CALLBACKS) */
- }
-
- huart->gState = HAL_UART_STATE_BUSY;
-
- /* Disable the Peripheral */
- __HAL_UART_DISABLE(huart);
-
- /* Set the UART Communication parameters */
- if (UART_SetConfig(huart) == HAL_ERROR)
- {
- return HAL_ERROR;
- }
-
- if (huart->AdvancedInit.AdvFeatureInit != UART_ADVFEATURE_NO_INIT)
- {
- UART_AdvFeatureConfig(huart);
- }
-
- /* Enable the Driver Enable mode by setting the DEM bit in the CR3 register */
- SET_BIT(huart->Instance->CR3, USART_CR3_DEM);
-
- /* Set the Driver Enable polarity */
- MODIFY_REG(huart->Instance->CR3, USART_CR3_DEP, Polarity);
-
- /* Set the Driver Enable assertion and deassertion times */
- temp = (AssertionTime << UART_CR1_DEAT_ADDRESS_LSB_POS);
- temp |= (DeassertionTime << UART_CR1_DEDT_ADDRESS_LSB_POS);
- MODIFY_REG(huart->Instance->CR1, (USART_CR1_DEDT | USART_CR1_DEAT), temp);
-
- /* Enable the Peripheral */
- __HAL_UART_ENABLE(huart);
-
- /* TEACK and/or REACK to check before moving huart->gState and huart->RxState to Ready */
- return (UART_CheckIdleState(huart));
-}
-
-/**
- * @}
- */
-
-/** @defgroup UARTEx_Exported_Functions_Group2 IO operation functions
- * @brief Extended functions
- *
-@verbatim
- ===============================================================================
- ##### IO operation functions #####
- ===============================================================================
- This subsection provides a set of Wakeup and FIFO mode related callback functions.
-
- (#) Wakeup from Stop mode Callback:
- (+) HAL_UARTEx_WakeupCallback()
-
-@endverbatim
- * @{
- */
-
-/**
- * @brief UART wakeup from Stop mode callback.
- * @param huart UART handle.
- * @retval None
- */
-__weak void HAL_UARTEx_WakeupCallback(UART_HandleTypeDef *huart)
-{
- /* Prevent unused argument(s) compilation warning */
- UNUSED(huart);
-
- /* NOTE : This function should not be modified, when the callback is needed,
- the HAL_UARTEx_WakeupCallback can be implemented in the user file.
- */
-}
-
-
-/**
- * @}
- */
-
-/** @defgroup UARTEx_Exported_Functions_Group3 Peripheral Control functions
- * @brief Extended Peripheral Control functions
- *
-@verbatim
- ===============================================================================
- ##### Peripheral Control functions #####
- ===============================================================================
- [..] This section provides the following functions:
- (+) HAL_UARTEx_EnableClockStopMode() API enables the UART clock (HSI or LSE only) during stop mode
- (+) HAL_UARTEx_DisableClockStopMode() API disables the above functionality
- (+) HAL_MultiProcessorEx_AddressLength_Set() API optionally sets the UART node address
- detection length to more than 4 bits for multiprocessor address mark wake up.
- (+) HAL_UARTEx_StopModeWakeUpSourceConfig() API defines the wake-up from stop mode
- trigger: address match, Start Bit detection or RXNE bit status.
- (+) HAL_UARTEx_EnableStopMode() API enables the UART to wake up the MCU from stop mode
- (+) HAL_UARTEx_DisableStopMode() API disables the above functionality
-
- [..] This subsection also provides a set of additional functions providing enhanced reception
- services to user. (For example, these functions allow application to handle use cases
- where number of data to be received is unknown).
-
- (#) Compared to standard reception services which only consider number of received
- data elements as reception completion criteria, these functions also consider additional events
- as triggers for updating reception status to caller :
- (+) Detection of inactivity period (RX line has not been active for a given period).
- (++) RX inactivity detected by IDLE event, i.e. RX line has been in idle state (normally high state)
- for 1 frame time, after last received byte.
- (++) RX inactivity detected by RTO, i.e. line has been in idle state
- for a programmable time, after last received byte.
- (+) Detection that a specific character has been received.
-
- (#) There are two mode of transfer:
- (+) Blocking mode: The reception is performed in polling mode, until either expected number of data is received,
- or till IDLE event occurs. Reception is handled only during function execution.
- When function exits, no data reception could occur. HAL status and number of actually received data elements,
- are returned by function after finishing transfer.
- (+) Non-Blocking mode: The reception is performed using Interrupts or DMA.
- These API's return the HAL status.
- The end of the data processing will be indicated through the
- dedicated UART IRQ when using Interrupt mode or the DMA IRQ when using DMA mode.
- The HAL_UARTEx_RxEventCallback() user callback will be executed during Receive process
- The HAL_UART_ErrorCallback()user callback will be executed when a reception error is detected.
-
- (#) Blocking mode API:
- (+) HAL_UARTEx_ReceiveToIdle()
-
- (#) Non-Blocking mode API with Interrupt:
- (+) HAL_UARTEx_ReceiveToIdle_IT()
-
- (#) Non-Blocking mode API with DMA:
- (+) HAL_UARTEx_ReceiveToIdle_DMA()
-
-@endverbatim
- * @{
- */
-
-/**
- * @brief Keep UART Clock enabled when in Stop Mode.
- * @note When the USART clock source is configured to be LSE or HSI, it is possible to keep enabled
- * this clock during STOP mode by setting the UCESM bit in USART_CR3 control register.
- * @note When LPUART is used to wakeup from stop with LSE is selected as LPUART clock source,
- * and desired baud rate is 9600 baud, the bit UCESM bit in LPUART_CR3 control register must be set.
- * @param huart UART handle.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_UARTEx_EnableClockStopMode(UART_HandleTypeDef *huart)
-{
- /* Process Locked */
- __HAL_LOCK(huart);
-
- /* Set UCESM bit */
- ATOMIC_SET_BIT(huart->Instance->CR3, USART_CR3_UCESM);
-
- /* Process Unlocked */
- __HAL_UNLOCK(huart);
-
- return HAL_OK;
-}
-
-/**
- * @brief Disable UART Clock when in Stop Mode.
- * @param huart UART handle.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_UARTEx_DisableClockStopMode(UART_HandleTypeDef *huart)
-{
- /* Process Locked */
- __HAL_LOCK(huart);
-
- /* Clear UCESM bit */
- ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_UCESM);
-
- /* Process Unlocked */
- __HAL_UNLOCK(huart);
-
- return HAL_OK;
-}
-
-/**
- * @brief By default in multiprocessor mode, when the wake up method is set
- * to address mark, the UART handles only 4-bit long addresses detection;
- * this API allows to enable longer addresses detection (6-, 7- or 8-bit
- * long).
- * @note Addresses detection lengths are: 6-bit address detection in 7-bit data mode,
- * 7-bit address detection in 8-bit data mode, 8-bit address detection in 9-bit data mode.
- * @param huart UART handle.
- * @param AddressLength This parameter can be one of the following values:
- * @arg @ref UART_ADDRESS_DETECT_4B 4-bit long address
- * @arg @ref UART_ADDRESS_DETECT_7B 6-, 7- or 8-bit long address
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_MultiProcessorEx_AddressLength_Set(UART_HandleTypeDef *huart, uint32_t AddressLength)
-{
- /* Check the UART handle allocation */
- if (huart == NULL)
- {
- return HAL_ERROR;
- }
-
- /* Check the address length parameter */
- assert_param(IS_UART_ADDRESSLENGTH_DETECT(AddressLength));
-
- huart->gState = HAL_UART_STATE_BUSY;
-
- /* Disable the Peripheral */
- __HAL_UART_DISABLE(huart);
-
- /* Set the address length */
- MODIFY_REG(huart->Instance->CR2, USART_CR2_ADDM7, AddressLength);
-
- /* Enable the Peripheral */
- __HAL_UART_ENABLE(huart);
-
- /* TEACK and/or REACK to check before moving huart->gState to Ready */
- return (UART_CheckIdleState(huart));
-}
-
-/**
- * @brief Set Wakeup from Stop mode interrupt flag selection.
- * @note It is the application responsibility to enable the interrupt used as
- * usart_wkup interrupt source before entering low-power mode.
- * @param huart UART handle.
- * @param WakeUpSelection Address match, Start Bit detection or RXNE/RXFNE bit status.
- * This parameter can be one of the following values:
- * @arg @ref UART_WAKEUP_ON_ADDRESS
- * @arg @ref UART_WAKEUP_ON_STARTBIT
- * @arg @ref UART_WAKEUP_ON_READDATA_NONEMPTY
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_UARTEx_StopModeWakeUpSourceConfig(UART_HandleTypeDef *huart, UART_WakeUpTypeDef WakeUpSelection)
-{
- HAL_StatusTypeDef status = HAL_OK;
- uint32_t tickstart;
-
- /* check the wake-up from stop mode UART instance */
- assert_param(IS_UART_WAKEUP_FROMSTOP_INSTANCE(huart->Instance));
- /* check the wake-up selection parameter */
- assert_param(IS_UART_WAKEUP_SELECTION(WakeUpSelection.WakeUpEvent));
-
- /* Process Locked */
- __HAL_LOCK(huart);
-
- huart->gState = HAL_UART_STATE_BUSY;
-
- /* Disable the Peripheral */
- __HAL_UART_DISABLE(huart);
-
- /* Set the wake-up selection scheme */
- MODIFY_REG(huart->Instance->CR3, USART_CR3_WUS, WakeUpSelection.WakeUpEvent);
-
- if (WakeUpSelection.WakeUpEvent == UART_WAKEUP_ON_ADDRESS)
- {
- UARTEx_Wakeup_AddressConfig(huart, WakeUpSelection);
- }
-
- /* Enable the Peripheral */
- __HAL_UART_ENABLE(huart);
-
- /* Init tickstart for timeout management */
- tickstart = HAL_GetTick();
-
- /* Wait until REACK flag is set */
- if (UART_WaitOnFlagUntilTimeout(huart, USART_ISR_REACK, RESET, tickstart, HAL_UART_TIMEOUT_VALUE) != HAL_OK)
- {
- status = HAL_TIMEOUT;
- }
- else
- {
- /* Initialize the UART State */
- huart->gState = HAL_UART_STATE_READY;
- }
-
- /* Process Unlocked */
- __HAL_UNLOCK(huart);
-
- return status;
-}
-
-/**
- * @brief Enable UART Stop Mode.
- * @note The UART is able to wake up the MCU from Stop 1 mode as long as UART clock is HSI or LSE.
- * @param huart UART handle.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_UARTEx_EnableStopMode(UART_HandleTypeDef *huart)
-{
- /* Process Locked */
- __HAL_LOCK(huart);
-
- /* Set UESM bit */
- ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_UESM);
-
- /* Process Unlocked */
- __HAL_UNLOCK(huart);
-
- return HAL_OK;
-}
-
-/**
- * @brief Disable UART Stop Mode.
- * @param huart UART handle.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_UARTEx_DisableStopMode(UART_HandleTypeDef *huart)
-{
- /* Process Locked */
- __HAL_LOCK(huart);
-
- /* Clear UESM bit */
- ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_UESM);
-
- /* Process Unlocked */
- __HAL_UNLOCK(huart);
-
- return HAL_OK;
-}
-
-/**
- * @brief Receive an amount of data in blocking mode till either the expected number of data
- * is received or an IDLE event occurs.
- * @note HAL_OK is returned if reception is completed (expected number of data has been received)
- * or if reception is stopped after IDLE event (less than the expected number of data has been received)
- * In this case, RxLen output parameter indicates number of data available in reception buffer.
- * @note When UART parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01),
- * the received data is handled as a set of uint16_t. In this case, Size must indicate the number
- * of uint16_t available through pData.
- * @note When UART parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01),
- * address of user data buffer for storing data to be received, should be aligned on a half word frontier
- * (16 bits) (as received data will be handled using uint16_t pointer cast). Depending on compilation chain,
- * use of specific alignment compilation directives or pragmas might be required to ensure proper
- * alignment for pData.
- * @param huart UART handle.
- * @param pData Pointer to data buffer (uint8_t or uint16_t data elements).
- * @param Size Amount of data elements (uint8_t or uint16_t) to be received.
- * @param RxLen Number of data elements finally received
- * (could be lower than Size, in case reception ends on IDLE event)
- * @param Timeout Timeout duration expressed in ms (covers the whole reception sequence).
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_UARTEx_ReceiveToIdle(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint16_t *RxLen,
- uint32_t Timeout)
-{
- uint8_t *pdata8bits;
- uint16_t *pdata16bits;
- uint16_t uhMask;
- uint32_t tickstart;
-
- /* Check that a Rx process is not already ongoing */
- if (huart->RxState == HAL_UART_STATE_READY)
- {
- if ((pData == NULL) || (Size == 0U))
- {
- return HAL_ERROR;
- }
-
- /* In case of 9bits/No Parity transfer, pData buffer provided as input parameter
- should be aligned on a uint16_t frontier, as data to be received from RDR will be
- handled through a uint16_t cast. */
- if ((huart->Init.WordLength == UART_WORDLENGTH_9B) && (huart->Init.Parity == UART_PARITY_NONE))
- {
- if ((((uint32_t)pData) & 1U) != 0U)
- {
- return HAL_ERROR;
- }
- }
-
- __HAL_LOCK(huart);
-
- huart->ErrorCode = HAL_UART_ERROR_NONE;
- huart->RxState = HAL_UART_STATE_BUSY_RX;
- huart->ReceptionType = HAL_UART_RECEPTION_TOIDLE;
-
- /* Init tickstart for timeout management */
- tickstart = HAL_GetTick();
-
- huart->RxXferSize = Size;
- huart->RxXferCount = Size;
-
- /* Computation of UART mask to apply to RDR register */
- UART_MASK_COMPUTATION(huart);
- uhMask = huart->Mask;
-
- /* In case of 9bits/No Parity transfer, pRxData needs to be handled as a uint16_t pointer */
- if ((huart->Init.WordLength == UART_WORDLENGTH_9B) && (huart->Init.Parity == UART_PARITY_NONE))
- {
- pdata8bits = NULL;
- pdata16bits = (uint16_t *) pData;
- }
- else
- {
- pdata8bits = pData;
- pdata16bits = NULL;
- }
-
- __HAL_UNLOCK(huart);
-
- /* Initialize output number of received elements */
- *RxLen = 0U;
-
- /* as long as data have to be received */
- while (huart->RxXferCount > 0U)
- {
- /* Check if IDLE flag is set */
- if (__HAL_UART_GET_FLAG(huart, UART_FLAG_IDLE))
- {
- /* Clear IDLE flag in ISR */
- __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_IDLEF);
-
- /* If Set, but no data ever received, clear flag without exiting loop */
- /* If Set, and data has already been received, this means Idle Event is valid : End reception */
- if (*RxLen > 0U)
- {
- huart->RxState = HAL_UART_STATE_READY;
-
- return HAL_OK;
- }
- }
-
- /* Check if RXNE flag is set */
- if (__HAL_UART_GET_FLAG(huart, UART_FLAG_RXNE))
- {
- if (pdata8bits == NULL)
- {
- *pdata16bits = (uint16_t)(huart->Instance->RDR & uhMask);
- pdata16bits++;
- }
- else
- {
- *pdata8bits = (uint8_t)(huart->Instance->RDR & (uint8_t)uhMask);
- pdata8bits++;
- }
- /* Increment number of received elements */
- *RxLen += 1U;
- huart->RxXferCount--;
- }
-
- /* Check for the Timeout */
- if (Timeout != HAL_MAX_DELAY)
- {
- if (((HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U))
- {
- huart->RxState = HAL_UART_STATE_READY;
-
- return HAL_TIMEOUT;
- }
- }
- }
-
- /* Set number of received elements in output parameter : RxLen */
- *RxLen = huart->RxXferSize - huart->RxXferCount;
- /* At end of Rx process, restore huart->RxState to Ready */
- huart->RxState = HAL_UART_STATE_READY;
-
- return HAL_OK;
- }
- else
- {
- return HAL_BUSY;
- }
-}
-
-/**
- * @brief Receive an amount of data in interrupt mode till either the expected number of data
- * is received or an IDLE event occurs.
- * @note Reception is initiated by this function call. Further progress of reception is achieved thanks
- * to UART interrupts raised by RXNE and IDLE events. Callback is called at end of reception indicating
- * number of received data elements.
- * @note When UART parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01),
- * the received data is handled as a set of uint16_t. In this case, Size must indicate the number
- * of uint16_t available through pData.
- * @note When UART parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01),
- * address of user data buffer for storing data to be received, should be aligned on a half word frontier
- * (16 bits) (as received data will be handled using uint16_t pointer cast). Depending on compilation chain,
- * use of specific alignment compilation directives or pragmas might be required
- * to ensure proper alignment for pData.
- * @param huart UART handle.
- * @param pData Pointer to data buffer (uint8_t or uint16_t data elements).
- * @param Size Amount of data elements (uint8_t or uint16_t) to be received.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_UARTEx_ReceiveToIdle_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
-{
- HAL_StatusTypeDef status;
-
- /* Check that a Rx process is not already ongoing */
- if (huart->RxState == HAL_UART_STATE_READY)
- {
- if ((pData == NULL) || (Size == 0U))
- {
- return HAL_ERROR;
- }
-
- /* In case of 9bits/No Parity transfer, pData buffer provided as input parameter
- should be aligned on a uint16_t frontier, as data to be received from RDR will be
- handled through a uint16_t cast. */
- if ((huart->Init.WordLength == UART_WORDLENGTH_9B) && (huart->Init.Parity == UART_PARITY_NONE))
- {
- if ((((uint32_t)pData) & 1U) != 0U)
- {
- return HAL_ERROR;
- }
- }
-
- __HAL_LOCK(huart);
-
- /* Set Reception type to reception till IDLE Event*/
- huart->ReceptionType = HAL_UART_RECEPTION_TOIDLE;
-
- status = UART_Start_Receive_IT(huart, pData, Size);
-
- /* Check Rx process has been successfully started */
- if (status == HAL_OK)
- {
- if (huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE)
- {
- __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_IDLEF);
- ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_IDLEIE);
- }
- else
- {
- /* In case of errors already pending when reception is started,
- Interrupts may have already been raised and lead to reception abortion.
- (Overrun error for instance).
- In such case Reception Type has been reset to HAL_UART_RECEPTION_STANDARD. */
- status = HAL_ERROR;
- }
- }
-
- return status;
- }
- else
- {
- return HAL_BUSY;
- }
-}
-
-/**
- * @brief Receive an amount of data in DMA mode till either the expected number
- * of data is received or an IDLE event occurs.
- * @note Reception is initiated by this function call. Further progress of reception is achieved thanks
- * to DMA services, transferring automatically received data elements in user reception buffer and
- * calling registered callbacks at half/end of reception. UART IDLE events are also used to consider
- * reception phase as ended. In all cases, callback execution will indicate number of received data elements.
- * @note When the UART parity is enabled (PCE = 1), the received data contain
- * the parity bit (MSB position).
- * @note When UART parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01),
- * the received data is handled as a set of uint16_t. In this case, Size must indicate the number
- * of uint16_t available through pData.
- * @note When UART parity is not enabled (PCE = 0), and Word Length is configured to 9 bits (M1-M0 = 01),
- * address of user data buffer for storing data to be received, should be aligned on a half word frontier
- * (16 bits) (as received data will be handled by DMA from halfword frontier). Depending on compilation chain,
- * use of specific alignment compilation directives or pragmas might be required
- * to ensure proper alignment for pData.
- * @param huart UART handle.
- * @param pData Pointer to data buffer (uint8_t or uint16_t data elements).
- * @param Size Amount of data elements (uint8_t or uint16_t) to be received.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_UARTEx_ReceiveToIdle_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
-{
- HAL_StatusTypeDef status;
-
- /* Check that a Rx process is not already ongoing */
- if (huart->RxState == HAL_UART_STATE_READY)
- {
- if ((pData == NULL) || (Size == 0U))
- {
- return HAL_ERROR;
- }
-
- /* In case of 9bits/No Parity transfer, pData buffer provided as input parameter
- should be aligned on a uint16_t frontier, as data copy from RDR will be
- handled by DMA from a uint16_t frontier. */
- if ((huart->Init.WordLength == UART_WORDLENGTH_9B) && (huart->Init.Parity == UART_PARITY_NONE))
- {
- if ((((uint32_t)pData) & 1U) != 0U)
- {
- return HAL_ERROR;
- }
- }
-
- __HAL_LOCK(huart);
-
- /* Set Reception type to reception till IDLE Event*/
- huart->ReceptionType = HAL_UART_RECEPTION_TOIDLE;
-
- status = UART_Start_Receive_DMA(huart, pData, Size);
-
- /* Check Rx process has been successfully started */
- if (status == HAL_OK)
- {
- if (huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE)
- {
- __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_IDLEF);
- ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_IDLEIE);
- }
- else
- {
- /* In case of errors already pending when reception is started,
- Interrupts may have already been raised and lead to reception abortion.
- (Overrun error for instance).
- In such case Reception Type has been reset to HAL_UART_RECEPTION_STANDARD. */
- status = HAL_ERROR;
- }
- }
-
- return status;
- }
- else
- {
- return HAL_BUSY;
- }
-}
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/** @addtogroup UARTEx_Private_Functions
- * @{
- */
-
-/**
- * @brief Initialize the UART wake-up from stop mode parameters when triggered by address detection.
- * @param huart UART handle.
- * @param WakeUpSelection UART wake up from stop mode parameters.
- * @retval None
- */
-static void UARTEx_Wakeup_AddressConfig(UART_HandleTypeDef *huart, UART_WakeUpTypeDef WakeUpSelection)
-{
- assert_param(IS_UART_ADDRESSLENGTH_DETECT(WakeUpSelection.AddressLength));
-
- /* Set the USART address length */
- MODIFY_REG(huart->Instance->CR2, USART_CR2_ADDM7, WakeUpSelection.AddressLength);
-
- /* Set the USART address node */
- MODIFY_REG(huart->Instance->CR2, USART_CR2_ADD, ((uint32_t)WakeUpSelection.Address << UART_CR2_ADDRESS_LSB_POS));
-}
-
-/**
- * @}
- */
-
-#endif /* HAL_UART_MODULE_ENABLED */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_usart.c b/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_usart.c
deleted file mode 100644
index bd6ff67255..0000000000
--- a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_usart.c
+++ /dev/null
@@ -1,3249 +0,0 @@
-/**
- ******************************************************************************
- * @file stm32l0xx_hal_usart.c
- * @author MCD Application Team
- * @brief USART HAL module driver.
- * This file provides firmware functions to manage the following
- * functionalities of the Universal Synchronous/Asynchronous Receiver Transmitter
- * Peripheral (USART).
- * + Initialization and de-initialization functions
- * + IO operation functions
- * + Peripheral Control functions
- * + Peripheral State and Error functions
- *
- @verbatim
- ===============================================================================
- ##### How to use this driver #####
- ===============================================================================
- [..]
- The USART HAL driver can be used as follows:
-
- (#) Declare a USART_HandleTypeDef handle structure (eg. USART_HandleTypeDef husart).
- (#) Initialize the USART low level resources by implementing the HAL_USART_MspInit() API:
- (++) Enable the USARTx interface clock.
- (++) USART pins configuration:
- (+++) Enable the clock for the USART GPIOs.
- (+++) Configure these USART pins as alternate function pull-up.
- (++) NVIC configuration if you need to use interrupt process (HAL_USART_Transmit_IT(),
- HAL_USART_Receive_IT() and HAL_USART_TransmitReceive_IT() APIs):
- (+++) Configure the USARTx interrupt priority.
- (+++) Enable the NVIC USART IRQ handle.
- (++) USART interrupts handling:
- -@@- The specific USART interrupts (Transmission complete interrupt,
- RXNE interrupt and Error Interrupts) will be managed using the macros
- __HAL_USART_ENABLE_IT() and __HAL_USART_DISABLE_IT() inside the transmit and receive process.
- (++) DMA Configuration if you need to use DMA process (HAL_USART_Transmit_DMA()
- HAL_USART_Receive_DMA() and HAL_USART_TransmitReceive_DMA() APIs):
- (+++) Declare a DMA handle structure for the Tx/Rx channel.
- (+++) Enable the DMAx interface clock.
- (+++) Configure the declared DMA handle structure with the required Tx/Rx parameters.
- (+++) Configure the DMA Tx/Rx channel.
- (+++) Associate the initialized DMA handle to the USART DMA Tx/Rx handle.
- (+++) Configure the priority and enable the NVIC for the transfer
- complete interrupt on the DMA Tx/Rx channel.
-
- (#) Program the Baud Rate, Word Length, Stop Bit, Parity, and Mode
- (Receiver/Transmitter) in the husart handle Init structure.
-
- (#) Initialize the USART registers by calling the HAL_USART_Init() API:
- (++) This API configures also the low level Hardware GPIO, CLOCK, CORTEX...etc)
- by calling the customized HAL_USART_MspInit(&husart) API.
-
- [..]
- (@) To configure and enable/disable the USART to wake up the MCU from stop mode, resort to UART API's
- HAL_UARTEx_StopModeWakeUpSourceConfig(), HAL_UARTEx_EnableStopMode() and
- HAL_UARTEx_DisableStopMode() in casting the USART handle to UART type UART_HandleTypeDef.
-
- ##### Callback registration #####
- ==================================
-
- [..]
- The compilation define USE_HAL_USART_REGISTER_CALLBACKS when set to 1
- allows the user to configure dynamically the driver callbacks.
-
- [..]
- Use Function HAL_USART_RegisterCallback() to register a user callback.
- Function HAL_USART_RegisterCallback() allows to register following callbacks:
- (+) TxHalfCpltCallback : Tx Half Complete Callback.
- (+) TxCpltCallback : Tx Complete Callback.
- (+) RxHalfCpltCallback : Rx Half Complete Callback.
- (+) RxCpltCallback : Rx Complete Callback.
- (+) TxRxCpltCallback : Tx Rx Complete Callback.
- (+) ErrorCallback : Error Callback.
- (+) AbortCpltCallback : Abort Complete Callback.
- (+) MspInitCallback : USART MspInit.
- (+) MspDeInitCallback : USART MspDeInit.
- This function takes as parameters the HAL peripheral handle, the Callback ID
- and a pointer to the user callback function.
-
- [..]
- Use function HAL_USART_UnRegisterCallback() to reset a callback to the default
- weak (surcharged) function.
- HAL_USART_UnRegisterCallback() takes as parameters the HAL peripheral handle,
- and the Callback ID.
- This function allows to reset following callbacks:
- (+) TxHalfCpltCallback : Tx Half Complete Callback.
- (+) TxCpltCallback : Tx Complete Callback.
- (+) RxHalfCpltCallback : Rx Half Complete Callback.
- (+) RxCpltCallback : Rx Complete Callback.
- (+) TxRxCpltCallback : Tx Rx Complete Callback.
- (+) ErrorCallback : Error Callback.
- (+) AbortCpltCallback : Abort Complete Callback.
- (+) MspInitCallback : USART MspInit.
- (+) MspDeInitCallback : USART MspDeInit.
-
- [..]
- By default, after the HAL_USART_Init() and when the state is HAL_USART_STATE_RESET
- all callbacks are set to the corresponding weak (surcharged) functions:
- examples HAL_USART_TxCpltCallback(), HAL_USART_RxHalfCpltCallback().
- Exception done for MspInit and MspDeInit functions that are respectively
- reset to the legacy weak (surcharged) functions in the HAL_USART_Init()
- and HAL_USART_DeInit() only when these callbacks are null (not registered beforehand).
- If not, MspInit or MspDeInit are not null, the HAL_USART_Init() and HAL_USART_DeInit()
- keep and use the user MspInit/MspDeInit callbacks (registered beforehand).
-
- [..]
- Callbacks can be registered/unregistered in HAL_USART_STATE_READY state only.
- Exception done MspInit/MspDeInit that can be registered/unregistered
- in HAL_USART_STATE_READY or HAL_USART_STATE_RESET state, thus registered (user)
- MspInit/DeInit callbacks can be used during the Init/DeInit.
- In that case first register the MspInit/MspDeInit user callbacks
- using HAL_USART_RegisterCallback() before calling HAL_USART_DeInit()
- or HAL_USART_Init() function.
-
- [..]
- When The compilation define USE_HAL_USART_REGISTER_CALLBACKS is set to 0 or
- not defined, the callback registration feature is not available
- and weak (surcharged) callbacks are used.
-
-
- @endverbatim
- ******************************************************************************
- * @attention
- *
- *
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-#include "stm32l0xx_hal.h"
-
-/** @addtogroup STM32L0xx_HAL_Driver
- * @{
- */
-
-#ifdef HAL_WWDG_MODULE_ENABLED
-/** @defgroup WWDG WWDG
- * @brief WWDG HAL module driver.
- * @{
- */
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Exported functions --------------------------------------------------------*/
-
-/** @defgroup WWDG_Exported_Functions WWDG Exported Functions
- * @{
- */
-
-/** @defgroup WWDG_Exported_Functions_Group1 Initialization and Configuration functions
- * @brief Initialization and Configuration functions.
- *
-@verbatim
- ==============================================================================
- ##### Initialization and Configuration functions #####
- ==============================================================================
- [..]
- This section provides functions allowing to:
- (+) Initialize and start the WWDG according to the specified parameters
- in the WWDG_InitTypeDef of associated handle.
- (+) Initialize the WWDG MSP.
-
-@endverbatim
- * @{
- */
-
-/**
- * @brief Initialize the WWDG according to the specified.
- * parameters in the WWDG_InitTypeDef of associated handle.
- * @param hwwdg pointer to a WWDG_HandleTypeDef structure that contains
- * the configuration information for the specified WWDG module.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_WWDG_Init(WWDG_HandleTypeDef *hwwdg)
-{
- /* Check the WWDG handle allocation */
- if (hwwdg == NULL)
- {
- return HAL_ERROR;
- }
-
- /* Check the parameters */
- assert_param(IS_WWDG_ALL_INSTANCE(hwwdg->Instance));
- assert_param(IS_WWDG_PRESCALER(hwwdg->Init.Prescaler));
- assert_param(IS_WWDG_WINDOW(hwwdg->Init.Window));
- assert_param(IS_WWDG_COUNTER(hwwdg->Init.Counter));
- assert_param(IS_WWDG_EWI_MODE(hwwdg->Init.EWIMode));
-
-#if (USE_HAL_WWDG_REGISTER_CALLBACKS == 1)
- /* Reset Callback pointers */
- if (hwwdg->EwiCallback == NULL)
- {
- hwwdg->EwiCallback = HAL_WWDG_EarlyWakeupCallback;
- }
-
- if (hwwdg->MspInitCallback == NULL)
- {
- hwwdg->MspInitCallback = HAL_WWDG_MspInit;
- }
-
- /* Init the low level hardware */
- hwwdg->MspInitCallback(hwwdg);
-#else
- /* Init the low level hardware */
- HAL_WWDG_MspInit(hwwdg);
-#endif /* USE_HAL_WWDG_REGISTER_CALLBACKS */
-
- /* Set WWDG Counter */
- WRITE_REG(hwwdg->Instance->CR, (WWDG_CR_WDGA | hwwdg->Init.Counter));
-
- /* Set WWDG Prescaler and Window */
- WRITE_REG(hwwdg->Instance->CFR, (hwwdg->Init.EWIMode | hwwdg->Init.Prescaler | hwwdg->Init.Window));
-
- /* Return function status */
- return HAL_OK;
-}
-
-
-/**
- * @brief Initialize the WWDG MSP.
- * @param hwwdg pointer to a WWDG_HandleTypeDef structure that contains
- * the configuration information for the specified WWDG module.
- * @note When rewriting this function in user file, mechanism may be added
- * to avoid multiple initialize when HAL_WWDG_Init function is called
- * again to change parameters.
- * @retval None
- */
-__weak void HAL_WWDG_MspInit(WWDG_HandleTypeDef *hwwdg)
-{
- /* Prevent unused argument(s) compilation warning */
- UNUSED(hwwdg);
-
- /* NOTE: This function should not be modified, when the callback is needed,
- the HAL_WWDG_MspInit could be implemented in the user file
- */
-}
-
-
-#if (USE_HAL_WWDG_REGISTER_CALLBACKS == 1)
-/**
- * @brief Register a User WWDG Callback
- * To be used instead of the weak (surcharged) predefined callback
- * @param hwwdg WWDG handle
- * @param CallbackID ID of the callback to be registered
- * This parameter can be one of the following values:
- * @arg @ref HAL_WWDG_EWI_CB_ID Early WakeUp Interrupt Callback ID
- * @arg @ref HAL_WWDG_MSPINIT_CB_ID MspInit callback ID
- * @param pCallback pointer to the Callback function
- * @retval status
- */
-HAL_StatusTypeDef HAL_WWDG_RegisterCallback(WWDG_HandleTypeDef *hwwdg, HAL_WWDG_CallbackIDTypeDef CallbackID,
- pWWDG_CallbackTypeDef pCallback)
-{
- HAL_StatusTypeDef status = HAL_OK;
-
- if (pCallback == NULL)
- {
- status = HAL_ERROR;
- }
- else
- {
- switch (CallbackID)
- {
- case HAL_WWDG_EWI_CB_ID:
- hwwdg->EwiCallback = pCallback;
- break;
-
- case HAL_WWDG_MSPINIT_CB_ID:
- hwwdg->MspInitCallback = pCallback;
- break;
-
- default:
- status = HAL_ERROR;
- break;
- }
- }
-
- return status;
-}
-
-
-/**
- * @brief Unregister a WWDG Callback
- * WWDG Callback is redirected to the weak (surcharged) predefined callback
- * @param hwwdg WWDG handle
- * @param CallbackID ID of the callback to be registered
- * This parameter can be one of the following values:
- * @arg @ref HAL_WWDG_EWI_CB_ID Early WakeUp Interrupt Callback ID
- * @arg @ref HAL_WWDG_MSPINIT_CB_ID MspInit callback ID
- * @retval status
- */
-HAL_StatusTypeDef HAL_WWDG_UnRegisterCallback(WWDG_HandleTypeDef *hwwdg, HAL_WWDG_CallbackIDTypeDef CallbackID)
-{
- HAL_StatusTypeDef status = HAL_OK;
-
- switch (CallbackID)
- {
- case HAL_WWDG_EWI_CB_ID:
- hwwdg->EwiCallback = HAL_WWDG_EarlyWakeupCallback;
- break;
-
- case HAL_WWDG_MSPINIT_CB_ID:
- hwwdg->MspInitCallback = HAL_WWDG_MspInit;
- break;
-
- default:
- status = HAL_ERROR;
- break;
- }
-
- return status;
-}
-#endif /* USE_HAL_WWDG_REGISTER_CALLBACKS */
-
-/**
- * @}
- */
-
-/** @defgroup WWDG_Exported_Functions_Group2 IO operation functions
- * @brief IO operation functions
- *
-@verbatim
- ==============================================================================
- ##### IO operation functions #####
- ==============================================================================
- [..]
- This section provides functions allowing to:
- (+) Refresh the WWDG.
- (+) Handle WWDG interrupt request and associated function callback.
-
-@endverbatim
- * @{
- */
-
-/**
- * @brief Refresh the WWDG.
- * @param hwwdg pointer to a WWDG_HandleTypeDef structure that contains
- * the configuration information for the specified WWDG module.
- * @retval HAL status
- */
-HAL_StatusTypeDef HAL_WWDG_Refresh(WWDG_HandleTypeDef *hwwdg)
-{
- /* Write to WWDG CR the WWDG Counter value to refresh with */
- WRITE_REG(hwwdg->Instance->CR, (hwwdg->Init.Counter));
-
- /* Return function status */
- return HAL_OK;
-}
-
-/**
- * @brief Handle WWDG interrupt request.
- * @note The Early Wakeup Interrupt (EWI) can be used if specific safety operations
- * or data logging must be performed before the actual reset is generated.
- * The EWI interrupt is enabled by calling HAL_WWDG_Init function with
- * EWIMode set to WWDG_EWI_ENABLE.
- * When the downcounter reaches the value 0x40, and EWI interrupt is
- * generated and the corresponding Interrupt Service Routine (ISR) can
- * be used to trigger specific actions (such as communications or data
- * logging), before resetting the device.
- * @param hwwdg pointer to a WWDG_HandleTypeDef structure that contains
- * the configuration information for the specified WWDG module.
- * @retval None
- */
-void HAL_WWDG_IRQHandler(WWDG_HandleTypeDef *hwwdg)
-{
- /* Check if Early Wakeup Interrupt is enable */
- if (__HAL_WWDG_GET_IT_SOURCE(hwwdg, WWDG_IT_EWI) != RESET)
- {
- /* Check if WWDG Early Wakeup Interrupt occurred */
- if (__HAL_WWDG_GET_FLAG(hwwdg, WWDG_FLAG_EWIF) != RESET)
- {
- /* Clear the WWDG Early Wakeup flag */
- __HAL_WWDG_CLEAR_FLAG(hwwdg, WWDG_FLAG_EWIF);
-
-#if (USE_HAL_WWDG_REGISTER_CALLBACKS == 1)
- /* Early Wakeup registered callback */
- hwwdg->EwiCallback(hwwdg);
-#else
- /* Early Wakeup callback */
- HAL_WWDG_EarlyWakeupCallback(hwwdg);
-#endif /* USE_HAL_WWDG_REGISTER_CALLBACKS */
- }
- }
-}
-
-
-/**
- * @brief WWDG Early Wakeup callback.
- * @param hwwdg pointer to a WWDG_HandleTypeDef structure that contains
- * the configuration information for the specified WWDG module.
- * @retval None
- */
-__weak void HAL_WWDG_EarlyWakeupCallback(WWDG_HandleTypeDef *hwwdg)
-{
- /* Prevent unused argument(s) compilation warning */
- UNUSED(hwwdg);
-
- /* NOTE: This function should not be modified, when the callback is needed,
- the HAL_WWDG_EarlyWakeupCallback could be implemented in the user file
- */
-}
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-#endif /* HAL_WWDG_MODULE_ENABLED */
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_adc.c b/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_adc.c
deleted file mode 100644
index 3b88320aaf..0000000000
--- a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_adc.c
+++ /dev/null
@@ -1,670 +0,0 @@
-/**
- ******************************************************************************
- * @file stm32l0xx_ll_adc.c
- * @author MCD Application Team
- * @brief ADC LL module driver
- ******************************************************************************
- * @attention
- *
- *
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- ******************************************************************************
- */
-/* Includes ------------------------------------------------------------------*/
-#include "stm32l0xx_ll_rcc.h"
-#include "stm32l0xx_ll_utils.h"
-#include "stm32l0xx_ll_system.h"
-#include "stm32l0xx_ll_pwr.h"
-#ifdef USE_FULL_ASSERT
-#include "stm32_assert.h"
-#else
-#define assert_param(expr) ((void)0U)
-#endif
-
-/** @addtogroup STM32L0xx_LL_Driver
- * @{
- */
-
-/** @addtogroup UTILS_LL
- * @{
- */
-
-/* Private types -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private constants ---------------------------------------------------------*/
-/** @addtogroup UTILS_LL_Private_Constants
- * @{
- */
-#define UTILS_MAX_FREQUENCY_SCALE1 (32000000U) /*!< Maximum frequency for system clock at power scale1, in Hz */
-#define UTILS_MAX_FREQUENCY_SCALE2 (16000000U) /*!< Maximum frequency for system clock at power scale2, in Hz */
-#define UTILS_MAX_FREQUENCY_SCALE3 (4194304U) /*!< Maximum frequency for system clock at power scale3, in Hz */
-
-/* Defines used for PLL range */
-#define UTILS_PLLVCO_OUTPUT_SCALE1 (96000000U) /*!< Frequency max for PLLVCO output at power scale1, in Hz */
-#define UTILS_PLLVCO_OUTPUT_SCALE2 (48000000U) /*!< Frequency max for PLLVCO output at power scale2, in Hz */
-#define UTILS_PLLVCO_OUTPUT_SCALE3 (24000000U) /*!< Frequency max for PLLVCO output at power scale3, in Hz */
-
-/* Defines used for HSE range */
-#define UTILS_HSE_FREQUENCY_MIN (1000000U) /*!< Frequency min for HSE frequency, in Hz */
-#define UTILS_HSE_FREQUENCY_MAX (24000000U) /*!< Frequency max for HSE frequency, in Hz */
-
-/* Defines used for FLASH latency according to HCLK Frequency */
-#define UTILS_SCALE1_LATENCY1_FREQ (16000000U) /*!< HCLK frequency to set FLASH latency 1 in power scale 1 */
-#define UTILS_SCALE2_LATENCY1_FREQ (8000000U) /*!< HCLK frequency to set FLASH latency 1 in power scale 2 */
-#define UTILS_SCALE3_LATENCY1_FREQ (2000000U) /*!< HCLK frequency to set FLASH latency 1 in power scale 3 */
-/**
- * @}
- */
-/* Private macros ------------------------------------------------------------*/
-/** @addtogroup UTILS_LL_Private_Macros
- * @{
- */
-#define IS_LL_UTILS_SYSCLK_DIV(__VALUE__) (((__VALUE__) == LL_RCC_SYSCLK_DIV_1) \
- || ((__VALUE__) == LL_RCC_SYSCLK_DIV_2) \
- || ((__VALUE__) == LL_RCC_SYSCLK_DIV_4) \
- || ((__VALUE__) == LL_RCC_SYSCLK_DIV_8) \
- || ((__VALUE__) == LL_RCC_SYSCLK_DIV_16) \
- || ((__VALUE__) == LL_RCC_SYSCLK_DIV_64) \
- || ((__VALUE__) == LL_RCC_SYSCLK_DIV_128) \
- || ((__VALUE__) == LL_RCC_SYSCLK_DIV_256) \
- || ((__VALUE__) == LL_RCC_SYSCLK_DIV_512))
-
-#define IS_LL_UTILS_APB1_DIV(__VALUE__) (((__VALUE__) == LL_RCC_APB1_DIV_1) \
- || ((__VALUE__) == LL_RCC_APB1_DIV_2) \
- || ((__VALUE__) == LL_RCC_APB1_DIV_4) \
- || ((__VALUE__) == LL_RCC_APB1_DIV_8) \
- || ((__VALUE__) == LL_RCC_APB1_DIV_16))
-
-#define IS_LL_UTILS_APB2_DIV(__VALUE__) (((__VALUE__) == LL_RCC_APB2_DIV_1) \
- || ((__VALUE__) == LL_RCC_APB2_DIV_2) \
- || ((__VALUE__) == LL_RCC_APB2_DIV_4) \
- || ((__VALUE__) == LL_RCC_APB2_DIV_8) \
- || ((__VALUE__) == LL_RCC_APB2_DIV_16))
-
-#define IS_LL_UTILS_PLLMUL_VALUE(__VALUE__) (((__VALUE__) == LL_RCC_PLL_MUL_3) \
- || ((__VALUE__) == LL_RCC_PLL_MUL_4) \
- || ((__VALUE__) == LL_RCC_PLL_MUL_6) \
- || ((__VALUE__) == LL_RCC_PLL_MUL_8) \
- || ((__VALUE__) == LL_RCC_PLL_MUL_12) \
- || ((__VALUE__) == LL_RCC_PLL_MUL_16) \
- || ((__VALUE__) == LL_RCC_PLL_MUL_24) \
- || ((__VALUE__) == LL_RCC_PLL_MUL_32) \
- || ((__VALUE__) == LL_RCC_PLL_MUL_48))
-
-#define IS_LL_UTILS_PLLDIV_VALUE(__VALUE__) (((__VALUE__) == LL_RCC_PLL_DIV_2) || ((__VALUE__) == LL_RCC_PLL_DIV_3) || \
- ((__VALUE__) == LL_RCC_PLL_DIV_4))
-
-#define IS_LL_UTILS_PLLVCO_OUTPUT(__VALUE__) ((LL_PWR_GetRegulVoltageScaling() == LL_PWR_REGU_VOLTAGE_SCALE1) ? ((__VALUE__) <= UTILS_PLLVCO_OUTPUT_SCALE1) : \
- ((LL_PWR_GetRegulVoltageScaling() == LL_PWR_REGU_VOLTAGE_SCALE2) ? ((__VALUE__) <= UTILS_PLLVCO_OUTPUT_SCALE2) : \
- ((__VALUE__) <= UTILS_PLLVCO_OUTPUT_SCALE3)))
-
-#define IS_LL_UTILS_PLL_FREQUENCY(__VALUE__) ((LL_PWR_GetRegulVoltageScaling() == LL_PWR_REGU_VOLTAGE_SCALE1) ? ((__VALUE__) <= UTILS_MAX_FREQUENCY_SCALE1) : \
- ((LL_PWR_GetRegulVoltageScaling() == LL_PWR_REGU_VOLTAGE_SCALE2) ? ((__VALUE__) <= UTILS_MAX_FREQUENCY_SCALE2) : \
- ((__VALUE__) <= UTILS_MAX_FREQUENCY_SCALE3)))
-
-#define IS_LL_UTILS_HSE_BYPASS(__STATE__) (((__STATE__) == LL_UTILS_HSEBYPASS_ON) \
- || ((__STATE__) == LL_UTILS_HSEBYPASS_OFF))
-
-#define IS_LL_UTILS_HSE_FREQUENCY(__FREQUENCY__) (((__FREQUENCY__) >= UTILS_HSE_FREQUENCY_MIN) && ((__FREQUENCY__) <= UTILS_HSE_FREQUENCY_MAX))
-/**
- * @}
- */
-/* Private function prototypes -----------------------------------------------*/
-/** @defgroup UTILS_LL_Private_Functions UTILS Private functions
- * @{
- */
-static uint32_t UTILS_GetPLLOutputFrequency(uint32_t PLL_InputFrequency,
- LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct);
-static ErrorStatus UTILS_EnablePLLAndSwitchSystem(uint32_t SYSCLK_Frequency, LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct);
-static ErrorStatus UTILS_PLL_IsBusy(void);
-/**
- * @}
- */
-
-/* Exported functions --------------------------------------------------------*/
-/** @addtogroup UTILS_LL_Exported_Functions
- * @{
- */
-
-/** @addtogroup UTILS_LL_EF_DELAY
- * @{
- */
-
-/**
- * @brief This function configures the Cortex-M SysTick source to have 1ms time base.
- * @note When a RTOS is used, it is recommended to avoid changing the Systick
- * configuration by calling this function, for a delay use rather osDelay RTOS service.
- * @param HCLKFrequency HCLK frequency in Hz
- * @note HCLK frequency can be calculated thanks to RCC helper macro or function @ref LL_RCC_GetSystemClocksFreq
- * @retval None
- */
-void LL_Init1msTick(uint32_t HCLKFrequency)
-{
- /* Use frequency provided in argument */
- LL_InitTick(HCLKFrequency, 1000U);
-}
-
-/**
- * @brief This function provides accurate delay (in milliseconds) based
- * on SysTick counter flag
- * @note When a RTOS is used, it is recommended to avoid using blocking delay
- * and use rather osDelay service.
- * @note To respect 1ms timebase, user should call @ref LL_Init1msTick function which
- * will configure Systick to 1ms
- * @param Delay specifies the delay time length, in milliseconds.
- * @retval None
- */
-void LL_mDelay(uint32_t Delay)
-{
- __IO uint32_t tmp = SysTick->CTRL; /* Clear the COUNTFLAG first */
- /* Add this code to indicate that local variable is not used */
- ((void)tmp);
-
- /* Add a period to guaranty minimum wait */
- if (Delay < LL_MAX_DELAY)
- {
- Delay++;
- }
-
- while (Delay)
- {
- if ((SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk) != 0U)
- {
- Delay--;
- }
- }
-}
-
-/**
- * @}
- */
-
-/** @addtogroup UTILS_EF_SYSTEM
- * @brief System Configuration functions
- *
- @verbatim
- ===============================================================================
- ##### System Configuration functions #####
- ===============================================================================
- [..]
- System, AHB and APB buses clocks configuration
-
- (+) The maximum frequency of the SYSCLK, HCLK, PCLK1 and PCLK2 is 32000000 Hz.
- @endverbatim
- @internal
- Depending on the device voltage range, the maximum frequency should be
- adapted accordingly:
- (++) +----------------------------------------------------------------+
- (++) | Wait states | HCLK clock frequency (MHz) |
- (++) | |------------------------------------------------|
- (++) | (Latency) | voltage range | voltage range |
- (++) | | 1.65 V - 3.6 V | 2.0 V - 3.6 V |
- (++) | |----------------|---------------|---------------|
- (++) | | VCORE = 1.2 V | VCORE = 1.5 V | VCORE = 1.8 V |
- (++) |-------------- |----------------|---------------|---------------|
- (++) |0WS(1CPU cycle)|0 < HCLK <= 2 |0 < HCLK <= 8 |0 < HCLK <= 16 |
- (++) |---------------|----------------|---------------|---------------|
- (++) |1WS(2CPU cycle)|2 < HCLK <= 4 |8 < HCLK <= 16 |16 < HCLK <= 32|
- (++) +----------------------------------------------------------------+
- @endinternal
- * @{
- */
-
-/**
- * @brief This function sets directly SystemCoreClock CMSIS variable.
- * @note Variable can be calculated also through SystemCoreClockUpdate function.
- * @param HCLKFrequency HCLK frequency in Hz (can be calculated thanks to RCC helper macro)
- * @retval None
- */
-void LL_SetSystemCoreClock(uint32_t HCLKFrequency)
-{
- /* HCLK clock frequency */
- SystemCoreClock = HCLKFrequency;
-}
-
-/**
- * @brief Update number of Flash wait states in line with new frequency and current
- voltage range.
- * @param Frequency HCLK frequency
- * @retval An ErrorStatus enumeration value:
- * - SUCCESS: Latency has been modified
- * - ERROR: Latency cannot be modified
- */
-ErrorStatus LL_SetFlashLatency(uint32_t Frequency)
-{
- uint32_t timeout;
- uint32_t getlatency;
- uint32_t latency;
- ErrorStatus status = SUCCESS;
-
- /* Frequency cannot be equal to 0 */
- if ((Frequency == 0U) || (Frequency > UTILS_MAX_FREQUENCY_SCALE1))
- {
- status = ERROR;
- }
- else
- {
- if (LL_PWR_GetRegulVoltageScaling() == LL_PWR_REGU_VOLTAGE_SCALE1)
- {
- if (Frequency > UTILS_SCALE1_LATENCY1_FREQ)
- {
- /* 16 < HCLK <= 32 => 1WS (2 CPU cycles) */
- latency = LL_FLASH_LATENCY_1;
- }
- else
- {
- /* else HCLK < 16MHz default LL_FLASH_LATENCY_0 0WS */
- latency = LL_FLASH_LATENCY_0;
- }
- }
- else if (LL_PWR_GetRegulVoltageScaling() == LL_PWR_REGU_VOLTAGE_SCALE2)
- {
- if (Frequency > UTILS_SCALE2_LATENCY1_FREQ)
- {
- /* 8 < HCLK <= 16 => 1WS (2 CPU cycles) */
- latency = LL_FLASH_LATENCY_1;
- }
- else
- {
- /* else HCLK < 8MHz default LL_FLASH_LATENCY_0 0WS */
- latency = LL_FLASH_LATENCY_0;
- }
- }
- else
- {
- if (Frequency > UTILS_SCALE3_LATENCY1_FREQ)
- {
- /* 2 < HCLK <= 4 => 1WS (2 CPU cycles) */
- latency = LL_FLASH_LATENCY_1;
- }
- else
- {
- /* else HCLK < 2MHz default LL_FLASH_LATENCY_0 0WS */
- latency = LL_FLASH_LATENCY_0;
- }
- }
-
- if (status != ERROR)
- {
- LL_FLASH_SetLatency(latency);
-
- /* Check that the new number of wait states is taken into account to access the Flash
- memory by reading the FLASH_ACR register */
- timeout = 2;
- do
- {
- /* Wait for Flash latency to be updated */
- getlatency = LL_FLASH_GetLatency();
- timeout--;
- } while ((getlatency != latency) && (timeout > 0));
-
- if(getlatency != latency)
- {
- status = ERROR;
- }
- else
- {
- status = SUCCESS;
- }
- }
- }
- return status;
-}
-
-/**
- * @brief This function configures system clock with HSI as clock source of the PLL
- * @note The application need to ensure that PLL is disabled.
- * @note Function is based on the following formula:
- * - PLL output frequency = ((HSI frequency * PLLMul) / PLLDiv)
- * - PLLMul: The application software must set correctly the PLL multiplication factor to ensure
- * - PLLVCO does not exceed 96 MHz when the product is in range 1,
- * - PLLVCO does not exceed 48 MHz when the product is in range 2,
- * - PLLVCO does not exceed 24 MHz when the product is in range 3
- * @note FLASH latency can be modified through this function.
- * @param UTILS_PLLInitStruct pointer to a @ref LL_UTILS_PLLInitTypeDef structure that contains
- * the configuration information for the PLL.
- * @param UTILS_ClkInitStruct pointer to a @ref LL_UTILS_ClkInitTypeDef structure that contains
- * the configuration information for the BUS prescalers.
- * @retval An ErrorStatus enumeration value:
- * - SUCCESS: Max frequency configuration done
- * - ERROR: Max frequency configuration not done
- */
-ErrorStatus LL_PLL_ConfigSystemClock_HSI(LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct,
- LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct)
-{
- ErrorStatus status = SUCCESS;
- uint32_t pllfreq = 0U;
-
- /* Check if one of the PLL is enabled */
- if (UTILS_PLL_IsBusy() == SUCCESS)
- {
- /* Calculate the new PLL output frequency */
- pllfreq = UTILS_GetPLLOutputFrequency(HSI_VALUE, UTILS_PLLInitStruct);
-
- /* Enable HSI if not enabled */
- if (LL_RCC_HSI_IsReady() != 1U)
- {
- LL_RCC_HSI_Enable();
- while (LL_RCC_HSI_IsReady() != 1U)
- {
- /* Wait for HSI ready */
- }
- }
-
- /* Configure PLL */
- LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSI, UTILS_PLLInitStruct->PLLMul, UTILS_PLLInitStruct->PLLDiv);
-
- /* Enable PLL and switch system clock to PLL */
- status = UTILS_EnablePLLAndSwitchSystem(pllfreq, UTILS_ClkInitStruct);
- }
- else
- {
- /* Current PLL configuration cannot be modified */
- status = ERROR;
- }
-
- return status;
-}
-
-/**
- * @brief This function configures system clock with HSE as clock source of the PLL
- * @note The application need to ensure that PLL is disabled.
- * @note Function is based on the following formula:
- * - PLL output frequency = ((HSE frequency * PLLMul) / PLLDiv)
- * - PLLMul: The application software must set correctly the PLL multiplication factor to to ensure
- * - PLLVCO does not exceed 96 MHz when the product is in range 1,
- * - PLLVCO does not exceed 48 MHz when the product is in range 2,
- * - PLLVCO does not exceed 24 MHz when the product is in range 3
- * @note FLASH latency can be modified through this function.
- * @param HSEFrequency Value between Min_Data = 1000000 and Max_Data = 24000000
- * @param HSEBypass This parameter can be one of the following values:
- * @arg @ref LL_UTILS_HSEBYPASS_ON
- * @arg @ref LL_UTILS_HSEBYPASS_OFF
- * @param UTILS_PLLInitStruct pointer to a @ref LL_UTILS_PLLInitTypeDef structure that contains
- * the configuration information for the PLL.
- * @param UTILS_ClkInitStruct pointer to a @ref LL_UTILS_ClkInitTypeDef structure that contains
- * the configuration information for the BUS prescalers.
- * @retval An ErrorStatus enumeration value:
- * - SUCCESS: Max frequency configuration done
- * - ERROR: Max frequency configuration not done
- */
-ErrorStatus LL_PLL_ConfigSystemClock_HSE(uint32_t HSEFrequency, uint32_t HSEBypass,
- LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct, LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct)
-{
- ErrorStatus status = SUCCESS;
- uint32_t pllfreq = 0U;
-
- /* Check the parameters */
- assert_param(IS_LL_UTILS_HSE_FREQUENCY(HSEFrequency));
- assert_param(IS_LL_UTILS_HSE_BYPASS(HSEBypass));
-
- /* Check if one of the PLL is enabled */
- if (UTILS_PLL_IsBusy() == SUCCESS)
- {
- /* Calculate the new PLL output frequency */
- pllfreq = UTILS_GetPLLOutputFrequency(HSEFrequency, UTILS_PLLInitStruct);
-
- /* Enable HSE if not enabled */
- if (LL_RCC_HSE_IsReady() != 1U)
- {
- /* Check if need to enable HSE bypass feature or not */
- if (HSEBypass == LL_UTILS_HSEBYPASS_ON)
- {
- LL_RCC_HSE_EnableBypass();
- }
- else
- {
- LL_RCC_HSE_DisableBypass();
- }
-
- /* Enable HSE */
- LL_RCC_HSE_Enable();
- while (LL_RCC_HSE_IsReady() != 1U)
- {
- /* Wait for HSE ready */
- }
- }
-
- /* Configure PLL */
- LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSE, UTILS_PLLInitStruct->PLLMul, UTILS_PLLInitStruct->PLLDiv);
-
- /* Enable PLL and switch system clock to PLL */
- status = UTILS_EnablePLLAndSwitchSystem(pllfreq, UTILS_ClkInitStruct);
- }
- else
- {
- /* Current PLL configuration cannot be modified */
- status = ERROR;
- }
-
- return status;
-}
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/** @addtogroup UTILS_LL_Private_Functions
- * @{
- */
-/**
- * @brief Function to check that PLL can be modified
- * @param PLL_InputFrequency PLL input frequency (in Hz)
- * @param UTILS_PLLInitStruct pointer to a @ref LL_UTILS_PLLInitTypeDef structure that contains
- * the configuration information for the PLL.
- * @retval PLL output frequency (in Hz)
- */
-static uint32_t UTILS_GetPLLOutputFrequency(uint32_t PLL_InputFrequency, LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct)
-{
- uint32_t pllfreq = 0U;
-
- /* Check the parameters */
- assert_param(IS_LL_UTILS_PLLMUL_VALUE(UTILS_PLLInitStruct->PLLMul));
- assert_param(IS_LL_UTILS_PLLDIV_VALUE(UTILS_PLLInitStruct->PLLDiv));
-
- /* Check different PLL parameters according to RM */
- /* The application software must set correctly the PLL multiplication factor to avoid exceeding
- 96 MHz as PLLVCO when the product is in range 1,
- 48 MHz as PLLVCO when the product is in range 2,
- 24 MHz when the product is in range 3. */
- pllfreq = PLL_InputFrequency * (PLLMulTable[UTILS_PLLInitStruct->PLLMul >> RCC_CFGR_PLLMUL_Pos]);
- assert_param(IS_LL_UTILS_PLLVCO_OUTPUT(pllfreq));
-
- /* The application software must set correctly the PLL multiplication factor to avoid exceeding
- maximum frequency 32000000 in range 1 */
- pllfreq = pllfreq / ((UTILS_PLLInitStruct->PLLDiv >> RCC_CFGR_PLLDIV_Pos)+1U);
- assert_param(IS_LL_UTILS_PLL_FREQUENCY(pllfreq));
-
- return pllfreq;
-}
-
-/**
- * @brief Function to check that PLL can be modified
- * @retval An ErrorStatus enumeration value:
- * - SUCCESS: PLL modification can be done
- * - ERROR: PLL is busy
- */
-static ErrorStatus UTILS_PLL_IsBusy(void)
-{
- ErrorStatus status = SUCCESS;
-
- /* Check if PLL is busy*/
- if (LL_RCC_PLL_IsReady() != 0U)
- {
- /* PLL configuration cannot be modified */
- status = ERROR;
- }
-
-
- return status;
-}
-
-/**
- * @brief Function to enable PLL and switch system clock to PLL
- * @param SYSCLK_Frequency SYSCLK frequency
- * @param UTILS_ClkInitStruct pointer to a @ref LL_UTILS_ClkInitTypeDef structure that contains
- * the configuration information for the BUS prescalers.
- * @retval An ErrorStatus enumeration value:
- * - SUCCESS: No problem to switch system to PLL
- * - ERROR: Problem to switch system to PLL
- */
-static ErrorStatus UTILS_EnablePLLAndSwitchSystem(uint32_t SYSCLK_Frequency, LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct)
-{
- ErrorStatus status = SUCCESS;
- uint32_t hclk_frequency = 0U;
-
- assert_param(IS_LL_UTILS_SYSCLK_DIV(UTILS_ClkInitStruct->AHBCLKDivider));
- assert_param(IS_LL_UTILS_APB1_DIV(UTILS_ClkInitStruct->APB1CLKDivider));
- assert_param(IS_LL_UTILS_APB2_DIV(UTILS_ClkInitStruct->APB2CLKDivider));
-
- /* Calculate HCLK frequency */
- hclk_frequency = __LL_RCC_CALC_HCLK_FREQ(SYSCLK_Frequency, UTILS_ClkInitStruct->AHBCLKDivider);
-
- /* Increasing the number of wait states because of higher CPU frequency */
- if (SystemCoreClock < hclk_frequency)
- {
- /* Set FLASH latency to highest latency */
- status = LL_SetFlashLatency(hclk_frequency);
- }
-
- /* Update system clock configuration */
- if (status == SUCCESS)
- {
- /* Enable PLL */
- LL_RCC_PLL_Enable();
- while (LL_RCC_PLL_IsReady() != 1U)
- {
- /* Wait for PLL ready */
- }
-
- /* Sysclk activation on the main PLL */
- LL_RCC_SetAHBPrescaler(UTILS_ClkInitStruct->AHBCLKDivider);
- LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL);
- while (LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL)
- {
- /* Wait for system clock switch to PLL */
- }
-
- /* Set APB1 & APB2 prescaler*/
- LL_RCC_SetAPB1Prescaler(UTILS_ClkInitStruct->APB1CLKDivider);
- LL_RCC_SetAPB2Prescaler(UTILS_ClkInitStruct->APB2CLKDivider);
- }
-
- /* Decreasing the number of wait states because of lower CPU frequency */
- if (SystemCoreClock > hclk_frequency)
- {
- /* Set FLASH latency to lowest latency */
- status = LL_SetFlashLatency(hclk_frequency);
- }
-
- /* Update SystemCoreClock variable */
- if (status == SUCCESS)
- {
- LL_SetSystemCoreClock(hclk_frequency);
- }
-
- return status;
-}
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/bsp/stm32/stm32l010-st-nucleo/.config b/bsp/stm32/stm32l010-st-nucleo/.config
index 6ae2864ad1..7b8228b3a5 100644
--- a/bsp/stm32/stm32l010-st-nucleo/.config
+++ b/bsp/stm32/stm32l010-st-nucleo/.config
@@ -1,17 +1,119 @@
-#
-# Automatically generated file; DO NOT EDIT.
-# RT-Thread Configuration
-#
CONFIG_SOC_STM32L010RB=y
CONFIG_BOARD_STM32L010_NUCLEO=y
#
# RT-Thread Kernel
#
+
+#
+# klibc options
+#
+
+#
+# rt_vsnprintf options
+#
+# CONFIG_RT_KLIBC_USING_LIBC_VSNPRINTF is not set
+# CONFIG_RT_KLIBC_USING_VSNPRINTF_LONGLONG is not set
+# CONFIG_RT_KLIBC_USING_VSNPRINTF_STANDARD is not set
+# end of rt_vsnprintf options
+
+#
+# rt_vsscanf options
+#
+# CONFIG_RT_KLIBC_USING_LIBC_VSSCANF is not set
+# end of rt_vsscanf options
+
+#
+# rt_memset options
+#
+# CONFIG_RT_KLIBC_USING_USER_MEMSET is not set
+# CONFIG_RT_KLIBC_USING_LIBC_MEMSET is not set
+# CONFIG_RT_KLIBC_USING_TINY_MEMSET is not set
+# end of rt_memset options
+
+#
+# rt_memcpy options
+#
+# CONFIG_RT_KLIBC_USING_USER_MEMCPY is not set
+# CONFIG_RT_KLIBC_USING_LIBC_MEMCPY is not set
+# CONFIG_RT_KLIBC_USING_TINY_MEMCPY is not set
+# end of rt_memcpy options
+
+#
+# rt_memmove options
+#
+# CONFIG_RT_KLIBC_USING_USER_MEMMOVE is not set
+# CONFIG_RT_KLIBC_USING_LIBC_MEMMOVE is not set
+# end of rt_memmove options
+
+#
+# rt_memcmp options
+#
+# CONFIG_RT_KLIBC_USING_USER_MEMCMP is not set
+# CONFIG_RT_KLIBC_USING_LIBC_MEMCMP is not set
+# end of rt_memcmp options
+
+#
+# rt_strstr options
+#
+# CONFIG_RT_KLIBC_USING_USER_STRSTR is not set
+# CONFIG_RT_KLIBC_USING_LIBC_STRSTR is not set
+# end of rt_strstr options
+
+#
+# rt_strcasecmp options
+#
+# CONFIG_RT_KLIBC_USING_USER_STRCASECMP is not set
+# end of rt_strcasecmp options
+
+#
+# rt_strncpy options
+#
+# CONFIG_RT_KLIBC_USING_USER_STRNCPY is not set
+# CONFIG_RT_KLIBC_USING_LIBC_STRNCPY is not set
+# end of rt_strncpy options
+
+#
+# rt_strcpy options
+#
+# CONFIG_RT_KLIBC_USING_USER_STRCPY is not set
+# CONFIG_RT_KLIBC_USING_LIBC_STRCPY is not set
+# end of rt_strcpy options
+
+#
+# rt_strncmp options
+#
+# CONFIG_RT_KLIBC_USING_USER_STRNCMP is not set
+# CONFIG_RT_KLIBC_USING_LIBC_STRNCMP is not set
+# end of rt_strncmp options
+
+#
+# rt_strcmp options
+#
+# CONFIG_RT_KLIBC_USING_USER_STRCMP is not set
+# CONFIG_RT_KLIBC_USING_LIBC_STRCMP is not set
+# end of rt_strcmp options
+
+#
+# rt_strlen options
+#
+# CONFIG_RT_KLIBC_USING_USER_STRLEN is not set
+# CONFIG_RT_KLIBC_USING_LIBC_STRLEN is not set
+# end of rt_strlen options
+
+#
+# rt_strnlen options
+#
+# CONFIG_RT_KLIBC_USING_USER_STRNLEN is not set
+# end of rt_strnlen options
+
+# CONFIG_RT_UTEST_TC_USING_KLIBC is not set
+# end of klibc options
+
CONFIG_RT_NAME_MAX=8
# CONFIG_RT_USING_ARCH_DATA_TYPE is not set
-# CONFIG_RT_USING_SMART is not set
# CONFIG_RT_USING_NANO is not set
+# CONFIG_RT_USING_SMART is not set
# CONFIG_RT_USING_AMP is not set
# CONFIG_RT_USING_SMP is not set
CONFIG_RT_CPUS_NR=1
@@ -29,18 +131,20 @@ CONFIG_RT_USING_IDLE_HOOK=y
CONFIG_RT_IDLE_HOOK_LIST_SIZE=4
CONFIG_IDLE_THREAD_STACK_SIZE=256
# CONFIG_RT_USING_TIMER_SOFT is not set
+# CONFIG_RT_USING_CPU_USAGE_TRACER is not set
#
-# kservice optimization
+# kservice options
#
-# CONFIG_RT_KSERVICE_USING_STDLIB is not set
-# CONFIG_RT_KSERVICE_USING_TINY_SIZE is not set
# CONFIG_RT_USING_TINY_FFS is not set
-# CONFIG_RT_KPRINTF_USING_LONGLONG is not set
+# end of kservice options
+
CONFIG_RT_USING_DEBUG=y
+CONFIG_RT_DEBUGING_ASSERT=y
CONFIG_RT_DEBUGING_COLOR=y
CONFIG_RT_DEBUGING_CONTEXT=y
# CONFIG_RT_DEBUGING_AUTO_INIT is not set
+# CONFIG_RT_USING_CI_ACTION is not set
#
# Inter-Thread communication
@@ -52,6 +156,7 @@ CONFIG_RT_USING_MAILBOX=y
CONFIG_RT_USING_MESSAGEQUEUE=y
# CONFIG_RT_USING_MESSAGEQUEUE_PRIORITY is not set
# CONFIG_RT_USING_SIGNALS is not set
+# end of Inter-Thread communication
#
# Memory Management
@@ -68,22 +173,20 @@ CONFIG_RT_USING_SMALL_MEM_AS_HEAP=y
# CONFIG_RT_USING_MEMTRACE is not set
# CONFIG_RT_USING_HEAP_ISR is not set
CONFIG_RT_USING_HEAP=y
+# end of Memory Management
+
CONFIG_RT_USING_DEVICE=y
# CONFIG_RT_USING_DEVICE_OPS is not set
# CONFIG_RT_USING_INTERRUPT_INFO is not set
# CONFIG_RT_USING_THREADSAFE_PRINTF is not set
-# CONFIG_RT_USING_SCHED_THREAD_CTX is not set
CONFIG_RT_USING_CONSOLE=y
CONFIG_RT_CONSOLEBUF_SIZE=256
CONFIG_RT_CONSOLE_DEVICE_NAME="uart2"
-CONFIG_RT_VER_NUM=0x50100
+CONFIG_RT_VER_NUM=0x50201
# CONFIG_RT_USING_STDC_ATOMIC is not set
CONFIG_RT_BACKTRACE_LEVEL_MAX_NR=32
-# CONFIG_RT_USING_CACHE is not set
-# CONFIG_RT_USING_HW_ATOMIC is not set
-# CONFIG_ARCH_ARM_BOOTWITH_FLUSH_CACHE is not set
-# CONFIG_ARCH_CPU_STACK_GROWS_UPWARD is not set
-# CONFIG_RT_USING_CPU_FFS is not set
+# end of RT-Thread Kernel
+
CONFIG_ARCH_ARM=y
CONFIG_ARCH_ARM_CORTEX_M=y
CONFIG_ARCH_ARM_CORTEX_M0=y
@@ -117,12 +220,15 @@ CONFIG_FINSH_USING_OPTION_COMPLETION=y
# DFS: device virtual file system
#
# CONFIG_RT_USING_DFS is not set
+# end of DFS: device virtual file system
+
# CONFIG_RT_USING_FAL is not set
#
# Device Drivers
#
# CONFIG_RT_USING_DM is not set
+# CONFIG_RT_USING_DEV_BUS is not set
CONFIG_RT_USING_DEVICE_IPC=y
CONFIG_RT_UNAMED_PIPE_NUMBER=64
# CONFIG_RT_USING_SYSTEM_WORKQUEUE is not set
@@ -131,16 +237,20 @@ CONFIG_RT_USING_SERIAL_V1=y
# CONFIG_RT_USING_SERIAL_V2 is not set
CONFIG_RT_SERIAL_USING_DMA=y
CONFIG_RT_SERIAL_RB_BUFSZ=64
+# CONFIG_RT_USING_SERIAL_BYPASS is not set
# CONFIG_RT_USING_CAN is not set
# CONFIG_RT_USING_CPUTIME is not set
# CONFIG_RT_USING_I2C is not set
# CONFIG_RT_USING_PHY is not set
+# CONFIG_RT_USING_PHY_V2 is not set
# CONFIG_RT_USING_ADC is not set
# CONFIG_RT_USING_DAC is not set
# CONFIG_RT_USING_NULL is not set
# CONFIG_RT_USING_ZERO is not set
# CONFIG_RT_USING_RANDOM is not set
# CONFIG_RT_USING_PWM is not set
+# CONFIG_RT_USING_PULSE_ENCODER is not set
+# CONFIG_RT_USING_INPUT_CAPTURE is not set
# CONFIG_RT_USING_MTD_NOR is not set
# CONFIG_RT_USING_MTD_NAND is not set
# CONFIG_RT_USING_PM is not set
@@ -153,21 +263,14 @@ CONFIG_RT_SERIAL_RB_BUFSZ=64
# CONFIG_RT_USING_TOUCH is not set
# CONFIG_RT_USING_LCD is not set
# CONFIG_RT_USING_HWCRYPTO is not set
-# CONFIG_RT_USING_PULSE_ENCODER is not set
-# CONFIG_RT_USING_INPUT_CAPTURE is not set
-# CONFIG_RT_USING_DEV_BUS is not set
# CONFIG_RT_USING_WIFI is not set
+# CONFIG_RT_USING_BLK is not set
# CONFIG_RT_USING_VIRTIO is not set
CONFIG_RT_USING_PIN=y
# CONFIG_RT_USING_KTIME is not set
# CONFIG_RT_USING_HWTIMER is not set
-
-#
-# Using USB
-#
-# CONFIG_RT_USING_USB is not set
-# CONFIG_RT_USING_USB_HOST is not set
-# CONFIG_RT_USING_USB_DEVICE is not set
+# CONFIG_RT_USING_CHERRYUSB is not set
+# end of Device Drivers
#
# C/C++ and POSIX layer
@@ -185,6 +288,8 @@ CONFIG_RT_LIBC_USING_LIGHT_TZ_DST=y
CONFIG_RT_LIBC_TZ_DEFAULT_HOUR=8
CONFIG_RT_LIBC_TZ_DEFAULT_MIN=0
CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
+# end of Timezone and Daylight Saving Time
+# end of ISO-ANSI C layer
#
# POSIX (Portable Operating System Interface) layer
@@ -206,7 +311,11 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
#
# Socket is in the 'Network' category
#
+# end of Interprocess Communication (IPC)
+# end of POSIX (Portable Operating System Interface) layer
+
# CONFIG_RT_USING_CPLUSPLUS is not set
+# end of C/C++ and POSIX layer
#
# Network
@@ -215,12 +324,14 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_RT_USING_NETDEV is not set
# CONFIG_RT_USING_LWIP is not set
# CONFIG_RT_USING_AT is not set
+# end of Network
#
# Memory protection
#
# CONFIG_RT_USING_MEM_PROTECTION is not set
# CONFIG_RT_USING_HW_STACK_GUARD is not set
+# end of Memory protection
#
# Utilities
@@ -232,12 +343,25 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_RT_USING_RESOURCE_ID is not set
# CONFIG_RT_USING_ADT is not set
# CONFIG_RT_USING_RT_LINK is not set
+# end of Utilities
+
# CONFIG_RT_USING_VBUS is not set
+#
+# Using USB legacy version
+#
+# CONFIG_RT_USING_USB_HOST is not set
+# CONFIG_RT_USING_USB_DEVICE is not set
+# end of Using USB legacy version
+
+# CONFIG_RT_USING_FDT is not set
+# end of RT-Thread Components
+
#
# RT-Thread Utestcases
#
# CONFIG_RT_USING_UTESTCASES is not set
+# end of RT-Thread Utestcases
#
# RT-Thread online packages
@@ -246,7 +370,6 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
#
# IoT - internet of things
#
-# CONFIG_PKG_USING_LWIP is not set
# CONFIG_PKG_USING_LORAWAN_DRIVER is not set
# CONFIG_PKG_USING_PAHOMQTT is not set
# CONFIG_PKG_USING_UMQTT is not set
@@ -259,6 +382,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_WEBTERMINAL is not set
# CONFIG_PKG_USING_FREEMODBUS is not set
# CONFIG_PKG_USING_NANOPB is not set
+# CONFIG_PKG_USING_WIFI_HOST_DRIVER is not set
#
# Wi-Fi
@@ -268,27 +392,35 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# Marvell WiFi
#
# CONFIG_PKG_USING_WLANMARVELL is not set
+# end of Marvell WiFi
#
# Wiced WiFi
#
# CONFIG_PKG_USING_WLAN_WICED is not set
+# end of Wiced WiFi
+
# CONFIG_PKG_USING_RW007 is not set
#
# CYW43012 WiFi
#
# CONFIG_PKG_USING_WLAN_CYW43012 is not set
+# end of CYW43012 WiFi
#
# BL808 WiFi
#
# CONFIG_PKG_USING_WLAN_BL808 is not set
+# end of BL808 WiFi
#
# CYW43439 WiFi
#
# CONFIG_PKG_USING_WLAN_CYW43439 is not set
+# end of CYW43439 WiFi
+# end of Wi-Fi
+
# CONFIG_PKG_USING_COAP is not set
# CONFIG_PKG_USING_NOPOLL is not set
# CONFIG_PKG_USING_NETUTILS is not set
@@ -311,6 +443,8 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_UCLOUD_IOT_SDK is not set
# CONFIG_PKG_USING_JOYLINK is not set
# CONFIG_PKG_USING_IOTSHARP_SDK is not set
+# end of IoT Cloud
+
# CONFIG_PKG_USING_NIMBLE is not set
# CONFIG_PKG_USING_LLSYNC_SDK_ADAPTER is not set
# CONFIG_PKG_USING_OTA_DOWNLOADER is not set
@@ -353,6 +487,10 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_ZEPHYR_POLLING is not set
# CONFIG_PKG_USING_MATTER_ADAPTATION_LAYER is not set
# CONFIG_PKG_USING_LHC_MODBUS is not set
+# CONFIG_PKG_USING_QMODBUS is not set
+# CONFIG_PKG_USING_PNET is not set
+# CONFIG_PKG_USING_OPENER is not set
+# end of IoT - internet of things
#
# security packages
@@ -363,6 +501,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_TINYCRYPT is not set
# CONFIG_PKG_USING_TFM is not set
# CONFIG_PKG_USING_YD_CRYPTO is not set
+# end of security packages
#
# language packages
@@ -378,18 +517,23 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_JSMN is not set
# CONFIG_PKG_USING_AGILE_JSMN is not set
# CONFIG_PKG_USING_PARSON is not set
+# CONFIG_PKG_USING_RYAN_JSON is not set
+# end of JSON: JavaScript Object Notation, a lightweight data-interchange format
#
# XML: Extensible Markup Language
#
# CONFIG_PKG_USING_SIMPLE_XML is not set
# CONFIG_PKG_USING_EZXML is not set
+# end of XML: Extensible Markup Language
+
# CONFIG_PKG_USING_LUATOS_SOC is not set
# CONFIG_PKG_USING_LUA is not set
# CONFIG_PKG_USING_JERRYSCRIPT is not set
# CONFIG_PKG_USING_MICROPYTHON is not set
# CONFIG_PKG_USING_PIKASCRIPT is not set
# CONFIG_PKG_USING_RTT_RUST is not set
+# end of language packages
#
# multimedia packages
@@ -401,12 +545,15 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_LVGL is not set
# CONFIG_PKG_USING_LV_MUSIC_DEMO is not set
# CONFIG_PKG_USING_GUI_GUIDER_DEMO is not set
+# end of LVGL: powerful and easy-to-use embedded GUI library
#
# u8g2: a monochrome graphic library
#
# CONFIG_PKG_USING_U8G2_OFFICIAL is not set
# CONFIG_PKG_USING_U8G2 is not set
+# end of u8g2: a monochrome graphic library
+
# CONFIG_PKG_USING_OPENMV is not set
# CONFIG_PKG_USING_MUPDF is not set
# CONFIG_PKG_USING_STEMWIN is not set
@@ -426,6 +573,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_QRCODE is not set
# CONFIG_PKG_USING_GUIENGINE is not set
# CONFIG_PKG_USING_3GPP_AMRNB is not set
+# end of multimedia packages
#
# tools packages
@@ -475,6 +623,9 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_VOFA_PLUS is not set
# CONFIG_PKG_USING_RT_TRACE is not set
# CONFIG_PKG_USING_ZDEBUG is not set
+# CONFIG_PKG_USING_RVBACKTRACE is not set
+# CONFIG_PKG_USING_HPATCHLITE is not set
+# end of tools packages
#
# system packages
@@ -485,7 +636,9 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
#
# CONFIG_PKG_USING_RT_MEMCPY_CM is not set
# CONFIG_PKG_USING_RT_KPRINTF_THREADSAFE is not set
-# CONFIG_PKG_USING_RT_VSNPRINTF_FULL is not set
+# end of enhanced kernel services
+
+# CONFIG_PKG_USING_AUNITY is not set
#
# acceleration: Assembly language or algorithmic acceleration packages
@@ -493,16 +646,20 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_QFPLIB_M0_FULL is not set
# CONFIG_PKG_USING_QFPLIB_M0_TINY is not set
# CONFIG_PKG_USING_QFPLIB_M3 is not set
+# end of acceleration: Assembly language or algorithmic acceleration packages
#
# CMSIS: ARM Cortex-M Microcontroller Software Interface Standard
#
# CONFIG_PKG_USING_CMSIS_5 is not set
-# CONFIG_PKG_USING_CMSIS_CORE is not set
-# CONFIG_PKG_USING_CMSIS_DSP is not set
+CONFIG_PKG_USING_CMSIS_CORE=y
+CONFIG_PKG_CMSIS_CORE_PATH="/packages/system/CMSIS/CMSIS-Core"
+CONFIG_PKG_USING_CMSIS_CORE_LATEST_VERSION=y
+CONFIG_PKG_CMSIS_CORE_VER="latest"
# CONFIG_PKG_USING_CMSIS_NN is not set
# CONFIG_PKG_USING_CMSIS_RTOS1 is not set
# CONFIG_PKG_USING_CMSIS_RTOS2 is not set
+# end of CMSIS: ARM Cortex-M Microcontroller Software Interface Standard
#
# Micrium: Micrium software products porting for RT-Thread
@@ -513,6 +670,8 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_UC_CLK is not set
# CONFIG_PKG_USING_UC_COMMON is not set
# CONFIG_PKG_USING_UC_MODBUS is not set
+# end of Micrium: Micrium software products porting for RT-Thread
+
# CONFIG_PKG_USING_FREERTOS_WRAPPER is not set
# CONFIG_PKG_USING_LITEOS_SDK is not set
# CONFIG_PKG_USING_TZ_DATABASE is not set
@@ -548,7 +707,6 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_ARM_2D is not set
# CONFIG_PKG_USING_MCUBOOT is not set
# CONFIG_PKG_USING_TINYUSB is not set
-# CONFIG_PKG_USING_CHERRYUSB is not set
# CONFIG_PKG_USING_KMULTI_RTIMER is not set
# CONFIG_PKG_USING_TFDB is not set
# CONFIG_PKG_USING_QPC is not set
@@ -556,10 +714,14 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_FLASH_BLOB is not set
# CONFIG_PKG_USING_MLIBC is not set
# CONFIG_PKG_USING_TASK_MSG_BUS is not set
+# CONFIG_PKG_USING_UART_FRAMEWORK is not set
# CONFIG_PKG_USING_SFDB is not set
# CONFIG_PKG_USING_RTP is not set
# CONFIG_PKG_USING_REB is not set
+# CONFIG_PKG_USING_RMP is not set
# CONFIG_PKG_USING_R_RHEALSTONE is not set
+# CONFIG_PKG_USING_HEARTBEAT is not set
+# end of system packages
#
# peripheral libraries and drivers
@@ -572,9 +734,63 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
#
# STM32 HAL & SDK Drivers
#
-# CONFIG_PKG_USING_STM32L4XX_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32F0_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32F0_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_STM32F1_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32F1_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_STM32F2_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32F2_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_STM32F3_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32F3_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_STM32F4_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32F4_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_STM32F7_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32F7_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_STM32G0_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32G0_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_STM32G4_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32G4_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_STM32H5_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32H5_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_STM32H7_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32H7_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_STM32H7RS_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32H7RS_CMSIS_DRIVER is not set
+CONFIG_PKG_USING_STM32L0_HAL_DRIVER=y
+CONFIG_PKG_STM32L0_HAL_DRIVER_PATH="/packages/peripherals/hal-sdk/stm32/stm32l0_hal_driver"
+CONFIG_PKG_USING_STM32L0_HAL_DRIVER_LATEST_VERSION=y
+CONFIG_PKG_STM32L0_HAL_DRIVER_VER="latest"
+CONFIG_PKG_USING_STM32L0_CMSIS_DRIVER=y
+CONFIG_PKG_STM32L0_CMSIS_DRIVER_PATH="/packages/peripherals/hal-sdk/stm32/stm32l0_cmsis_driver"
+CONFIG_PKG_USING_STM32L0_CMSIS_DRIVER_LATEST_VERSION=y
+CONFIG_PKG_STM32L0_CMSIS_DRIVER_VER="latest"
+# CONFIG_PKG_USING_STM32L4_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32L4_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_STM32L5_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32L5_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_STM32U5_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32U5_CMSIS_DRIVER is not set
# CONFIG_PKG_USING_STM32WB55_SDK is not set
# CONFIG_PKG_USING_STM32_SDIO is not set
+# CONFIG_PKG_USING_STM32WL_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32WL_CMSIS_DRIVER is not set
+# end of STM32 HAL & SDK Drivers
+
+#
+# Infineon HAL Packages
+#
+# CONFIG_PKG_USING_INFINEON_CAT1CM0P is not set
+# CONFIG_PKG_USING_INFINEON_CMSIS is not set
+# CONFIG_PKG_USING_INFINEON_CORE_LIB is not set
+# CONFIG_PKG_USING_INFINEON_MTB_HAL_CAT1 is not set
+# CONFIG_PKG_USING_INFINEON_MTB_PDL_CAT1 is not set
+# CONFIG_PKG_USING_INFINEON_RETARGET_IO is not set
+# CONFIG_PKG_USING_INFINEON_CAPSENSE is not set
+# CONFIG_PKG_USING_INFINEON_CSDIDAC is not set
+# CONFIG_PKG_USING_INFINEON_SERIAL_FLASH is not set
+# CONFIG_PKG_USING_INFINEON_USBDEV is not set
+# end of Infineon HAL Packages
+
# CONFIG_PKG_USING_BLUETRUM_SDK is not set
# CONFIG_PKG_USING_EMBARC_BSP is not set
# CONFIG_PKG_USING_ESP_IDF is not set
@@ -584,9 +800,49 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
#
# CONFIG_PKG_USING_K210_SDK is not set
# CONFIG_PKG_USING_KENDRYTE_SDK is not set
+# end of Kendryte SDK
+
# CONFIG_PKG_USING_NRF5X_SDK is not set
# CONFIG_PKG_USING_NRFX is not set
# CONFIG_PKG_USING_RASPBERRYPI_PICO_SDK is not set
+# CONFIG_PKG_USING_MM32 is not set
+
+#
+# WCH HAL & SDK Drivers
+#
+# CONFIG_PKG_USING_CH32V20x_SDK is not set
+# CONFIG_PKG_USING_CH32V307_SDK is not set
+# end of WCH HAL & SDK Drivers
+
+#
+# AT32 HAL & SDK Drivers
+#
+# CONFIG_PKG_USING_AT32A403A_HAL_DRIVER is not set
+# CONFIG_PKG_USING_AT32A403A_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_AT32A423_HAL_DRIVER is not set
+# CONFIG_PKG_USING_AT32A423_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_AT32F45x_HAL_DRIVER is not set
+# CONFIG_PKG_USING_AT32F45x_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_AT32F402_405_HAL_DRIVER is not set
+# CONFIG_PKG_USING_AT32F402_405_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_AT32F403A_407_HAL_DRIVER is not set
+# CONFIG_PKG_USING_AT32F403A_407_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_AT32F413_HAL_DRIVER is not set
+# CONFIG_PKG_USING_AT32F413_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_AT32F415_HAL_DRIVER is not set
+# CONFIG_PKG_USING_AT32F415_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_AT32F421_HAL_DRIVER is not set
+# CONFIG_PKG_USING_AT32F421_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_AT32F423_HAL_DRIVER is not set
+# CONFIG_PKG_USING_AT32F423_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_AT32F425_HAL_DRIVER is not set
+# CONFIG_PKG_USING_AT32F425_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_AT32F435_437_HAL_DRIVER is not set
+# CONFIG_PKG_USING_AT32F435_437_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_AT32M412_416_HAL_DRIVER is not set
+# CONFIG_PKG_USING_AT32M412_416_CMSIS_DRIVER is not set
+# end of AT32 HAL & SDK Drivers
+# end of HAL & SDK Drivers
#
# sensors drivers
@@ -623,14 +879,17 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_BMI088 is not set
# CONFIG_PKG_USING_HMC5883 is not set
# CONFIG_PKG_USING_MAX6675 is not set
+# CONFIG_PKG_USING_MAX31855 is not set
# CONFIG_PKG_USING_TMP1075 is not set
# CONFIG_PKG_USING_SR04 is not set
# CONFIG_PKG_USING_CCS811 is not set
# CONFIG_PKG_USING_PMSXX is not set
# CONFIG_PKG_USING_RT3020 is not set
# CONFIG_PKG_USING_MLX90632 is not set
+# CONFIG_PKG_USING_MLX90382 is not set
# CONFIG_PKG_USING_MLX90393 is not set
# CONFIG_PKG_USING_MLX90392 is not set
+# CONFIG_PKG_USING_MLX90394 is not set
# CONFIG_PKG_USING_MLX90397 is not set
# CONFIG_PKG_USING_MS5611 is not set
# CONFIG_PKG_USING_MAX31865 is not set
@@ -656,6 +915,8 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_ICM20608 is not set
# CONFIG_PKG_USING_PAJ7620 is not set
# CONFIG_PKG_USING_STHS34PF80 is not set
+# CONFIG_PKG_USING_P3T1755 is not set
+# end of sensors drivers
#
# touch drivers
@@ -670,6 +931,8 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_XPT2046_TOUCH is not set
# CONFIG_PKG_USING_CST816X is not set
# CONFIG_PKG_USING_CST812T is not set
+# end of touch drivers
+
# CONFIG_PKG_USING_REALTEK_AMEBA is not set
# CONFIG_PKG_USING_BUTTON is not set
# CONFIG_PKG_USING_PCF8574 is not set
@@ -741,7 +1004,12 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_SYSTEM_RUN_LED is not set
# CONFIG_PKG_USING_BT_MX01 is not set
# CONFIG_PKG_USING_RGPOWER is not set
+# CONFIG_PKG_USING_BT_MX02 is not set
+# CONFIG_PKG_USING_GC9A01 is not set
+# CONFIG_PKG_USING_IK485 is not set
+# CONFIG_PKG_USING_SERVO is not set
# CONFIG_PKG_USING_SPI_TOOLS is not set
+# end of peripheral libraries and drivers
#
# AI packages
@@ -756,15 +1024,20 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_QUEST is not set
# CONFIG_PKG_USING_NAXOS is not set
# CONFIG_PKG_USING_R_TINYMAIX is not set
+# CONFIG_PKG_USING_LLMCHAT is not set
+# end of AI packages
#
# Signal Processing and Control Algorithm Packages
#
+# CONFIG_PKG_USING_APID is not set
# CONFIG_PKG_USING_FIRE_PID_CURVE is not set
# CONFIG_PKG_USING_QPID is not set
# CONFIG_PKG_USING_UKAL is not set
# CONFIG_PKG_USING_DIGITALCTRL is not set
# CONFIG_PKG_USING_KISSFFT is not set
+# CONFIG_PKG_USING_CMSIS_DSP is not set
+# end of Signal Processing and Control Algorithm Packages
#
# miscellaneous packages
@@ -773,6 +1046,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
#
# project laboratory
#
+# end of project laboratory
#
# samples: kernel and components samples
@@ -781,6 +1055,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_FILESYSTEM_SAMPLES is not set
# CONFIG_PKG_USING_NETWORK_SAMPLES is not set
# CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set
+# end of samples: kernel and components samples
#
# entertainment: terminal games and other interesting software packages
@@ -797,6 +1072,8 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_COWSAY is not set
# CONFIG_PKG_USING_MORSE is not set
# CONFIG_PKG_USING_TINYSQUARE is not set
+# end of entertainment: terminal games and other interesting software packages
+
# CONFIG_PKG_USING_LIBCSV is not set
# CONFIG_PKG_USING_OPTPARSE is not set
# CONFIG_PKG_USING_FASTLZ is not set
@@ -820,6 +1097,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_KI is not set
# CONFIG_PKG_USING_ARMv7M_DWT is not set
# CONFIG_PKG_USING_CRCLIB is not set
+# CONFIG_PKG_USING_LIBCRC is not set
# CONFIG_PKG_USING_LWGPS is not set
# CONFIG_PKG_USING_STATE_MACHINE is not set
# CONFIG_PKG_USING_DESIGN_PATTERN is not set
@@ -831,6 +1109,8 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_QPARAM is not set
# CONFIG_PKG_USING_CorevMCU_CLI is not set
# CONFIG_PKG_USING_GET_IRQ_PRIORITY is not set
+# CONFIG_PKG_USING_DRMP is not set
+# end of miscellaneous packages
#
# Arduino libraries
@@ -843,9 +1123,11 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_ARDUINO_MSGQ_C_CPP_DEMO is not set
# CONFIG_PKG_USING_ARDUINO_SKETCH_LOADER_DEMO is not set
# CONFIG_PKG_USING_ARDUINO_ULTRASOUND_RADAR is not set
+# CONFIG_PKG_USING_ARDUINO_RTDUINO_SENSORFUSION_SHIELD is not set
# CONFIG_PKG_USING_ARDUINO_NINEINONE_SENSOR_SHIELD is not set
# CONFIG_PKG_USING_ARDUINO_SENSOR_KIT is not set
# CONFIG_PKG_USING_ARDUINO_MATLAB_SUPPORT is not set
+# end of Projects and Demos
#
# Sensors
@@ -985,6 +1267,8 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_ARDUINO_SEEED_LTC2941 is not set
# CONFIG_PKG_USING_ARDUINO_SEEED_LDC1612 is not set
# CONFIG_PKG_USING_ARDUINO_CAPACITIVESENSOR is not set
+# CONFIG_PKG_USING_ARDUINO_JARZEBSKI_MPU6050 is not set
+# end of Sensors
#
# Display
@@ -996,6 +1280,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_SSD1306 is not set
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_ILI9341 is not set
# CONFIG_PKG_USING_SEEED_TM1637 is not set
+# end of Display
#
# Timing
@@ -1004,6 +1289,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_ARDUINO_MSTIMER2 is not set
# CONFIG_PKG_USING_ARDUINO_TICKER is not set
# CONFIG_PKG_USING_ARDUINO_TASKSCHEDULER is not set
+# end of Timing
#
# Data Processing
@@ -1011,6 +1297,8 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_ARDUINO_KALMANFILTER is not set
# CONFIG_PKG_USING_ARDUINO_ARDUINOJSON is not set
# CONFIG_PKG_USING_ARDUINO_TENSORFLOW_LITE_MICRO is not set
+# CONFIG_PKG_USING_ARDUINO_RUNNINGMEDIAN is not set
+# end of Data Processing
#
# Data Storage
@@ -1021,6 +1309,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
#
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_PN532 is not set
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_SI4713 is not set
+# end of Communication
#
# Device Control
@@ -1032,12 +1321,14 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_DS1841 is not set
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_DS3502 is not set
# CONFIG_PKG_USING_ARDUINO_SEEED_PCF85063TP is not set
+# end of Device Control
#
# Other
#
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_MFRC630 is not set
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_SI5351 is not set
+# end of Other
#
# Signal IO
@@ -1050,10 +1341,14 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_MCP3008 is not set
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_MCP4725 is not set
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_BD3491FS is not set
+# end of Signal IO
#
# Uncategorized
#
+# end of Arduino libraries
+# end of RT-Thread online packages
+
CONFIG_SOC_FAMILY_STM32=y
CONFIG_SOC_SERIES_STM32L0=y
CONFIG_BOARD_SERIES_STM32_NUCLEO_64=y
@@ -1066,16 +1361,20 @@ CONFIG_BOARD_SERIES_STM32_NUCLEO_64=y
# Onboard Peripheral Drivers
#
# CONFIG_BSP_USING_USB_TO_USART is not set
+# end of Onboard Peripheral Drivers
#
# On-chip Peripheral Drivers
#
CONFIG_BSP_USING_GPIO=y
CONFIG_BSP_USING_UART=y
+CONFIG_BSP_STM32_UART_V1_TX_TIMEOUT=2000
CONFIG_BSP_USING_UART2=y
# CONFIG_BSP_UART2_RX_USING_DMA is not set
# CONFIG_BSP_USING_UDID is not set
+# end of On-chip Peripheral Drivers
#
# Board extended module Drivers
#
+# end of Hardware Drivers Config
diff --git a/bsp/stm32/stm32l010-st-nucleo/README_zh.md b/bsp/stm32/stm32l010-st-nucleo/README_zh.md
index c69bbe14fa..84bb870c82 100644
--- a/bsp/stm32/stm32l010-st-nucleo/README_zh.md
+++ b/bsp/stm32/stm32l010-st-nucleo/README_zh.md
@@ -71,6 +71,14 @@ NUCLEO-L010RB 开发板是 ST 官方推出的一款基于 ARM Cortex-M0+ 内核
本 BSP 为开发者提供 MDK5 和 IAR 工程,并且支持 GCC 开发环境。下面以 MDK5 开发环境为例,介绍如何将系统运行起来。
+**请注意!!!**
+
+在执行编译工作前请先打开ENV执行以下指令(该指令用于拉取必要的HAL库及CMSIS库,否则无法通过编译):
+
+```bash
+pkgs --update
+```
+
#### 硬件连接
使用数据线连接开发板到 PC,打开电源开关。
diff --git a/bsp/stm32/stm32l010-st-nucleo/SConstruct b/bsp/stm32/stm32l010-st-nucleo/SConstruct
index d7ad786f03..7ec774fd90 100644
--- a/bsp/stm32/stm32l010-st-nucleo/SConstruct
+++ b/bsp/stm32/stm32l010-st-nucleo/SConstruct
@@ -42,19 +42,13 @@ if os.path.exists(SDK_ROOT + '/libraries'):
else:
libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/libraries'
-SDK_LIB = libraries_path_prefix
-Export('SDK_LIB')
-
# prepare building environment
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
-stm32_library = 'STM32L0xx_HAL'
-rtconfig.BSP_LIBRARY_TYPE = stm32_library
+rtconfig.BSP_LIBRARY_TYPE = None
-# include libraries
-objs.extend(SConscript(os.path.join(libraries_path_prefix, stm32_library, 'SConscript'), variant_dir='build/libraries/'+stm32_library, duplicate=0))
# include drivers
-objs.extend(SConscript(os.path.join(libraries_path_prefix, 'HAL_Drivers', 'SConscript'),variant_dir='build/libraries/'+'HAL_Drivers', duplicate=0))
+objs.extend(SConscript(os.path.join(libraries_path_prefix, 'HAL_Drivers', 'SConscript'),variant_dir='build/libraries/HAL_Drivers', duplicate=0))
# make a building
DoBuilding(TARGET, objs)
diff --git a/bsp/stm32/stm32l010-st-nucleo/board/SConscript b/bsp/stm32/stm32l010-st-nucleo/board/SConscript
index 563c041422..1dfb4e3aa2 100644
--- a/bsp/stm32/stm32l010-st-nucleo/board/SConscript
+++ b/bsp/stm32/stm32l010-st-nucleo/board/SConscript
@@ -1,9 +1,6 @@
import os
-import rtconfig
from building import *
-Import('SDK_LIB')
-
cwd = GetCurrentDir()
# add general drivers
@@ -13,17 +10,16 @@ CubeMX_Config/Src/stm32l0xx_hal_msp.c
''')
path = [cwd]
-path += [cwd + '/CubeMX_Config/Inc']
+path += [os.path.join(cwd, 'CubeMX_Config', 'Inc')]
-startup_path_prefix = SDK_LIB
+CPPDEFINES = ['STM32L053xx']
+group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
-if rtconfig.PLATFORM in ['gcc']:
- src += [startup_path_prefix + '/STM32L0xx_HAL/CMSIS/Device/ST/STM32L0xx/Source/Templates/gcc/startup_stm32l053xx.s']
-elif rtconfig.PLATFORM in ['armcc', 'armclang']:
- src += [startup_path_prefix + '/STM32L0xx_HAL/CMSIS/Device/ST/STM32L0xx/Source/Templates/arm/startup_stm32l053xx.s']
-elif rtconfig.PLATFORM in ['iccarm']:
- src += [startup_path_prefix + '/STM32L0xx_HAL/CMSIS/Device/ST/STM32L0xx/Source/Templates/iar/startup_stm32l053xx.s']
-
-group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path)
+# if os.path.isfile(os.path.join(cwd, "ports", 'SConscript')):
+# group = group + SConscript(os.path.join("ports", 'SConscript'))
+list = os.listdir(cwd)
+for item in list:
+ if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
+ group = group + SConscript(os.path.join(item, 'SConscript'))
Return('group')
diff --git a/bsp/stm32/stm32l010-st-nucleo/rtconfig.h b/bsp/stm32/stm32l010-st-nucleo/rtconfig.h
index 9ca5b3ddd7..ad74346987 100644
--- a/bsp/stm32/stm32l010-st-nucleo/rtconfig.h
+++ b/bsp/stm32/stm32l010-st-nucleo/rtconfig.h
@@ -1,14 +1,69 @@
#ifndef RT_CONFIG_H__
#define RT_CONFIG_H__
-/* Automatically generated file; DO NOT EDIT. */
-/* RT-Thread Configuration */
-
#define SOC_STM32L010RB
#define BOARD_STM32L010_NUCLEO
/* RT-Thread Kernel */
+/* klibc options */
+
+/* rt_vsnprintf options */
+
+/* end of rt_vsnprintf options */
+
+/* rt_vsscanf options */
+
+/* end of rt_vsscanf options */
+
+/* rt_memset options */
+
+/* end of rt_memset options */
+
+/* rt_memcpy options */
+
+/* end of rt_memcpy options */
+
+/* rt_memmove options */
+
+/* end of rt_memmove options */
+
+/* rt_memcmp options */
+
+/* end of rt_memcmp options */
+
+/* rt_strstr options */
+
+/* end of rt_strstr options */
+
+/* rt_strcasecmp options */
+
+/* end of rt_strcasecmp options */
+
+/* rt_strncpy options */
+
+/* end of rt_strncpy options */
+
+/* rt_strcpy options */
+
+/* end of rt_strcpy options */
+
+/* rt_strncmp options */
+
+/* end of rt_strncmp options */
+
+/* rt_strcmp options */
+
+/* end of rt_strcmp options */
+
+/* rt_strlen options */
+
+/* end of rt_strlen options */
+
+/* rt_strnlen options */
+
+/* end of rt_strnlen options */
+/* end of klibc options */
#define RT_NAME_MAX 8
#define RT_CPUS_NR 1
#define RT_ALIGN_SIZE 8
@@ -22,9 +77,11 @@
#define RT_IDLE_HOOK_LIST_SIZE 4
#define IDLE_THREAD_STACK_SIZE 256
-/* kservice optimization */
+/* kservice options */
+/* end of kservice options */
#define RT_USING_DEBUG
+#define RT_DEBUGING_ASSERT
#define RT_DEBUGING_COLOR
#define RT_DEBUGING_CONTEXT
@@ -35,6 +92,7 @@
#define RT_USING_EVENT
#define RT_USING_MAILBOX
#define RT_USING_MESSAGEQUEUE
+/* end of Inter-Thread communication */
/* Memory Management */
@@ -42,12 +100,14 @@
#define RT_USING_SMALL_MEM
#define RT_USING_SMALL_MEM_AS_HEAP
#define RT_USING_HEAP
+/* end of Memory Management */
#define RT_USING_DEVICE
#define RT_USING_CONSOLE
#define RT_CONSOLEBUF_SIZE 256
#define RT_CONSOLE_DEVICE_NAME "uart2"
-#define RT_VER_NUM 0x50100
+#define RT_VER_NUM 0x50201
#define RT_BACKTRACE_LEVEL_MAX_NR 32
+/* end of RT-Thread Kernel */
#define ARCH_ARM
#define ARCH_ARM_CORTEX_M
#define ARCH_ARM_CORTEX_M0
@@ -75,6 +135,7 @@
/* DFS: device virtual file system */
+/* end of DFS: device virtual file system */
/* Device Drivers */
@@ -85,9 +146,7 @@
#define RT_SERIAL_USING_DMA
#define RT_SERIAL_RB_BUFSZ 64
#define RT_USING_PIN
-
-/* Using USB */
-
+/* end of Device Drivers */
/* C/C++ and POSIX layer */
@@ -99,6 +158,8 @@
#define RT_LIBC_TZ_DEFAULT_HOUR 8
#define RT_LIBC_TZ_DEFAULT_MIN 0
#define RT_LIBC_TZ_DEFAULT_SEC 0
+/* end of Timezone and Daylight Saving Time */
+/* end of ISO-ANSI C layer */
/* POSIX (Portable Operating System Interface) layer */
@@ -108,18 +169,30 @@
/* Socket is in the 'Network' category */
+/* end of Interprocess Communication (IPC) */
+/* end of POSIX (Portable Operating System Interface) layer */
+/* end of C/C++ and POSIX layer */
/* Network */
+/* end of Network */
/* Memory protection */
+/* end of Memory protection */
/* Utilities */
+/* end of Utilities */
+
+/* Using USB legacy version */
+
+/* end of Using USB legacy version */
+/* end of RT-Thread Components */
/* RT-Thread Utestcases */
+/* end of RT-Thread Utestcases */
/* RT-Thread online packages */
@@ -130,57 +203,80 @@
/* Marvell WiFi */
+/* end of Marvell WiFi */
/* Wiced WiFi */
+/* end of Wiced WiFi */
/* CYW43012 WiFi */
+/* end of CYW43012 WiFi */
/* BL808 WiFi */
+/* end of BL808 WiFi */
/* CYW43439 WiFi */
+/* end of CYW43439 WiFi */
+/* end of Wi-Fi */
/* IoT Cloud */
+/* end of IoT Cloud */
+/* end of IoT - internet of things */
/* security packages */
+/* end of security packages */
/* language packages */
/* JSON: JavaScript Object Notation, a lightweight data-interchange format */
+/* end of JSON: JavaScript Object Notation, a lightweight data-interchange format */
/* XML: Extensible Markup Language */
+/* end of XML: Extensible Markup Language */
+/* end of language packages */
/* multimedia packages */
/* LVGL: powerful and easy-to-use embedded GUI library */
+/* end of LVGL: powerful and easy-to-use embedded GUI library */
/* u8g2: a monochrome graphic library */
+/* end of u8g2: a monochrome graphic library */
+/* end of multimedia packages */
/* tools packages */
+/* end of tools packages */
/* system packages */
/* enhanced kernel services */
+/* end of enhanced kernel services */
/* acceleration: Assembly language or algorithmic acceleration packages */
+/* end of acceleration: Assembly language or algorithmic acceleration packages */
/* CMSIS: ARM Cortex-M Microcontroller Software Interface Standard */
+#define PKG_USING_CMSIS_CORE
+#define PKG_USING_CMSIS_CORE_LATEST_VERSION
+/* end of CMSIS: ARM Cortex-M Microcontroller Software Interface Standard */
/* Micrium: Micrium software products porting for RT-Thread */
+/* end of Micrium: Micrium software products porting for RT-Thread */
+/* end of system packages */
/* peripheral libraries and drivers */
@@ -188,66 +284,106 @@
/* STM32 HAL & SDK Drivers */
+#define PKG_USING_STM32L0_HAL_DRIVER
+#define PKG_USING_STM32L0_HAL_DRIVER_LATEST_VERSION
+#define PKG_USING_STM32L0_CMSIS_DRIVER
+#define PKG_USING_STM32L0_CMSIS_DRIVER_LATEST_VERSION
+/* end of STM32 HAL & SDK Drivers */
+
+/* Infineon HAL Packages */
+
+/* end of Infineon HAL Packages */
/* Kendryte SDK */
+/* end of Kendryte SDK */
+
+/* WCH HAL & SDK Drivers */
+
+/* end of WCH HAL & SDK Drivers */
+
+/* AT32 HAL & SDK Drivers */
+
+/* end of AT32 HAL & SDK Drivers */
+/* end of HAL & SDK Drivers */
/* sensors drivers */
+/* end of sensors drivers */
/* touch drivers */
+/* end of touch drivers */
+/* end of peripheral libraries and drivers */
/* AI packages */
+/* end of AI packages */
/* Signal Processing and Control Algorithm Packages */
+/* end of Signal Processing and Control Algorithm Packages */
/* miscellaneous packages */
/* project laboratory */
+/* end of project laboratory */
+
/* samples: kernel and components samples */
+/* end of samples: kernel and components samples */
/* entertainment: terminal games and other interesting software packages */
+/* end of entertainment: terminal games and other interesting software packages */
+/* end of miscellaneous packages */
/* Arduino libraries */
/* Projects and Demos */
+/* end of Projects and Demos */
/* Sensors */
+/* end of Sensors */
/* Display */
+/* end of Display */
/* Timing */
+/* end of Timing */
/* Data Processing */
+/* end of Data Processing */
/* Data Storage */
/* Communication */
+/* end of Communication */
/* Device Control */
+/* end of Device Control */
/* Other */
+/* end of Other */
/* Signal IO */
+/* end of Signal IO */
/* Uncategorized */
+/* end of Arduino libraries */
+/* end of RT-Thread online packages */
#define SOC_FAMILY_STM32
#define SOC_SERIES_STM32L0
#define BOARD_SERIES_STM32_NUCLEO_64
@@ -256,14 +392,18 @@
/* Onboard Peripheral Drivers */
+/* end of Onboard Peripheral Drivers */
/* On-chip Peripheral Drivers */
#define BSP_USING_GPIO
#define BSP_USING_UART
+#define BSP_STM32_UART_V1_TX_TIMEOUT 2000
#define BSP_USING_UART2
+/* end of On-chip Peripheral Drivers */
/* Board extended module Drivers */
+/* end of Hardware Drivers Config */
#endif
diff --git a/bsp/stm32/stm32l053-st-nucleo/.config b/bsp/stm32/stm32l053-st-nucleo/.config
index 216c46fcc4..69e028a48f 100644
--- a/bsp/stm32/stm32l053-st-nucleo/.config
+++ b/bsp/stm32/stm32l053-st-nucleo/.config
@@ -1,17 +1,119 @@
-#
-# Automatically generated file; DO NOT EDIT.
-# RT-Thread Configuration
-#
CONFIG_SOC_STM32L053R8=y
CONFIG_BOARD_STM32L053_NUCLEO=y
#
# RT-Thread Kernel
#
+
+#
+# klibc options
+#
+
+#
+# rt_vsnprintf options
+#
+# CONFIG_RT_KLIBC_USING_LIBC_VSNPRINTF is not set
+# CONFIG_RT_KLIBC_USING_VSNPRINTF_LONGLONG is not set
+# CONFIG_RT_KLIBC_USING_VSNPRINTF_STANDARD is not set
+# end of rt_vsnprintf options
+
+#
+# rt_vsscanf options
+#
+# CONFIG_RT_KLIBC_USING_LIBC_VSSCANF is not set
+# end of rt_vsscanf options
+
+#
+# rt_memset options
+#
+# CONFIG_RT_KLIBC_USING_USER_MEMSET is not set
+# CONFIG_RT_KLIBC_USING_LIBC_MEMSET is not set
+# CONFIG_RT_KLIBC_USING_TINY_MEMSET is not set
+# end of rt_memset options
+
+#
+# rt_memcpy options
+#
+# CONFIG_RT_KLIBC_USING_USER_MEMCPY is not set
+# CONFIG_RT_KLIBC_USING_LIBC_MEMCPY is not set
+# CONFIG_RT_KLIBC_USING_TINY_MEMCPY is not set
+# end of rt_memcpy options
+
+#
+# rt_memmove options
+#
+# CONFIG_RT_KLIBC_USING_USER_MEMMOVE is not set
+# CONFIG_RT_KLIBC_USING_LIBC_MEMMOVE is not set
+# end of rt_memmove options
+
+#
+# rt_memcmp options
+#
+# CONFIG_RT_KLIBC_USING_USER_MEMCMP is not set
+# CONFIG_RT_KLIBC_USING_LIBC_MEMCMP is not set
+# end of rt_memcmp options
+
+#
+# rt_strstr options
+#
+# CONFIG_RT_KLIBC_USING_USER_STRSTR is not set
+# CONFIG_RT_KLIBC_USING_LIBC_STRSTR is not set
+# end of rt_strstr options
+
+#
+# rt_strcasecmp options
+#
+# CONFIG_RT_KLIBC_USING_USER_STRCASECMP is not set
+# end of rt_strcasecmp options
+
+#
+# rt_strncpy options
+#
+# CONFIG_RT_KLIBC_USING_USER_STRNCPY is not set
+# CONFIG_RT_KLIBC_USING_LIBC_STRNCPY is not set
+# end of rt_strncpy options
+
+#
+# rt_strcpy options
+#
+# CONFIG_RT_KLIBC_USING_USER_STRCPY is not set
+# CONFIG_RT_KLIBC_USING_LIBC_STRCPY is not set
+# end of rt_strcpy options
+
+#
+# rt_strncmp options
+#
+# CONFIG_RT_KLIBC_USING_USER_STRNCMP is not set
+# CONFIG_RT_KLIBC_USING_LIBC_STRNCMP is not set
+# end of rt_strncmp options
+
+#
+# rt_strcmp options
+#
+# CONFIG_RT_KLIBC_USING_USER_STRCMP is not set
+# CONFIG_RT_KLIBC_USING_LIBC_STRCMP is not set
+# end of rt_strcmp options
+
+#
+# rt_strlen options
+#
+# CONFIG_RT_KLIBC_USING_USER_STRLEN is not set
+# CONFIG_RT_KLIBC_USING_LIBC_STRLEN is not set
+# end of rt_strlen options
+
+#
+# rt_strnlen options
+#
+# CONFIG_RT_KLIBC_USING_USER_STRNLEN is not set
+# end of rt_strnlen options
+
+# CONFIG_RT_UTEST_TC_USING_KLIBC is not set
+# end of klibc options
+
CONFIG_RT_NAME_MAX=8
# CONFIG_RT_USING_ARCH_DATA_TYPE is not set
-# CONFIG_RT_USING_SMART is not set
# CONFIG_RT_USING_NANO is not set
+# CONFIG_RT_USING_SMART is not set
# CONFIG_RT_USING_AMP is not set
# CONFIG_RT_USING_SMP is not set
CONFIG_RT_CPUS_NR=1
@@ -29,18 +131,20 @@ CONFIG_RT_USING_IDLE_HOOK=y
CONFIG_RT_IDLE_HOOK_LIST_SIZE=4
CONFIG_IDLE_THREAD_STACK_SIZE=256
# CONFIG_RT_USING_TIMER_SOFT is not set
+# CONFIG_RT_USING_CPU_USAGE_TRACER is not set
#
-# kservice optimization
+# kservice options
#
-# CONFIG_RT_KSERVICE_USING_STDLIB is not set
-# CONFIG_RT_KSERVICE_USING_TINY_SIZE is not set
# CONFIG_RT_USING_TINY_FFS is not set
-# CONFIG_RT_KPRINTF_USING_LONGLONG is not set
+# end of kservice options
+
CONFIG_RT_USING_DEBUG=y
+CONFIG_RT_DEBUGING_ASSERT=y
CONFIG_RT_DEBUGING_COLOR=y
CONFIG_RT_DEBUGING_CONTEXT=y
# CONFIG_RT_DEBUGING_AUTO_INIT is not set
+# CONFIG_RT_USING_CI_ACTION is not set
#
# Inter-Thread communication
@@ -52,6 +156,7 @@ CONFIG_RT_USING_MAILBOX=y
CONFIG_RT_USING_MESSAGEQUEUE=y
# CONFIG_RT_USING_MESSAGEQUEUE_PRIORITY is not set
# CONFIG_RT_USING_SIGNALS is not set
+# end of Inter-Thread communication
#
# Memory Management
@@ -68,22 +173,20 @@ CONFIG_RT_USING_SMALL_MEM_AS_HEAP=y
# CONFIG_RT_USING_MEMTRACE is not set
# CONFIG_RT_USING_HEAP_ISR is not set
CONFIG_RT_USING_HEAP=y
+# end of Memory Management
+
CONFIG_RT_USING_DEVICE=y
# CONFIG_RT_USING_DEVICE_OPS is not set
# CONFIG_RT_USING_INTERRUPT_INFO is not set
# CONFIG_RT_USING_THREADSAFE_PRINTF is not set
-# CONFIG_RT_USING_SCHED_THREAD_CTX is not set
CONFIG_RT_USING_CONSOLE=y
CONFIG_RT_CONSOLEBUF_SIZE=256
CONFIG_RT_CONSOLE_DEVICE_NAME="uart2"
-CONFIG_RT_VER_NUM=0x50100
+CONFIG_RT_VER_NUM=0x50201
# CONFIG_RT_USING_STDC_ATOMIC is not set
CONFIG_RT_BACKTRACE_LEVEL_MAX_NR=32
-# CONFIG_RT_USING_CACHE is not set
-# CONFIG_RT_USING_HW_ATOMIC is not set
-# CONFIG_ARCH_ARM_BOOTWITH_FLUSH_CACHE is not set
-# CONFIG_ARCH_CPU_STACK_GROWS_UPWARD is not set
-# CONFIG_RT_USING_CPU_FFS is not set
+# end of RT-Thread Kernel
+
CONFIG_ARCH_ARM=y
CONFIG_ARCH_ARM_CORTEX_M=y
CONFIG_ARCH_ARM_CORTEX_M0=y
@@ -117,12 +220,15 @@ CONFIG_FINSH_USING_OPTION_COMPLETION=y
# DFS: device virtual file system
#
# CONFIG_RT_USING_DFS is not set
+# end of DFS: device virtual file system
+
# CONFIG_RT_USING_FAL is not set
#
# Device Drivers
#
# CONFIG_RT_USING_DM is not set
+# CONFIG_RT_USING_DEV_BUS is not set
CONFIG_RT_USING_DEVICE_IPC=y
CONFIG_RT_UNAMED_PIPE_NUMBER=64
# CONFIG_RT_USING_SYSTEM_WORKQUEUE is not set
@@ -131,16 +237,20 @@ CONFIG_RT_USING_SERIAL_V1=y
# CONFIG_RT_USING_SERIAL_V2 is not set
CONFIG_RT_SERIAL_USING_DMA=y
CONFIG_RT_SERIAL_RB_BUFSZ=64
+# CONFIG_RT_USING_SERIAL_BYPASS is not set
# CONFIG_RT_USING_CAN is not set
# CONFIG_RT_USING_CPUTIME is not set
# CONFIG_RT_USING_I2C is not set
# CONFIG_RT_USING_PHY is not set
+# CONFIG_RT_USING_PHY_V2 is not set
# CONFIG_RT_USING_ADC is not set
# CONFIG_RT_USING_DAC is not set
# CONFIG_RT_USING_NULL is not set
# CONFIG_RT_USING_ZERO is not set
# CONFIG_RT_USING_RANDOM is not set
# CONFIG_RT_USING_PWM is not set
+# CONFIG_RT_USING_PULSE_ENCODER is not set
+# CONFIG_RT_USING_INPUT_CAPTURE is not set
# CONFIG_RT_USING_MTD_NOR is not set
# CONFIG_RT_USING_MTD_NAND is not set
# CONFIG_RT_USING_PM is not set
@@ -153,21 +263,14 @@ CONFIG_RT_SERIAL_RB_BUFSZ=64
# CONFIG_RT_USING_TOUCH is not set
# CONFIG_RT_USING_LCD is not set
# CONFIG_RT_USING_HWCRYPTO is not set
-# CONFIG_RT_USING_PULSE_ENCODER is not set
-# CONFIG_RT_USING_INPUT_CAPTURE is not set
-# CONFIG_RT_USING_DEV_BUS is not set
# CONFIG_RT_USING_WIFI is not set
+# CONFIG_RT_USING_BLK is not set
# CONFIG_RT_USING_VIRTIO is not set
CONFIG_RT_USING_PIN=y
# CONFIG_RT_USING_KTIME is not set
# CONFIG_RT_USING_HWTIMER is not set
-
-#
-# Using USB
-#
-# CONFIG_RT_USING_USB is not set
-# CONFIG_RT_USING_USB_HOST is not set
-# CONFIG_RT_USING_USB_DEVICE is not set
+# CONFIG_RT_USING_CHERRYUSB is not set
+# end of Device Drivers
#
# C/C++ and POSIX layer
@@ -185,6 +288,8 @@ CONFIG_RT_LIBC_USING_LIGHT_TZ_DST=y
CONFIG_RT_LIBC_TZ_DEFAULT_HOUR=8
CONFIG_RT_LIBC_TZ_DEFAULT_MIN=0
CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
+# end of Timezone and Daylight Saving Time
+# end of ISO-ANSI C layer
#
# POSIX (Portable Operating System Interface) layer
@@ -206,7 +311,11 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
#
# Socket is in the 'Network' category
#
+# end of Interprocess Communication (IPC)
+# end of POSIX (Portable Operating System Interface) layer
+
# CONFIG_RT_USING_CPLUSPLUS is not set
+# end of C/C++ and POSIX layer
#
# Network
@@ -215,12 +324,14 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_RT_USING_NETDEV is not set
# CONFIG_RT_USING_LWIP is not set
# CONFIG_RT_USING_AT is not set
+# end of Network
#
# Memory protection
#
# CONFIG_RT_USING_MEM_PROTECTION is not set
# CONFIG_RT_USING_HW_STACK_GUARD is not set
+# end of Memory protection
#
# Utilities
@@ -232,12 +343,25 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_RT_USING_RESOURCE_ID is not set
# CONFIG_RT_USING_ADT is not set
# CONFIG_RT_USING_RT_LINK is not set
+# end of Utilities
+
# CONFIG_RT_USING_VBUS is not set
+#
+# Using USB legacy version
+#
+# CONFIG_RT_USING_USB_HOST is not set
+# CONFIG_RT_USING_USB_DEVICE is not set
+# end of Using USB legacy version
+
+# CONFIG_RT_USING_FDT is not set
+# end of RT-Thread Components
+
#
# RT-Thread Utestcases
#
# CONFIG_RT_USING_UTESTCASES is not set
+# end of RT-Thread Utestcases
#
# RT-Thread online packages
@@ -246,7 +370,6 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
#
# IoT - internet of things
#
-# CONFIG_PKG_USING_LWIP is not set
# CONFIG_PKG_USING_LORAWAN_DRIVER is not set
# CONFIG_PKG_USING_PAHOMQTT is not set
# CONFIG_PKG_USING_UMQTT is not set
@@ -259,6 +382,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_WEBTERMINAL is not set
# CONFIG_PKG_USING_FREEMODBUS is not set
# CONFIG_PKG_USING_NANOPB is not set
+# CONFIG_PKG_USING_WIFI_HOST_DRIVER is not set
#
# Wi-Fi
@@ -268,27 +392,35 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# Marvell WiFi
#
# CONFIG_PKG_USING_WLANMARVELL is not set
+# end of Marvell WiFi
#
# Wiced WiFi
#
# CONFIG_PKG_USING_WLAN_WICED is not set
+# end of Wiced WiFi
+
# CONFIG_PKG_USING_RW007 is not set
#
# CYW43012 WiFi
#
# CONFIG_PKG_USING_WLAN_CYW43012 is not set
+# end of CYW43012 WiFi
#
# BL808 WiFi
#
# CONFIG_PKG_USING_WLAN_BL808 is not set
+# end of BL808 WiFi
#
# CYW43439 WiFi
#
# CONFIG_PKG_USING_WLAN_CYW43439 is not set
+# end of CYW43439 WiFi
+# end of Wi-Fi
+
# CONFIG_PKG_USING_COAP is not set
# CONFIG_PKG_USING_NOPOLL is not set
# CONFIG_PKG_USING_NETUTILS is not set
@@ -311,6 +443,8 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_UCLOUD_IOT_SDK is not set
# CONFIG_PKG_USING_JOYLINK is not set
# CONFIG_PKG_USING_IOTSHARP_SDK is not set
+# end of IoT Cloud
+
# CONFIG_PKG_USING_NIMBLE is not set
# CONFIG_PKG_USING_LLSYNC_SDK_ADAPTER is not set
# CONFIG_PKG_USING_OTA_DOWNLOADER is not set
@@ -353,6 +487,10 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_ZEPHYR_POLLING is not set
# CONFIG_PKG_USING_MATTER_ADAPTATION_LAYER is not set
# CONFIG_PKG_USING_LHC_MODBUS is not set
+# CONFIG_PKG_USING_QMODBUS is not set
+# CONFIG_PKG_USING_PNET is not set
+# CONFIG_PKG_USING_OPENER is not set
+# end of IoT - internet of things
#
# security packages
@@ -363,6 +501,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_TINYCRYPT is not set
# CONFIG_PKG_USING_TFM is not set
# CONFIG_PKG_USING_YD_CRYPTO is not set
+# end of security packages
#
# language packages
@@ -378,18 +517,23 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_JSMN is not set
# CONFIG_PKG_USING_AGILE_JSMN is not set
# CONFIG_PKG_USING_PARSON is not set
+# CONFIG_PKG_USING_RYAN_JSON is not set
+# end of JSON: JavaScript Object Notation, a lightweight data-interchange format
#
# XML: Extensible Markup Language
#
# CONFIG_PKG_USING_SIMPLE_XML is not set
# CONFIG_PKG_USING_EZXML is not set
+# end of XML: Extensible Markup Language
+
# CONFIG_PKG_USING_LUATOS_SOC is not set
# CONFIG_PKG_USING_LUA is not set
# CONFIG_PKG_USING_JERRYSCRIPT is not set
# CONFIG_PKG_USING_MICROPYTHON is not set
# CONFIG_PKG_USING_PIKASCRIPT is not set
# CONFIG_PKG_USING_RTT_RUST is not set
+# end of language packages
#
# multimedia packages
@@ -401,12 +545,15 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_LVGL is not set
# CONFIG_PKG_USING_LV_MUSIC_DEMO is not set
# CONFIG_PKG_USING_GUI_GUIDER_DEMO is not set
+# end of LVGL: powerful and easy-to-use embedded GUI library
#
# u8g2: a monochrome graphic library
#
# CONFIG_PKG_USING_U8G2_OFFICIAL is not set
# CONFIG_PKG_USING_U8G2 is not set
+# end of u8g2: a monochrome graphic library
+
# CONFIG_PKG_USING_OPENMV is not set
# CONFIG_PKG_USING_MUPDF is not set
# CONFIG_PKG_USING_STEMWIN is not set
@@ -426,6 +573,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_QRCODE is not set
# CONFIG_PKG_USING_GUIENGINE is not set
# CONFIG_PKG_USING_3GPP_AMRNB is not set
+# end of multimedia packages
#
# tools packages
@@ -475,6 +623,9 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_VOFA_PLUS is not set
# CONFIG_PKG_USING_RT_TRACE is not set
# CONFIG_PKG_USING_ZDEBUG is not set
+# CONFIG_PKG_USING_RVBACKTRACE is not set
+# CONFIG_PKG_USING_HPATCHLITE is not set
+# end of tools packages
#
# system packages
@@ -485,7 +636,9 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
#
# CONFIG_PKG_USING_RT_MEMCPY_CM is not set
# CONFIG_PKG_USING_RT_KPRINTF_THREADSAFE is not set
-# CONFIG_PKG_USING_RT_VSNPRINTF_FULL is not set
+# end of enhanced kernel services
+
+# CONFIG_PKG_USING_AUNITY is not set
#
# acceleration: Assembly language or algorithmic acceleration packages
@@ -493,16 +646,20 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_QFPLIB_M0_FULL is not set
# CONFIG_PKG_USING_QFPLIB_M0_TINY is not set
# CONFIG_PKG_USING_QFPLIB_M3 is not set
+# end of acceleration: Assembly language or algorithmic acceleration packages
#
# CMSIS: ARM Cortex-M Microcontroller Software Interface Standard
#
# CONFIG_PKG_USING_CMSIS_5 is not set
-# CONFIG_PKG_USING_CMSIS_CORE is not set
-# CONFIG_PKG_USING_CMSIS_DSP is not set
+CONFIG_PKG_USING_CMSIS_CORE=y
+CONFIG_PKG_CMSIS_CORE_PATH="/packages/system/CMSIS/CMSIS-Core"
+CONFIG_PKG_USING_CMSIS_CORE_LATEST_VERSION=y
+CONFIG_PKG_CMSIS_CORE_VER="latest"
# CONFIG_PKG_USING_CMSIS_NN is not set
# CONFIG_PKG_USING_CMSIS_RTOS1 is not set
# CONFIG_PKG_USING_CMSIS_RTOS2 is not set
+# end of CMSIS: ARM Cortex-M Microcontroller Software Interface Standard
#
# Micrium: Micrium software products porting for RT-Thread
@@ -513,6 +670,8 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_UC_CLK is not set
# CONFIG_PKG_USING_UC_COMMON is not set
# CONFIG_PKG_USING_UC_MODBUS is not set
+# end of Micrium: Micrium software products porting for RT-Thread
+
# CONFIG_PKG_USING_FREERTOS_WRAPPER is not set
# CONFIG_PKG_USING_LITEOS_SDK is not set
# CONFIG_PKG_USING_TZ_DATABASE is not set
@@ -548,7 +707,6 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_ARM_2D is not set
# CONFIG_PKG_USING_MCUBOOT is not set
# CONFIG_PKG_USING_TINYUSB is not set
-# CONFIG_PKG_USING_CHERRYUSB is not set
# CONFIG_PKG_USING_KMULTI_RTIMER is not set
# CONFIG_PKG_USING_TFDB is not set
# CONFIG_PKG_USING_QPC is not set
@@ -556,10 +714,14 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_FLASH_BLOB is not set
# CONFIG_PKG_USING_MLIBC is not set
# CONFIG_PKG_USING_TASK_MSG_BUS is not set
+# CONFIG_PKG_USING_UART_FRAMEWORK is not set
# CONFIG_PKG_USING_SFDB is not set
# CONFIG_PKG_USING_RTP is not set
# CONFIG_PKG_USING_REB is not set
+# CONFIG_PKG_USING_RMP is not set
# CONFIG_PKG_USING_R_RHEALSTONE is not set
+# CONFIG_PKG_USING_HEARTBEAT is not set
+# end of system packages
#
# peripheral libraries and drivers
@@ -572,9 +734,63 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
#
# STM32 HAL & SDK Drivers
#
-# CONFIG_PKG_USING_STM32L4XX_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32F0_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32F0_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_STM32F1_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32F1_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_STM32F2_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32F2_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_STM32F3_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32F3_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_STM32F4_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32F4_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_STM32F7_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32F7_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_STM32G0_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32G0_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_STM32G4_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32G4_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_STM32H5_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32H5_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_STM32H7_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32H7_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_STM32H7RS_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32H7RS_CMSIS_DRIVER is not set
+CONFIG_PKG_USING_STM32L0_HAL_DRIVER=y
+CONFIG_PKG_STM32L0_HAL_DRIVER_PATH="/packages/peripherals/hal-sdk/stm32/stm32l0_hal_driver"
+CONFIG_PKG_USING_STM32L0_HAL_DRIVER_LATEST_VERSION=y
+CONFIG_PKG_STM32L0_HAL_DRIVER_VER="latest"
+CONFIG_PKG_USING_STM32L0_CMSIS_DRIVER=y
+CONFIG_PKG_STM32L0_CMSIS_DRIVER_PATH="/packages/peripherals/hal-sdk/stm32/stm32l0_cmsis_driver"
+CONFIG_PKG_USING_STM32L0_CMSIS_DRIVER_LATEST_VERSION=y
+CONFIG_PKG_STM32L0_CMSIS_DRIVER_VER="latest"
+# CONFIG_PKG_USING_STM32L4_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32L4_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_STM32L5_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32L5_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_STM32U5_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32U5_CMSIS_DRIVER is not set
# CONFIG_PKG_USING_STM32WB55_SDK is not set
# CONFIG_PKG_USING_STM32_SDIO is not set
+# CONFIG_PKG_USING_STM32WL_HAL_DRIVER is not set
+# CONFIG_PKG_USING_STM32WL_CMSIS_DRIVER is not set
+# end of STM32 HAL & SDK Drivers
+
+#
+# Infineon HAL Packages
+#
+# CONFIG_PKG_USING_INFINEON_CAT1CM0P is not set
+# CONFIG_PKG_USING_INFINEON_CMSIS is not set
+# CONFIG_PKG_USING_INFINEON_CORE_LIB is not set
+# CONFIG_PKG_USING_INFINEON_MTB_HAL_CAT1 is not set
+# CONFIG_PKG_USING_INFINEON_MTB_PDL_CAT1 is not set
+# CONFIG_PKG_USING_INFINEON_RETARGET_IO is not set
+# CONFIG_PKG_USING_INFINEON_CAPSENSE is not set
+# CONFIG_PKG_USING_INFINEON_CSDIDAC is not set
+# CONFIG_PKG_USING_INFINEON_SERIAL_FLASH is not set
+# CONFIG_PKG_USING_INFINEON_USBDEV is not set
+# end of Infineon HAL Packages
+
# CONFIG_PKG_USING_BLUETRUM_SDK is not set
# CONFIG_PKG_USING_EMBARC_BSP is not set
# CONFIG_PKG_USING_ESP_IDF is not set
@@ -584,9 +800,49 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
#
# CONFIG_PKG_USING_K210_SDK is not set
# CONFIG_PKG_USING_KENDRYTE_SDK is not set
+# end of Kendryte SDK
+
# CONFIG_PKG_USING_NRF5X_SDK is not set
# CONFIG_PKG_USING_NRFX is not set
# CONFIG_PKG_USING_RASPBERRYPI_PICO_SDK is not set
+# CONFIG_PKG_USING_MM32 is not set
+
+#
+# WCH HAL & SDK Drivers
+#
+# CONFIG_PKG_USING_CH32V20x_SDK is not set
+# CONFIG_PKG_USING_CH32V307_SDK is not set
+# end of WCH HAL & SDK Drivers
+
+#
+# AT32 HAL & SDK Drivers
+#
+# CONFIG_PKG_USING_AT32A403A_HAL_DRIVER is not set
+# CONFIG_PKG_USING_AT32A403A_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_AT32A423_HAL_DRIVER is not set
+# CONFIG_PKG_USING_AT32A423_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_AT32F45x_HAL_DRIVER is not set
+# CONFIG_PKG_USING_AT32F45x_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_AT32F402_405_HAL_DRIVER is not set
+# CONFIG_PKG_USING_AT32F402_405_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_AT32F403A_407_HAL_DRIVER is not set
+# CONFIG_PKG_USING_AT32F403A_407_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_AT32F413_HAL_DRIVER is not set
+# CONFIG_PKG_USING_AT32F413_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_AT32F415_HAL_DRIVER is not set
+# CONFIG_PKG_USING_AT32F415_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_AT32F421_HAL_DRIVER is not set
+# CONFIG_PKG_USING_AT32F421_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_AT32F423_HAL_DRIVER is not set
+# CONFIG_PKG_USING_AT32F423_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_AT32F425_HAL_DRIVER is not set
+# CONFIG_PKG_USING_AT32F425_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_AT32F435_437_HAL_DRIVER is not set
+# CONFIG_PKG_USING_AT32F435_437_CMSIS_DRIVER is not set
+# CONFIG_PKG_USING_AT32M412_416_HAL_DRIVER is not set
+# CONFIG_PKG_USING_AT32M412_416_CMSIS_DRIVER is not set
+# end of AT32 HAL & SDK Drivers
+# end of HAL & SDK Drivers
#
# sensors drivers
@@ -623,14 +879,17 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_BMI088 is not set
# CONFIG_PKG_USING_HMC5883 is not set
# CONFIG_PKG_USING_MAX6675 is not set
+# CONFIG_PKG_USING_MAX31855 is not set
# CONFIG_PKG_USING_TMP1075 is not set
# CONFIG_PKG_USING_SR04 is not set
# CONFIG_PKG_USING_CCS811 is not set
# CONFIG_PKG_USING_PMSXX is not set
# CONFIG_PKG_USING_RT3020 is not set
# CONFIG_PKG_USING_MLX90632 is not set
+# CONFIG_PKG_USING_MLX90382 is not set
# CONFIG_PKG_USING_MLX90393 is not set
# CONFIG_PKG_USING_MLX90392 is not set
+# CONFIG_PKG_USING_MLX90394 is not set
# CONFIG_PKG_USING_MLX90397 is not set
# CONFIG_PKG_USING_MS5611 is not set
# CONFIG_PKG_USING_MAX31865 is not set
@@ -656,6 +915,8 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_ICM20608 is not set
# CONFIG_PKG_USING_PAJ7620 is not set
# CONFIG_PKG_USING_STHS34PF80 is not set
+# CONFIG_PKG_USING_P3T1755 is not set
+# end of sensors drivers
#
# touch drivers
@@ -670,6 +931,8 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_XPT2046_TOUCH is not set
# CONFIG_PKG_USING_CST816X is not set
# CONFIG_PKG_USING_CST812T is not set
+# end of touch drivers
+
# CONFIG_PKG_USING_REALTEK_AMEBA is not set
# CONFIG_PKG_USING_BUTTON is not set
# CONFIG_PKG_USING_PCF8574 is not set
@@ -741,7 +1004,12 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_SYSTEM_RUN_LED is not set
# CONFIG_PKG_USING_BT_MX01 is not set
# CONFIG_PKG_USING_RGPOWER is not set
+# CONFIG_PKG_USING_BT_MX02 is not set
+# CONFIG_PKG_USING_GC9A01 is not set
+# CONFIG_PKG_USING_IK485 is not set
+# CONFIG_PKG_USING_SERVO is not set
# CONFIG_PKG_USING_SPI_TOOLS is not set
+# end of peripheral libraries and drivers
#
# AI packages
@@ -756,15 +1024,20 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_QUEST is not set
# CONFIG_PKG_USING_NAXOS is not set
# CONFIG_PKG_USING_R_TINYMAIX is not set
+# CONFIG_PKG_USING_LLMCHAT is not set
+# end of AI packages
#
# Signal Processing and Control Algorithm Packages
#
+# CONFIG_PKG_USING_APID is not set
# CONFIG_PKG_USING_FIRE_PID_CURVE is not set
# CONFIG_PKG_USING_QPID is not set
# CONFIG_PKG_USING_UKAL is not set
# CONFIG_PKG_USING_DIGITALCTRL is not set
# CONFIG_PKG_USING_KISSFFT is not set
+# CONFIG_PKG_USING_CMSIS_DSP is not set
+# end of Signal Processing and Control Algorithm Packages
#
# miscellaneous packages
@@ -773,6 +1046,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
#
# project laboratory
#
+# end of project laboratory
#
# samples: kernel and components samples
@@ -781,6 +1055,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_FILESYSTEM_SAMPLES is not set
# CONFIG_PKG_USING_NETWORK_SAMPLES is not set
# CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set
+# end of samples: kernel and components samples
#
# entertainment: terminal games and other interesting software packages
@@ -797,6 +1072,8 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_COWSAY is not set
# CONFIG_PKG_USING_MORSE is not set
# CONFIG_PKG_USING_TINYSQUARE is not set
+# end of entertainment: terminal games and other interesting software packages
+
# CONFIG_PKG_USING_LIBCSV is not set
# CONFIG_PKG_USING_OPTPARSE is not set
# CONFIG_PKG_USING_FASTLZ is not set
@@ -820,6 +1097,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_KI is not set
# CONFIG_PKG_USING_ARMv7M_DWT is not set
# CONFIG_PKG_USING_CRCLIB is not set
+# CONFIG_PKG_USING_LIBCRC is not set
# CONFIG_PKG_USING_LWGPS is not set
# CONFIG_PKG_USING_STATE_MACHINE is not set
# CONFIG_PKG_USING_DESIGN_PATTERN is not set
@@ -831,6 +1109,8 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_QPARAM is not set
# CONFIG_PKG_USING_CorevMCU_CLI is not set
# CONFIG_PKG_USING_GET_IRQ_PRIORITY is not set
+# CONFIG_PKG_USING_DRMP is not set
+# end of miscellaneous packages
#
# Arduino libraries
@@ -843,9 +1123,11 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_ARDUINO_MSGQ_C_CPP_DEMO is not set
# CONFIG_PKG_USING_ARDUINO_SKETCH_LOADER_DEMO is not set
# CONFIG_PKG_USING_ARDUINO_ULTRASOUND_RADAR is not set
+# CONFIG_PKG_USING_ARDUINO_RTDUINO_SENSORFUSION_SHIELD is not set
# CONFIG_PKG_USING_ARDUINO_NINEINONE_SENSOR_SHIELD is not set
# CONFIG_PKG_USING_ARDUINO_SENSOR_KIT is not set
# CONFIG_PKG_USING_ARDUINO_MATLAB_SUPPORT is not set
+# end of Projects and Demos
#
# Sensors
@@ -985,6 +1267,8 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_ARDUINO_SEEED_LTC2941 is not set
# CONFIG_PKG_USING_ARDUINO_SEEED_LDC1612 is not set
# CONFIG_PKG_USING_ARDUINO_CAPACITIVESENSOR is not set
+# CONFIG_PKG_USING_ARDUINO_JARZEBSKI_MPU6050 is not set
+# end of Sensors
#
# Display
@@ -996,6 +1280,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_SSD1306 is not set
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_ILI9341 is not set
# CONFIG_PKG_USING_SEEED_TM1637 is not set
+# end of Display
#
# Timing
@@ -1004,6 +1289,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_ARDUINO_MSTIMER2 is not set
# CONFIG_PKG_USING_ARDUINO_TICKER is not set
# CONFIG_PKG_USING_ARDUINO_TASKSCHEDULER is not set
+# end of Timing
#
# Data Processing
@@ -1011,6 +1297,8 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_ARDUINO_KALMANFILTER is not set
# CONFIG_PKG_USING_ARDUINO_ARDUINOJSON is not set
# CONFIG_PKG_USING_ARDUINO_TENSORFLOW_LITE_MICRO is not set
+# CONFIG_PKG_USING_ARDUINO_RUNNINGMEDIAN is not set
+# end of Data Processing
#
# Data Storage
@@ -1021,6 +1309,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
#
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_PN532 is not set
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_SI4713 is not set
+# end of Communication
#
# Device Control
@@ -1032,12 +1321,14 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_DS1841 is not set
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_DS3502 is not set
# CONFIG_PKG_USING_ARDUINO_SEEED_PCF85063TP is not set
+# end of Device Control
#
# Other
#
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_MFRC630 is not set
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_SI5351 is not set
+# end of Other
#
# Signal IO
@@ -1050,10 +1341,14 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_MCP3008 is not set
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_MCP4725 is not set
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_BD3491FS is not set
+# end of Signal IO
#
# Uncategorized
#
+# end of Arduino libraries
+# end of RT-Thread online packages
+
CONFIG_SOC_FAMILY_STM32=y
CONFIG_SOC_SERIES_STM32L0=y
CONFIG_BOARD_SERIES_STM32_NUCLEO_64=y
@@ -1066,16 +1361,20 @@ CONFIG_BOARD_SERIES_STM32_NUCLEO_64=y
# Onboard Peripheral Drivers
#
CONFIG_BSP_USING_USB_TO_USART=y
+# end of Onboard Peripheral Drivers
#
# On-chip Peripheral Drivers
#
CONFIG_BSP_USING_GPIO=y
CONFIG_BSP_USING_UART=y
+CONFIG_BSP_STM32_UART_V1_TX_TIMEOUT=2000
CONFIG_BSP_USING_UART2=y
# CONFIG_BSP_UART2_RX_USING_DMA is not set
# CONFIG_BSP_USING_UDID is not set
+# end of On-chip Peripheral Drivers
#
# Board extended module Drivers
#
+# end of Hardware Drivers Config
diff --git a/bsp/stm32/stm32l053-st-nucleo/README_zh.md b/bsp/stm32/stm32l053-st-nucleo/README_zh.md
index 35799d2715..63c92c3dff 100644
--- a/bsp/stm32/stm32l053-st-nucleo/README_zh.md
+++ b/bsp/stm32/stm32l053-st-nucleo/README_zh.md
@@ -66,6 +66,14 @@ NUCLEO-L053R8 开发板是 ST 官方推出的一款基于 ARM Cortex-M0+ 内核
本 BSP 为开发者提供 MDK5 和 IAR 工程,并且支持 GCC 开发环境。下面以 MDK5 开发环境为例,介绍如何将系统运行起来。
+**请注意!!!**
+
+在执行编译工作前请先打开ENV执行以下指令(该指令用于拉取必要的HAL库及CMSIS库,否则无法通过编译):
+
+```bash
+pkgs --update
+```
+
#### 硬件连接
使用数据线连接开发板到 PC,打开电源开关。
diff --git a/bsp/stm32/stm32l053-st-nucleo/SConstruct b/bsp/stm32/stm32l053-st-nucleo/SConstruct
index d7ad786f03..7ec774fd90 100644
--- a/bsp/stm32/stm32l053-st-nucleo/SConstruct
+++ b/bsp/stm32/stm32l053-st-nucleo/SConstruct
@@ -42,19 +42,13 @@ if os.path.exists(SDK_ROOT + '/libraries'):
else:
libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/libraries'
-SDK_LIB = libraries_path_prefix
-Export('SDK_LIB')
-
# prepare building environment
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
-stm32_library = 'STM32L0xx_HAL'
-rtconfig.BSP_LIBRARY_TYPE = stm32_library
+rtconfig.BSP_LIBRARY_TYPE = None
-# include libraries
-objs.extend(SConscript(os.path.join(libraries_path_prefix, stm32_library, 'SConscript'), variant_dir='build/libraries/'+stm32_library, duplicate=0))
# include drivers
-objs.extend(SConscript(os.path.join(libraries_path_prefix, 'HAL_Drivers', 'SConscript'),variant_dir='build/libraries/'+'HAL_Drivers', duplicate=0))
+objs.extend(SConscript(os.path.join(libraries_path_prefix, 'HAL_Drivers', 'SConscript'),variant_dir='build/libraries/HAL_Drivers', duplicate=0))
# make a building
DoBuilding(TARGET, objs)
diff --git a/bsp/stm32/stm32l053-st-nucleo/board/SConscript b/bsp/stm32/stm32l053-st-nucleo/board/SConscript
index 563c041422..1dfb4e3aa2 100644
--- a/bsp/stm32/stm32l053-st-nucleo/board/SConscript
+++ b/bsp/stm32/stm32l053-st-nucleo/board/SConscript
@@ -1,9 +1,6 @@
import os
-import rtconfig
from building import *
-Import('SDK_LIB')
-
cwd = GetCurrentDir()
# add general drivers
@@ -13,17 +10,16 @@ CubeMX_Config/Src/stm32l0xx_hal_msp.c
''')
path = [cwd]
-path += [cwd + '/CubeMX_Config/Inc']
+path += [os.path.join(cwd, 'CubeMX_Config', 'Inc')]
-startup_path_prefix = SDK_LIB
+CPPDEFINES = ['STM32L053xx']
+group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
-if rtconfig.PLATFORM in ['gcc']:
- src += [startup_path_prefix + '/STM32L0xx_HAL/CMSIS/Device/ST/STM32L0xx/Source/Templates/gcc/startup_stm32l053xx.s']
-elif rtconfig.PLATFORM in ['armcc', 'armclang']:
- src += [startup_path_prefix + '/STM32L0xx_HAL/CMSIS/Device/ST/STM32L0xx/Source/Templates/arm/startup_stm32l053xx.s']
-elif rtconfig.PLATFORM in ['iccarm']:
- src += [startup_path_prefix + '/STM32L0xx_HAL/CMSIS/Device/ST/STM32L0xx/Source/Templates/iar/startup_stm32l053xx.s']
-
-group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path)
+# if os.path.isfile(os.path.join(cwd, "ports", 'SConscript')):
+# group = group + SConscript(os.path.join("ports", 'SConscript'))
+list = os.listdir(cwd)
+for item in list:
+ if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
+ group = group + SConscript(os.path.join(item, 'SConscript'))
Return('group')
diff --git a/bsp/stm32/stm32l053-st-nucleo/rtconfig.h b/bsp/stm32/stm32l053-st-nucleo/rtconfig.h
index 416b9b312d..89fd7d3962 100644
--- a/bsp/stm32/stm32l053-st-nucleo/rtconfig.h
+++ b/bsp/stm32/stm32l053-st-nucleo/rtconfig.h
@@ -1,14 +1,69 @@
#ifndef RT_CONFIG_H__
#define RT_CONFIG_H__
-/* Automatically generated file; DO NOT EDIT. */
-/* RT-Thread Configuration */
-
#define SOC_STM32L053R8
#define BOARD_STM32L053_NUCLEO
/* RT-Thread Kernel */
+/* klibc options */
+
+/* rt_vsnprintf options */
+
+/* end of rt_vsnprintf options */
+
+/* rt_vsscanf options */
+
+/* end of rt_vsscanf options */
+
+/* rt_memset options */
+
+/* end of rt_memset options */
+
+/* rt_memcpy options */
+
+/* end of rt_memcpy options */
+
+/* rt_memmove options */
+
+/* end of rt_memmove options */
+
+/* rt_memcmp options */
+
+/* end of rt_memcmp options */
+
+/* rt_strstr options */
+
+/* end of rt_strstr options */
+
+/* rt_strcasecmp options */
+
+/* end of rt_strcasecmp options */
+
+/* rt_strncpy options */
+
+/* end of rt_strncpy options */
+
+/* rt_strcpy options */
+
+/* end of rt_strcpy options */
+
+/* rt_strncmp options */
+
+/* end of rt_strncmp options */
+
+/* rt_strcmp options */
+
+/* end of rt_strcmp options */
+
+/* rt_strlen options */
+
+/* end of rt_strlen options */
+
+/* rt_strnlen options */
+
+/* end of rt_strnlen options */
+/* end of klibc options */
#define RT_NAME_MAX 8
#define RT_CPUS_NR 1
#define RT_ALIGN_SIZE 8
@@ -22,9 +77,11 @@
#define RT_IDLE_HOOK_LIST_SIZE 4
#define IDLE_THREAD_STACK_SIZE 256
-/* kservice optimization */
+/* kservice options */
+/* end of kservice options */
#define RT_USING_DEBUG
+#define RT_DEBUGING_ASSERT
#define RT_DEBUGING_COLOR
#define RT_DEBUGING_CONTEXT
@@ -35,6 +92,7 @@
#define RT_USING_EVENT
#define RT_USING_MAILBOX
#define RT_USING_MESSAGEQUEUE
+/* end of Inter-Thread communication */
/* Memory Management */
@@ -42,12 +100,14 @@
#define RT_USING_SMALL_MEM
#define RT_USING_SMALL_MEM_AS_HEAP
#define RT_USING_HEAP
+/* end of Memory Management */
#define RT_USING_DEVICE
#define RT_USING_CONSOLE
#define RT_CONSOLEBUF_SIZE 256
#define RT_CONSOLE_DEVICE_NAME "uart2"
-#define RT_VER_NUM 0x50100
+#define RT_VER_NUM 0x50201
#define RT_BACKTRACE_LEVEL_MAX_NR 32
+/* end of RT-Thread Kernel */
#define ARCH_ARM
#define ARCH_ARM_CORTEX_M
#define ARCH_ARM_CORTEX_M0
@@ -75,6 +135,7 @@
/* DFS: device virtual file system */
+/* end of DFS: device virtual file system */
/* Device Drivers */
@@ -85,9 +146,7 @@
#define RT_SERIAL_USING_DMA
#define RT_SERIAL_RB_BUFSZ 64
#define RT_USING_PIN
-
-/* Using USB */
-
+/* end of Device Drivers */
/* C/C++ and POSIX layer */
@@ -99,6 +158,8 @@
#define RT_LIBC_TZ_DEFAULT_HOUR 8
#define RT_LIBC_TZ_DEFAULT_MIN 0
#define RT_LIBC_TZ_DEFAULT_SEC 0
+/* end of Timezone and Daylight Saving Time */
+/* end of ISO-ANSI C layer */
/* POSIX (Portable Operating System Interface) layer */
@@ -108,18 +169,30 @@
/* Socket is in the 'Network' category */
+/* end of Interprocess Communication (IPC) */
+/* end of POSIX (Portable Operating System Interface) layer */
+/* end of C/C++ and POSIX layer */
/* Network */
+/* end of Network */
/* Memory protection */
+/* end of Memory protection */
/* Utilities */
+/* end of Utilities */
+
+/* Using USB legacy version */
+
+/* end of Using USB legacy version */
+/* end of RT-Thread Components */
/* RT-Thread Utestcases */
+/* end of RT-Thread Utestcases */
/* RT-Thread online packages */
@@ -130,57 +203,80 @@
/* Marvell WiFi */
+/* end of Marvell WiFi */
/* Wiced WiFi */
+/* end of Wiced WiFi */
/* CYW43012 WiFi */
+/* end of CYW43012 WiFi */
/* BL808 WiFi */
+/* end of BL808 WiFi */
/* CYW43439 WiFi */
+/* end of CYW43439 WiFi */
+/* end of Wi-Fi */
/* IoT Cloud */
+/* end of IoT Cloud */
+/* end of IoT - internet of things */
/* security packages */
+/* end of security packages */
/* language packages */
/* JSON: JavaScript Object Notation, a lightweight data-interchange format */
+/* end of JSON: JavaScript Object Notation, a lightweight data-interchange format */
/* XML: Extensible Markup Language */
+/* end of XML: Extensible Markup Language */
+/* end of language packages */
/* multimedia packages */
/* LVGL: powerful and easy-to-use embedded GUI library */
+/* end of LVGL: powerful and easy-to-use embedded GUI library */
/* u8g2: a monochrome graphic library */
+/* end of u8g2: a monochrome graphic library */
+/* end of multimedia packages */
/* tools packages */
+/* end of tools packages */
/* system packages */
/* enhanced kernel services */
+/* end of enhanced kernel services */
/* acceleration: Assembly language or algorithmic acceleration packages */
+/* end of acceleration: Assembly language or algorithmic acceleration packages */
/* CMSIS: ARM Cortex-M Microcontroller Software Interface Standard */
+#define PKG_USING_CMSIS_CORE
+#define PKG_USING_CMSIS_CORE_LATEST_VERSION
+/* end of CMSIS: ARM Cortex-M Microcontroller Software Interface Standard */
/* Micrium: Micrium software products porting for RT-Thread */
+/* end of Micrium: Micrium software products porting for RT-Thread */
+/* end of system packages */
/* peripheral libraries and drivers */
@@ -188,66 +284,106 @@
/* STM32 HAL & SDK Drivers */
+#define PKG_USING_STM32L0_HAL_DRIVER
+#define PKG_USING_STM32L0_HAL_DRIVER_LATEST_VERSION
+#define PKG_USING_STM32L0_CMSIS_DRIVER
+#define PKG_USING_STM32L0_CMSIS_DRIVER_LATEST_VERSION
+/* end of STM32 HAL & SDK Drivers */
+
+/* Infineon HAL Packages */
+
+/* end of Infineon HAL Packages */
/* Kendryte SDK */
+/* end of Kendryte SDK */
+
+/* WCH HAL & SDK Drivers */
+
+/* end of WCH HAL & SDK Drivers */
+
+/* AT32 HAL & SDK Drivers */
+
+/* end of AT32 HAL & SDK Drivers */
+/* end of HAL & SDK Drivers */
/* sensors drivers */
+/* end of sensors drivers */
/* touch drivers */
+/* end of touch drivers */
+/* end of peripheral libraries and drivers */
/* AI packages */
+/* end of AI packages */
/* Signal Processing and Control Algorithm Packages */
+/* end of Signal Processing and Control Algorithm Packages */
/* miscellaneous packages */
/* project laboratory */
+/* end of project laboratory */
+
/* samples: kernel and components samples */
+/* end of samples: kernel and components samples */
/* entertainment: terminal games and other interesting software packages */
+/* end of entertainment: terminal games and other interesting software packages */
+/* end of miscellaneous packages */
/* Arduino libraries */
/* Projects and Demos */
+/* end of Projects and Demos */
/* Sensors */
+/* end of Sensors */
/* Display */
+/* end of Display */
/* Timing */
+/* end of Timing */
/* Data Processing */
+/* end of Data Processing */
/* Data Storage */
/* Communication */
+/* end of Communication */
/* Device Control */
+/* end of Device Control */
/* Other */
+/* end of Other */
/* Signal IO */
+/* end of Signal IO */
/* Uncategorized */
+/* end of Arduino libraries */
+/* end of RT-Thread online packages */
#define SOC_FAMILY_STM32
#define SOC_SERIES_STM32L0
#define BOARD_SERIES_STM32_NUCLEO_64
@@ -257,14 +393,18 @@
/* Onboard Peripheral Drivers */
#define BSP_USING_USB_TO_USART
+/* end of Onboard Peripheral Drivers */
/* On-chip Peripheral Drivers */
#define BSP_USING_GPIO
#define BSP_USING_UART
+#define BSP_STM32_UART_V1_TX_TIMEOUT 2000
#define BSP_USING_UART2
+/* end of On-chip Peripheral Drivers */
/* Board extended module Drivers */
+/* end of Hardware Drivers Config */
#endif