Hello!
I see that you’re building for the Electron. This post predates the Photon/Electron. I briefly checked this morning, and the code still builds with the latest firmware if you’re building for the Spark Core (make PLATFORM=core
) however the Core had a different microcontroller from the Photon/Electron (STM32F103CB vs. STM32F205RG) and I see that the Standard Peripheral Library is also a bit different.
ADC modes and their applications is great because it explains the modes in detail and comes with example code, however AFAICT the code examples (at least) are particular to the STM32F10x. I searched briefly but didn’t find a resource for the STM32F2xx, so I guess you’d need either to port those examples or learn how to configure the STM32F2xx from some other resource(s).
The STM32F2xx Standard Peripheral Library comes with some ADC code examples (STM32F2xx_StdPeriph_Lib_V1.1.0/Project/STM32F2xx_StdPeriph_Examples/ADC/
). I briefly checked and they build with the Electron firmware, no problem. There’s also the ADC chapter in the Reference manual (section 10).
Does that help you out?