Closed ag88 closed 3 years ago
partly discussed in issue thread in steve's core https://github.com/stevstrong/Arduino_STM32/issues/41
Do you have a simple sketch to test the new functions?
working on it (the example/test sketch), check back later ;)
i've added a test sketch in STM32F4/libraries/STM32F4_ADC/examples/PR784F4AdcTest/
as i worked the test sketch, i actually found a bug in my code and fixed it that fix is commited here as well. as the tests include a few functionality, e.g. setting adc_prescaler, setting up awd and overrun interrupts. the tests evolved into a little app on its own, i made the sketch read the temperature sensor and use the analog watch dog to test the upper threshold which triggers when a higher temperature is detected. it responds to a single character command 'w' which toggles the watch dog on / off.
i observed something interesting during the tests, EOC may not be set if the awd triggers. i end up adding some codes, which checks for awd triggers and if the awd is triggered, i disable AWD and read the temperature sensor again. hence, the adc_awd_disable() function becomes handy.
to test adc overrun, you'd need to uncomment several lines of codes in loop().
the overruns occurs by triggering conversion ADC1->regs->CR2 |= ADC_CR2_SWSTART
but not reading the ADC data register. i've added in addition a readme.md file which i hope may be helpful.
Seems to work ok, so I will merge it.
initially i'm running into some errors: invalid conversion from 'const adc_dev*' while using ADC1, ADC2, ADC3
those errors are resolved by defining them as follows
adc.h
adc.c
adc.h
adc.h
adc.c