Explains how to read from ADC and control the PWM.
#include <stm32f4xx.h>
#define PWM_HZ 2000
#define PWM_PERIOD 100
#define ADC_MAX 1023
int main(void) {
uint16_t value;
uint16_t prescaler;
prescaler = (uint16_t) ((SystemCoreClock / 2) / PWM_HZ) - 1;
for (;;) {
}
return 0;
}