dwelch67 / stm32_samples

99 stars 25 forks source link

Added an ADC example for the blue pill module using its internal tmp sensor on channel 16, plus a generic example using PB1 as analog input #2

Closed samehmohamed88 closed 5 years ago

samehmohamed88 commented 6 years ago

Added a Analog to Digital conversion example using ADC1. tmpsensor_internal.c uses the built in temprature sensor on channel 16, and adc01.c uses any analog sensor connected to PB1. No real conversions are done past reading the adc value from ADC1_DR.

Some of the functions can be combined into a single function to avoid overhead, but I wanted to keep it simple to read for myself in terms of sequence of steps. Each ADC related function is a single step (more or less).

This example uses a regular group with a sequence of one conversion (on channel 16 for example), and does not use any injected groups in the sequence. Conversion is single shot (dis-continuous) and does not use scan mode.