Prusa MINI Firmware overview
|
Go to the documentation of this file.
37 #ifndef __STM32F4xx_ADC_H
38 #define __STM32F4xx_ADC_H
173 #define HAL_ADC_STATE_RESET 0x00000000U
174 #define HAL_ADC_STATE_READY 0x00000001U
175 #define HAL_ADC_STATE_BUSY_INTERNAL 0x00000002U
176 #define HAL_ADC_STATE_TIMEOUT 0x00000004U
179 #define HAL_ADC_STATE_ERROR_INTERNAL 0x00000010U
180 #define HAL_ADC_STATE_ERROR_CONFIG 0x00000020U
181 #define HAL_ADC_STATE_ERROR_DMA 0x00000040U
184 #define HAL_ADC_STATE_REG_BUSY 0x00000100U
186 #define HAL_ADC_STATE_REG_EOC 0x00000200U
187 #define HAL_ADC_STATE_REG_OVR 0x00000400U
190 #define HAL_ADC_STATE_INJ_BUSY 0x00001000U
192 #define HAL_ADC_STATE_INJ_EOC 0x00002000U
195 #define HAL_ADC_STATE_AWD1 0x00010000U
196 #define HAL_ADC_STATE_AWD2 0x00020000U
197 #define HAL_ADC_STATE_AWD3 0x00040000U
200 #define HAL_ADC_STATE_MULTIMODE_SLAVE 0x00100000U
208 ADC_TypeDef *Instance;
212 __IO uint32_t NbrOfCurrentConversionRank;
220 __IO uint32_t ErrorCode;
234 #define HAL_ADC_ERROR_NONE 0x00U
235 #define HAL_ADC_ERROR_INTERNAL 0x01U
237 #define HAL_ADC_ERROR_OVR 0x02U
238 #define HAL_ADC_ERROR_DMA 0x04U
247 #define ADC_CLOCK_SYNC_PCLK_DIV2 0x00000000U
248 #define ADC_CLOCK_SYNC_PCLK_DIV4 ((uint32_t)ADC_CCR_ADCPRE_0)
249 #define ADC_CLOCK_SYNC_PCLK_DIV6 ((uint32_t)ADC_CCR_ADCPRE_1)
250 #define ADC_CLOCK_SYNC_PCLK_DIV8 ((uint32_t)ADC_CCR_ADCPRE)
258 #define ADC_TWOSAMPLINGDELAY_5CYCLES 0x00000000U
259 #define ADC_TWOSAMPLINGDELAY_6CYCLES ((uint32_t)ADC_CCR_DELAY_0)
260 #define ADC_TWOSAMPLINGDELAY_7CYCLES ((uint32_t)ADC_CCR_DELAY_1)
261 #define ADC_TWOSAMPLINGDELAY_8CYCLES ((uint32_t)(ADC_CCR_DELAY_1 | ADC_CCR_DELAY_0))
262 #define ADC_TWOSAMPLINGDELAY_9CYCLES ((uint32_t)ADC_CCR_DELAY_2)
263 #define ADC_TWOSAMPLINGDELAY_10CYCLES ((uint32_t)(ADC_CCR_DELAY_2 | ADC_CCR_DELAY_0))
264 #define ADC_TWOSAMPLINGDELAY_11CYCLES ((uint32_t)(ADC_CCR_DELAY_2 | ADC_CCR_DELAY_1))
265 #define ADC_TWOSAMPLINGDELAY_12CYCLES ((uint32_t)(ADC_CCR_DELAY_2 | ADC_CCR_DELAY_1 | ADC_CCR_DELAY_0))
266 #define ADC_TWOSAMPLINGDELAY_13CYCLES ((uint32_t)ADC_CCR_DELAY_3)
267 #define ADC_TWOSAMPLINGDELAY_14CYCLES ((uint32_t)(ADC_CCR_DELAY_3 | ADC_CCR_DELAY_0))
268 #define ADC_TWOSAMPLINGDELAY_15CYCLES ((uint32_t)(ADC_CCR_DELAY_3 | ADC_CCR_DELAY_1))
269 #define ADC_TWOSAMPLINGDELAY_16CYCLES ((uint32_t)(ADC_CCR_DELAY_3 | ADC_CCR_DELAY_1 | ADC_CCR_DELAY_0))
270 #define ADC_TWOSAMPLINGDELAY_17CYCLES ((uint32_t)(ADC_CCR_DELAY_3 | ADC_CCR_DELAY_2))
271 #define ADC_TWOSAMPLINGDELAY_18CYCLES ((uint32_t)(ADC_CCR_DELAY_3 | ADC_CCR_DELAY_2 | ADC_CCR_DELAY_0))
272 #define ADC_TWOSAMPLINGDELAY_19CYCLES ((uint32_t)(ADC_CCR_DELAY_3 | ADC_CCR_DELAY_2 | ADC_CCR_DELAY_1))
273 #define ADC_TWOSAMPLINGDELAY_20CYCLES ((uint32_t)ADC_CCR_DELAY)
281 #define ADC_RESOLUTION_12B 0x00000000U
282 #define ADC_RESOLUTION_10B ((uint32_t)ADC_CR1_RES_0)
283 #define ADC_RESOLUTION_8B ((uint32_t)ADC_CR1_RES_1)
284 #define ADC_RESOLUTION_6B ((uint32_t)ADC_CR1_RES)
292 #define ADC_EXTERNALTRIGCONVEDGE_NONE 0x00000000U
293 #define ADC_EXTERNALTRIGCONVEDGE_RISING ((uint32_t)ADC_CR2_EXTEN_0)
294 #define ADC_EXTERNALTRIGCONVEDGE_FALLING ((uint32_t)ADC_CR2_EXTEN_1)
295 #define ADC_EXTERNALTRIGCONVEDGE_RISINGFALLING ((uint32_t)ADC_CR2_EXTEN)
305 #define ADC_EXTERNALTRIGCONV_T1_CC1 0x00000000U
306 #define ADC_EXTERNALTRIGCONV_T1_CC2 ((uint32_t)ADC_CR2_EXTSEL_0)
307 #define ADC_EXTERNALTRIGCONV_T1_CC3 ((uint32_t)ADC_CR2_EXTSEL_1)
308 #define ADC_EXTERNALTRIGCONV_T2_CC2 ((uint32_t)(ADC_CR2_EXTSEL_1 | ADC_CR2_EXTSEL_0))
309 #define ADC_EXTERNALTRIGCONV_T2_CC3 ((uint32_t)ADC_CR2_EXTSEL_2)
310 #define ADC_EXTERNALTRIGCONV_T2_CC4 ((uint32_t)(ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_0))
311 #define ADC_EXTERNALTRIGCONV_T2_TRGO ((uint32_t)(ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_1))
312 #define ADC_EXTERNALTRIGCONV_T3_CC1 ((uint32_t)(ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_1 | ADC_CR2_EXTSEL_0))
313 #define ADC_EXTERNALTRIGCONV_T3_TRGO ((uint32_t)ADC_CR2_EXTSEL_3)
314 #define ADC_EXTERNALTRIGCONV_T4_CC4 ((uint32_t)(ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_0))
315 #define ADC_EXTERNALTRIGCONV_T5_CC1 ((uint32_t)(ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_1))
316 #define ADC_EXTERNALTRIGCONV_T5_CC2 ((uint32_t)(ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_1 | ADC_CR2_EXTSEL_0))
317 #define ADC_EXTERNALTRIGCONV_T5_CC3 ((uint32_t)(ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_2))
318 #define ADC_EXTERNALTRIGCONV_T8_CC1 ((uint32_t)(ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_0))
319 #define ADC_EXTERNALTRIGCONV_T8_TRGO ((uint32_t)(ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_1))
320 #define ADC_EXTERNALTRIGCONV_Ext_IT11 ((uint32_t)ADC_CR2_EXTSEL)
321 #define ADC_SOFTWARE_START ((uint32_t)ADC_CR2_EXTSEL + 1U)
329 #define ADC_DATAALIGN_RIGHT 0x00000000U
330 #define ADC_DATAALIGN_LEFT ((uint32_t)ADC_CR2_ALIGN)
338 #define ADC_CHANNEL_0 0x00000000U
339 #define ADC_CHANNEL_1 ((uint32_t)ADC_CR1_AWDCH_0)
340 #define ADC_CHANNEL_2 ((uint32_t)ADC_CR1_AWDCH_1)
341 #define ADC_CHANNEL_3 ((uint32_t)(ADC_CR1_AWDCH_1 | ADC_CR1_AWDCH_0))
342 #define ADC_CHANNEL_4 ((uint32_t)ADC_CR1_AWDCH_2)
343 #define ADC_CHANNEL_5 ((uint32_t)(ADC_CR1_AWDCH_2 | ADC_CR1_AWDCH_0))
344 #define ADC_CHANNEL_6 ((uint32_t)(ADC_CR1_AWDCH_2 | ADC_CR1_AWDCH_1))
345 #define ADC_CHANNEL_7 ((uint32_t)(ADC_CR1_AWDCH_2 | ADC_CR1_AWDCH_1 | ADC_CR1_AWDCH_0))
346 #define ADC_CHANNEL_8 ((uint32_t)ADC_CR1_AWDCH_3)
347 #define ADC_CHANNEL_9 ((uint32_t)(ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_0))
348 #define ADC_CHANNEL_10 ((uint32_t)(ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_1))
349 #define ADC_CHANNEL_11 ((uint32_t)(ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_1 | ADC_CR1_AWDCH_0))
350 #define ADC_CHANNEL_12 ((uint32_t)(ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_2))
351 #define ADC_CHANNEL_13 ((uint32_t)(ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_2 | ADC_CR1_AWDCH_0))
352 #define ADC_CHANNEL_14 ((uint32_t)(ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_2 | ADC_CR1_AWDCH_1))
353 #define ADC_CHANNEL_15 ((uint32_t)(ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_2 | ADC_CR1_AWDCH_1 | ADC_CR1_AWDCH_0))
354 #define ADC_CHANNEL_16 ((uint32_t)ADC_CR1_AWDCH_4)
355 #define ADC_CHANNEL_17 ((uint32_t)(ADC_CR1_AWDCH_4 | ADC_CR1_AWDCH_0))
356 #define ADC_CHANNEL_18 ((uint32_t)(ADC_CR1_AWDCH_4 | ADC_CR1_AWDCH_1))
358 #define ADC_CHANNEL_VREFINT ((uint32_t)ADC_CHANNEL_17)
359 #define ADC_CHANNEL_VBAT ((uint32_t)ADC_CHANNEL_18)
367 #define ADC_SAMPLETIME_3CYCLES 0x00000000U
368 #define ADC_SAMPLETIME_15CYCLES ((uint32_t)ADC_SMPR1_SMP10_0)
369 #define ADC_SAMPLETIME_28CYCLES ((uint32_t)ADC_SMPR1_SMP10_1)
370 #define ADC_SAMPLETIME_56CYCLES ((uint32_t)(ADC_SMPR1_SMP10_1 | ADC_SMPR1_SMP10_0))
371 #define ADC_SAMPLETIME_84CYCLES ((uint32_t)ADC_SMPR1_SMP10_2)
372 #define ADC_SAMPLETIME_112CYCLES ((uint32_t)(ADC_SMPR1_SMP10_2 | ADC_SMPR1_SMP10_0))
373 #define ADC_SAMPLETIME_144CYCLES ((uint32_t)(ADC_SMPR1_SMP10_2 | ADC_SMPR1_SMP10_1))
374 #define ADC_SAMPLETIME_480CYCLES ((uint32_t)ADC_SMPR1_SMP10)
382 #define ADC_EOC_SEQ_CONV 0x00000000U
383 #define ADC_EOC_SINGLE_CONV 0x00000001U
384 #define ADC_EOC_SINGLE_SEQ_CONV 0x00000002U
392 #define ADC_AWD_EVENT ((uint32_t)ADC_FLAG_AWD)
393 #define ADC_OVR_EVENT ((uint32_t)ADC_FLAG_OVR)
401 #define ADC_ANALOGWATCHDOG_SINGLE_REG ((uint32_t)(ADC_CR1_AWDSGL | ADC_CR1_AWDEN))
402 #define ADC_ANALOGWATCHDOG_SINGLE_INJEC ((uint32_t)(ADC_CR1_AWDSGL | ADC_CR1_JAWDEN))
403 #define ADC_ANALOGWATCHDOG_SINGLE_REGINJEC ((uint32_t)(ADC_CR1_AWDSGL | ADC_CR1_AWDEN | ADC_CR1_JAWDEN))
404 #define ADC_ANALOGWATCHDOG_ALL_REG ((uint32_t)ADC_CR1_AWDEN)
405 #define ADC_ANALOGWATCHDOG_ALL_INJEC ((uint32_t)ADC_CR1_JAWDEN)
406 #define ADC_ANALOGWATCHDOG_ALL_REGINJEC ((uint32_t)(ADC_CR1_AWDEN | ADC_CR1_JAWDEN))
407 #define ADC_ANALOGWATCHDOG_NONE 0x00000000U
415 #define ADC_IT_EOC ((uint32_t)ADC_CR1_EOCIE)
416 #define ADC_IT_AWD ((uint32_t)ADC_CR1_AWDIE)
417 #define ADC_IT_JEOC ((uint32_t)ADC_CR1_JEOCIE)
418 #define ADC_IT_OVR ((uint32_t)ADC_CR1_OVRIE)
426 #define ADC_FLAG_AWD ((uint32_t)ADC_SR_AWD)
427 #define ADC_FLAG_EOC ((uint32_t)ADC_SR_EOC)
428 #define ADC_FLAG_JEOC ((uint32_t)ADC_SR_JEOC)
429 #define ADC_FLAG_JSTRT ((uint32_t)ADC_SR_JSTRT)
430 #define ADC_FLAG_STRT ((uint32_t)ADC_SR_STRT)
431 #define ADC_FLAG_OVR ((uint32_t)ADC_SR_OVR)
439 #define ADC_ALL_CHANNELS 0x00000001U
440 #define ADC_REGULAR_CHANNELS 0x00000002U
441 #define ADC_INJECTED_CHANNELS 0x00000003U
459 #define __HAL_ADC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_ADC_STATE_RESET)
466 #define __HAL_ADC_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR2 |= ADC_CR2_ADON)
473 #define __HAL_ADC_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR2 &= ~ADC_CR2_ADON)
481 #define __HAL_ADC_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR1) |= (__INTERRUPT__))
489 #define __HAL_ADC_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR1) &= ~(__INTERRUPT__))
496 #define __HAL_ADC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR1 & (__INTERRUPT__)) == (__INTERRUPT__))
504 #define __HAL_ADC_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR) = ~(__FLAG__))
512 #define __HAL_ADC_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__))
598 #define ADC_STAB_DELAY_US 3U
602 #define ADC_TEMPSENSOR_DELAY_US 10U
620 #define ADC_IS_ENABLE(__HANDLE__) \
621 ((( ((__HANDLE__)->Instance->SR & ADC_SR_ADONS) == ADC_SR_ADONS ) \
630 #define ADC_IS_SOFTWARE_START_REGULAR(__HANDLE__) \
631 (((__HANDLE__)->Instance->CR2 & ADC_CR2_EXTEN) == RESET)
639 #define ADC_IS_SOFTWARE_START_INJECTED(__HANDLE__) \
640 (((__HANDLE__)->Instance->CR2 & ADC_CR2_JEXTEN) == RESET)
649 #define ADC_STATE_CLR_SET MODIFY_REG
656 #define ADC_CLEAR_ERRORCODE(__HANDLE__) \
657 ((__HANDLE__)->ErrorCode = HAL_ADC_ERROR_NONE)
660 #define IS_ADC_CLOCKPRESCALER(ADC_CLOCK) (((ADC_CLOCK) == ADC_CLOCK_SYNC_PCLK_DIV2) || \
661 ((ADC_CLOCK) == ADC_CLOCK_SYNC_PCLK_DIV4) || \
662 ((ADC_CLOCK) == ADC_CLOCK_SYNC_PCLK_DIV6) || \
663 ((ADC_CLOCK) == ADC_CLOCK_SYNC_PCLK_DIV8))
664 #define IS_ADC_SAMPLING_DELAY(DELAY) (((DELAY) == ADC_TWOSAMPLINGDELAY_5CYCLES) || \
665 ((DELAY) == ADC_TWOSAMPLINGDELAY_6CYCLES) || \
666 ((DELAY) == ADC_TWOSAMPLINGDELAY_7CYCLES) || \
667 ((DELAY) == ADC_TWOSAMPLINGDELAY_8CYCLES) || \
668 ((DELAY) == ADC_TWOSAMPLINGDELAY_9CYCLES) || \
669 ((DELAY) == ADC_TWOSAMPLINGDELAY_10CYCLES) || \
670 ((DELAY) == ADC_TWOSAMPLINGDELAY_11CYCLES) || \
671 ((DELAY) == ADC_TWOSAMPLINGDELAY_12CYCLES) || \
672 ((DELAY) == ADC_TWOSAMPLINGDELAY_13CYCLES) || \
673 ((DELAY) == ADC_TWOSAMPLINGDELAY_14CYCLES) || \
674 ((DELAY) == ADC_TWOSAMPLINGDELAY_15CYCLES) || \
675 ((DELAY) == ADC_TWOSAMPLINGDELAY_16CYCLES) || \
676 ((DELAY) == ADC_TWOSAMPLINGDELAY_17CYCLES) || \
677 ((DELAY) == ADC_TWOSAMPLINGDELAY_18CYCLES) || \
678 ((DELAY) == ADC_TWOSAMPLINGDELAY_19CYCLES) || \
679 ((DELAY) == ADC_TWOSAMPLINGDELAY_20CYCLES))
680 #define IS_ADC_RESOLUTION(RESOLUTION) (((RESOLUTION) == ADC_RESOLUTION_12B) || \
681 ((RESOLUTION) == ADC_RESOLUTION_10B) || \
682 ((RESOLUTION) == ADC_RESOLUTION_8B) || \
683 ((RESOLUTION) == ADC_RESOLUTION_6B))
684 #define IS_ADC_EXT_TRIG_EDGE(EDGE) (((EDGE) == ADC_EXTERNALTRIGCONVEDGE_NONE) || \
685 ((EDGE) == ADC_EXTERNALTRIGCONVEDGE_RISING) || \
686 ((EDGE) == ADC_EXTERNALTRIGCONVEDGE_FALLING) || \
687 ((EDGE) == ADC_EXTERNALTRIGCONVEDGE_RISINGFALLING))
688 #define IS_ADC_EXT_TRIG(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC1) || \
689 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC2) || \
690 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC3) || \
691 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC2) || \
692 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC3) || \
693 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC4) || \
694 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_TRGO) || \
695 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_CC1) || \
696 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_TRGO) || \
697 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_CC4) || \
698 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T5_CC1) || \
699 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T5_CC2) || \
700 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T5_CC3) || \
701 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T8_CC1) || \
702 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T8_TRGO) || \
703 ((REGTRIG) == ADC_EXTERNALTRIGCONV_Ext_IT11)|| \
704 ((REGTRIG) == ADC_SOFTWARE_START))
705 #define IS_ADC_DATA_ALIGN(ALIGN) (((ALIGN) == ADC_DATAALIGN_RIGHT) || \
706 ((ALIGN) == ADC_DATAALIGN_LEFT))
707 #define IS_ADC_SAMPLE_TIME(TIME) (((TIME) == ADC_SAMPLETIME_3CYCLES) || \
708 ((TIME) == ADC_SAMPLETIME_15CYCLES) || \
709 ((TIME) == ADC_SAMPLETIME_28CYCLES) || \
710 ((TIME) == ADC_SAMPLETIME_56CYCLES) || \
711 ((TIME) == ADC_SAMPLETIME_84CYCLES) || \
712 ((TIME) == ADC_SAMPLETIME_112CYCLES) || \
713 ((TIME) == ADC_SAMPLETIME_144CYCLES) || \
714 ((TIME) == ADC_SAMPLETIME_480CYCLES))
715 #define IS_ADC_EOCSelection(EOCSelection) (((EOCSelection) == ADC_EOC_SINGLE_CONV) || \
716 ((EOCSelection) == ADC_EOC_SEQ_CONV) || \
717 ((EOCSelection) == ADC_EOC_SINGLE_SEQ_CONV))
718 #define IS_ADC_EVENT_TYPE(EVENT) (((EVENT) == ADC_AWD_EVENT) || \
719 ((EVENT) == ADC_OVR_EVENT))
720 #define IS_ADC_ANALOG_WATCHDOG(WATCHDOG) (((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_REG) || \
721 ((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_INJEC) || \
722 ((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_REGINJEC) || \
723 ((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_REG) || \
724 ((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_INJEC) || \
725 ((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_REGINJEC) || \
726 ((WATCHDOG) == ADC_ANALOGWATCHDOG_NONE))
727 #define IS_ADC_CHANNELS_TYPE(CHANNEL_TYPE) (((CHANNEL_TYPE) == ADC_ALL_CHANNELS) || \
728 ((CHANNEL_TYPE) == ADC_REGULAR_CHANNELS) || \
729 ((CHANNEL_TYPE) == ADC_INJECTED_CHANNELS))
730 #define IS_ADC_THRESHOLD(THRESHOLD) ((THRESHOLD) <= 0xFFFU)
732 #define IS_ADC_REGULAR_LENGTH(LENGTH) (((LENGTH) >= 1U) && ((LENGTH) <= 16U))
733 #define IS_ADC_REGULAR_RANK(RANK) (((RANK) >= 1U) && ((RANK) <= (16U)))
734 #define IS_ADC_REGULAR_DISC_NUMBER(NUMBER) (((NUMBER) >= 1U) && ((NUMBER) <= 8U))
735 #define IS_ADC_RANGE(RESOLUTION, ADC_VALUE) \
736 ((((RESOLUTION) == ADC_RESOLUTION_12B) && ((ADC_VALUE) <= 0x0FFFU)) || \
737 (((RESOLUTION) == ADC_RESOLUTION_10B) && ((ADC_VALUE) <= 0x03FFU)) || \
738 (((RESOLUTION) == ADC_RESOLUTION_8B) && ((ADC_VALUE) <= 0x00FFU)) || \
739 (((RESOLUTION) == ADC_RESOLUTION_6B) && ((ADC_VALUE) <= 0x003FU)))
746 #define ADC_SQR1(_NbrOfConversion_) (((_NbrOfConversion_) - (uint8_t)1U) << 20U)
754 #define ADC_SMPR1(_SAMPLETIME_, _CHANNELNB_) ((_SAMPLETIME_) << (3U * (((uint32_t)((uint16_t)(_CHANNELNB_))) - 10U)))
762 #define ADC_SMPR2(_SAMPLETIME_, _CHANNELNB_) ((_SAMPLETIME_) << (3U * ((uint32_t)((uint16_t)(_CHANNELNB_)))))
770 #define ADC_SQR3_RK(_CHANNELNB_, _RANKNB_) (((uint32_t)((uint16_t)(_CHANNELNB_))) << (5U * ((_RANKNB_) - 1U)))
778 #define ADC_SQR2_RK(_CHANNELNB_, _RANKNB_) (((uint32_t)((uint16_t)(_CHANNELNB_))) << (5U * ((_RANKNB_) - 7U)))
786 #define ADC_SQR1_RK(_CHANNELNB_, _RANKNB_) (((uint32_t)((uint16_t)(_CHANNELNB_))) << (5U * ((_RANKNB_) - 13U)))
793 #define ADC_CR2_CONTINUOUS(_CONTINUOUS_MODE_) ((_CONTINUOUS_MODE_) << 1U)
800 #define ADC_CR1_DISCONTINUOUS(_NBR_DISCONTINUOUSCONV_) (((_NBR_DISCONTINUOUSCONV_) - 1U) << ADC_CR1_DISCNUM_Pos)
807 #define ADC_CR1_SCANCONV(_SCANCONV_MODE_) ((_SCANCONV_MODE_) << 8U)
814 #define ADC_CR2_EOCSelection(_EOCSelection_MODE_) ((_EOCSelection_MODE_) << 10U)
821 #define ADC_CR2_DMAContReq(_DMAContReq_MODE_) ((_DMAContReq_MODE_) << 9U)
828 #define ADC_GET_RESOLUTION(__HANDLE__) (((__HANDLE__)->Instance->CR1) & ADC_CR1_RES)
uint32_t HAL_ADC_GetState(ADC_HandleTypeDef *hadc)
uint32_t ContinuousConvMode
Definition: stm32f4xx_hal_adc.h:97
This file contains HAL common defines, enumeration, macros and structures definitions.
uint32_t WatchdogNumber
Definition: stm32f4xx_hal_adc.h:166
uint32_t ITMode
Definition: stm32f4xx_hal_adc.h:163
HAL_StatusTypeDef HAL_ADC_Start(ADC_HandleTypeDef *hadc)
void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc)
ADC MSP De-Initialization This function freeze the hardware resources used in this example.
Definition: stm32f4xx_hal_msp.c:158
void HAL_ADC_IRQHandler(ADC_HandleTypeDef *hadc)
HAL_StatusTypeDef HAL_ADC_AnalogWDGConfig(ADC_HandleTypeDef *hadc, ADC_AnalogWDGConfTypeDef *AnalogWDGConfig)
uint32_t Offset
Definition: stm32f4xx_hal_adc.h:146
uint32_t DMAContinuousRequests
Definition: stm32f4xx_hal_adc.h:117
void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc)
ADC MSP Initialization This function configures the hardware resources used in this example.
Definition: stm32f4xx_hal_msp.c:116
uint32_t HAL_ADC_GetValue(ADC_HandleTypeDef *hadc)
uint32_t Channel
Definition: stm32f4xx_hal_adc.h:133
uint32_t Rank
Definition: stm32f4xx_hal_adc.h:135
HAL_StatusTypeDef HAL_ADC_DeInit(ADC_HandleTypeDef *hadc)
HAL_StatusTypeDef HAL_ADC_Stop_DMA(ADC_HandleTypeDef *hadc)
HAL_StatusTypeDef
HAL Status structures definition.
Definition: stm32f4xx_hal_def.h:55
uint32_t WatchdogMode
Definition: stm32f4xx_hal_adc.h:154
void HAL_ADC_ErrorCallback(ADC_HandleTypeDef *hadc)
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef *hadc)
void HAL_ADC_ConvHalfCpltCallback(ADC_HandleTypeDef *hadc)
Structure definition of ADC channel for regular group.
Definition: stm32f4xx_hal_adc.h:131
HAL_StatusTypeDef HAL_ADC_Init(ADC_HandleTypeDef *hadc)
uint32_t DataAlign
Definition: stm32f4xx_hal_adc.h:80
uint32_t Resolution
Definition: stm32f4xx_hal_adc.h:78
uint32_t HAL_ADC_GetError(ADC_HandleTypeDef *hadc)
uint32_t Channel
Definition: stm32f4xx_hal_adc.h:160
DMA handle Structure definition.
Definition: stm32f4xx_hal_dma.h:155
HAL_StatusTypeDef HAL_ADC_Stop(ADC_HandleTypeDef *hadc)
uint32_t ClockPrescaler
Definition: stm32f4xx_hal_adc.h:75
uint32_t SamplingTime
Definition: stm32f4xx_hal_adc.h:137
ADC Configuration multi-mode structure definition.
Definition: stm32f4xx_hal_adc.h:152
Structure definition of ADC and regular group initialization.
Definition: stm32f4xx_hal_adc.h:73
ADC handle Structure definition.
Definition: stm32f4xx_hal_adc.h:208
uint32_t NbrOfDiscConversion
Definition: stm32f4xx_hal_adc.h:107
HAL_StatusTypeDef HAL_ADC_Start_DMA(ADC_HandleTypeDef *hadc, uint32_t *pData, uint32_t Length)
HAL_StatusTypeDef HAL_ADC_PollForConversion(ADC_HandleTypeDef *hadc, uint32_t Timeout)
HAL_StatusTypeDef HAL_ADC_Start_IT(ADC_HandleTypeDef *hadc)
uint32_t NbrOfConversion
Definition: stm32f4xx_hal_adc.h:100
uint32_t EOCSelection
Definition: stm32f4xx_hal_adc.h:90
uint32_t DiscontinuousConvMode
Definition: stm32f4xx_hal_adc.h:103
uint32_t ExternalTrigConvEdge
Definition: stm32f4xx_hal_adc.h:114
HAL_StatusTypeDef HAL_ADC_ConfigChannel(ADC_HandleTypeDef *hadc, ADC_ChannelConfTypeDef *sConfig)
HAL_StatusTypeDef HAL_ADC_Stop_IT(ADC_HandleTypeDef *hadc)
Header file of ADC HAL module.
uint32_t ScanConvMode
Definition: stm32f4xx_hal_adc.h:83
uint32_t LowThreshold
Definition: stm32f4xx_hal_adc.h:158
void HAL_ADC_LevelOutOfWindowCallback(ADC_HandleTypeDef *hadc)
HAL_LockTypeDef
HAL Lock structures definition.
Definition: stm32f4xx_hal_def.h:66
HAL_StatusTypeDef HAL_ADC_PollForEvent(ADC_HandleTypeDef *hadc, uint32_t EventType, uint32_t Timeout)
uint32_t ExternalTrigConv
Definition: stm32f4xx_hal_adc.h:110
uint32_t HighThreshold
Definition: stm32f4xx_hal_adc.h:156