rogerclarkmelbourne / Arduino_STM32

Arduino STM32. Hardware files to support STM32 boards, on Arduino IDE 1.8.x including LeafLabs Maple and other generic STM32F103 boards
Other
2.52k stars 1.26k forks source link

STM32ADC Examples #785

Closed nikjayswal closed 3 years ago

nikjayswal commented 4 years ago

Please ADD those 2 codes in STM32ADC DMA Examples.

dma_disable(DMA1, DMA_CH1); //Disable DMA and transfer

myADC.setTrigger(ADC_EXT_EV_SWSTART); // Disable ADC & DMA Trigger
nikjayswal commented 4 years ago

and Also PC13 LED Working inverted if i write High the LED is Off and if i write LOW led On. Please fix it.

dewhisna commented 4 years ago

@nikjayswal -- PC13 is working backwards because that's exactly how the blue pill board is designed. The PC13 pin can't source much current. It can, however, barely sink enough current to turn on an LED at really low power. So that's what they did in the design. Therefore, writing it to HIGH is Off, and writing it to LOW is On. That is NOT a code problem but because the designers of the blue pill were too cheap to add a transistor between the CPU and the LED to provide enough current flow and not run it inverted. If you don't want it to work backwards, then redesign your board so that the LED isn't wired inverted.

stevstrong commented 4 years ago

@nikjayswal , in which example do you mean?

nikjayswal commented 4 years ago

STM32ADC "SingleChannelAtSampleRateCircularBuffer , MultiChannelSingleConversion , MultiChannelContinuousConversion "

Those two lines is useful to disable the DMA and ADC Trigger to avoid analogRead errors "please add those two lines as a comment in Example sketch".

stevstrong commented 4 years ago

Can you make a pull request?

stevstrong commented 3 years ago

I will close this due to inactivity.