mirror of
https://github.com/xiaozhou233/RiverWaterQualityMonitoring.git
synced 2026-12-05 13:05:53 +08:00
BugFix和添加ADC
This commit is contained in:
1 parent
5af7a0b4a2
commit
bc855b2712
10 files changed
+9542
-23
No files matched your search
@@ -1,8 +1,8 @@
|
|||||||
[PreviousLibFiles]
|
[PreviousLibFiles]
|
||||||
LibFiles=Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_spi.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_spi.h;Drivers\STM32F1xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_def.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_bus.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_system.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_utils.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio_ex.h;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_exti.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_exti.h;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_spi.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_exti.c;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_spi.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_spi.h;Drivers\STM32F1xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_def.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_bus.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_system.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_utils.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio_ex.h;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_exti.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_exti.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f103xb.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f1xx.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\system_stm32f1xx.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\system_stm32f1xx.h;Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\system_stm32f1xx.c;Drivers\CMSIS\Include\cmsis_armcc.h;Drivers\CMSIS\Include\cmsis_armclang.h;Drivers\CMSIS\Include\cmsis_compiler.h;Drivers\CMSIS\Include\cmsis_gcc.h;Drivers\CMSIS\Include\cmsis_iccarm.h;Drivers\CMSIS\Include\cmsis_version.h;Drivers\CMSIS\Include\core_armv8mbl.h;Drivers\CMSIS\Include\core_armv8mml.h;Drivers\CMSIS\Include\core_cm0.h;Drivers\CMSIS\Include\core_cm0plus.h;Drivers\CMSIS\Include\core_cm1.h;Drivers\CMSIS\Include\core_cm23.h;Drivers\CMSIS\Include\core_cm3.h;Drivers\CMSIS\Include\core_cm33.h;Drivers\CMSIS\Include\core_cm4.h;Drivers\CMSIS\Include\core_cm7.h;Drivers\CMSIS\Include\core_sc000.h;Drivers\CMSIS\Include\core_sc300.h;Drivers\CMSIS\Include\mpu_armv7.h;Drivers\CMSIS\Include\mpu_armv8.h;Drivers\CMSIS\Include\tz_context.h;
|
LibFiles=Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_adc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_adc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_adc_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_def.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_bus.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_system.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_utils.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio_ex.h;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_exti.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_exti.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_spi.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_spi.h;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_adc.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_adc_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_exti.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_spi.c;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_adc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_adc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_adc_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_def.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_bus.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_system.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_utils.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio_ex.h;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_exti.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_exti.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_spi.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_spi.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f103xb.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f1xx.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\system_stm32f1xx.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\system_stm32f1xx.h;Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\system_stm32f1xx.c;Drivers\CMSIS\Include\cmsis_armcc.h;Drivers\CMSIS\Include\cmsis_armclang.h;Drivers\CMSIS\Include\cmsis_compiler.h;Drivers\CMSIS\Include\cmsis_gcc.h;Drivers\CMSIS\Include\cmsis_iccarm.h;Drivers\CMSIS\Include\cmsis_version.h;Drivers\CMSIS\Include\core_armv8mbl.h;Drivers\CMSIS\Include\core_armv8mml.h;Drivers\CMSIS\Include\core_cm0.h;Drivers\CMSIS\Include\core_cm0plus.h;Drivers\CMSIS\Include\core_cm1.h;Drivers\CMSIS\Include\core_cm23.h;Drivers\CMSIS\Include\core_cm3.h;Drivers\CMSIS\Include\core_cm33.h;Drivers\CMSIS\Include\core_cm4.h;Drivers\CMSIS\Include\core_cm7.h;Drivers\CMSIS\Include\core_sc000.h;Drivers\CMSIS\Include\core_sc300.h;Drivers\CMSIS\Include\mpu_armv7.h;Drivers\CMSIS\Include\mpu_armv8.h;Drivers\CMSIS\Include\tz_context.h;
|
||||||
|
|
||||||
[PreviousUsedCubeIDEFiles]
|
[PreviousUsedCubeIDEFiles]
|
||||||
SourceFiles=Core\Src\main.c;Core\Src\stm32f1xx_it.c;Core\Src\stm32f1xx_hal_msp.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_spi.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_exti.c;Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\system_stm32f1xx.c;Core\Src\system_stm32f1xx.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_spi.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_exti.c;Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\system_stm32f1xx.c;Core\Src\system_stm32f1xx.c;;;
|
SourceFiles=Core\Src\main.c;Core\Src\stm32f1xx_it.c;Core\Src\stm32f1xx_hal_msp.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_adc.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_adc_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_exti.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_spi.c;Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\system_stm32f1xx.c;Core\Src\system_stm32f1xx.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_adc.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_adc_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_exti.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_spi.c;Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\system_stm32f1xx.c;Core\Src\system_stm32f1xx.c;;;
|
||||||
HeaderPath=Drivers\STM32F1xx_HAL_Driver\Inc;Drivers\STM32F1xx_HAL_Driver\Inc\Legacy;Drivers\CMSIS\Device\ST\STM32F1xx\Include;Drivers\CMSIS\Include;Core\Inc;
|
HeaderPath=Drivers\STM32F1xx_HAL_Driver\Inc;Drivers\STM32F1xx_HAL_Driver\Inc\Legacy;Drivers\CMSIS\Device\ST\STM32F1xx\Include;Drivers\CMSIS\Include;Core\Inc;
|
||||||
CDefines=USE_HAL_DRIVER;STM32F103xB;USE_HAL_DRIVER;USE_HAL_DRIVER;
|
CDefines=USE_HAL_DRIVER;STM32F103xB;USE_HAL_DRIVER;USE_HAL_DRIVER;
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define HAL_MODULE_ENABLED
|
#define HAL_MODULE_ENABLED
|
||||||
/*#define HAL_ADC_MODULE_ENABLED */
|
#define HAL_ADC_MODULE_ENABLED
|
||||||
/*#define HAL_CRYP_MODULE_ENABLED */
|
/*#define HAL_CRYP_MODULE_ENABLED */
|
||||||
/*#define HAL_CAN_MODULE_ENABLED */
|
/*#define HAL_CAN_MODULE_ENABLED */
|
||||||
/*#define HAL_CAN_LEGACY_MODULE_ENABLED */
|
/*#define HAL_CAN_LEGACY_MODULE_ENABLED */
|
||||||
|
|||||||
@@ -41,6 +41,8 @@
|
|||||||
/* USER CODE END PM */
|
/* USER CODE END PM */
|
||||||
|
|
||||||
/* Private variables ---------------------------------------------------------*/
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
ADC_HandleTypeDef hadc1;
|
||||||
|
|
||||||
SPI_HandleTypeDef hspi1;
|
SPI_HandleTypeDef hspi1;
|
||||||
|
|
||||||
/* USER CODE BEGIN PV */
|
/* USER CODE BEGIN PV */
|
||||||
@@ -51,6 +53,7 @@ SPI_HandleTypeDef hspi1;
|
|||||||
void SystemClock_Config(void);
|
void SystemClock_Config(void);
|
||||||
static void MX_GPIO_Init(void);
|
static void MX_GPIO_Init(void);
|
||||||
static void MX_SPI1_Init(void);
|
static void MX_SPI1_Init(void);
|
||||||
|
static void MX_ADC1_Init(void);
|
||||||
/* USER CODE BEGIN PFP */
|
/* USER CODE BEGIN PFP */
|
||||||
|
|
||||||
/* USER CODE END PFP */
|
/* USER CODE END PFP */
|
||||||
@@ -90,6 +93,7 @@ int main(void)
|
|||||||
/* Initialize all configured peripherals */
|
/* Initialize all configured peripherals */
|
||||||
MX_GPIO_Init();
|
MX_GPIO_Init();
|
||||||
MX_SPI1_Init();
|
MX_SPI1_Init();
|
||||||
|
MX_ADC1_Init();
|
||||||
/* USER CODE BEGIN 2 */
|
/* USER CODE BEGIN 2 */
|
||||||
ST7735_Init();
|
ST7735_Init();
|
||||||
/* USER CODE END 2 */
|
/* USER CODE END 2 */
|
||||||
@@ -98,12 +102,13 @@ int main(void)
|
|||||||
/* USER CODE BEGIN WHILE */
|
/* USER CODE BEGIN WHILE */
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
/* USER CODE END WHILE */
|
|
||||||
ST7735_FillScreen(ST7735_BLACK);
|
ST7735_FillScreen(ST7735_BLACK);
|
||||||
ST7735_WriteString(0, 0, "Font_7x10, red on black, lorem ipsum dolor sit amet", Font_7x10, ST7735_RED, ST7735_BLACK);
|
ST7735_WriteString(0, 0, "Font_7x10, red on black, lorem ipsum dolor sit amet", Font_7x10, ST7735_RED, ST7735_BLACK);
|
||||||
ST7735_WriteString(0, 3*10, "Font_11x18, green, lorem ipsum", Font_11x18, ST7735_GREEN, ST7735_BLACK);
|
ST7735_WriteString(0, 3*10, "Font_11x18, green, lorem ipsum", Font_11x18, ST7735_GREEN, ST7735_BLACK);
|
||||||
ST7735_WriteString(0, 3*10+3*18, "Font_16x26", Font_16x26, ST7735_BLUE, ST7735_BLACK);
|
ST7735_WriteString(0, 3*10+3*18, "Font_16x26", Font_16x26, ST7735_BLUE, ST7735_BLACK);
|
||||||
HAL_Delay(2000);
|
HAL_Delay(2000);
|
||||||
|
/* USER CODE END WHILE */
|
||||||
|
|
||||||
/* USER CODE BEGIN 3 */
|
/* USER CODE BEGIN 3 */
|
||||||
}
|
}
|
||||||
/* USER CODE END 3 */
|
/* USER CODE END 3 */
|
||||||
@@ -117,6 +122,7 @@ void SystemClock_Config(void)
|
|||||||
{
|
{
|
||||||
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
||||||
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
||||||
|
RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
|
||||||
|
|
||||||
/** Initializes the RCC Oscillators according to the specified parameters
|
/** Initializes the RCC Oscillators according to the specified parameters
|
||||||
* in the RCC_OscInitTypeDef structure.
|
* in the RCC_OscInitTypeDef structure.
|
||||||
@@ -143,6 +149,59 @@ void SystemClock_Config(void)
|
|||||||
{
|
{
|
||||||
Error_Handler();
|
Error_Handler();
|
||||||
}
|
}
|
||||||
|
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC;
|
||||||
|
PeriphClkInit.AdcClockSelection = RCC_ADCPCLK2_DIV2;
|
||||||
|
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ADC1 Initialization Function
|
||||||
|
* @param None
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
static void MX_ADC1_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN ADC1_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END ADC1_Init 0 */
|
||||||
|
|
||||||
|
ADC_ChannelConfTypeDef sConfig = {0};
|
||||||
|
|
||||||
|
/* USER CODE BEGIN ADC1_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END ADC1_Init 1 */
|
||||||
|
|
||||||
|
/** Common config
|
||||||
|
*/
|
||||||
|
hadc1.Instance = ADC1;
|
||||||
|
hadc1.Init.ScanConvMode = ADC_SCAN_DISABLE;
|
||||||
|
hadc1.Init.ContinuousConvMode = DISABLE;
|
||||||
|
hadc1.Init.DiscontinuousConvMode = DISABLE;
|
||||||
|
hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START;
|
||||||
|
hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT;
|
||||||
|
hadc1.Init.NbrOfConversion = 1;
|
||||||
|
if (HAL_ADC_Init(&hadc1) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Configure Regular Channel
|
||||||
|
*/
|
||||||
|
sConfig.Channel = ADC_CHANNEL_0;
|
||||||
|
sConfig.Rank = ADC_REGULAR_RANK_1;
|
||||||
|
sConfig.SamplingTime = ADC_SAMPLETIME_239CYCLES_5;
|
||||||
|
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
/* USER CODE BEGIN ADC1_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END ADC1_Init 2 */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -81,6 +81,67 @@ void HAL_MspInit(void)
|
|||||||
/* USER CODE END MspInit 1 */
|
/* USER CODE END MspInit 1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ADC MSP Initialization
|
||||||
|
* This function configures the hardware resources used in this example
|
||||||
|
* @param hadc: ADC handle pointer
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc)
|
||||||
|
{
|
||||||
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
if(hadc->Instance==ADC1)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN ADC1_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END ADC1_MspInit 0 */
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
__HAL_RCC_ADC1_CLK_ENABLE();
|
||||||
|
|
||||||
|
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||||
|
/**ADC1 GPIO Configuration
|
||||||
|
PA0-WKUP ------> ADC1_IN0
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_0;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||||
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN ADC1_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END ADC1_MspInit 1 */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ADC MSP De-Initialization
|
||||||
|
* This function freeze the hardware resources used in this example
|
||||||
|
* @param hadc: ADC handle pointer
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void HAL_ADC_MspDeInit(ADC_HandleTypeDef* hadc)
|
||||||
|
{
|
||||||
|
if(hadc->Instance==ADC1)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN ADC1_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END ADC1_MspDeInit 0 */
|
||||||
|
/* Peripheral clock disable */
|
||||||
|
__HAL_RCC_ADC1_CLK_DISABLE();
|
||||||
|
|
||||||
|
/**ADC1 GPIO Configuration
|
||||||
|
PA0-WKUP ------> ADC1_IN0
|
||||||
|
*/
|
||||||
|
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_0);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN ADC1_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END ADC1_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief SPI MSP Initialization
|
* @brief SPI MSP Initialization
|
||||||
* This function configures the hardware resources used in this example
|
* This function configures the hardware resources used in this example
|
||||||
|
|||||||
@@ -0,0 +1,1000 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32f1xx_hal_adc.h
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief Header file containing functions prototypes of ADC HAL library.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Copyright (c) 2016 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef __STM32F1xx_HAL_ADC_H
|
||||||
|
#define __STM32F1xx_HAL_ADC_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "stm32f1xx_hal_def.h"
|
||||||
|
/** @addtogroup STM32F1xx_HAL_Driver
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup ADC
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
/** @defgroup ADC_Exported_Types ADC Exported Types
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Structure definition of ADC and regular group initialization
|
||||||
|
* @note Parameters of this structure are shared within 2 scopes:
|
||||||
|
* - Scope entire ADC (affects regular and injected groups): DataAlign, ScanConvMode.
|
||||||
|
* - Scope regular group: ContinuousConvMode, NbrOfConversion, DiscontinuousConvMode, NbrOfDiscConversion, ExternalTrigConvEdge, ExternalTrigConv.
|
||||||
|
* @note The setting of these parameters with function HAL_ADC_Init() is conditioned to ADC state.
|
||||||
|
* ADC can be either disabled or enabled without conversion on going on regular group.
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint32_t DataAlign; /*!< Specifies ADC data alignment to right (MSB on register bit 11 and LSB on register bit 0) (default setting)
|
||||||
|
or to left (if regular group: MSB on register bit 15 and LSB on register bit 4, if injected group (MSB kept as signed value due to potential negative value after offset application): MSB on register bit 14 and LSB on register bit 3).
|
||||||
|
This parameter can be a value of @ref ADC_Data_align */
|
||||||
|
uint32_t ScanConvMode; /*!< Configures the sequencer of regular and injected groups.
|
||||||
|
This parameter can be associated to parameter 'DiscontinuousConvMode' to have main sequence subdivided in successive parts.
|
||||||
|
If disabled: Conversion is performed in single mode (one channel converted, the one defined in rank 1).
|
||||||
|
Parameters 'NbrOfConversion' and 'InjectedNbrOfConversion' are discarded (equivalent to set to 1).
|
||||||
|
If enabled: Conversions are performed in sequence mode (multiple ranks defined by 'NbrOfConversion'/'InjectedNbrOfConversion' and each channel rank).
|
||||||
|
Scan direction is upward: from rank1 to rank 'n'.
|
||||||
|
This parameter can be a value of @ref ADC_Scan_mode
|
||||||
|
Note: For regular group, this parameter should be enabled in conversion either by polling (HAL_ADC_Start with Discontinuous mode and NbrOfDiscConversion=1)
|
||||||
|
or by DMA (HAL_ADC_Start_DMA), but not by interruption (HAL_ADC_Start_IT): in scan mode, interruption is triggered only on the
|
||||||
|
the last conversion of the sequence. All previous conversions would be overwritten by the last one.
|
||||||
|
Injected group used with scan mode has not this constraint: each rank has its own result register, no data is overwritten. */
|
||||||
|
FunctionalState ContinuousConvMode; /*!< Specifies whether the conversion is performed in single mode (one conversion) or continuous mode for regular group,
|
||||||
|
after the selected trigger occurred (software start or external trigger).
|
||||||
|
This parameter can be set to ENABLE or DISABLE. */
|
||||||
|
uint32_t NbrOfConversion; /*!< Specifies the number of ranks that will be converted within the regular group sequencer.
|
||||||
|
To use regular group sequencer and convert several ranks, parameter 'ScanConvMode' must be enabled.
|
||||||
|
This parameter must be a number between Min_Data = 1 and Max_Data = 16. */
|
||||||
|
FunctionalState DiscontinuousConvMode; /*!< Specifies whether the conversions sequence of regular group is performed in Complete-sequence/Discontinuous-sequence (main sequence subdivided in successive parts).
|
||||||
|
Discontinuous mode is used only if sequencer is enabled (parameter 'ScanConvMode'). If sequencer is disabled, this parameter is discarded.
|
||||||
|
Discontinuous mode can be enabled only if continuous mode is disabled. If continuous mode is enabled, this parameter setting is discarded.
|
||||||
|
This parameter can be set to ENABLE or DISABLE. */
|
||||||
|
uint32_t NbrOfDiscConversion; /*!< Specifies the number of discontinuous conversions in which the main sequence of regular group (parameter NbrOfConversion) will be subdivided.
|
||||||
|
If parameter 'DiscontinuousConvMode' is disabled, this parameter is discarded.
|
||||||
|
This parameter must be a number between Min_Data = 1 and Max_Data = 8. */
|
||||||
|
uint32_t ExternalTrigConv; /*!< Selects the external event used to trigger the conversion start of regular group.
|
||||||
|
If set to ADC_SOFTWARE_START, external triggers are disabled.
|
||||||
|
If set to external trigger source, triggering is on event rising edge.
|
||||||
|
This parameter can be a value of @ref ADC_External_trigger_source_Regular */
|
||||||
|
}ADC_InitTypeDef;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Structure definition of ADC channel for regular group
|
||||||
|
* @note The setting of these parameters with function HAL_ADC_ConfigChannel() is conditioned to ADC state.
|
||||||
|
* ADC can be either disabled or enabled without conversion on going on regular group.
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint32_t Channel; /*!< Specifies the channel to configure into ADC regular group.
|
||||||
|
This parameter can be a value of @ref ADC_channels
|
||||||
|
Note: Depending on devices, some channels may not be available on package pins. Refer to device datasheet for channels availability.
|
||||||
|
Note: On STM32F1 devices with several ADC: Only ADC1 can access internal measurement channels (VrefInt/TempSensor)
|
||||||
|
Note: On STM32F10xx8 and STM32F10xxB devices: A low-amplitude voltage glitch may be generated (on ADC input 0) on the PA0 pin, when the ADC is converting with injection trigger.
|
||||||
|
It is advised to distribute the analog channels so that Channel 0 is configured as an injected channel.
|
||||||
|
Refer to errata sheet of these devices for more details. */
|
||||||
|
uint32_t Rank; /*!< Specifies the rank in the regular group sequencer
|
||||||
|
This parameter can be a value of @ref ADC_regular_rank
|
||||||
|
Note: In case of need to disable a channel or change order of conversion sequencer, rank containing a previous channel setting can be overwritten by the new channel setting (or parameter number of conversions can be adjusted) */
|
||||||
|
uint32_t SamplingTime; /*!< Sampling time value to be set for the selected channel.
|
||||||
|
Unit: ADC clock cycles
|
||||||
|
Conversion time is the addition of sampling time and processing time (12.5 ADC clock cycles at ADC resolution 12 bits).
|
||||||
|
This parameter can be a value of @ref ADC_sampling_times
|
||||||
|
Caution: This parameter updates the parameter property of the channel, that can be used into regular and/or injected groups.
|
||||||
|
If this same channel has been previously configured in the other group (regular/injected), it will be updated to last setting.
|
||||||
|
Note: In case of usage of internal measurement channels (VrefInt/TempSensor),
|
||||||
|
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 (values rough order: 5us to 17.1us min). */
|
||||||
|
}ADC_ChannelConfTypeDef;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ADC Configuration analog watchdog definition
|
||||||
|
* @note The setting of these parameters with function is conditioned to ADC state.
|
||||||
|
* ADC state can be either disabled or enabled without conversion on going on regular and injected groups.
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint32_t WatchdogMode; /*!< Configures the ADC analog watchdog mode: single/all channels, regular/injected group.
|
||||||
|
This parameter can be a value of @ref ADC_analog_watchdog_mode. */
|
||||||
|
uint32_t Channel; /*!< Selects which ADC channel to monitor by analog watchdog.
|
||||||
|
This parameter has an effect only if watchdog mode is configured on single channel (parameter WatchdogMode)
|
||||||
|
This parameter can be a value of @ref ADC_channels. */
|
||||||
|
FunctionalState ITMode; /*!< Specifies whether the analog watchdog is configured in interrupt or polling mode.
|
||||||
|
This parameter can be set to ENABLE or DISABLE */
|
||||||
|
uint32_t HighThreshold; /*!< Configures the ADC analog watchdog High threshold value.
|
||||||
|
This parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF. */
|
||||||
|
uint32_t LowThreshold; /*!< Configures the ADC analog watchdog High threshold value.
|
||||||
|
This parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF. */
|
||||||
|
uint32_t WatchdogNumber; /*!< Reserved for future use, can be set to 0 */
|
||||||
|
}ADC_AnalogWDGConfTypeDef;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief HAL ADC state machine: ADC states definition (bitfields)
|
||||||
|
*/
|
||||||
|
/* States of ADC global scope */
|
||||||
|
#define HAL_ADC_STATE_RESET 0x00000000U /*!< ADC not yet initialized or disabled */
|
||||||
|
#define HAL_ADC_STATE_READY 0x00000001U /*!< ADC peripheral ready for use */
|
||||||
|
#define HAL_ADC_STATE_BUSY_INTERNAL 0x00000002U /*!< ADC is busy to internal process (initialization, calibration) */
|
||||||
|
#define HAL_ADC_STATE_TIMEOUT 0x00000004U /*!< TimeOut occurrence */
|
||||||
|
|
||||||
|
/* States of ADC errors */
|
||||||
|
#define HAL_ADC_STATE_ERROR_INTERNAL 0x00000010U /*!< Internal error occurrence */
|
||||||
|
#define HAL_ADC_STATE_ERROR_CONFIG 0x00000020U /*!< Configuration error occurrence */
|
||||||
|
#define HAL_ADC_STATE_ERROR_DMA 0x00000040U /*!< DMA error occurrence */
|
||||||
|
|
||||||
|
/* States of ADC group regular */
|
||||||
|
#define HAL_ADC_STATE_REG_BUSY 0x00000100U /*!< A conversion on group regular is ongoing or can occur (either by continuous mode,
|
||||||
|
external trigger, low power auto power-on, multimode ADC master control) */
|
||||||
|
#define HAL_ADC_STATE_REG_EOC 0x00000200U /*!< Conversion data available on group regular */
|
||||||
|
#define HAL_ADC_STATE_REG_OVR 0x00000400U /*!< Not available on STM32F1 device: Overrun occurrence */
|
||||||
|
#define HAL_ADC_STATE_REG_EOSMP 0x00000800U /*!< Not available on STM32F1 device: End Of Sampling flag raised */
|
||||||
|
|
||||||
|
/* States of ADC group injected */
|
||||||
|
#define HAL_ADC_STATE_INJ_BUSY 0x00001000U /*!< A conversion on group injected is ongoing or can occur (either by auto-injection mode,
|
||||||
|
external trigger, low power auto power-on, multimode ADC master control) */
|
||||||
|
#define HAL_ADC_STATE_INJ_EOC 0x00002000U /*!< Conversion data available on group injected */
|
||||||
|
#define HAL_ADC_STATE_INJ_JQOVF 0x00004000U /*!< Not available on STM32F1 device: Injected queue overflow occurrence */
|
||||||
|
|
||||||
|
/* States of ADC analog watchdogs */
|
||||||
|
#define HAL_ADC_STATE_AWD1 0x00010000U /*!< Out-of-window occurrence of analog watchdog 1 */
|
||||||
|
#define HAL_ADC_STATE_AWD2 0x00020000U /*!< Not available on STM32F1 device: Out-of-window occurrence of analog watchdog 2 */
|
||||||
|
#define HAL_ADC_STATE_AWD3 0x00040000U /*!< Not available on STM32F1 device: Out-of-window occurrence of analog watchdog 3 */
|
||||||
|
|
||||||
|
/* States of ADC multi-mode */
|
||||||
|
#define HAL_ADC_STATE_MULTIMODE_SLAVE 0x00100000U /*!< ADC in multimode slave state, controlled by another ADC master ( */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ADC handle Structure definition
|
||||||
|
*/
|
||||||
|
typedef struct __ADC_HandleTypeDef
|
||||||
|
{
|
||||||
|
ADC_TypeDef *Instance; /*!< Register base address */
|
||||||
|
|
||||||
|
ADC_InitTypeDef Init; /*!< ADC required parameters */
|
||||||
|
|
||||||
|
DMA_HandleTypeDef *DMA_Handle; /*!< Pointer DMA Handler */
|
||||||
|
|
||||||
|
HAL_LockTypeDef Lock; /*!< ADC locking object */
|
||||||
|
|
||||||
|
__IO uint32_t State; /*!< ADC communication state (bitmap of ADC states) */
|
||||||
|
|
||||||
|
__IO uint32_t ErrorCode; /*!< ADC Error code */
|
||||||
|
|
||||||
|
#if (USE_HAL_ADC_REGISTER_CALLBACKS == 1)
|
||||||
|
void (* ConvCpltCallback)(struct __ADC_HandleTypeDef *hadc); /*!< ADC conversion complete callback */
|
||||||
|
void (* ConvHalfCpltCallback)(struct __ADC_HandleTypeDef *hadc); /*!< ADC conversion DMA half-transfer callback */
|
||||||
|
void (* LevelOutOfWindowCallback)(struct __ADC_HandleTypeDef *hadc); /*!< ADC analog watchdog 1 callback */
|
||||||
|
void (* ErrorCallback)(struct __ADC_HandleTypeDef *hadc); /*!< ADC error callback */
|
||||||
|
void (* InjectedConvCpltCallback)(struct __ADC_HandleTypeDef *hadc); /*!< ADC group injected conversion complete callback */ /*!< ADC end of sampling callback */
|
||||||
|
void (* MspInitCallback)(struct __ADC_HandleTypeDef *hadc); /*!< ADC Msp Init callback */
|
||||||
|
void (* MspDeInitCallback)(struct __ADC_HandleTypeDef *hadc); /*!< ADC Msp DeInit callback */
|
||||||
|
#endif /* USE_HAL_ADC_REGISTER_CALLBACKS */
|
||||||
|
}ADC_HandleTypeDef;
|
||||||
|
|
||||||
|
|
||||||
|
#if (USE_HAL_ADC_REGISTER_CALLBACKS == 1)
|
||||||
|
/**
|
||||||
|
* @brief HAL ADC Callback ID enumeration definition
|
||||||
|
*/
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
HAL_ADC_CONVERSION_COMPLETE_CB_ID = 0x00U, /*!< ADC conversion complete callback ID */
|
||||||
|
HAL_ADC_CONVERSION_HALF_CB_ID = 0x01U, /*!< ADC conversion DMA half-transfer callback ID */
|
||||||
|
HAL_ADC_LEVEL_OUT_OF_WINDOW_1_CB_ID = 0x02U, /*!< ADC analog watchdog 1 callback ID */
|
||||||
|
HAL_ADC_ERROR_CB_ID = 0x03U, /*!< ADC error callback ID */
|
||||||
|
HAL_ADC_INJ_CONVERSION_COMPLETE_CB_ID = 0x04U, /*!< ADC group injected conversion complete callback ID */
|
||||||
|
HAL_ADC_MSPINIT_CB_ID = 0x09U, /*!< ADC Msp Init callback ID */
|
||||||
|
HAL_ADC_MSPDEINIT_CB_ID = 0x0AU /*!< ADC Msp DeInit callback ID */
|
||||||
|
} HAL_ADC_CallbackIDTypeDef;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief HAL ADC Callback pointer definition
|
||||||
|
*/
|
||||||
|
typedef void (*pADC_CallbackTypeDef)(ADC_HandleTypeDef *hadc); /*!< pointer to a ADC callback function */
|
||||||
|
|
||||||
|
#endif /* USE_HAL_ADC_REGISTER_CALLBACKS */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
|
||||||
|
/** @defgroup ADC_Exported_Constants ADC Exported Constants
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup ADC_Error_Code ADC Error Code
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define HAL_ADC_ERROR_NONE 0x00U /*!< No error */
|
||||||
|
#define HAL_ADC_ERROR_INTERNAL 0x01U /*!< ADC IP internal error: if problem of clocking,
|
||||||
|
enable/disable, erroneous state */
|
||||||
|
#define HAL_ADC_ERROR_OVR 0x02U /*!< Overrun error */
|
||||||
|
#define HAL_ADC_ERROR_DMA 0x04U /*!< DMA transfer error */
|
||||||
|
|
||||||
|
#if (USE_HAL_ADC_REGISTER_CALLBACKS == 1)
|
||||||
|
#define HAL_ADC_ERROR_INVALID_CALLBACK (0x10U) /*!< Invalid Callback error */
|
||||||
|
#endif /* USE_HAL_ADC_REGISTER_CALLBACKS */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/** @defgroup ADC_Data_align ADC data alignment
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define ADC_DATAALIGN_RIGHT 0x00000000U
|
||||||
|
#define ADC_DATAALIGN_LEFT ((uint32_t)ADC_CR2_ALIGN)
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup ADC_Scan_mode ADC scan mode
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/* Note: Scan mode values are not among binary choices ENABLE/DISABLE for */
|
||||||
|
/* compatibility with other STM32 devices having a sequencer with */
|
||||||
|
/* additional options. */
|
||||||
|
#define ADC_SCAN_DISABLE 0x00000000U
|
||||||
|
#define ADC_SCAN_ENABLE ((uint32_t)ADC_CR1_SCAN)
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup ADC_External_trigger_edge_Regular ADC external trigger enable for regular group
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define ADC_EXTERNALTRIGCONVEDGE_NONE 0x00000000U
|
||||||
|
#define ADC_EXTERNALTRIGCONVEDGE_RISING ((uint32_t)ADC_CR2_EXTTRIG)
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup ADC_channels ADC channels
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/* Note: Depending on devices, some channels may not be available on package */
|
||||||
|
/* pins. Refer to device datasheet for channels availability. */
|
||||||
|
#define ADC_CHANNEL_0 0x00000000U
|
||||||
|
#define ADC_CHANNEL_1 ((uint32_t)( ADC_SQR3_SQ1_0))
|
||||||
|
#define ADC_CHANNEL_2 ((uint32_t)( ADC_SQR3_SQ1_1 ))
|
||||||
|
#define ADC_CHANNEL_3 ((uint32_t)( ADC_SQR3_SQ1_1 | ADC_SQR3_SQ1_0))
|
||||||
|
#define ADC_CHANNEL_4 ((uint32_t)( ADC_SQR3_SQ1_2 ))
|
||||||
|
#define ADC_CHANNEL_5 ((uint32_t)( ADC_SQR3_SQ1_2 | ADC_SQR3_SQ1_0))
|
||||||
|
#define ADC_CHANNEL_6 ((uint32_t)( ADC_SQR3_SQ1_2 | ADC_SQR3_SQ1_1 ))
|
||||||
|
#define ADC_CHANNEL_7 ((uint32_t)( ADC_SQR3_SQ1_2 | ADC_SQR3_SQ1_1 | ADC_SQR3_SQ1_0))
|
||||||
|
#define ADC_CHANNEL_8 ((uint32_t)( ADC_SQR3_SQ1_3 ))
|
||||||
|
#define ADC_CHANNEL_9 ((uint32_t)( ADC_SQR3_SQ1_3 | ADC_SQR3_SQ1_0))
|
||||||
|
#define ADC_CHANNEL_10 ((uint32_t)( ADC_SQR3_SQ1_3 | ADC_SQR3_SQ1_1 ))
|
||||||
|
#define ADC_CHANNEL_11 ((uint32_t)( ADC_SQR3_SQ1_3 | ADC_SQR3_SQ1_1 | ADC_SQR3_SQ1_0))
|
||||||
|
#define ADC_CHANNEL_12 ((uint32_t)( ADC_SQR3_SQ1_3 | ADC_SQR3_SQ1_2 ))
|
||||||
|
#define ADC_CHANNEL_13 ((uint32_t)( ADC_SQR3_SQ1_3 | ADC_SQR3_SQ1_2 | ADC_SQR3_SQ1_0))
|
||||||
|
#define ADC_CHANNEL_14 ((uint32_t)( ADC_SQR3_SQ1_3 | ADC_SQR3_SQ1_2 | ADC_SQR3_SQ1_1 ))
|
||||||
|
#define ADC_CHANNEL_15 ((uint32_t)( ADC_SQR3_SQ1_3 | ADC_SQR3_SQ1_2 | ADC_SQR3_SQ1_1 | ADC_SQR3_SQ1_0))
|
||||||
|
#define ADC_CHANNEL_16 ((uint32_t)(ADC_SQR3_SQ1_4 ))
|
||||||
|
#define ADC_CHANNEL_17 ((uint32_t)(ADC_SQR3_SQ1_4 | ADC_SQR3_SQ1_0))
|
||||||
|
|
||||||
|
#define ADC_CHANNEL_TEMPSENSOR ADC_CHANNEL_16 /* ADC internal channel (no connection on device pin) */
|
||||||
|
#define ADC_CHANNEL_VREFINT ADC_CHANNEL_17 /* ADC internal channel (no connection on device pin) */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup ADC_sampling_times ADC sampling times
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define ADC_SAMPLETIME_1CYCLE_5 0x00000000U /*!< Sampling time 1.5 ADC clock cycle */
|
||||||
|
#define ADC_SAMPLETIME_7CYCLES_5 ((uint32_t)( ADC_SMPR2_SMP0_0)) /*!< Sampling time 7.5 ADC clock cycles */
|
||||||
|
#define ADC_SAMPLETIME_13CYCLES_5 ((uint32_t)( ADC_SMPR2_SMP0_1 )) /*!< Sampling time 13.5 ADC clock cycles */
|
||||||
|
#define ADC_SAMPLETIME_28CYCLES_5 ((uint32_t)( ADC_SMPR2_SMP0_1 | ADC_SMPR2_SMP0_0)) /*!< Sampling time 28.5 ADC clock cycles */
|
||||||
|
#define ADC_SAMPLETIME_41CYCLES_5 ((uint32_t)(ADC_SMPR2_SMP0_2 )) /*!< Sampling time 41.5 ADC clock cycles */
|
||||||
|
#define ADC_SAMPLETIME_55CYCLES_5 ((uint32_t)(ADC_SMPR2_SMP0_2 | ADC_SMPR2_SMP0_0)) /*!< Sampling time 55.5 ADC clock cycles */
|
||||||
|
#define ADC_SAMPLETIME_71CYCLES_5 ((uint32_t)(ADC_SMPR2_SMP0_2 | ADC_SMPR2_SMP0_1 )) /*!< Sampling time 71.5 ADC clock cycles */
|
||||||
|
#define ADC_SAMPLETIME_239CYCLES_5 ((uint32_t)(ADC_SMPR2_SMP0_2 | ADC_SMPR2_SMP0_1 | ADC_SMPR2_SMP0_0)) /*!< Sampling time 239.5 ADC clock cycles */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup ADC_regular_rank ADC rank into regular group
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define ADC_REGULAR_RANK_1 0x00000001U
|
||||||
|
#define ADC_REGULAR_RANK_2 0x00000002U
|
||||||
|
#define ADC_REGULAR_RANK_3 0x00000003U
|
||||||
|
#define ADC_REGULAR_RANK_4 0x00000004U
|
||||||
|
#define ADC_REGULAR_RANK_5 0x00000005U
|
||||||
|
#define ADC_REGULAR_RANK_6 0x00000006U
|
||||||
|
#define ADC_REGULAR_RANK_7 0x00000007U
|
||||||
|
#define ADC_REGULAR_RANK_8 0x00000008U
|
||||||
|
#define ADC_REGULAR_RANK_9 0x00000009U
|
||||||
|
#define ADC_REGULAR_RANK_10 0x0000000AU
|
||||||
|
#define ADC_REGULAR_RANK_11 0x0000000BU
|
||||||
|
#define ADC_REGULAR_RANK_12 0x0000000CU
|
||||||
|
#define ADC_REGULAR_RANK_13 0x0000000DU
|
||||||
|
#define ADC_REGULAR_RANK_14 0x0000000EU
|
||||||
|
#define ADC_REGULAR_RANK_15 0x0000000FU
|
||||||
|
#define ADC_REGULAR_RANK_16 0x00000010U
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup ADC_analog_watchdog_mode ADC analog watchdog mode
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define ADC_ANALOGWATCHDOG_NONE 0x00000000U
|
||||||
|
#define ADC_ANALOGWATCHDOG_SINGLE_REG ((uint32_t)(ADC_CR1_AWDSGL | ADC_CR1_AWDEN))
|
||||||
|
#define ADC_ANALOGWATCHDOG_SINGLE_INJEC ((uint32_t)(ADC_CR1_AWDSGL | ADC_CR1_JAWDEN))
|
||||||
|
#define ADC_ANALOGWATCHDOG_SINGLE_REGINJEC ((uint32_t)(ADC_CR1_AWDSGL | ADC_CR1_AWDEN | ADC_CR1_JAWDEN))
|
||||||
|
#define ADC_ANALOGWATCHDOG_ALL_REG ((uint32_t)ADC_CR1_AWDEN)
|
||||||
|
#define ADC_ANALOGWATCHDOG_ALL_INJEC ((uint32_t)ADC_CR1_JAWDEN)
|
||||||
|
#define ADC_ANALOGWATCHDOG_ALL_REGINJEC ((uint32_t)(ADC_CR1_AWDEN | ADC_CR1_JAWDEN))
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup ADC_conversion_group ADC conversion group
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define ADC_REGULAR_GROUP ((uint32_t)(ADC_FLAG_EOC))
|
||||||
|
#define ADC_INJECTED_GROUP ((uint32_t)(ADC_FLAG_JEOC))
|
||||||
|
#define ADC_REGULAR_INJECTED_GROUP ((uint32_t)(ADC_FLAG_EOC | ADC_FLAG_JEOC))
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup ADC_Event_type ADC Event type
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define ADC_AWD_EVENT ((uint32_t)ADC_FLAG_AWD) /*!< ADC Analog watchdog event */
|
||||||
|
|
||||||
|
#define ADC_AWD1_EVENT ADC_AWD_EVENT /*!< ADC Analog watchdog 1 event: Alternate naming for compatibility with other STM32 devices having several analog watchdogs */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup ADC_interrupts_definition ADC interrupts definition
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define ADC_IT_EOC ADC_CR1_EOCIE /*!< ADC End of Regular Conversion interrupt source */
|
||||||
|
#define ADC_IT_JEOC ADC_CR1_JEOCIE /*!< ADC End of Injected Conversion interrupt source */
|
||||||
|
#define ADC_IT_AWD ADC_CR1_AWDIE /*!< ADC Analog watchdog interrupt source */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup ADC_flags_definition ADC flags definition
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define ADC_FLAG_STRT ADC_SR_STRT /*!< ADC Regular group start flag */
|
||||||
|
#define ADC_FLAG_JSTRT ADC_SR_JSTRT /*!< ADC Injected group start flag */
|
||||||
|
#define ADC_FLAG_EOC ADC_SR_EOC /*!< ADC End of Regular conversion flag */
|
||||||
|
#define ADC_FLAG_JEOC ADC_SR_JEOC /*!< ADC End of Injected conversion flag */
|
||||||
|
#define ADC_FLAG_AWD ADC_SR_AWD /*!< ADC Analog watchdog flag */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Private constants ---------------------------------------------------------*/
|
||||||
|
|
||||||
|
/** @addtogroup ADC_Private_Constants ADC Private Constants
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup ADC_conversion_cycles ADC conversion cycles
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/* ADC conversion cycles (unit: ADC clock cycles) */
|
||||||
|
/* (selected sampling time + conversion time of 12.5 ADC clock cycles, with */
|
||||||
|
/* resolution 12 bits) */
|
||||||
|
#define ADC_CONVERSIONCLOCKCYCLES_SAMPLETIME_1CYCLE5 14U
|
||||||
|
#define ADC_CONVERSIONCLOCKCYCLES_SAMPLETIME_7CYCLES5 20U
|
||||||
|
#define ADC_CONVERSIONCLOCKCYCLES_SAMPLETIME_13CYCLES5 26U
|
||||||
|
#define ADC_CONVERSIONCLOCKCYCLES_SAMPLETIME_28CYCLES5 41U
|
||||||
|
#define ADC_CONVERSIONCLOCKCYCLES_SAMPLETIME_41CYCLES5 54U
|
||||||
|
#define ADC_CONVERSIONCLOCKCYCLES_SAMPLETIME_55CYCLES5 68U
|
||||||
|
#define ADC_CONVERSIONCLOCKCYCLES_SAMPLETIME_71CYCLES5 84U
|
||||||
|
#define ADC_CONVERSIONCLOCKCYCLES_SAMPLETIME_239CYCLES5 252U
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup ADC_sampling_times_all_channels ADC sampling times all channels
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT2 \
|
||||||
|
(ADC_SMPR2_SMP9_2 | ADC_SMPR2_SMP8_2 | ADC_SMPR2_SMP7_2 | ADC_SMPR2_SMP6_2 | \
|
||||||
|
ADC_SMPR2_SMP5_2 | ADC_SMPR2_SMP4_2 | ADC_SMPR2_SMP3_2 | ADC_SMPR2_SMP2_2 | \
|
||||||
|
ADC_SMPR2_SMP1_2 | ADC_SMPR2_SMP0_2)
|
||||||
|
#define ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT2 \
|
||||||
|
(ADC_SMPR1_SMP17_2 | ADC_SMPR1_SMP16_2 | ADC_SMPR1_SMP15_2 | ADC_SMPR1_SMP14_2 | \
|
||||||
|
ADC_SMPR1_SMP13_2 | ADC_SMPR1_SMP12_2 | ADC_SMPR1_SMP11_2 | ADC_SMPR1_SMP10_2 )
|
||||||
|
|
||||||
|
#define ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT1 \
|
||||||
|
(ADC_SMPR2_SMP9_1 | ADC_SMPR2_SMP8_1 | ADC_SMPR2_SMP7_1 | ADC_SMPR2_SMP6_1 | \
|
||||||
|
ADC_SMPR2_SMP5_1 | ADC_SMPR2_SMP4_1 | ADC_SMPR2_SMP3_1 | ADC_SMPR2_SMP2_1 | \
|
||||||
|
ADC_SMPR2_SMP1_1 | ADC_SMPR2_SMP0_1)
|
||||||
|
#define ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT1 \
|
||||||
|
(ADC_SMPR1_SMP17_1 | ADC_SMPR1_SMP16_1 | ADC_SMPR1_SMP15_1 | ADC_SMPR1_SMP14_1 | \
|
||||||
|
ADC_SMPR1_SMP13_1 | ADC_SMPR1_SMP12_1 | ADC_SMPR1_SMP11_1 | ADC_SMPR1_SMP10_1 )
|
||||||
|
|
||||||
|
#define ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT0 \
|
||||||
|
(ADC_SMPR2_SMP9_0 | ADC_SMPR2_SMP8_0 | ADC_SMPR2_SMP7_0 | ADC_SMPR2_SMP6_0 | \
|
||||||
|
ADC_SMPR2_SMP5_0 | ADC_SMPR2_SMP4_0 | ADC_SMPR2_SMP3_0 | ADC_SMPR2_SMP2_0 | \
|
||||||
|
ADC_SMPR2_SMP1_0 | ADC_SMPR2_SMP0_0)
|
||||||
|
#define ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT0 \
|
||||||
|
(ADC_SMPR1_SMP17_0 | ADC_SMPR1_SMP16_0 | ADC_SMPR1_SMP15_0 | ADC_SMPR1_SMP14_0 | \
|
||||||
|
ADC_SMPR1_SMP13_0 | ADC_SMPR1_SMP12_0 | ADC_SMPR1_SMP11_0 | ADC_SMPR1_SMP10_0 )
|
||||||
|
|
||||||
|
#define ADC_SAMPLETIME_1CYCLE5_SMPR2ALLCHANNELS 0x00000000U
|
||||||
|
#define ADC_SAMPLETIME_7CYCLES5_SMPR2ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT0)
|
||||||
|
#define ADC_SAMPLETIME_13CYCLES5_SMPR2ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT1)
|
||||||
|
#define ADC_SAMPLETIME_28CYCLES5_SMPR2ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT1 | ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT0)
|
||||||
|
#define ADC_SAMPLETIME_41CYCLES5_SMPR2ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT2)
|
||||||
|
#define ADC_SAMPLETIME_55CYCLES5_SMPR2ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT2 | ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT0)
|
||||||
|
#define ADC_SAMPLETIME_71CYCLES5_SMPR2ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT2 | ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT1)
|
||||||
|
#define ADC_SAMPLETIME_239CYCLES5_SMPR2ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT2 | ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT1 | ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT0)
|
||||||
|
|
||||||
|
#define ADC_SAMPLETIME_1CYCLE5_SMPR1ALLCHANNELS 0x00000000U
|
||||||
|
#define ADC_SAMPLETIME_7CYCLES5_SMPR1ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT0)
|
||||||
|
#define ADC_SAMPLETIME_13CYCLES5_SMPR1ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT1)
|
||||||
|
#define ADC_SAMPLETIME_28CYCLES5_SMPR1ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT1 | ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT0)
|
||||||
|
#define ADC_SAMPLETIME_41CYCLES5_SMPR1ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT2)
|
||||||
|
#define ADC_SAMPLETIME_55CYCLES5_SMPR1ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT2 | ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT0)
|
||||||
|
#define ADC_SAMPLETIME_71CYCLES5_SMPR1ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT2 | ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT1)
|
||||||
|
#define ADC_SAMPLETIME_239CYCLES5_SMPR1ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT2 | ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT1 | ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT0)
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Combination of all post-conversion flags bits: EOC/EOS, JEOC/JEOS, OVR, AWDx */
|
||||||
|
#define ADC_FLAG_POSTCONV_ALL (ADC_FLAG_EOC | ADC_FLAG_JEOC | ADC_FLAG_AWD )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/** @defgroup ADC_Exported_Macros ADC Exported Macros
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/* Macro for internal HAL driver usage, and possibly can be used into code of */
|
||||||
|
/* final user. */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enable the ADC peripheral
|
||||||
|
* @note ADC enable requires a delay for ADC stabilization time
|
||||||
|
* (refer to device datasheet, parameter tSTAB)
|
||||||
|
* @note On STM32F1, if ADC is already enabled this macro trigs a conversion
|
||||||
|
* SW start on regular group.
|
||||||
|
* @param __HANDLE__: ADC handle
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define __HAL_ADC_ENABLE(__HANDLE__) \
|
||||||
|
(SET_BIT((__HANDLE__)->Instance->CR2, (ADC_CR2_ADON)))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Disable the ADC peripheral
|
||||||
|
* @param __HANDLE__: ADC handle
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define __HAL_ADC_DISABLE(__HANDLE__) \
|
||||||
|
(CLEAR_BIT((__HANDLE__)->Instance->CR2, (ADC_CR2_ADON)))
|
||||||
|
|
||||||
|
/** @brief Enable the ADC end of conversion interrupt.
|
||||||
|
* @param __HANDLE__: ADC handle
|
||||||
|
* @param __INTERRUPT__: ADC Interrupt
|
||||||
|
* This parameter can be any combination of the following values:
|
||||||
|
* @arg ADC_IT_EOC: ADC End of Regular Conversion interrupt source
|
||||||
|
* @arg ADC_IT_JEOC: ADC End of Injected Conversion interrupt source
|
||||||
|
* @arg ADC_IT_AWD: ADC Analog watchdog interrupt source
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define __HAL_ADC_ENABLE_IT(__HANDLE__, __INTERRUPT__) \
|
||||||
|
(SET_BIT((__HANDLE__)->Instance->CR1, (__INTERRUPT__)))
|
||||||
|
|
||||||
|
/** @brief Disable the ADC end of conversion interrupt.
|
||||||
|
* @param __HANDLE__: ADC handle
|
||||||
|
* @param __INTERRUPT__: ADC Interrupt
|
||||||
|
* This parameter can be any combination of the following values:
|
||||||
|
* @arg ADC_IT_EOC: ADC End of Regular Conversion interrupt source
|
||||||
|
* @arg ADC_IT_JEOC: ADC End of Injected Conversion interrupt source
|
||||||
|
* @arg ADC_IT_AWD: ADC Analog watchdog interrupt source
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define __HAL_ADC_DISABLE_IT(__HANDLE__, __INTERRUPT__) \
|
||||||
|
(CLEAR_BIT((__HANDLE__)->Instance->CR1, (__INTERRUPT__)))
|
||||||
|
|
||||||
|
/** @brief Checks if the specified ADC interrupt source is enabled or disabled.
|
||||||
|
* @param __HANDLE__: ADC handle
|
||||||
|
* @param __INTERRUPT__: ADC interrupt source to check
|
||||||
|
* This parameter can be any combination of the following values:
|
||||||
|
* @arg ADC_IT_EOC: ADC End of Regular Conversion interrupt source
|
||||||
|
* @arg ADC_IT_JEOC: ADC End of Injected Conversion interrupt source
|
||||||
|
* @arg ADC_IT_AWD: ADC Analog watchdog interrupt source
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define __HAL_ADC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) \
|
||||||
|
(((__HANDLE__)->Instance->CR1 & (__INTERRUPT__)) == (__INTERRUPT__))
|
||||||
|
|
||||||
|
/** @brief Get the selected ADC's flag status.
|
||||||
|
* @param __HANDLE__: ADC handle
|
||||||
|
* @param __FLAG__: ADC flag
|
||||||
|
* This parameter can be any combination of the following values:
|
||||||
|
* @arg ADC_FLAG_STRT: ADC Regular group start flag
|
||||||
|
* @arg ADC_FLAG_JSTRT: ADC Injected group start flag
|
||||||
|
* @arg ADC_FLAG_EOC: ADC End of Regular conversion flag
|
||||||
|
* @arg ADC_FLAG_JEOC: ADC End of Injected conversion flag
|
||||||
|
* @arg ADC_FLAG_AWD: ADC Analog watchdog flag
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define __HAL_ADC_GET_FLAG(__HANDLE__, __FLAG__) \
|
||||||
|
((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__))
|
||||||
|
|
||||||
|
/** @brief Clear the ADC's pending flags
|
||||||
|
* @param __HANDLE__: ADC handle
|
||||||
|
* @param __FLAG__: ADC flag
|
||||||
|
* This parameter can be any combination of the following values:
|
||||||
|
* @arg ADC_FLAG_STRT: ADC Regular group start flag
|
||||||
|
* @arg ADC_FLAG_JSTRT: ADC Injected group start flag
|
||||||
|
* @arg ADC_FLAG_EOC: ADC End of Regular conversion flag
|
||||||
|
* @arg ADC_FLAG_JEOC: ADC End of Injected conversion flag
|
||||||
|
* @arg ADC_FLAG_AWD: ADC Analog watchdog flag
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define __HAL_ADC_CLEAR_FLAG(__HANDLE__, __FLAG__) \
|
||||||
|
(WRITE_REG((__HANDLE__)->Instance->SR, ~(__FLAG__)))
|
||||||
|
|
||||||
|
/** @brief Reset ADC handle state
|
||||||
|
* @param __HANDLE__: ADC handle
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#if (USE_HAL_ADC_REGISTER_CALLBACKS == 1)
|
||||||
|
#define __HAL_ADC_RESET_HANDLE_STATE(__HANDLE__) \
|
||||||
|
do{ \
|
||||||
|
(__HANDLE__)->State = HAL_ADC_STATE_RESET; \
|
||||||
|
(__HANDLE__)->MspInitCallback = NULL; \
|
||||||
|
(__HANDLE__)->MspDeInitCallback = NULL; \
|
||||||
|
} while(0)
|
||||||
|
#else
|
||||||
|
#define __HAL_ADC_RESET_HANDLE_STATE(__HANDLE__) \
|
||||||
|
((__HANDLE__)->State = HAL_ADC_STATE_RESET)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Private macro ------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/** @defgroup ADC_Private_Macros ADC Private Macros
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/* Macro reserved for internal HAL driver usage, not intended to be used in */
|
||||||
|
/* code of final user. */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Verification of ADC state: enabled or disabled
|
||||||
|
* @param __HANDLE__: ADC handle
|
||||||
|
* @retval SET (ADC enabled) or RESET (ADC disabled)
|
||||||
|
*/
|
||||||
|
#define ADC_IS_ENABLE(__HANDLE__) \
|
||||||
|
((( ((__HANDLE__)->Instance->CR2 & ADC_CR2_ADON) == ADC_CR2_ADON ) \
|
||||||
|
) ? SET : RESET)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Test if conversion trigger of regular group is software start
|
||||||
|
* or external trigger.
|
||||||
|
* @param __HANDLE__: ADC handle
|
||||||
|
* @retval SET (software start) or RESET (external trigger)
|
||||||
|
*/
|
||||||
|
#define ADC_IS_SOFTWARE_START_REGULAR(__HANDLE__) \
|
||||||
|
(READ_BIT((__HANDLE__)->Instance->CR2, ADC_CR2_EXTSEL) == ADC_SOFTWARE_START)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Test if conversion trigger of injected group is software start
|
||||||
|
* or external trigger.
|
||||||
|
* @param __HANDLE__: ADC handle
|
||||||
|
* @retval SET (software start) or RESET (external trigger)
|
||||||
|
*/
|
||||||
|
#define ADC_IS_SOFTWARE_START_INJECTED(__HANDLE__) \
|
||||||
|
(READ_BIT((__HANDLE__)->Instance->CR2, ADC_CR2_JEXTSEL) == ADC_INJECTED_SOFTWARE_START)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Simultaneously clears and sets specific bits of the handle State
|
||||||
|
* @note: ADC_STATE_CLR_SET() macro is merely aliased to generic macro MODIFY_REG(),
|
||||||
|
* the first parameter is the ADC handle State, the second parameter is the
|
||||||
|
* bit field to clear, the third and last parameter is the bit field to set.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define ADC_STATE_CLR_SET MODIFY_REG
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Clear ADC error code (set it to error code: "no error")
|
||||||
|
* @param __HANDLE__: ADC handle
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define ADC_CLEAR_ERRORCODE(__HANDLE__) \
|
||||||
|
((__HANDLE__)->ErrorCode = HAL_ADC_ERROR_NONE)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set ADC number of conversions into regular channel sequence length.
|
||||||
|
* @param _NbrOfConversion_: Regular channel sequence length
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define ADC_SQR1_L_SHIFT(_NbrOfConversion_) \
|
||||||
|
(((_NbrOfConversion_) - (uint8_t)1) << ADC_SQR1_L_Pos)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the ADC's sample time for channel numbers between 10 and 18.
|
||||||
|
* @param _SAMPLETIME_: Sample time parameter.
|
||||||
|
* @param _CHANNELNB_: Channel number.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define ADC_SMPR1(_SAMPLETIME_, _CHANNELNB_) \
|
||||||
|
((_SAMPLETIME_) << (ADC_SMPR1_SMP11_Pos * ((_CHANNELNB_) - 10)))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the ADC's sample time for channel numbers between 0 and 9.
|
||||||
|
* @param _SAMPLETIME_: Sample time parameter.
|
||||||
|
* @param _CHANNELNB_: Channel number.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define ADC_SMPR2(_SAMPLETIME_, _CHANNELNB_) \
|
||||||
|
((_SAMPLETIME_) << (ADC_SMPR2_SMP1_Pos * (_CHANNELNB_)))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the selected regular channel rank for rank between 1 and 6.
|
||||||
|
* @param _CHANNELNB_: Channel number.
|
||||||
|
* @param _RANKNB_: Rank number.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define ADC_SQR3_RK(_CHANNELNB_, _RANKNB_) \
|
||||||
|
((_CHANNELNB_) << (ADC_SQR3_SQ2_Pos * ((_RANKNB_) - 1)))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the selected regular channel rank for rank between 7 and 12.
|
||||||
|
* @param _CHANNELNB_: Channel number.
|
||||||
|
* @param _RANKNB_: Rank number.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define ADC_SQR2_RK(_CHANNELNB_, _RANKNB_) \
|
||||||
|
((_CHANNELNB_) << (ADC_SQR2_SQ8_Pos * ((_RANKNB_) - 7)))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the selected regular channel rank for rank between 13 and 16.
|
||||||
|
* @param _CHANNELNB_: Channel number.
|
||||||
|
* @param _RANKNB_: Rank number.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define ADC_SQR1_RK(_CHANNELNB_, _RANKNB_) \
|
||||||
|
((_CHANNELNB_) << (ADC_SQR1_SQ14_Pos * ((_RANKNB_) - 13)))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the injected sequence length.
|
||||||
|
* @param _JSQR_JL_: Sequence length.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define ADC_JSQR_JL_SHIFT(_JSQR_JL_) \
|
||||||
|
(((_JSQR_JL_) -1) << ADC_JSQR_JL_Pos)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the selected injected channel rank
|
||||||
|
* Note: on STM32F1 devices, channel rank position in JSQR register
|
||||||
|
* is depending on total number of ranks selected into
|
||||||
|
* injected sequencer (ranks sequence starting from 4-JL)
|
||||||
|
* @param _CHANNELNB_: Channel number.
|
||||||
|
* @param _RANKNB_: Rank number.
|
||||||
|
* @param _JSQR_JL_: Sequence length.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define ADC_JSQR_RK_JL(_CHANNELNB_, _RANKNB_, _JSQR_JL_) \
|
||||||
|
((_CHANNELNB_) << (ADC_JSQR_JSQ2_Pos * ((4 - ((_JSQR_JL_) - (_RANKNB_))) - 1)))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enable ADC continuous conversion mode.
|
||||||
|
* @param _CONTINUOUS_MODE_: Continuous mode.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define ADC_CR2_CONTINUOUS(_CONTINUOUS_MODE_) \
|
||||||
|
((_CONTINUOUS_MODE_) << ADC_CR2_CONT_Pos)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Configures the number of discontinuous conversions for the regular group channels.
|
||||||
|
* @param _NBR_DISCONTINUOUS_CONV_: Number of discontinuous conversions.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define ADC_CR1_DISCONTINUOUS_NUM(_NBR_DISCONTINUOUS_CONV_) \
|
||||||
|
(((_NBR_DISCONTINUOUS_CONV_) - 1) << ADC_CR1_DISCNUM_Pos)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enable ADC scan mode to convert multiple ranks with sequencer.
|
||||||
|
* @param _SCAN_MODE_: Scan conversion mode.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
/* Note: Scan mode is compared to ENABLE for legacy purpose, this parameter */
|
||||||
|
/* is equivalent to ADC_SCAN_ENABLE. */
|
||||||
|
#define ADC_CR1_SCAN_SET(_SCAN_MODE_) \
|
||||||
|
(( ((_SCAN_MODE_) == ADC_SCAN_ENABLE) || ((_SCAN_MODE_) == ENABLE) \
|
||||||
|
)? (ADC_SCAN_ENABLE) : (ADC_SCAN_DISABLE) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the maximum ADC conversion cycles on all channels.
|
||||||
|
* Returns the selected sampling time + conversion time (12.5 ADC clock cycles)
|
||||||
|
* Approximation of sampling time within 4 ranges, returns the highest value:
|
||||||
|
* below 7.5 cycles {1.5 cycle; 7.5 cycles},
|
||||||
|
* between 13.5 cycles and 28.5 cycles {13.5 cycles; 28.5 cycles}
|
||||||
|
* between 41.5 cycles and 71.5 cycles {41.5 cycles; 55.5 cycles; 71.5cycles}
|
||||||
|
* equal to 239.5 cycles
|
||||||
|
* Unit: ADC clock cycles
|
||||||
|
* @param __HANDLE__: ADC handle
|
||||||
|
* @retval ADC conversion cycles on all channels
|
||||||
|
*/
|
||||||
|
#define ADC_CONVCYCLES_MAX_RANGE(__HANDLE__) \
|
||||||
|
(( (((__HANDLE__)->Instance->SMPR2 & ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT2) == RESET) && \
|
||||||
|
(((__HANDLE__)->Instance->SMPR1 & ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT2) == RESET) ) ? \
|
||||||
|
\
|
||||||
|
(( (((__HANDLE__)->Instance->SMPR2 & ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT1) == RESET) && \
|
||||||
|
(((__HANDLE__)->Instance->SMPR1 & ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT1) == RESET) ) ? \
|
||||||
|
ADC_CONVERSIONCLOCKCYCLES_SAMPLETIME_7CYCLES5 : ADC_CONVERSIONCLOCKCYCLES_SAMPLETIME_28CYCLES5) \
|
||||||
|
: \
|
||||||
|
((((((__HANDLE__)->Instance->SMPR2 & ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT1) == RESET) && \
|
||||||
|
(((__HANDLE__)->Instance->SMPR1 & ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT1) == RESET)) || \
|
||||||
|
((((__HANDLE__)->Instance->SMPR2 & ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT0) == RESET) && \
|
||||||
|
(((__HANDLE__)->Instance->SMPR1 & ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT0) == RESET))) ? \
|
||||||
|
ADC_CONVERSIONCLOCKCYCLES_SAMPLETIME_71CYCLES5 : ADC_CONVERSIONCLOCKCYCLES_SAMPLETIME_239CYCLES5) \
|
||||||
|
)
|
||||||
|
|
||||||
|
#define IS_ADC_DATA_ALIGN(ALIGN) (((ALIGN) == ADC_DATAALIGN_RIGHT) || \
|
||||||
|
((ALIGN) == ADC_DATAALIGN_LEFT) )
|
||||||
|
|
||||||
|
#define IS_ADC_SCAN_MODE(SCAN_MODE) (((SCAN_MODE) == ADC_SCAN_DISABLE) || \
|
||||||
|
((SCAN_MODE) == ADC_SCAN_ENABLE) )
|
||||||
|
|
||||||
|
#define IS_ADC_EXTTRIG_EDGE(EDGE) (((EDGE) == ADC_EXTERNALTRIGCONVEDGE_NONE) || \
|
||||||
|
((EDGE) == ADC_EXTERNALTRIGCONVEDGE_RISING) )
|
||||||
|
|
||||||
|
#define IS_ADC_CHANNEL(CHANNEL) (((CHANNEL) == ADC_CHANNEL_0) || \
|
||||||
|
((CHANNEL) == ADC_CHANNEL_1) || \
|
||||||
|
((CHANNEL) == ADC_CHANNEL_2) || \
|
||||||
|
((CHANNEL) == ADC_CHANNEL_3) || \
|
||||||
|
((CHANNEL) == ADC_CHANNEL_4) || \
|
||||||
|
((CHANNEL) == ADC_CHANNEL_5) || \
|
||||||
|
((CHANNEL) == ADC_CHANNEL_6) || \
|
||||||
|
((CHANNEL) == ADC_CHANNEL_7) || \
|
||||||
|
((CHANNEL) == ADC_CHANNEL_8) || \
|
||||||
|
((CHANNEL) == ADC_CHANNEL_9) || \
|
||||||
|
((CHANNEL) == ADC_CHANNEL_10) || \
|
||||||
|
((CHANNEL) == ADC_CHANNEL_11) || \
|
||||||
|
((CHANNEL) == ADC_CHANNEL_12) || \
|
||||||
|
((CHANNEL) == ADC_CHANNEL_13) || \
|
||||||
|
((CHANNEL) == ADC_CHANNEL_14) || \
|
||||||
|
((CHANNEL) == ADC_CHANNEL_15) || \
|
||||||
|
((CHANNEL) == ADC_CHANNEL_16) || \
|
||||||
|
((CHANNEL) == ADC_CHANNEL_17) )
|
||||||
|
|
||||||
|
#define IS_ADC_SAMPLE_TIME(TIME) (((TIME) == ADC_SAMPLETIME_1CYCLE_5) || \
|
||||||
|
((TIME) == ADC_SAMPLETIME_7CYCLES_5) || \
|
||||||
|
((TIME) == ADC_SAMPLETIME_13CYCLES_5) || \
|
||||||
|
((TIME) == ADC_SAMPLETIME_28CYCLES_5) || \
|
||||||
|
((TIME) == ADC_SAMPLETIME_41CYCLES_5) || \
|
||||||
|
((TIME) == ADC_SAMPLETIME_55CYCLES_5) || \
|
||||||
|
((TIME) == ADC_SAMPLETIME_71CYCLES_5) || \
|
||||||
|
((TIME) == ADC_SAMPLETIME_239CYCLES_5) )
|
||||||
|
|
||||||
|
#define IS_ADC_REGULAR_RANK(CHANNEL) (((CHANNEL) == ADC_REGULAR_RANK_1 ) || \
|
||||||
|
((CHANNEL) == ADC_REGULAR_RANK_2 ) || \
|
||||||
|
((CHANNEL) == ADC_REGULAR_RANK_3 ) || \
|
||||||
|
((CHANNEL) == ADC_REGULAR_RANK_4 ) || \
|
||||||
|
((CHANNEL) == ADC_REGULAR_RANK_5 ) || \
|
||||||
|
((CHANNEL) == ADC_REGULAR_RANK_6 ) || \
|
||||||
|
((CHANNEL) == ADC_REGULAR_RANK_7 ) || \
|
||||||
|
((CHANNEL) == ADC_REGULAR_RANK_8 ) || \
|
||||||
|
((CHANNEL) == ADC_REGULAR_RANK_9 ) || \
|
||||||
|
((CHANNEL) == ADC_REGULAR_RANK_10) || \
|
||||||
|
((CHANNEL) == ADC_REGULAR_RANK_11) || \
|
||||||
|
((CHANNEL) == ADC_REGULAR_RANK_12) || \
|
||||||
|
((CHANNEL) == ADC_REGULAR_RANK_13) || \
|
||||||
|
((CHANNEL) == ADC_REGULAR_RANK_14) || \
|
||||||
|
((CHANNEL) == ADC_REGULAR_RANK_15) || \
|
||||||
|
((CHANNEL) == ADC_REGULAR_RANK_16) )
|
||||||
|
|
||||||
|
#define IS_ADC_ANALOG_WATCHDOG_MODE(WATCHDOG) (((WATCHDOG) == ADC_ANALOGWATCHDOG_NONE) || \
|
||||||
|
((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_REG) || \
|
||||||
|
((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_INJEC) || \
|
||||||
|
((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_REGINJEC) || \
|
||||||
|
((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_REG) || \
|
||||||
|
((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_INJEC) || \
|
||||||
|
((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_REGINJEC) )
|
||||||
|
|
||||||
|
#define IS_ADC_CONVERSION_GROUP(CONVERSION) (((CONVERSION) == ADC_REGULAR_GROUP) || \
|
||||||
|
((CONVERSION) == ADC_INJECTED_GROUP) || \
|
||||||
|
((CONVERSION) == ADC_REGULAR_INJECTED_GROUP) )
|
||||||
|
|
||||||
|
#define IS_ADC_EVENT_TYPE(EVENT) ((EVENT) == ADC_AWD_EVENT)
|
||||||
|
|
||||||
|
|
||||||
|
/** @defgroup ADC_range_verification ADC range verification
|
||||||
|
* For a unique ADC resolution: 12 bits
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define IS_ADC_RANGE(ADC_VALUE) ((ADC_VALUE) <= 0x0FFFU)
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup ADC_regular_nb_conv_verification ADC regular nb conv verification
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define IS_ADC_REGULAR_NB_CONV(LENGTH) (((LENGTH) >= 1U) && ((LENGTH) <= 16U))
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup ADC_regular_discontinuous_mode_number_verification ADC regular discontinuous mode number verification
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define IS_ADC_REGULAR_DISCONT_NUMBER(NUMBER) (((NUMBER) >= 1U) && ((NUMBER) <= 8U))
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Include ADC HAL Extension module */
|
||||||
|
#include "stm32f1xx_hal_adc_ex.h"
|
||||||
|
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
/** @addtogroup ADC_Exported_Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup ADC_Exported_Functions_Group1
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Initialization and de-initialization functions **********************************/
|
||||||
|
HAL_StatusTypeDef HAL_ADC_Init(ADC_HandleTypeDef* hadc);
|
||||||
|
HAL_StatusTypeDef HAL_ADC_DeInit(ADC_HandleTypeDef *hadc);
|
||||||
|
void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc);
|
||||||
|
void HAL_ADC_MspDeInit(ADC_HandleTypeDef* hadc);
|
||||||
|
|
||||||
|
#if (USE_HAL_ADC_REGISTER_CALLBACKS == 1)
|
||||||
|
/* Callbacks Register/UnRegister functions ***********************************/
|
||||||
|
HAL_StatusTypeDef HAL_ADC_RegisterCallback(ADC_HandleTypeDef *hadc, HAL_ADC_CallbackIDTypeDef CallbackID, pADC_CallbackTypeDef pCallback);
|
||||||
|
HAL_StatusTypeDef HAL_ADC_UnRegisterCallback(ADC_HandleTypeDef *hadc, HAL_ADC_CallbackIDTypeDef CallbackID);
|
||||||
|
#endif /* USE_HAL_ADC_REGISTER_CALLBACKS */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* IO operation functions *****************************************************/
|
||||||
|
|
||||||
|
/** @addtogroup ADC_Exported_Functions_Group2
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Blocking mode: Polling */
|
||||||
|
HAL_StatusTypeDef HAL_ADC_Start(ADC_HandleTypeDef* hadc);
|
||||||
|
HAL_StatusTypeDef HAL_ADC_Stop(ADC_HandleTypeDef* hadc);
|
||||||
|
HAL_StatusTypeDef HAL_ADC_PollForConversion(ADC_HandleTypeDef* hadc, uint32_t Timeout);
|
||||||
|
HAL_StatusTypeDef HAL_ADC_PollForEvent(ADC_HandleTypeDef* hadc, uint32_t EventType, uint32_t Timeout);
|
||||||
|
|
||||||
|
/* Non-blocking mode: Interruption */
|
||||||
|
HAL_StatusTypeDef HAL_ADC_Start_IT(ADC_HandleTypeDef* hadc);
|
||||||
|
HAL_StatusTypeDef HAL_ADC_Stop_IT(ADC_HandleTypeDef* hadc);
|
||||||
|
|
||||||
|
/* Non-blocking mode: DMA */
|
||||||
|
HAL_StatusTypeDef HAL_ADC_Start_DMA(ADC_HandleTypeDef* hadc, uint32_t* pData, uint32_t Length);
|
||||||
|
HAL_StatusTypeDef HAL_ADC_Stop_DMA(ADC_HandleTypeDef* hadc);
|
||||||
|
|
||||||
|
/* ADC retrieve conversion value intended to be used with polling or interruption */
|
||||||
|
uint32_t HAL_ADC_GetValue(ADC_HandleTypeDef* hadc);
|
||||||
|
|
||||||
|
/* ADC IRQHandler and Callbacks used in non-blocking modes (Interruption and DMA) */
|
||||||
|
void HAL_ADC_IRQHandler(ADC_HandleTypeDef* hadc);
|
||||||
|
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc);
|
||||||
|
void HAL_ADC_ConvHalfCpltCallback(ADC_HandleTypeDef* hadc);
|
||||||
|
void HAL_ADC_LevelOutOfWindowCallback(ADC_HandleTypeDef* hadc);
|
||||||
|
void HAL_ADC_ErrorCallback(ADC_HandleTypeDef *hadc);
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Peripheral Control functions ***********************************************/
|
||||||
|
/** @addtogroup ADC_Exported_Functions_Group3
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_ADC_ConfigChannel(ADC_HandleTypeDef* hadc, ADC_ChannelConfTypeDef* sConfig);
|
||||||
|
HAL_StatusTypeDef HAL_ADC_AnalogWDGConfig(ADC_HandleTypeDef* hadc, ADC_AnalogWDGConfTypeDef* AnalogWDGConfig);
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Peripheral State functions *************************************************/
|
||||||
|
/** @addtogroup ADC_Exported_Functions_Group4
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
uint32_t HAL_ADC_GetState(ADC_HandleTypeDef* hadc);
|
||||||
|
uint32_t HAL_ADC_GetError(ADC_HandleTypeDef *hadc);
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Internal HAL driver functions **********************************************/
|
||||||
|
/** @addtogroup ADC_Private_Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef ADC_Enable(ADC_HandleTypeDef* hadc);
|
||||||
|
HAL_StatusTypeDef ADC_ConversionStop_Disable(ADC_HandleTypeDef* hadc);
|
||||||
|
void ADC_StabilizationTime(uint32_t DelayUs);
|
||||||
|
void ADC_DMAConvCplt(DMA_HandleTypeDef *hdma);
|
||||||
|
void ADC_DMAHalfConvCplt(DMA_HandleTypeDef *hdma);
|
||||||
|
void ADC_DMAError(DMA_HandleTypeDef *hdma);
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __STM32F1xx_HAL_ADC_H */
|
||||||
@@ -0,0 +1,706 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32f1xx_hal_adc_ex.h
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief Header file of ADC HAL extension module.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2016 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef __STM32F1xx_HAL_ADC_EX_H
|
||||||
|
#define __STM32F1xx_HAL_ADC_EX_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "stm32f1xx_hal_def.h"
|
||||||
|
|
||||||
|
/** @addtogroup STM32F1xx_HAL_Driver
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup ADCEx
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
/** @defgroup ADCEx_Exported_Types ADCEx Exported Types
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ADC Configuration injected Channel structure definition
|
||||||
|
* @note Parameters of this structure are shared within 2 scopes:
|
||||||
|
* - Scope channel: InjectedChannel, InjectedRank, InjectedSamplingTime, InjectedOffset
|
||||||
|
* - Scope injected group (affects all channels of injected group): InjectedNbrOfConversion, InjectedDiscontinuousConvMode,
|
||||||
|
* AutoInjectedConv, ExternalTrigInjecConvEdge, ExternalTrigInjecConv.
|
||||||
|
* @note The setting of these parameters with function HAL_ADCEx_InjectedConfigChannel() is conditioned to ADC state.
|
||||||
|
* ADC state can be either:
|
||||||
|
* - For all parameters: ADC disabled (this is the only possible ADC state to modify parameter 'ExternalTrigInjecConv')
|
||||||
|
* - For all except parameters 'ExternalTrigInjecConv': ADC enabled without conversion on going on injected group.
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint32_t InjectedChannel; /*!< Selection of ADC channel to configure
|
||||||
|
This parameter can be a value of @ref ADC_channels
|
||||||
|
Note: Depending on devices, some channels may not be available on package pins. Refer to device datasheet for channels availability.
|
||||||
|
Note: On STM32F1 devices with several ADC: Only ADC1 can access internal measurement channels (VrefInt/TempSensor)
|
||||||
|
Note: On STM32F10xx8 and STM32F10xxB devices: A low-amplitude voltage glitch may be generated (on ADC input 0) on the PA0 pin, when the ADC is converting with injection trigger.
|
||||||
|
It is advised to distribute the analog channels so that Channel 0 is configured as an injected channel.
|
||||||
|
Refer to errata sheet of these devices for more details. */
|
||||||
|
uint32_t InjectedRank; /*!< Rank in the injected group sequencer
|
||||||
|
This parameter must be a value of @ref ADCEx_injected_rank
|
||||||
|
Note: In case of need to disable a channel or change order of conversion sequencer, rank containing a previous channel setting can be overwritten by the new channel setting (or parameter number of conversions can be adjusted) */
|
||||||
|
uint32_t InjectedSamplingTime; /*!< Sampling time value to be set for the selected channel.
|
||||||
|
Unit: ADC clock cycles
|
||||||
|
Conversion time is the addition of sampling time and processing time (12.5 ADC clock cycles at ADC resolution 12 bits).
|
||||||
|
This parameter can be a value of @ref ADC_sampling_times
|
||||||
|
Caution: This parameter updates the parameter property of the channel, that can be used into regular and/or injected groups.
|
||||||
|
If this same channel has been previously configured in the other group (regular/injected), it will be updated to last setting.
|
||||||
|
Note: In case of usage of internal measurement channels (VrefInt/TempSensor),
|
||||||
|
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 (values rough order: 5us to 17.1us min). */
|
||||||
|
uint32_t InjectedOffset; /*!< Defines the offset to be subtracted from the raw converted data (for channels set on injected group only).
|
||||||
|
Offset value must be a positive number.
|
||||||
|
Depending of ADC resolution selected (12, 10, 8 or 6 bits),
|
||||||
|
this parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF, 0x3FF, 0xFF or 0x3F respectively. */
|
||||||
|
uint32_t InjectedNbrOfConversion; /*!< Specifies the number of ranks that will be converted within the injected group sequencer.
|
||||||
|
To use the injected group sequencer and convert several ranks, parameter 'ScanConvMode' must be enabled.
|
||||||
|
This parameter must be a number between Min_Data = 1 and Max_Data = 4.
|
||||||
|
Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to
|
||||||
|
configure a channel on injected group can impact the configuration of other channels previously set. */
|
||||||
|
FunctionalState InjectedDiscontinuousConvMode; /*!< Specifies whether the conversions sequence of injected group is performed in Complete-sequence/Discontinuous-sequence (main sequence subdivided in successive parts).
|
||||||
|
Discontinuous mode is used only if sequencer is enabled (parameter 'ScanConvMode'). If sequencer is disabled, this parameter is discarded.
|
||||||
|
Discontinuous mode can be enabled only if continuous mode is disabled. If continuous mode is enabled, this parameter setting is discarded.
|
||||||
|
This parameter can be set to ENABLE or DISABLE.
|
||||||
|
Note: For injected group, number of discontinuous ranks increment is fixed to one-by-one.
|
||||||
|
Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to
|
||||||
|
configure a channel on injected group can impact the configuration of other channels previously set. */
|
||||||
|
FunctionalState AutoInjectedConv; /*!< Enables or disables the selected ADC automatic injected group conversion after regular one
|
||||||
|
This parameter can be set to ENABLE or DISABLE.
|
||||||
|
Note: To use Automatic injected conversion, discontinuous mode must be disabled ('DiscontinuousConvMode' and 'InjectedDiscontinuousConvMode' set to DISABLE)
|
||||||
|
Note: To use Automatic injected conversion, injected group external triggers must be disabled ('ExternalTrigInjecConv' set to ADC_SOFTWARE_START)
|
||||||
|
Note: In case of DMA used with regular group: if DMA configured in normal mode (single shot) JAUTO will be stopped upon DMA transfer complete.
|
||||||
|
To maintain JAUTO always enabled, DMA must be configured in circular mode.
|
||||||
|
Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to
|
||||||
|
configure a channel on injected group can impact the configuration of other channels previously set. */
|
||||||
|
uint32_t ExternalTrigInjecConv; /*!< Selects the external event used to trigger the conversion start of injected group.
|
||||||
|
If set to ADC_INJECTED_SOFTWARE_START, external triggers are disabled.
|
||||||
|
If set to external trigger source, triggering is on event rising edge.
|
||||||
|
This parameter can be a value of @ref ADCEx_External_trigger_source_Injected
|
||||||
|
Note: This parameter must be modified when ADC is disabled (before ADC start conversion or after ADC stop conversion).
|
||||||
|
If ADC is enabled, this parameter setting is bypassed without error reporting (as it can be the expected behaviour in case of another parameter update on the fly)
|
||||||
|
Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to
|
||||||
|
configure a channel on injected group can impact the configuration of other channels previously set. */
|
||||||
|
}ADC_InjectionConfTypeDef;
|
||||||
|
|
||||||
|
#if defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F105xC) || defined (STM32F107xC) || defined (STM32F103xE) || defined (STM32F103xG)
|
||||||
|
/**
|
||||||
|
* @brief Structure definition of ADC multimode
|
||||||
|
* @note The setting of these parameters with function HAL_ADCEx_MultiModeConfigChannel() is conditioned to ADCs state (both ADCs of the common group).
|
||||||
|
* State of ADCs of the common group must be: disabled.
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint32_t Mode; /*!< Configures the ADC to operate in independent or multi mode.
|
||||||
|
This parameter can be a value of @ref ADCEx_Common_mode
|
||||||
|
Note: In dual mode, a change of channel configuration generates a restart that can produce a loss of synchronization. It is recommended to disable dual mode before any configuration change.
|
||||||
|
Note: In case of simultaneous mode used: Exactly the same sampling time should be configured for the 2 channels that will be sampled simultaneously by ACD1 and ADC2.
|
||||||
|
Note: In case of interleaved mode used: To avoid overlap between conversions, maximum sampling time allowed is 7 ADC clock cycles for fast interleaved mode and 14 ADC clock cycles for slow interleaved mode.
|
||||||
|
Note: Some multimode parameters are fixed on STM32F1 and can be configured on other STM32 devices with several ADC (multimode configuration structure can have additional parameters).
|
||||||
|
The equivalences are:
|
||||||
|
- Parameter 'DMAAccessMode': On STM32F1, this parameter is fixed to 1 DMA channel (one DMA channel for both ADC, DMA of ADC master). On other STM32 devices with several ADC, this is equivalent to parameter 'ADC_DMAACCESSMODE_12_10_BITS'.
|
||||||
|
- Parameter 'TwoSamplingDelay': On STM32F1, this parameter is fixed to 7 or 14 ADC clock cycles depending on fast or slow interleaved mode selected. On other STM32 devices with several ADC, this is equivalent to parameter 'ADC_TWOSAMPLINGDELAY_7CYCLES' (for fast interleaved mode). */
|
||||||
|
|
||||||
|
|
||||||
|
}ADC_MultiModeTypeDef;
|
||||||
|
#endif /* defined STM32F103x6 || defined STM32F103xB || defined STM32F105xC || defined STM32F107xC || defined STM32F103xE || defined STM32F103xG */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
|
||||||
|
/** @defgroup ADCEx_Exported_Constants ADCEx Exported Constants
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup ADCEx_injected_rank ADCEx rank into injected group
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define ADC_INJECTED_RANK_1 0x00000001U
|
||||||
|
#define ADC_INJECTED_RANK_2 0x00000002U
|
||||||
|
#define ADC_INJECTED_RANK_3 0x00000003U
|
||||||
|
#define ADC_INJECTED_RANK_4 0x00000004U
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup ADCEx_External_trigger_edge_Injected ADCEx external trigger enable for injected group
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define ADC_EXTERNALTRIGINJECCONV_EDGE_NONE 0x00000000U
|
||||||
|
#define ADC_EXTERNALTRIGINJECCONV_EDGE_RISING ((uint32_t)ADC_CR2_JEXTTRIG)
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup ADC_External_trigger_source_Regular ADC External trigger selection for regular group
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/*!< List of external triggers with generic trigger name, independently of */
|
||||||
|
/* ADC target, sorted by trigger name: */
|
||||||
|
|
||||||
|
/*!< External triggers of regular group for ADC1&ADC2 only */
|
||||||
|
#define ADC_EXTERNALTRIGCONV_T1_CC1 ADC1_2_EXTERNALTRIG_T1_CC1
|
||||||
|
#define ADC_EXTERNALTRIGCONV_T1_CC2 ADC1_2_EXTERNALTRIG_T1_CC2
|
||||||
|
#define ADC_EXTERNALTRIGCONV_T2_CC2 ADC1_2_EXTERNALTRIG_T2_CC2
|
||||||
|
#define ADC_EXTERNALTRIGCONV_T3_TRGO ADC1_2_EXTERNALTRIG_T3_TRGO
|
||||||
|
#define ADC_EXTERNALTRIGCONV_T4_CC4 ADC1_2_EXTERNALTRIG_T4_CC4
|
||||||
|
#define ADC_EXTERNALTRIGCONV_EXT_IT11 ADC1_2_EXTERNALTRIG_EXT_IT11
|
||||||
|
|
||||||
|
#if defined (STM32F103xE) || defined (STM32F103xG)
|
||||||
|
/*!< External triggers of regular group for ADC3 only */
|
||||||
|
#define ADC_EXTERNALTRIGCONV_T2_CC3 ADC3_EXTERNALTRIG_T2_CC3
|
||||||
|
#define ADC_EXTERNALTRIGCONV_T3_CC1 ADC3_EXTERNALTRIG_T3_CC1
|
||||||
|
#define ADC_EXTERNALTRIGCONV_T5_CC1 ADC3_EXTERNALTRIG_T5_CC1
|
||||||
|
#define ADC_EXTERNALTRIGCONV_T5_CC3 ADC3_EXTERNALTRIG_T5_CC3
|
||||||
|
#define ADC_EXTERNALTRIGCONV_T8_CC1 ADC3_EXTERNALTRIG_T8_CC1
|
||||||
|
#endif /* STM32F103xE || defined STM32F103xG */
|
||||||
|
|
||||||
|
/*!< External triggers of regular group for all ADC instances */
|
||||||
|
#define ADC_EXTERNALTRIGCONV_T1_CC3 ADC1_2_3_EXTERNALTRIG_T1_CC3
|
||||||
|
|
||||||
|
#if defined (STM32F101xE) || defined (STM32F103xE) || defined (STM32F103xG) || defined (STM32F105xC) || defined (STM32F107xC)
|
||||||
|
/*!< Note: TIM8_TRGO is available on ADC1 and ADC2 only in high-density and */
|
||||||
|
/* XL-density devices. */
|
||||||
|
/* To use it on ADC or ADC2, a remap of trigger must be done from */
|
||||||
|
/* EXTI line 11 to TIM8_TRGO with macro: */
|
||||||
|
/* __HAL_AFIO_REMAP_ADC1_ETRGREG_ENABLE() */
|
||||||
|
/* __HAL_AFIO_REMAP_ADC2_ETRGREG_ENABLE() */
|
||||||
|
|
||||||
|
/* Note for internal constant value management: If TIM8_TRGO is available, */
|
||||||
|
/* its definition is set to value for ADC1&ADC2 by default and changed to */
|
||||||
|
/* value for ADC3 by HAL ADC driver if ADC3 is selected. */
|
||||||
|
#define ADC_EXTERNALTRIGCONV_T8_TRGO ADC1_2_EXTERNALTRIG_T8_TRGO
|
||||||
|
#endif /* STM32F101xE || STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */
|
||||||
|
|
||||||
|
#define ADC_SOFTWARE_START ADC1_2_3_SWSTART
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup ADCEx_External_trigger_source_Injected ADCEx External trigger selection for injected group
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/*!< List of external triggers with generic trigger name, independently of */
|
||||||
|
/* ADC target, sorted by trigger name: */
|
||||||
|
|
||||||
|
/*!< External triggers of injected group for ADC1&ADC2 only */
|
||||||
|
#define ADC_EXTERNALTRIGINJECCONV_T2_TRGO ADC1_2_EXTERNALTRIGINJEC_T2_TRGO
|
||||||
|
#define ADC_EXTERNALTRIGINJECCONV_T2_CC1 ADC1_2_EXTERNALTRIGINJEC_T2_CC1
|
||||||
|
#define ADC_EXTERNALTRIGINJECCONV_T3_CC4 ADC1_2_EXTERNALTRIGINJEC_T3_CC4
|
||||||
|
#define ADC_EXTERNALTRIGINJECCONV_T4_TRGO ADC1_2_EXTERNALTRIGINJEC_T4_TRGO
|
||||||
|
#define ADC_EXTERNALTRIGINJECCONV_EXT_IT15 ADC1_2_EXTERNALTRIGINJEC_EXT_IT15
|
||||||
|
|
||||||
|
#if defined (STM32F103xE) || defined (STM32F103xG)
|
||||||
|
/*!< External triggers of injected group for ADC3 only */
|
||||||
|
#define ADC_EXTERNALTRIGINJECCONV_T4_CC3 ADC3_EXTERNALTRIGINJEC_T4_CC3
|
||||||
|
#define ADC_EXTERNALTRIGINJECCONV_T8_CC2 ADC3_EXTERNALTRIGINJEC_T8_CC2
|
||||||
|
#define ADC_EXTERNALTRIGINJECCONV_T5_TRGO ADC3_EXTERNALTRIGINJEC_T5_TRGO
|
||||||
|
#define ADC_EXTERNALTRIGINJECCONV_T5_CC4 ADC3_EXTERNALTRIGINJEC_T5_CC4
|
||||||
|
#endif /* STM32F103xE || defined STM32F103xG */
|
||||||
|
|
||||||
|
/*!< External triggers of injected group for all ADC instances */
|
||||||
|
#define ADC_EXTERNALTRIGINJECCONV_T1_CC4 ADC1_2_3_EXTERNALTRIGINJEC_T1_CC4
|
||||||
|
#define ADC_EXTERNALTRIGINJECCONV_T1_TRGO ADC1_2_3_EXTERNALTRIGINJEC_T1_TRGO
|
||||||
|
|
||||||
|
#if defined (STM32F101xE) || defined (STM32F103xE) || defined (STM32F103xG) || defined (STM32F105xC) || defined (STM32F107xC)
|
||||||
|
/*!< Note: TIM8_CC4 is available on ADC1 and ADC2 only in high-density and */
|
||||||
|
/* XL-density devices. */
|
||||||
|
/* To use it on ADC1 or ADC2, a remap of trigger must be done from */
|
||||||
|
/* EXTI line 11 to TIM8_CC4 with macro: */
|
||||||
|
/* __HAL_AFIO_REMAP_ADC1_ETRGINJ_ENABLE() */
|
||||||
|
/* __HAL_AFIO_REMAP_ADC2_ETRGINJ_ENABLE() */
|
||||||
|
|
||||||
|
/* Note for internal constant value management: If TIM8_CC4 is available, */
|
||||||
|
/* its definition is set to value for ADC1&ADC2 by default and changed to */
|
||||||
|
/* value for ADC3 by HAL ADC driver if ADC3 is selected. */
|
||||||
|
#define ADC_EXTERNALTRIGINJECCONV_T8_CC4 ADC1_2_EXTERNALTRIGINJEC_T8_CC4
|
||||||
|
#endif /* STM32F101xE || STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */
|
||||||
|
|
||||||
|
#define ADC_INJECTED_SOFTWARE_START ADC1_2_3_JSWSTART
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F105xC) || defined (STM32F107xC) || defined (STM32F103xE) || defined (STM32F103xG)
|
||||||
|
/** @defgroup ADCEx_Common_mode ADC Extended Dual ADC Mode
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define ADC_MODE_INDEPENDENT 0x00000000U /*!< ADC dual mode disabled (ADC independent mode) */
|
||||||
|
#define ADC_DUALMODE_REGSIMULT_INJECSIMULT ((uint32_t)( ADC_CR1_DUALMOD_0)) /*!< ADC dual mode enabled: Combined regular simultaneous + injected simultaneous mode, on groups regular and injected */
|
||||||
|
#define ADC_DUALMODE_REGSIMULT_ALTERTRIG ((uint32_t)( ADC_CR1_DUALMOD_1 )) /*!< ADC dual mode enabled: Combined regular simultaneous + alternate trigger mode, on groups regular and injected */
|
||||||
|
#define ADC_DUALMODE_INJECSIMULT_INTERLFAST ((uint32_t)( ADC_CR1_DUALMOD_1 | ADC_CR1_DUALMOD_0)) /*!< ADC dual mode enabled: Combined injected simultaneous + fast interleaved mode, on groups regular and injected (delay between ADC sampling phases: 7 ADC clock cycles (equivalent to parameter "TwoSamplingDelay" set to "ADC_TWOSAMPLINGDELAY_7CYCLES" on other STM32 devices)) */
|
||||||
|
#define ADC_DUALMODE_INJECSIMULT_INTERLSLOW ((uint32_t)( ADC_CR1_DUALMOD_2 )) /*!< ADC dual mode enabled: Combined injected simultaneous + slow Interleaved mode, on groups regular and injected (delay between ADC sampling phases: 14 ADC clock cycles (equivalent to parameter "TwoSamplingDelay" set to "ADC_TWOSAMPLINGDELAY_7CYCLES" on other STM32 devices)) */
|
||||||
|
#define ADC_DUALMODE_INJECSIMULT ((uint32_t)( ADC_CR1_DUALMOD_2 | ADC_CR1_DUALMOD_0)) /*!< ADC dual mode enabled: Injected simultaneous mode, on group injected */
|
||||||
|
#define ADC_DUALMODE_REGSIMULT ((uint32_t)( ADC_CR1_DUALMOD_2 | ADC_CR1_DUALMOD_1 )) /*!< ADC dual mode enabled: Regular simultaneous mode, on group regular */
|
||||||
|
#define ADC_DUALMODE_INTERLFAST ((uint32_t)( ADC_CR1_DUALMOD_2 | ADC_CR1_DUALMOD_1 | ADC_CR1_DUALMOD_0)) /*!< ADC dual mode enabled: Fast interleaved mode, on group regular (delay between ADC sampling phases: 7 ADC clock cycles (equivalent to parameter "TwoSamplingDelay" set to "ADC_TWOSAMPLINGDELAY_7CYCLES" on other STM32 devices)) */
|
||||||
|
#define ADC_DUALMODE_INTERLSLOW ((uint32_t)(ADC_CR1_DUALMOD_3 )) /*!< ADC dual mode enabled: Slow interleaved mode, on group regular (delay between ADC sampling phases: 14 ADC clock cycles (equivalent to parameter "TwoSamplingDelay" set to "ADC_TWOSAMPLINGDELAY_7CYCLES" on other STM32 devices)) */
|
||||||
|
#define ADC_DUALMODE_ALTERTRIG ((uint32_t)(ADC_CR1_DUALMOD_3 | ADC_CR1_DUALMOD_0)) /*!< ADC dual mode enabled: Alternate trigger mode, on group injected */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
#endif /* defined STM32F103x6 || defined STM32F103xB || defined STM32F105xC || defined STM32F107xC || defined STM32F103xE || defined STM32F103xG */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Private constants ---------------------------------------------------------*/
|
||||||
|
|
||||||
|
/** @addtogroup ADCEx_Private_Constants ADCEx Private Constants
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup ADCEx_Internal_HAL_driver_Ext_trig_src_Regular ADC Extended Internal HAL driver trigger selection for regular group
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/* List of external triggers of regular group for ADC1, ADC2, ADC3 (if ADC */
|
||||||
|
/* instance is available on the selected device). */
|
||||||
|
/* (used internally by HAL driver. To not use into HAL structure parameters) */
|
||||||
|
|
||||||
|
/* External triggers of regular group for ADC1&ADC2 (if ADCx available) */
|
||||||
|
#define ADC1_2_EXTERNALTRIG_T1_CC1 0x00000000U
|
||||||
|
#define ADC1_2_EXTERNALTRIG_T1_CC2 ((uint32_t)( ADC_CR2_EXTSEL_0))
|
||||||
|
#define ADC1_2_EXTERNALTRIG_T2_CC2 ((uint32_t)( ADC_CR2_EXTSEL_1 | ADC_CR2_EXTSEL_0))
|
||||||
|
#define ADC1_2_EXTERNALTRIG_T3_TRGO ((uint32_t)(ADC_CR2_EXTSEL_2 ))
|
||||||
|
#define ADC1_2_EXTERNALTRIG_T4_CC4 ((uint32_t)(ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_0))
|
||||||
|
#define ADC1_2_EXTERNALTRIG_EXT_IT11 ((uint32_t)(ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_1 ))
|
||||||
|
#if defined (STM32F101xE) || defined (STM32F103xE) || defined (STM32F103xG)
|
||||||
|
/* Note: TIM8_TRGO is available on ADC1 and ADC2 only in high-density and */
|
||||||
|
/* XL-density devices. */
|
||||||
|
#define ADC1_2_EXTERNALTRIG_T8_TRGO ADC1_2_EXTERNALTRIG_EXT_IT11
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (STM32F103xE) || defined (STM32F103xG)
|
||||||
|
/* External triggers of regular group for ADC3 */
|
||||||
|
#define ADC3_EXTERNALTRIG_T3_CC1 ADC1_2_EXTERNALTRIG_T1_CC1
|
||||||
|
#define ADC3_EXTERNALTRIG_T2_CC3 ADC1_2_EXTERNALTRIG_T1_CC2
|
||||||
|
#define ADC3_EXTERNALTRIG_T8_CC1 ADC1_2_EXTERNALTRIG_T2_CC2
|
||||||
|
#define ADC3_EXTERNALTRIG_T8_TRGO ADC1_2_EXTERNALTRIG_T3_TRGO
|
||||||
|
#define ADC3_EXTERNALTRIG_T5_CC1 ADC1_2_EXTERNALTRIG_T4_CC4
|
||||||
|
#define ADC3_EXTERNALTRIG_T5_CC3 ADC1_2_EXTERNALTRIG_EXT_IT11
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* External triggers of regular group for ADC1&ADC2&ADC3 (if ADCx available) */
|
||||||
|
#define ADC1_2_3_EXTERNALTRIG_T1_CC3 ((uint32_t)( ADC_CR2_EXTSEL_1 ))
|
||||||
|
#define ADC1_2_3_SWSTART ((uint32_t)(ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_1 | ADC_CR2_EXTSEL_0))
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup ADCEx_Internal_HAL_driver_Ext_trig_src_Injected ADC Extended Internal HAL driver trigger selection for injected group
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/* List of external triggers of injected group for ADC1, ADC2, ADC3 (if ADC */
|
||||||
|
/* instance is available on the selected device). */
|
||||||
|
/* (used internally by HAL driver. To not use into HAL structure parameters) */
|
||||||
|
|
||||||
|
/* External triggers of injected group for ADC1&ADC2 (if ADCx available) */
|
||||||
|
#define ADC1_2_EXTERNALTRIGINJEC_T2_TRGO ((uint32_t)( ADC_CR2_JEXTSEL_1 ))
|
||||||
|
#define ADC1_2_EXTERNALTRIGINJEC_T2_CC1 ((uint32_t)( ADC_CR2_JEXTSEL_1 | ADC_CR2_JEXTSEL_0))
|
||||||
|
#define ADC1_2_EXTERNALTRIGINJEC_T3_CC4 ((uint32_t)(ADC_CR2_JEXTSEL_2 ))
|
||||||
|
#define ADC1_2_EXTERNALTRIGINJEC_T4_TRGO ((uint32_t)(ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_0))
|
||||||
|
#define ADC1_2_EXTERNALTRIGINJEC_EXT_IT15 ((uint32_t)(ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_1 ))
|
||||||
|
#if defined (STM32F101xE) || defined (STM32F103xE) || defined (STM32F103xG)
|
||||||
|
/* Note: TIM8_CC4 is available on ADC1 and ADC2 only in high-density and */
|
||||||
|
/* XL-density devices. */
|
||||||
|
#define ADC1_2_EXTERNALTRIGINJEC_T8_CC4 ADC1_2_EXTERNALTRIGINJEC_EXT_IT15
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (STM32F103xE) || defined (STM32F103xG)
|
||||||
|
/* External triggers of injected group for ADC3 */
|
||||||
|
#define ADC3_EXTERNALTRIGINJEC_T4_CC3 ADC1_2_EXTERNALTRIGINJEC_T2_TRGO
|
||||||
|
#define ADC3_EXTERNALTRIGINJEC_T8_CC2 ADC1_2_EXTERNALTRIGINJEC_T2_CC1
|
||||||
|
#define ADC3_EXTERNALTRIGINJEC_T8_CC4 ADC1_2_EXTERNALTRIGINJEC_T3_CC4
|
||||||
|
#define ADC3_EXTERNALTRIGINJEC_T5_TRGO ADC1_2_EXTERNALTRIGINJEC_T4_TRGO
|
||||||
|
#define ADC3_EXTERNALTRIGINJEC_T5_CC4 ADC1_2_EXTERNALTRIGINJEC_EXT_IT15
|
||||||
|
#endif /* STM32F103xE || defined STM32F103xG */
|
||||||
|
|
||||||
|
/* External triggers of injected group for ADC1&ADC2&ADC3 (if ADCx available) */
|
||||||
|
#define ADC1_2_3_EXTERNALTRIGINJEC_T1_TRGO 0x00000000U
|
||||||
|
#define ADC1_2_3_EXTERNALTRIGINJEC_T1_CC4 ((uint32_t)( ADC_CR2_JEXTSEL_0))
|
||||||
|
#define ADC1_2_3_JSWSTART ((uint32_t)(ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_1 | ADC_CR2_JEXTSEL_0))
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Private macro -------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/** @defgroup ADCEx_Private_Macro ADCEx Private Macro
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/* Macro reserved for internal HAL driver usage, not intended to be used in */
|
||||||
|
/* code of final user. */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief For devices with 3 ADCs: Defines the external trigger source
|
||||||
|
* for regular group according to ADC into common group ADC1&ADC2 or
|
||||||
|
* ADC3 (some triggers with same source have different value to
|
||||||
|
* be programmed into ADC EXTSEL bits of CR2 register).
|
||||||
|
* For devices with 2 ADCs or less: this macro makes no change.
|
||||||
|
* @param __HANDLE__: ADC handle
|
||||||
|
* @param __EXT_TRIG_CONV__: External trigger selected for regular group.
|
||||||
|
* @retval External trigger to be programmed into EXTSEL bits of CR2 register
|
||||||
|
*/
|
||||||
|
#if defined (STM32F103xE) || defined (STM32F103xG)
|
||||||
|
#define ADC_CFGR_EXTSEL(__HANDLE__, __EXT_TRIG_CONV__) \
|
||||||
|
(( (((__HANDLE__)->Instance) == ADC3) \
|
||||||
|
)? \
|
||||||
|
( ( (__EXT_TRIG_CONV__) == ADC_EXTERNALTRIGCONV_T8_TRGO \
|
||||||
|
)? \
|
||||||
|
(ADC3_EXTERNALTRIG_T8_TRGO) \
|
||||||
|
: \
|
||||||
|
(__EXT_TRIG_CONV__) \
|
||||||
|
) \
|
||||||
|
: \
|
||||||
|
(__EXT_TRIG_CONV__) \
|
||||||
|
)
|
||||||
|
#else
|
||||||
|
#define ADC_CFGR_EXTSEL(__HANDLE__, __EXT_TRIG_CONV__) \
|
||||||
|
(__EXT_TRIG_CONV__)
|
||||||
|
#endif /* STM32F103xE || STM32F103xG */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief For devices with 3 ADCs: Defines the external trigger source
|
||||||
|
* for injected group according to ADC into common group ADC1&ADC2 or
|
||||||
|
* ADC3 (some triggers with same source have different value to
|
||||||
|
* be programmed into ADC JEXTSEL bits of CR2 register).
|
||||||
|
* For devices with 2 ADCs or less: this macro makes no change.
|
||||||
|
* @param __HANDLE__: ADC handle
|
||||||
|
* @param __EXT_TRIG_INJECTCONV__: External trigger selected for injected group.
|
||||||
|
* @retval External trigger to be programmed into JEXTSEL bits of CR2 register
|
||||||
|
*/
|
||||||
|
#if defined (STM32F103xE) || defined (STM32F103xG)
|
||||||
|
#define ADC_CFGR_JEXTSEL(__HANDLE__, __EXT_TRIG_INJECTCONV__) \
|
||||||
|
(( (((__HANDLE__)->Instance) == ADC3) \
|
||||||
|
)? \
|
||||||
|
( ( (__EXT_TRIG_INJECTCONV__) == ADC_EXTERNALTRIGINJECCONV_T8_CC4 \
|
||||||
|
)? \
|
||||||
|
(ADC3_EXTERNALTRIGINJEC_T8_CC4) \
|
||||||
|
: \
|
||||||
|
(__EXT_TRIG_INJECTCONV__) \
|
||||||
|
) \
|
||||||
|
: \
|
||||||
|
(__EXT_TRIG_INJECTCONV__) \
|
||||||
|
)
|
||||||
|
#else
|
||||||
|
#define ADC_CFGR_JEXTSEL(__HANDLE__, __EXT_TRIG_INJECTCONV__) \
|
||||||
|
(__EXT_TRIG_INJECTCONV__)
|
||||||
|
#endif /* STM32F103xE || STM32F103xG */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Verification if multimode is enabled for the selected ADC (multimode ADC master or ADC slave) (applicable for devices with several ADCs)
|
||||||
|
* @param __HANDLE__: ADC handle
|
||||||
|
* @retval Multimode state: RESET if multimode is disabled, other value if multimode is enabled
|
||||||
|
*/
|
||||||
|
#if defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F105xC) || defined (STM32F107xC) || defined (STM32F103xE) || defined (STM32F103xG)
|
||||||
|
#define ADC_MULTIMODE_IS_ENABLE(__HANDLE__) \
|
||||||
|
(( (((__HANDLE__)->Instance) == ADC1) || (((__HANDLE__)->Instance) == ADC2) \
|
||||||
|
)? \
|
||||||
|
(ADC1->CR1 & ADC_CR1_DUALMOD) \
|
||||||
|
: \
|
||||||
|
(RESET) \
|
||||||
|
)
|
||||||
|
#else
|
||||||
|
#define ADC_MULTIMODE_IS_ENABLE(__HANDLE__) \
|
||||||
|
(RESET)
|
||||||
|
#endif /* defined STM32F103x6 || defined STM32F103xB || defined STM32F105xC || defined STM32F107xC || defined STM32F103xE || defined STM32F103xG */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Verification of condition for ADC start conversion: ADC must be in non-multimode, or multimode with handle of ADC master (applicable for devices with several ADCs)
|
||||||
|
* @param __HANDLE__: ADC handle
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#if defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F105xC) || defined (STM32F107xC) || defined (STM32F103xE) || defined (STM32F103xG)
|
||||||
|
#define ADC_NONMULTIMODE_OR_MULTIMODEMASTER(__HANDLE__) \
|
||||||
|
(( (((__HANDLE__)->Instance) == ADC2) \
|
||||||
|
)? \
|
||||||
|
((ADC1->CR1 & ADC_CR1_DUALMOD) == RESET) \
|
||||||
|
: \
|
||||||
|
(!RESET) \
|
||||||
|
)
|
||||||
|
#else
|
||||||
|
#define ADC_NONMULTIMODE_OR_MULTIMODEMASTER(__HANDLE__) \
|
||||||
|
(!RESET)
|
||||||
|
#endif /* defined STM32F103x6 || defined STM32F103xB || defined STM32F105xC || defined STM32F107xC || defined STM32F103xE || defined STM32F103xG */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Check ADC multimode setting: In case of multimode, check whether ADC master of the selected ADC has feature auto-injection enabled (applicable for devices with several ADCs)
|
||||||
|
* @param __HANDLE__: ADC handle
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#if defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F105xC) || defined (STM32F107xC) || defined (STM32F103xE) || defined (STM32F103xG)
|
||||||
|
#define ADC_MULTIMODE_AUTO_INJECTED(__HANDLE__) \
|
||||||
|
(( (((__HANDLE__)->Instance) == ADC1) || (((__HANDLE__)->Instance) == ADC2) \
|
||||||
|
)? \
|
||||||
|
(ADC1->CR1 & ADC_CR1_JAUTO) \
|
||||||
|
: \
|
||||||
|
(RESET) \
|
||||||
|
)
|
||||||
|
#else
|
||||||
|
#define ADC_MULTIMODE_AUTO_INJECTED(__HANDLE__) \
|
||||||
|
(RESET)
|
||||||
|
#endif /* defined STM32F103x6 || defined STM32F103xB || defined STM32F105xC || defined STM32F107xC || defined STM32F103xE || defined STM32F103xG */
|
||||||
|
|
||||||
|
#if defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F105xC) || defined (STM32F107xC) || defined (STM32F103xE) || defined (STM32F103xG)
|
||||||
|
/**
|
||||||
|
* @brief Set handle of the other ADC sharing the common multimode settings
|
||||||
|
* @param __HANDLE__: ADC handle
|
||||||
|
* @param __HANDLE_OTHER_ADC__: other ADC handle
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define ADC_COMMON_ADC_OTHER(__HANDLE__, __HANDLE_OTHER_ADC__) \
|
||||||
|
((__HANDLE_OTHER_ADC__)->Instance = ADC2)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set handle of the ADC slave associated to the ADC master
|
||||||
|
* On STM32F1 devices, ADC slave is always ADC2 (this can be different
|
||||||
|
* on other STM32 devices)
|
||||||
|
* @param __HANDLE_MASTER__: ADC master handle
|
||||||
|
* @param __HANDLE_SLAVE__: ADC slave handle
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define ADC_MULTI_SLAVE(__HANDLE_MASTER__, __HANDLE_SLAVE__) \
|
||||||
|
((__HANDLE_SLAVE__)->Instance = ADC2)
|
||||||
|
|
||||||
|
#endif /* defined STM32F103x6 || defined STM32F103xB || defined STM32F105xC || defined STM32F107xC || defined STM32F103xE || defined STM32F103xG */
|
||||||
|
|
||||||
|
#define IS_ADC_INJECTED_RANK(CHANNEL) (((CHANNEL) == ADC_INJECTED_RANK_1) || \
|
||||||
|
((CHANNEL) == ADC_INJECTED_RANK_2) || \
|
||||||
|
((CHANNEL) == ADC_INJECTED_RANK_3) || \
|
||||||
|
((CHANNEL) == ADC_INJECTED_RANK_4))
|
||||||
|
|
||||||
|
#define IS_ADC_EXTTRIGINJEC_EDGE(EDGE) (((EDGE) == ADC_EXTERNALTRIGINJECCONV_EDGE_NONE) || \
|
||||||
|
((EDGE) == ADC_EXTERNALTRIGINJECCONV_EDGE_RISING))
|
||||||
|
|
||||||
|
/** @defgroup ADCEx_injected_nb_conv_verification ADCEx injected nb conv verification
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define IS_ADC_INJECTED_NB_CONV(LENGTH) (((LENGTH) >= 1U) && ((LENGTH) <= 4U))
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined (STM32F100xB) || defined (STM32F100xE) || defined (STM32F101x6) || defined (STM32F101xB) || defined (STM32F102x6) || defined (STM32F102xB) || defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F105xC) || defined (STM32F107xC)
|
||||||
|
#define IS_ADC_EXTTRIG(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC1) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC2) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC2) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_TRGO) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_CC4) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGCONV_EXT_IT11) || \
|
||||||
|
((REGTRIG) == ADC_SOFTWARE_START))
|
||||||
|
#endif
|
||||||
|
#if defined (STM32F101xE)
|
||||||
|
#define IS_ADC_EXTTRIG(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC1) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC2) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC2) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_TRGO) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_CC4) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGCONV_EXT_IT11) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGCONV_T8_TRGO) || \
|
||||||
|
((REGTRIG) == ADC_SOFTWARE_START))
|
||||||
|
#endif
|
||||||
|
#if defined (STM32F101xG)
|
||||||
|
#define IS_ADC_EXTTRIG(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC1) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC2) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC2) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_TRGO) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_CC4) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGCONV_EXT_IT11) || \
|
||||||
|
((REGTRIG) == ADC_SOFTWARE_START))
|
||||||
|
#endif
|
||||||
|
#if defined (STM32F103xE) || defined (STM32F103xG)
|
||||||
|
#define IS_ADC_EXTTRIG(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC1) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC2) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC2) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_TRGO) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_CC4) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGCONV_EXT_IT11) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_CC1) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC3) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGCONV_T8_CC1) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGCONV_T5_CC1) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGCONV_T5_CC3) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC3) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGCONV_T8_TRGO) || \
|
||||||
|
((REGTRIG) == ADC_SOFTWARE_START))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (STM32F100xB) || defined (STM32F100xE) || defined (STM32F101x6) || defined (STM32F101xB) || defined (STM32F102x6) || defined (STM32F102xB) || defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F105xC) || defined (STM32F107xC)
|
||||||
|
#define IS_ADC_EXTTRIGINJEC(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_TRGO) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_CC1) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC4) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T4_TRGO) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_EXT_IT15) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_CC4) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO) || \
|
||||||
|
((REGTRIG) == ADC_INJECTED_SOFTWARE_START))
|
||||||
|
#endif
|
||||||
|
#if defined (STM32F101xE)
|
||||||
|
#define IS_ADC_EXTTRIGINJEC(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_TRGO) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_CC1) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC4) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T4_TRGO) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_EXT_IT15) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_CC4) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T8_CC4) || \
|
||||||
|
((REGTRIG) == ADC_INJECTED_SOFTWARE_START))
|
||||||
|
#endif
|
||||||
|
#if defined (STM32F101xG)
|
||||||
|
#define IS_ADC_EXTTRIGINJEC(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_TRGO) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_CC1) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC4) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T4_TRGO) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_EXT_IT15) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_CC4) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO) || \
|
||||||
|
((REGTRIG) == ADC_INJECTED_SOFTWARE_START))
|
||||||
|
#endif
|
||||||
|
#if defined (STM32F103xE) || defined (STM32F103xG)
|
||||||
|
#define IS_ADC_EXTTRIGINJEC(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_TRGO) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_CC1) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC4) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T4_TRGO) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T5_CC4) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_EXT_IT15) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T4_CC3) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T8_CC2) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T5_TRGO) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T5_CC4) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_CC4) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO) || \
|
||||||
|
((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T8_CC4) || \
|
||||||
|
((REGTRIG) == ADC_INJECTED_SOFTWARE_START))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F105xC) || defined (STM32F107xC) || defined (STM32F103xE) || defined (STM32F103xG)
|
||||||
|
#define IS_ADC_MODE(MODE) (((MODE) == ADC_MODE_INDEPENDENT) || \
|
||||||
|
((MODE) == ADC_DUALMODE_REGSIMULT_INJECSIMULT) || \
|
||||||
|
((MODE) == ADC_DUALMODE_REGSIMULT_ALTERTRIG) || \
|
||||||
|
((MODE) == ADC_DUALMODE_INJECSIMULT_INTERLFAST) || \
|
||||||
|
((MODE) == ADC_DUALMODE_INJECSIMULT_INTERLSLOW) || \
|
||||||
|
((MODE) == ADC_DUALMODE_INJECSIMULT) || \
|
||||||
|
((MODE) == ADC_DUALMODE_REGSIMULT) || \
|
||||||
|
((MODE) == ADC_DUALMODE_INTERLFAST) || \
|
||||||
|
((MODE) == ADC_DUALMODE_INTERLSLOW) || \
|
||||||
|
((MODE) == ADC_DUALMODE_ALTERTRIG) )
|
||||||
|
#endif /* defined STM32F103x6 || defined STM32F103xB || defined STM32F105xC || defined STM32F107xC || defined STM32F103xE || defined STM32F103xG */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
/** @addtogroup ADCEx_Exported_Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* IO operation functions *****************************************************/
|
||||||
|
/** @addtogroup ADCEx_Exported_Functions_Group1
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* ADC calibration */
|
||||||
|
HAL_StatusTypeDef HAL_ADCEx_Calibration_Start(ADC_HandleTypeDef* hadc);
|
||||||
|
|
||||||
|
/* Blocking mode: Polling */
|
||||||
|
HAL_StatusTypeDef HAL_ADCEx_InjectedStart(ADC_HandleTypeDef* hadc);
|
||||||
|
HAL_StatusTypeDef HAL_ADCEx_InjectedStop(ADC_HandleTypeDef* hadc);
|
||||||
|
HAL_StatusTypeDef HAL_ADCEx_InjectedPollForConversion(ADC_HandleTypeDef* hadc, uint32_t Timeout);
|
||||||
|
|
||||||
|
/* Non-blocking mode: Interruption */
|
||||||
|
HAL_StatusTypeDef HAL_ADCEx_InjectedStart_IT(ADC_HandleTypeDef* hadc);
|
||||||
|
HAL_StatusTypeDef HAL_ADCEx_InjectedStop_IT(ADC_HandleTypeDef* hadc);
|
||||||
|
|
||||||
|
#if defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F105xC) || defined (STM32F107xC) || defined (STM32F103xE) || defined (STM32F103xG)
|
||||||
|
/* ADC multimode */
|
||||||
|
HAL_StatusTypeDef HAL_ADCEx_MultiModeStart_DMA(ADC_HandleTypeDef *hadc, uint32_t *pData, uint32_t Length);
|
||||||
|
HAL_StatusTypeDef HAL_ADCEx_MultiModeStop_DMA(ADC_HandleTypeDef *hadc);
|
||||||
|
#endif /* defined STM32F103x6 || defined STM32F103xB || defined STM32F105xC || defined STM32F107xC || defined STM32F103xE || defined STM32F103xG */
|
||||||
|
|
||||||
|
/* ADC retrieve conversion value intended to be used with polling or interruption */
|
||||||
|
uint32_t HAL_ADCEx_InjectedGetValue(ADC_HandleTypeDef* hadc, uint32_t InjectedRank);
|
||||||
|
#if defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F105xC) || defined (STM32F107xC) || defined (STM32F103xE) || defined (STM32F103xG)
|
||||||
|
uint32_t HAL_ADCEx_MultiModeGetValue(ADC_HandleTypeDef *hadc);
|
||||||
|
#endif /* defined STM32F103x6 || defined STM32F103xB || defined STM32F105xC || defined STM32F107xC || defined STM32F103xE || defined STM32F103xG */
|
||||||
|
|
||||||
|
/* ADC IRQHandler and Callbacks used in non-blocking modes (Interruption) */
|
||||||
|
void HAL_ADCEx_InjectedConvCpltCallback(ADC_HandleTypeDef* hadc);
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Peripheral Control functions ***********************************************/
|
||||||
|
/** @addtogroup ADCEx_Exported_Functions_Group2
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_ADCEx_InjectedConfigChannel(ADC_HandleTypeDef* hadc,ADC_InjectionConfTypeDef* sConfigInjected);
|
||||||
|
#if defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F105xC) || defined (STM32F107xC) || defined (STM32F103xE) || defined (STM32F103xG)
|
||||||
|
HAL_StatusTypeDef HAL_ADCEx_MultiModeConfigChannel(ADC_HandleTypeDef *hadc, ADC_MultiModeTypeDef *multimode);
|
||||||
|
#endif /* defined STM32F103x6 || defined STM32F103xB || defined STM32F105xC || defined STM32F107xC || defined STM32F103xE || defined STM32F103xG */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __STM32F1xx_HAL_ADC_EX_H */
|
||||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,4 +1,10 @@
|
|||||||
#MicroXplorer Configuration settings - do not modify
|
#MicroXplorer Configuration settings - do not modify
|
||||||
|
ADC1.Channel-2\#ChannelRegularConversion=ADC_CHANNEL_0
|
||||||
|
ADC1.IPParameters=Rank-2\#ChannelRegularConversion,master,Channel-2\#ChannelRegularConversion,SamplingTime-2\#ChannelRegularConversion,NbrOfConversionFlag
|
||||||
|
ADC1.NbrOfConversionFlag=1
|
||||||
|
ADC1.Rank-2\#ChannelRegularConversion=1
|
||||||
|
ADC1.SamplingTime-2\#ChannelRegularConversion=ADC_SAMPLETIME_239CYCLES_5
|
||||||
|
ADC1.master=1
|
||||||
CAD.formats=
|
CAD.formats=
|
||||||
CAD.pinconfig=
|
CAD.pinconfig=
|
||||||
CAD.provider=
|
CAD.provider=
|
||||||
@@ -7,23 +13,25 @@ GPIO.groupedBy=
|
|||||||
KeepUserPlacement=false
|
KeepUserPlacement=false
|
||||||
Mcu.CPN=STM32F103C8T6
|
Mcu.CPN=STM32F103C8T6
|
||||||
Mcu.Family=STM32F1
|
Mcu.Family=STM32F1
|
||||||
Mcu.IP0=NVIC
|
Mcu.IP0=ADC1
|
||||||
Mcu.IP1=RCC
|
Mcu.IP1=NVIC
|
||||||
Mcu.IP2=SPI1
|
Mcu.IP2=RCC
|
||||||
Mcu.IP3=SYS
|
Mcu.IP3=SPI1
|
||||||
Mcu.IPNb=4
|
Mcu.IP4=SYS
|
||||||
|
Mcu.IPNb=5
|
||||||
Mcu.Name=STM32F103C(8-B)Tx
|
Mcu.Name=STM32F103C(8-B)Tx
|
||||||
Mcu.Package=LQFP48
|
Mcu.Package=LQFP48
|
||||||
Mcu.Pin0=PA5
|
Mcu.Pin0=PA0-WKUP
|
||||||
Mcu.Pin1=PA6
|
Mcu.Pin1=PA5
|
||||||
Mcu.Pin2=PA7
|
Mcu.Pin2=PA6
|
||||||
Mcu.Pin3=PB10
|
Mcu.Pin3=PA7
|
||||||
Mcu.Pin4=PB11
|
Mcu.Pin4=PB10
|
||||||
Mcu.Pin5=PB12
|
Mcu.Pin5=PB11
|
||||||
Mcu.Pin6=PA13
|
Mcu.Pin6=PB12
|
||||||
Mcu.Pin7=PA14
|
Mcu.Pin7=PA13
|
||||||
Mcu.Pin8=VP_SYS_VS_Systick
|
Mcu.Pin8=PA14
|
||||||
Mcu.PinsNb=9
|
Mcu.Pin9=VP_SYS_VS_Systick
|
||||||
|
Mcu.PinsNb=10
|
||||||
Mcu.ThirdPartyNb=0
|
Mcu.ThirdPartyNb=0
|
||||||
Mcu.UserConstants=
|
Mcu.UserConstants=
|
||||||
Mcu.UserName=STM32F103C8Tx
|
Mcu.UserName=STM32F103C8Tx
|
||||||
@@ -40,6 +48,7 @@ NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
|
|||||||
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||||
NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:false\:true\:false
|
NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:false\:true\:false
|
||||||
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||||
|
PA0-WKUP.Signal=ADCx_IN0
|
||||||
PA13.Mode=Serial_Wire
|
PA13.Mode=Serial_Wire
|
||||||
PA13.Signal=SYS_JTMS-SWDIO
|
PA13.Signal=SYS_JTMS-SWDIO
|
||||||
PA14.Mode=Serial_Wire
|
PA14.Mode=Serial_Wire
|
||||||
@@ -104,6 +113,8 @@ RCC.IPParameters=APB1Freq_Value,APB2Freq_Value,FamilyName,PLLCLKFreq_Value,PLLMC
|
|||||||
RCC.PLLCLKFreq_Value=8000000
|
RCC.PLLCLKFreq_Value=8000000
|
||||||
RCC.PLLMCOFreq_Value=4000000
|
RCC.PLLMCOFreq_Value=4000000
|
||||||
RCC.TimSysFreq_Value=8000000
|
RCC.TimSysFreq_Value=8000000
|
||||||
|
SH.ADCx_IN0.0=ADC1_IN0,IN0
|
||||||
|
SH.ADCx_IN0.ConfNb=1
|
||||||
SPI1.CalculateBaudRate=4.0 MBits/s
|
SPI1.CalculateBaudRate=4.0 MBits/s
|
||||||
SPI1.Direction=SPI_DIRECTION_2LINES
|
SPI1.Direction=SPI_DIRECTION_2LINES
|
||||||
SPI1.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate
|
SPI1.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate
|
||||||
|
|||||||
Reference in new issue
Block a user