30 #ifndef __STM32F30x_ADC_H 31 #define __STM32F30x_ADC_H 38 #include "stm32f30x.h" 59 uint32_t ADC_Resolution;
67 uint32_t ADC_DataAlign;
114 uint32_t ADC_DMAAccessMode;
130 #define IS_ADC_ALL_PERIPH(PERIPH) (((PERIPH) == ADC1) || \ 131 ((PERIPH) == ADC2) || \ 132 ((PERIPH) == ADC3) || \ 135 #define IS_ADC_DMA_PERIPH(PERIPH) (((PERIPH) == ADC1) || \ 136 ((PERIPH) == ADC2) || \ 137 ((PERIPH) == ADC3) || \ 143 #define ADC_ContinuousConvMode_Enable ((uint32_t)0x00002000) 144 #define ADC_ContinuousConvMode_Disable ((uint32_t)0x00000000) 145 #define IS_ADC_CONVMODE(MODE) (((MODE) == ADC_ContinuousConvMode_Enable) || \ 146 ((MODE) == ADC_ContinuousConvMode_Disable)) 153 #define ADC_OverrunMode_Enable ((uint32_t)0x00001000) 154 #define ADC_OverrunMode_Disable ((uint32_t)0x00000000) 155 #define IS_ADC_OVRUNMODE(MODE) (((MODE) == ADC_OverrunMode_Enable) || \ 156 ((MODE) == ADC_OverrunMode_Disable)) 163 #define ADC_AutoInjec_Enable ((uint32_t)0x02000000) 164 #define ADC_AutoInjec_Disable ((uint32_t)0x00000000) 165 #define IS_ADC_AUTOINJECMODE(MODE) (((MODE) == ADC_AutoInjec_Enable) || \ 166 ((MODE) == ADC_AutoInjec_Disable)) 173 #define ADC_Resolution_12b ((uint32_t)0x00000000) 174 #define ADC_Resolution_10b ((uint32_t)0x00000008) 175 #define ADC_Resolution_8b ((uint32_t)0x00000010) 176 #define ADC_Resolution_6b ((uint32_t)0x00000018) 177 #define IS_ADC_RESOLUTION(RESOLUTION) (((RESOLUTION) == ADC_Resolution_12b) || \ 178 ((RESOLUTION) == ADC_Resolution_10b) || \ 179 ((RESOLUTION) == ADC_Resolution_8b) || \ 180 ((RESOLUTION) == ADC_Resolution_6b)) 190 #define ADC_ExternalTrigEventEdge_None ((uint16_t)0x0000) 191 #define ADC_ExternalTrigEventEdge_RisingEdge ((uint16_t)0x0400) 192 #define ADC_ExternalTrigEventEdge_FallingEdge ((uint16_t)0x0800) 193 #define ADC_ExternalTrigEventEdge_BothEdge ((uint16_t)0x0C00) 195 #define IS_EXTERNALTRIG_EDGE(EDGE) (((EDGE) == ADC_ExternalTrigEventEdge_None) || \ 196 ((EDGE) == ADC_ExternalTrigEventEdge_RisingEdge) || \ 197 ((EDGE) == ADC_ExternalTrigEventEdge_FallingEdge) || \ 198 ((EDGE) == ADC_ExternalTrigEventEdge_BothEdge)) 207 #define ADC_ExternalTrigInjecEventEdge_None ((uint16_t)0x0000) 208 #define ADC_ExternalTrigInjecEventEdge_RisingEdge ((uint16_t)0x0040) 209 #define ADC_ExternalTrigInjecEventEdge_FallingEdge ((uint16_t)0x0080) 210 #define ADC_ExternalTrigInjecEventEdge_BothEdge ((uint16_t)0x00C0) 212 #define IS_EXTERNALTRIGINJ_EDGE(EDGE) (((EDGE) == ADC_ExternalTrigInjecEventEdge_None) || \ 213 ((EDGE) == ADC_ExternalTrigInjecEventEdge_RisingEdge) || \ 214 ((EDGE) == ADC_ExternalTrigInjecEventEdge_FallingEdge) || \ 215 ((EDGE) == ADC_ExternalTrigInjecEventEdge_BothEdge)) 220 #define ADC_ExternalTrigConvEvent_0 ((uint16_t)0x0000) 221 #define ADC_ExternalTrigConvEvent_1 ((uint16_t)0x0040) 222 #define ADC_ExternalTrigConvEvent_2 ((uint16_t)0x0080) 223 #define ADC_ExternalTrigConvEvent_3 ((uint16_t)0x00C0) 224 #define ADC_ExternalTrigConvEvent_4 ((uint16_t)0x0100) 225 #define ADC_ExternalTrigConvEvent_5 ((uint16_t)0x0140) 226 #define ADC_ExternalTrigConvEvent_6 ((uint16_t)0x0180) 227 #define ADC_ExternalTrigConvEvent_7 ((uint16_t)0x01C0) 228 #define ADC_ExternalTrigConvEvent_8 ((uint16_t)0x0200) 229 #define ADC_ExternalTrigConvEvent_9 ((uint16_t)0x0240) 230 #define ADC_ExternalTrigConvEvent_10 ((uint16_t)0x0280) 231 #define ADC_ExternalTrigConvEvent_11 ((uint16_t)0x02C0) 232 #define ADC_ExternalTrigConvEvent_12 ((uint16_t)0x0300) 233 #define ADC_ExternalTrigConvEvent_13 ((uint16_t)0x0340) 234 #define ADC_ExternalTrigConvEvent_14 ((uint16_t)0x0380) 235 #define ADC_ExternalTrigConvEvent_15 ((uint16_t)0x03C0) 237 #define IS_ADC_EXT_TRIG(REGTRIG) (((REGTRIG) == ADC_ExternalTrigConvEvent_0) || \ 238 ((REGTRIG) == ADC_ExternalTrigConvEvent_1) || \ 239 ((REGTRIG) == ADC_ExternalTrigConvEvent_2) || \ 240 ((REGTRIG) == ADC_ExternalTrigConvEvent_3) || \ 241 ((REGTRIG) == ADC_ExternalTrigConvEvent_4) || \ 242 ((REGTRIG) == ADC_ExternalTrigConvEvent_5) || \ 243 ((REGTRIG) == ADC_ExternalTrigConvEvent_6) || \ 244 ((REGTRIG) == ADC_ExternalTrigConvEvent_7) || \ 245 ((REGTRIG) == ADC_ExternalTrigConvEvent_8) || \ 246 ((REGTRIG) == ADC_ExternalTrigConvEvent_9) || \ 247 ((REGTRIG) == ADC_ExternalTrigConvEvent_10) || \ 248 ((REGTRIG) == ADC_ExternalTrigConvEvent_11) || \ 249 ((REGTRIG) == ADC_ExternalTrigConvEvent_12) || \ 250 ((REGTRIG) == ADC_ExternalTrigConvEvent_13) || \ 251 ((REGTRIG) == ADC_ExternalTrigConvEvent_14) || \ 252 ((REGTRIG) == ADC_ExternalTrigConvEvent_15)) 262 #define ADC_ExternalTrigInjecConvEvent_0 ((uint16_t)0x0000) 263 #define ADC_ExternalTrigInjecConvEvent_1 ((uint16_t)0x0004) 264 #define ADC_ExternalTrigInjecConvEvent_2 ((uint16_t)0x0008) 265 #define ADC_ExternalTrigInjecConvEvent_3 ((uint16_t)0x000C) 266 #define ADC_ExternalTrigInjecConvEvent_4 ((uint16_t)0x0010) 267 #define ADC_ExternalTrigInjecConvEvent_5 ((uint16_t)0x0014) 268 #define ADC_ExternalTrigInjecConvEvent_6 ((uint16_t)0x0018) 269 #define ADC_ExternalTrigInjecConvEvent_7 ((uint16_t)0x001C) 270 #define ADC_ExternalTrigInjecConvEvent_8 ((uint16_t)0x0020) 271 #define ADC_ExternalTrigInjecConvEvent_9 ((uint16_t)0x0024) 272 #define ADC_ExternalTrigInjecConvEvent_10 ((uint16_t)0x0028) 273 #define ADC_ExternalTrigInjecConvEvent_11 ((uint16_t)0x002C) 274 #define ADC_ExternalTrigInjecConvEvent_12 ((uint16_t)0x0030) 275 #define ADC_ExternalTrigInjecConvEvent_13 ((uint16_t)0x0034) 276 #define ADC_ExternalTrigInjecConvEvent_14 ((uint16_t)0x0038) 277 #define ADC_ExternalTrigInjecConvEvent_15 ((uint16_t)0x003C) 279 #define IS_ADC_EXT_INJEC_TRIG(INJTRIG) (((INJTRIG) == ADC_ExternalTrigInjecConvEvent_0) || \ 280 ((INJTRIG) == ADC_ExternalTrigInjecConvEvent_1) || \ 281 ((INJTRIG) == ADC_ExternalTrigInjecConvEvent_2) || \ 282 ((INJTRIG) == ADC_ExternalTrigInjecConvEvent_3) || \ 283 ((INJTRIG) == ADC_ExternalTrigInjecConvEvent_4) || \ 284 ((INJTRIG) == ADC_ExternalTrigInjecConvEvent_5) || \ 285 ((INJTRIG) == ADC_ExternalTrigInjecConvEvent_6) || \ 286 ((INJTRIG) == ADC_ExternalTrigInjecConvEvent_7) || \ 287 ((INJTRIG) == ADC_ExternalTrigInjecConvEvent_8) || \ 288 ((INJTRIG) == ADC_ExternalTrigInjecConvEvent_9) || \ 289 ((INJTRIG) == ADC_ExternalTrigInjecConvEvent_10) || \ 290 ((INJTRIG) == ADC_ExternalTrigInjecConvEvent_11) || \ 291 ((INJTRIG) == ADC_ExternalTrigInjecConvEvent_12) || \ 292 ((INJTRIG) == ADC_ExternalTrigInjecConvEvent_13) || \ 293 ((INJTRIG) == ADC_ExternalTrigInjecConvEvent_14) || \ 294 ((INJTRIG) == ADC_ExternalTrigInjecConvEvent_15)) 302 #define ADC_DataAlign_Right ((uint32_t)0x00000000) 303 #define ADC_DataAlign_Left ((uint32_t)0x00000020) 304 #define IS_ADC_DATA_ALIGN(ALIGN) (((ALIGN) == ADC_DataAlign_Right) || \ 305 ((ALIGN) == ADC_DataAlign_Left)) 314 #define ADC_Channel_1 ((uint8_t)0x01) 315 #define ADC_Channel_2 ((uint8_t)0x02) 316 #define ADC_Channel_3 ((uint8_t)0x03) 317 #define ADC_Channel_4 ((uint8_t)0x04) 318 #define ADC_Channel_5 ((uint8_t)0x05) 319 #define ADC_Channel_6 ((uint8_t)0x06) 320 #define ADC_Channel_7 ((uint8_t)0x07) 321 #define ADC_Channel_8 ((uint8_t)0x08) 322 #define ADC_Channel_9 ((uint8_t)0x09) 323 #define ADC_Channel_10 ((uint8_t)0x0A) 324 #define ADC_Channel_11 ((uint8_t)0x0B) 325 #define ADC_Channel_12 ((uint8_t)0x0C) 326 #define ADC_Channel_13 ((uint8_t)0x0D) 327 #define ADC_Channel_14 ((uint8_t)0x0E) 328 #define ADC_Channel_15 ((uint8_t)0x0F) 329 #define ADC_Channel_16 ((uint8_t)0x10) 330 #define ADC_Channel_17 ((uint8_t)0x11) 331 #define ADC_Channel_18 ((uint8_t)0x12) 333 #define ADC_Channel_TempSensor ((uint8_t)ADC_Channel_16) 334 #define ADC_Channel_Vrefint ((uint8_t)ADC_Channel_18) 335 #define ADC_Channel_Vbat ((uint8_t)ADC_Channel_17) 337 #define IS_ADC_CHANNEL(CHANNEL) (((CHANNEL) == ADC_Channel_1) || \ 338 ((CHANNEL) == ADC_Channel_2) || \ 339 ((CHANNEL) == ADC_Channel_3) || \ 340 ((CHANNEL) == ADC_Channel_4) || \ 341 ((CHANNEL) == ADC_Channel_5) || \ 342 ((CHANNEL) == ADC_Channel_6) || \ 343 ((CHANNEL) == ADC_Channel_7) || \ 344 ((CHANNEL) == ADC_Channel_8) || \ 345 ((CHANNEL) == ADC_Channel_9) || \ 346 ((CHANNEL) == ADC_Channel_10) || \ 347 ((CHANNEL) == ADC_Channel_11) || \ 348 ((CHANNEL) == ADC_Channel_12) || \ 349 ((CHANNEL) == ADC_Channel_13) || \ 350 ((CHANNEL) == ADC_Channel_14) || \ 351 ((CHANNEL) == ADC_Channel_15) || \ 352 ((CHANNEL) == ADC_Channel_16) || \ 353 ((CHANNEL) == ADC_Channel_17) || \ 354 ((CHANNEL) == ADC_Channel_18)) 355 #define IS_ADC_DIFFCHANNEL(CHANNEL) (((CHANNEL) == ADC_Channel_1) || \ 356 ((CHANNEL) == ADC_Channel_2) || \ 357 ((CHANNEL) == ADC_Channel_3) || \ 358 ((CHANNEL) == ADC_Channel_4) || \ 359 ((CHANNEL) == ADC_Channel_5) || \ 360 ((CHANNEL) == ADC_Channel_6) || \ 361 ((CHANNEL) == ADC_Channel_7) || \ 362 ((CHANNEL) == ADC_Channel_8) || \ 363 ((CHANNEL) == ADC_Channel_9) || \ 364 ((CHANNEL) == ADC_Channel_10) || \ 365 ((CHANNEL) == ADC_Channel_11) || \ 366 ((CHANNEL) == ADC_Channel_12) || \ 367 ((CHANNEL) == ADC_Channel_13) || \ 368 ((CHANNEL) == ADC_Channel_14)) 376 #define ADC_Mode_Independent ((uint32_t)0x00000000) 377 #define ADC_Mode_CombRegSimulInjSimul ((uint32_t)0x00000001) 378 #define ADC_Mode_CombRegSimulAltTrig ((uint32_t)0x00000002) 379 #define ADC_Mode_InjSimul ((uint32_t)0x00000005) 380 #define ADC_Mode_RegSimul ((uint32_t)0x00000006) 381 #define ADC_Mode_Interleave ((uint32_t)0x00000007) 382 #define ADC_Mode_AltTrig ((uint32_t)0x00000009) 384 #define IS_ADC_MODE(MODE) (((MODE) == ADC_Mode_Independent) || \ 385 ((MODE) == ADC_Mode_CombRegSimulInjSimul) || \ 386 ((MODE) == ADC_Mode_CombRegSimulAltTrig) || \ 387 ((MODE) == ADC_Mode_InjSimul) || \ 388 ((MODE) == ADC_Mode_RegSimul) || \ 389 ((MODE) == ADC_Mode_Interleave) || \ 390 ((MODE) == ADC_Mode_AltTrig)) 399 #define ADC_Clock_AsynClkMode ((uint32_t)0x00000000) 400 #define ADC_Clock_SynClkModeDiv1 ((uint32_t)0x00010000) 401 #define ADC_Clock_SynClkModeDiv2 ((uint32_t)0x00020000) 402 #define ADC_Clock_SynClkModeDiv4 ((uint32_t)0x00030000) 403 #define IS_ADC_CLOCKMODE(CLOCK) (((CLOCK) == ADC_Clock_AsynClkMode) ||\ 404 ((CLOCK) == ADC_Clock_SynClkModeDiv1) ||\ 405 ((CLOCK) == ADC_Clock_SynClkModeDiv2)||\ 406 ((CLOCK) == ADC_Clock_SynClkModeDiv4)) 413 #define ADC_DMAAccessMode_Disabled ((uint32_t)0x00000000) 414 #define ADC_DMAAccessMode_1 ((uint32_t)0x00008000) 415 #define ADC_DMAAccessMode_2 ((uint32_t)0x0000C000) 416 #define IS_ADC_DMA_ACCESS_MODE(MODE) (((MODE) == ADC_DMAAccessMode_Disabled) || \ 417 ((MODE) == ADC_DMAAccessMode_1) || \ 418 ((MODE) == ADC_DMAAccessMode_2)) 427 #define ADC_SampleTime_1Cycles5 ((uint8_t)0x00) 428 #define ADC_SampleTime_2Cycles5 ((uint8_t)0x01) 429 #define ADC_SampleTime_4Cycles5 ((uint8_t)0x02) 430 #define ADC_SampleTime_7Cycles5 ((uint8_t)0x03) 431 #define ADC_SampleTime_19Cycles5 ((uint8_t)0x04) 432 #define ADC_SampleTime_61Cycles5 ((uint8_t)0x05) 433 #define ADC_SampleTime_181Cycles5 ((uint8_t)0x06) 434 #define ADC_SampleTime_601Cycles5 ((uint8_t)0x07) 435 #define IS_ADC_SAMPLE_TIME(TIME) (((TIME) == ADC_SampleTime_1Cycles5) || \ 436 ((TIME) == ADC_SampleTime_2Cycles5) || \ 437 ((TIME) == ADC_SampleTime_4Cycles5) || \ 438 ((TIME) == ADC_SampleTime_7Cycles5) || \ 439 ((TIME) == ADC_SampleTime_19Cycles5) || \ 440 ((TIME) == ADC_SampleTime_61Cycles5) || \ 441 ((TIME) == ADC_SampleTime_181Cycles5) || \ 442 ((TIME) == ADC_SampleTime_601Cycles5)) 451 #define ADC_InjectedChannel_1 ADC_Channel_1 452 #define ADC_InjectedChannel_2 ADC_Channel_2 453 #define ADC_InjectedChannel_3 ADC_Channel_3 454 #define ADC_InjectedChannel_4 ADC_Channel_4 455 #define ADC_InjectedChannel_5 ADC_Channel_5 456 #define ADC_InjectedChannel_6 ADC_Channel_6 457 #define ADC_InjectedChannel_7 ADC_Channel_7 458 #define ADC_InjectedChannel_8 ADC_Channel_8 459 #define ADC_InjectedChannel_9 ADC_Channel_9 460 #define ADC_InjectedChannel_10 ADC_Channel_10 461 #define ADC_InjectedChannel_11 ADC_Channel_11 462 #define ADC_InjectedChannel_12 ADC_Channel_12 463 #define ADC_InjectedChannel_13 ADC_Channel_13 464 #define ADC_InjectedChannel_14 ADC_Channel_14 465 #define ADC_InjectedChannel_15 ADC_Channel_15 466 #define ADC_InjectedChannel_16 ADC_Channel_16 467 #define ADC_InjectedChannel_17 ADC_Channel_17 468 #define ADC_InjectedChannel_18 ADC_Channel_18 470 #define IS_ADC_INJECTED_CHANNEL(CHANNEL) (((CHANNEL) == ADC_InjectedChannel_1) || \ 471 ((CHANNEL) == ADC_InjectedChannel_2) || \ 472 ((CHANNEL) == ADC_InjectedChannel_3) || \ 473 ((CHANNEL) == ADC_InjectedChannel_4) ||\ 474 ((CHANNEL) == ADC_InjectedChannel_5) ||\ 475 ((CHANNEL) == ADC_InjectedChannel_6) ||\ 476 ((CHANNEL) == ADC_InjectedChannel_7) ||\ 477 ((CHANNEL) == ADC_InjectedChannel_8) ||\ 478 ((CHANNEL) == ADC_InjectedChannel_9) ||\ 479 ((CHANNEL) == ADC_InjectedChannel_10) ||\ 480 ((CHANNEL) == ADC_InjectedChannel_11) ||\ 481 ((CHANNEL) == ADC_InjectedChannel_12) ||\ 482 ((CHANNEL) == ADC_InjectedChannel_13) ||\ 483 ((CHANNEL) == ADC_InjectedChannel_14) ||\ 484 ((CHANNEL) == ADC_InjectedChannel_15) ||\ 485 ((CHANNEL) == ADC_InjectedChannel_16) ||\ 486 ((CHANNEL) == ADC_InjectedChannel_17) ||\ 487 ((CHANNEL) == ADC_InjectedChannel_18)) 496 #define ADC_InjectedSequence_1 ADC_Channel_1 497 #define ADC_InjectedSequence_2 ADC_Channel_2 498 #define ADC_InjectedSequence_3 ADC_Channel_3 499 #define ADC_InjectedSequence_4 ADC_Channel_4 500 #define IS_ADC_INJECTED_SEQUENCE(SEQUENCE) (((SEQUENCE) == ADC_InjectedSequence_1) || \ 501 ((SEQUENCE) == ADC_InjectedSequence_2) || \ 502 ((SEQUENCE) == ADC_InjectedSequence_3) || \ 503 ((SEQUENCE) == ADC_InjectedSequence_4)) 512 #define ADC_AnalogWatchdog_SingleRegEnable ((uint32_t)0x00C00000) 513 #define ADC_AnalogWatchdog_SingleInjecEnable ((uint32_t)0x01400000) 514 #define ADC_AnalogWatchdog_SingleRegOrInjecEnable ((uint32_t)0x01C00000) 515 #define ADC_AnalogWatchdog_AllRegEnable ((uint32_t)0x00800000) 516 #define ADC_AnalogWatchdog_AllInjecEnable ((uint32_t)0x01000000) 517 #define ADC_AnalogWatchdog_AllRegAllInjecEnable ((uint32_t)0x01800000) 518 #define ADC_AnalogWatchdog_None ((uint32_t)0x00000000) 520 #define IS_ADC_ANALOG_WATCHDOG(WATCHDOG) (((WATCHDOG) == ADC_AnalogWatchdog_SingleRegEnable) || \ 521 ((WATCHDOG) == ADC_AnalogWatchdog_SingleInjecEnable) || \ 522 ((WATCHDOG) == ADC_AnalogWatchdog_SingleRegOrInjecEnable) || \ 523 ((WATCHDOG) == ADC_AnalogWatchdog_AllRegEnable) || \ 524 ((WATCHDOG) == ADC_AnalogWatchdog_AllInjecEnable) || \ 525 ((WATCHDOG) == ADC_AnalogWatchdog_AllRegAllInjecEnable) || \ 526 ((WATCHDOG) == ADC_AnalogWatchdog_None)) 534 #define ADC_CalibrationMode_Single ((uint32_t)0x00000000) 535 #define ADC_CalibrationMode_Differential ((uint32_t)0x40000000) 537 #define IS_ADC_CALIBRATION_MODE(MODE) (((MODE) == ADC_CalibrationMode_Single) ||((MODE) == ADC_CalibrationMode_Differential)) 546 #define ADC_DMAMode_OneShot ((uint32_t)0x00000000) 547 #define ADC_DMAMode_Circular ((uint32_t)0x00000002) 549 #define IS_ADC_DMA_MODE(MODE) (((MODE) == ADC_DMAMode_OneShot) || ((MODE) == ADC_DMAMode_Circular)) 558 #define ADC_IT_RDY ((uint16_t)0x0001) 559 #define ADC_IT_EOSMP ((uint16_t)0x0002) 560 #define ADC_IT_EOC ((uint16_t)0x0004) 561 #define ADC_IT_EOS ((uint16_t)0x0008) 562 #define ADC_IT_OVR ((uint16_t)0x0010) 563 #define ADC_IT_JEOC ((uint16_t)0x0020) 564 #define ADC_IT_JEOS ((uint16_t)0x0040) 565 #define ADC_IT_AWD1 ((uint16_t)0x0080) 566 #define ADC_IT_AWD2 ((uint16_t)0x0100) 567 #define ADC_IT_AWD3 ((uint16_t)0x0200) 568 #define ADC_IT_JQOVF ((uint16_t)0x0400) 571 #define IS_ADC_IT(IT) ((((IT) & (uint16_t)0xF800) == 0x0000) && ((IT) != 0x0000)) 573 #define IS_ADC_GET_IT(IT) (((IT) == ADC_IT_RDY) || ((IT) == ADC_IT_EOSMP) || \ 574 ((IT) == ADC_IT_EOC) || ((IT) == ADC_IT_EOS) || \ 575 ((IT) == ADC_IT_OVR) || ((IT) == ADC_IT_EOS) || \ 576 ((IT) == ADC_IT_JEOS) || ((IT) == ADC_IT_AWD1) || \ 577 ((IT) == ADC_IT_AWD2) || ((IT) == ADC_IT_AWD3) || \ 578 ((IT) == ADC_IT_JQOVF)) 587 #define ADC_FLAG_RDY ((uint16_t)0x0001) 588 #define ADC_FLAG_EOSMP ((uint16_t)0x0002) 589 #define ADC_FLAG_EOC ((uint16_t)0x0004) 590 #define ADC_FLAG_EOS ((uint16_t)0x0008) 591 #define ADC_FLAG_OVR ((uint16_t)0x0010) 592 #define ADC_FLAG_JEOC ((uint16_t)0x0020) 593 #define ADC_FLAG_JEOS ((uint16_t)0x0040) 594 #define ADC_FLAG_AWD1 ((uint16_t)0x0080) 595 #define ADC_FLAG_AWD2 ((uint16_t)0x0100) 596 #define ADC_FLAG_AWD3 ((uint16_t)0x0200) 597 #define ADC_FLAG_JQOVF ((uint16_t)0x0400) 599 #define IS_ADC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint16_t)0xF800) == 0x0000) && ((FLAG) != 0x0000)) 600 #define IS_ADC_GET_FLAG(FLAG) (((FLAG) == ADC_FLAG_RDY) || ((FLAG) == ADC_FLAG_EOSMP) || \ 601 ((FLAG) == ADC_FLAG_EOC) || ((FLAG) == ADC_FLAG_EOS) || \ 602 ((FLAG) == ADC_FLAG_OVR) || ((FLAG) == ADC_FLAG_JEOC) || \ 603 ((FLAG) == ADC_FLAG_JEOS) || ((FLAG) == ADC_FLAG_AWD1) || \ 604 ((FLAG) == ADC_FLAG_AWD2) || ((FLAG) == ADC_FLAG_AWD3) || \ 605 ((FLAG) == ADC_FLAG_JQOVF)) 614 #define ADC_FLAG_MSTRDY ((uint32_t)0x00000001) 615 #define ADC_FLAG_MSTEOSMP ((uint32_t)0x00000002) 616 #define ADC_FLAG_MSTEOC ((uint32_t)0x00000004) 617 #define ADC_FLAG_MSTEOS ((uint32_t)0x00000008) 618 #define ADC_FLAG_MSTOVR ((uint32_t)0x00000010) 619 #define ADC_FLAG_MSTJEOC ((uint32_t)0x00000020) 620 #define ADC_FLAG_MSTJEOS ((uint32_t)0x00000040) 621 #define ADC_FLAG_MSTAWD1 ((uint32_t)0x00000080) 622 #define ADC_FLAG_MSTAWD2 ((uint32_t)0x00000100) 623 #define ADC_FLAG_MSTAWD3 ((uint32_t)0x00000200) 624 #define ADC_FLAG_MSTJQOVF ((uint32_t)0x00000400) 626 #define ADC_FLAG_SLVRDY ((uint32_t)0x00010000) 627 #define ADC_FLAG_SLVEOSMP ((uint32_t)0x00020000) 628 #define ADC_FLAG_SLVEOC ((uint32_t)0x00040000) 629 #define ADC_FLAG_SLVEOS ((uint32_t)0x00080000) 630 #define ADC_FLAG_SLVOVR ((uint32_t)0x00100000) 631 #define ADC_FLAG_SLVJEOC ((uint32_t)0x00200000) 632 #define ADC_FLAG_SLVJEOS ((uint32_t)0x00400000) 633 #define ADC_FLAG_SLVAWD1 ((uint32_t)0x00800000) 634 #define ADC_FLAG_SLVAWD2 ((uint32_t)0x01000000) 635 #define ADC_FLAG_SLVAWD3 ((uint32_t)0x02000000) 636 #define ADC_FLAG_SLVJQOVF ((uint32_t)0x04000000) 638 #define IS_ADC_CLEAR_COMMONFLAG(FLAG) ((((FLAG) & (uint32_t)0xF800F800) == 0x0000) && ((FLAG) != 0x00000000)) 639 #define IS_ADC_GET_COMMONFLAG(FLAG) (((FLAG) == ADC_FLAG_MSTRDY) || ((FLAG) == ADC_FLAG_MSTEOSMP) || \ 640 ((FLAG) == ADC_FLAG_MSTEOC) || ((FLAG) == ADC_FLAG_MSTEOS) || \ 641 ((FLAG) == ADC_FLAG_MSTOVR) || ((FLAG) == ADC_FLAG_MSTEOS) || \ 642 ((FLAG) == ADC_FLAG_MSTJEOS) || ((FLAG) == ADC_FLAG_MSTAWD1) || \ 643 ((FLAG) == ADC_FLAG_MSTAWD2) || ((FLAG) == ADC_FLAG_MSTAWD3) || \ 644 ((FLAG) == ADC_FLAG_MSTJQOVF) || \ 645 ((FLAG) == ADC_FLAG_SLVRDY) || ((FLAG) == ADC_FLAG_SLVEOSMP) || \ 646 ((FLAG) == ADC_FLAG_SLVEOC) || ((FLAG) == ADC_FLAG_SLVEOS) || \ 647 ((FLAG) == ADC_FLAG_SLVOVR) || ((FLAG) == ADC_FLAG_SLVEOS) || \ 648 ((FLAG) == ADC_FLAG_SLVJEOS) || ((FLAG) == ADC_FLAG_SLVAWD1) || \ 649 ((FLAG) == ADC_FLAG_SLVAWD2) || ((FLAG) == ADC_FLAG_SLVAWD3) || \ 650 ((FLAG) == ADC_FLAG_SLVJQOVF)) 659 #define IS_ADC_THRESHOLD(THRESHOLD) ((THRESHOLD) <= 0xFFF) 669 #define IS_ADC_OFFSET(OFFSET) ((OFFSET) <= 0xFFF) 679 #define IS_ADC_INJECTED_LENGTH(LENGTH) (((LENGTH) >= 0x1) && ((LENGTH) <= 0x4)) 690 #define IS_ADC_REGULAR_LENGTH(LENGTH) (((LENGTH) >= 0x1) && ((LENGTH) <= 0x10)) 699 #define IS_ADC_REGULAR_DISC_NUMBER(NUMBER) (((NUMBER) >= 0x1) && ((NUMBER) <= 0x8)) 708 #define IS_ADC_TWOSAMPLING_DELAY(DELAY) (((DELAY) <= 0xF)) void ADC_SetChannelOffset2(ADC_TypeDef *ADCx, uint8_t ADC_Channel, uint16_t Offset)
Set the ADC channels conversion value offset2.
void ADC_VrefintCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
Enables or disables the Vrefint channel.
FlagStatus ADC_GetStartInjectedConversionStatus(ADC_TypeDef *ADCx)
Gets the selected ADC Software start injected conversion Status.
void ADC_AnalogWatchdogCmd(ADC_TypeDef *ADCx, uint32_t ADC_AnalogWatchdog)
Enables or disables the analog watchdog on single/all regular or injected channels.
void ADC_AnalogWatchdog2ThresholdsConfig(ADC_TypeDef *ADCx, uint8_t HighThreshold, uint8_t LowThreshold)
Configures the high and low thresholds of the analog watchdog2.
void ADC_AnalogWatchdog3ThresholdsConfig(ADC_TypeDef *ADCx, uint8_t HighThreshold, uint8_t LowThreshold)
Configures the high and low thresholds of the analog watchdog3.
void ADC_AnalogWatchdog3SingleChannelConfig(ADC_TypeDef *ADCx, uint8_t ADC_Channel)
Configures the analog watchdog 3 guarded single channel.
void ADC_VbatCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
Enables or disables the Vbat channel.
uint32_t ADC_GetDualModeConversionValue(ADC_TypeDef *ADCx)
Returns the last ADC1, ADC2, ADC3 and ADC4 regular conversions results data in the selected dual mode...
void ADC_ClearFlag(ADC_TypeDef *ADCx, uint32_t ADC_FLAG)
Clears the ADCx's pending flags.
void ADC_RegularChannelConfig(ADC_TypeDef *ADCx, uint8_t ADC_Channel, uint8_t Rank, uint8_t ADC_SampleTime)
Configures for the selected ADC regular channel its corresponding rank in the sequencer and its sampl...
ADC Init structure definition.
void ADC_SetChannelOffset1(ADC_TypeDef *ADCx, uint8_t ADC_Channel, uint16_t Offset)
Set the ADC channels conversion value offset1.
Analog to Digital Converter.
void ADC_DiscModeCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
Enables or disables the discontinuous mode on regular group channel for the specified ADC...
void ADC_InjectedDiscModeCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
Enables or disables the discontinuous mode for injected group channel for the specified ADC...
void ADC_RegularChannelSequencerLengthConfig(ADC_TypeDef *ADCx, uint8_t SequencerLength)
Sets the ADC regular channel sequence lenght.
void ADC_DisableCmd(ADC_TypeDef *ADCx)
ADC Disable Command.
void ADC_SelectQueueOfContextMode(ADC_TypeDef *ADCx, FunctionalState NewState)
Selects the Queue Of Context Mode for injected channels.
void ADC_ClearCommonFlag(ADC_TypeDef *ADCx, uint32_t ADC_FLAG)
Clears the ADCx's pending flags.
FlagStatus ADC_GetFlagStatus(ADC_TypeDef *ADCx, uint32_t ADC_FLAG)
Checks whether the specified ADC flag is set or not.
void ADC_StartInjectedConversion(ADC_TypeDef *ADCx)
Enables or disables the selected ADC start of the injected channels conversion.
void ADC_ChannelOffset4Cmd(ADC_TypeDef *ADCx, FunctionalState NewState)
Enables or disables the Offset4.
void ADC_DiscModeChannelCountConfig(ADC_TypeDef *ADCx, uint8_t Number)
Configures the discontinuous mode for the selected ADC regular group channel.
uint8_t ADC_NbrOfRegChannel
void ADC_Init(ADC_TypeDef *ADCx, ADC_InitTypeDef *ADC_InitStruct)
Initializes the ADCx peripheral according to the specified parameters in the ADC_InitStruct.
void ADC_CommonInit(ADC_TypeDef *ADCx, ADC_CommonInitTypeDef *ADC_CommonInitStruct)
Initializes the ADCs peripherals according to the specified parameters in the ADC_CommonInitStruct.
void ADC_ITConfig(ADC_TypeDef *ADCx, uint32_t ADC_IT, FunctionalState NewState)
Enables or disables the specified ADC interrupts.
void ADC_ChannelOffset3Cmd(ADC_TypeDef *ADCx, FunctionalState NewState)
Enables or disables the Offset3.
void ADC_SelectCalibrationMode(ADC_TypeDef *ADCx, uint32_t ADC_CalibrationMode)
Select the ADC calibration mode.
ADC Common Init structure definition.
uint8_t ADC_TwoSamplingDelay
uint32_t ADC_ExternalTrigInjecConvEvent
void ADC_InjectedChannelSampleTimeConfig(ADC_TypeDef *ADCx, uint8_t ADC_InjectedChannel, uint8_t ADC_SampleTime)
Configures for the selected ADC injected channel its corresponding sample time.
void ADC_SelectDifferentialMode(ADC_TypeDef *ADCx, uint8_t ADC_Channel, FunctionalState NewState)
Selectes the differential mode for a specific channel.
void ADC_SetChannelOffset4(ADC_TypeDef *ADCx, uint8_t ADC_Channel, uint16_t Offset)
Set the ADC channels conversion value offset4.
void ADC_Cmd(ADC_TypeDef *ADCx, FunctionalState NewState)
Enables or disables the specified ADC peripheral.
FlagStatus ADC_GetDisableCmdStatus(ADC_TypeDef *ADCx)
Gets the selected ADC disable command Status.
void ADC_SetCalibrationValue(ADC_TypeDef *ADCx, uint32_t ADC_Calibration)
Sets the ADCx calibration register.
void ADC_VoltageRegulatorCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
Enables or disables the specified ADC Voltage Regulator.
void ADC_TempSensorCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
Enables or disables the temperature sensor channel.
void ADC_DMAConfig(ADC_TypeDef *ADCx, uint32_t ADC_DMAMode)
Configure ADC DMA mode.
void ADC_DeInit(ADC_TypeDef *ADCx)
Deinitializes the ADCx peripheral registers to their default reset values.
void ADC_InjectedStructInit(ADC_InjectedInitTypeDef *ADC_InjectedInitStruct)
Fills each ADC_InjectedInitStruct member with its default value.
void ADC_AutoDelayCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
Selects the ADC Delayed Conversion Mode.
uint32_t ADC_InjecSequence4
FlagStatus ADC_GetCalibrationStatus(ADC_TypeDef *ADCx)
Gets the selected ADC calibration status.
void ADC_StartConversion(ADC_TypeDef *ADCx)
Enables or disables the selected ADC start conversion .
void ADC_AnalogWatchdog1ThresholdsConfig(ADC_TypeDef *ADCx, uint16_t HighThreshold, uint16_t LowThreshold)
Configures the high and low thresholds of the analog watchdog1.
void ADC_StopInjectedConversion(ADC_TypeDef *ADCx)
Stops the selected ADC ongoing injected conversion.
void ADC_StartCalibration(ADC_TypeDef *ADCx)
Starts the selected ADC calibration process.
uint32_t ADC_ExternalTrigInjecEventEdge
void ADC_StructInit(ADC_InitTypeDef *ADC_InitStruct)
Fills each ADC_InitStruct member with its default value.
FlagStatus ADC_GetCommonFlagStatus(ADC_TypeDef *ADCx, uint32_t ADC_FLAG)
Checks whether the specified ADC flag is set or not.
uint32_t ADC_GetCalibrationValue(ADC_TypeDef *ADCx)
Returns the ADCx calibration value.
void ADC_ChannelOffset1Cmd(ADC_TypeDef *ADCx, FunctionalState NewState)
Enables or disables the Offset1.
void ADC_SetChannelOffset3(ADC_TypeDef *ADCx, uint8_t ADC_Channel, uint16_t Offset)
Set the ADC channels conversion value offset3.
void ADC_ClearITPendingBit(ADC_TypeDef *ADCx, uint32_t ADC_IT)
Clears the ADCx's interrupt pending bits.
FlagStatus ADC_GetStartConversionStatus(ADC_TypeDef *ADCx)
Gets the selected ADC start conversion Status.
ITStatus ADC_GetITStatus(ADC_TypeDef *ADCx, uint32_t ADC_IT)
Checks whether the specified ADC interrupt has occurred or not.
void ADC_InjectedInit(ADC_TypeDef *ADCx, ADC_InjectedInitTypeDef *ADC_InjectedInitStruct)
Initializes the ADCx peripheral according to the specified parameters in the ADC_InitStruct.
void ADC_ChannelOffset2Cmd(ADC_TypeDef *ADCx, FunctionalState NewState)
Enables or disables the Offset2.
void ADC_AnalogWatchdog1SingleChannelConfig(ADC_TypeDef *ADCx, uint8_t ADC_Channel)
Configures the analog watchdog 2 guarded single channel.
void ADC_ExternalTriggerConfig(ADC_TypeDef *ADCx, uint16_t ADC_ExternalTrigConvEvent, uint16_t ADC_ExternalTrigEventEdge)
External Trigger Enable and Polarity Selection for regular channels.
void ADC_StopConversion(ADC_TypeDef *ADCx)
Stops the selected ADC ongoing conversion.
uint32_t ADC_ExternalTrigConvEvent
uint32_t ADC_ContinuousConvMode
uint32_t ADC_InjecSequence1
uint16_t ADC_GetConversionValue(ADC_TypeDef *ADCx)
Returns the last ADCx conversion result data for regular channel.
void ADC_AnalogWatchdog2SingleChannelConfig(ADC_TypeDef *ADCx, uint8_t ADC_Channel)
Configures the analog watchdog 2 guarded single channel.
uint32_t ADC_InjecSequence3
uint32_t ADC_InjecSequence2
void ADC_CommonStructInit(ADC_CommonInitTypeDef *ADC_CommonInitStruct)
Fills each ADC_CommonInitStruct member with its default value.
uint8_t ADC_NbrOfInjecChannel
void ADC_AutoInjectedConvCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
Enables or disables the selected ADC automatic injected group conversion after regular one...
uint16_t ADC_GetInjectedConversionValue(ADC_TypeDef *ADCx, uint8_t ADC_InjectedChannel)
Returns the ADC injected channel conversion result.
ADC Init structure definition.
void ADC_DMACmd(ADC_TypeDef *ADCx, FunctionalState NewState)
Enables or disables the specified ADC DMA request.
uint32_t ADC_ExternalTrigEventEdge