#include <STM32ADC.h>

Post Reply
minime
Posts: 18
Joined: Mon Feb 13, 2017 11:10 am

#include <STM32ADC.h>

Post by minime » Sat Jun 17, 2017 4:37 am

I am trying to compile the example for STM32ADC but gets the below erros, i ma using arduino ide 1.82 please advise


"C:\Users\goodness\AppData\Local\Arduino15\packages\STM32\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++" -c -g -Os -w -MMD -std=gnu++11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -DBOARD_generic_f407v -DVECT_TAB_BASE -DERROR_LED_PORT=GPIOA -DERROR_LED_PIN=7 -mcpu=cortex-m4 -DF_CPU=168000000L -DARDUINO=10802 -DARDUINO_STM32GenericF407VET6 -DARDUINO_ARCH_STM32F4 -mthumb -DSTM32_HIGH_DENSITY -DSTM32F4 -DBOARD_generic_f407v -DSERIAL_USB -mthumb -D__STM32F4__ "-IC:\arduino-1.8.2\hardware\Arduino_STM32-generic_f4\STM32F4\system/libmaple" "-IC:\arduino-1.8.2\hardware\Arduino_STM32-generic_f4\STM32F4\cores\maple/libmaple/usbF4" "-IC:\arduino-1.8.2\hardware\Arduino_STM32-generic_f4\STM32F4\cores\maple" "-IC:\arduino-1.8.2\hardware\Arduino_STM32-generic_f4\STM32F4\variants\generic_f407v" "-IC:\arduino-1.8.2\hardware\Arduino_STM32-generic_f4\STM32F4\libraries\STM32ADC\src" "C:\Users\goodness\AppData\Local\Temp\arduino_build_758768\sketch\MultiChannelContinuousConversion.ino.cpp" -o "C:\Users\goodness\AppData\Local\Temp\arduino_build_758768\sketch\MultiChannelContinuousConversion.ino.cpp.o"
In file included from C:\arduino-1.8.2\hardware\Arduino_STM32-generic_f4\STM32F4\libraries\STM32ADC\examples\MultiChannelContinuousConversion\MultiChannelContinuousConversion.ino:7:0:

C:\arduino-1.8.2\hardware\Arduino_STM32-generic_f4\STM32F4\libraries\STM32ADC\src/STM32ADC.h:155:44: error: 'constexpr' needed for in-class initialization of static data member 'const float STM32ADC::_AverageSlope' of non-integral type [-fpermissive]

static const float _AverageSlope = 4.3; // mV/oC //4.0 to 4.6

^

C:\arduino-1.8.2\hardware\Arduino_STM32-generic_f4\STM32F4\libraries\STM32ADC\src/STM32ADC.h:156:34: error: 'constexpr' needed for in-class initialization of static data member 'const float STM32ADC::_V25' of non-integral type [-fpermissive]

static const float _V25 = 1.43; //Volts //1.34 - 1.52

^

MultiChannelContinuousConversion:10: error: no matching function for call to 'STM32ADC::STM32ADC(const adc_dev&)'

STM32ADC myADC(ADC1);

^

C:\arduino-1.8.2\hardware\Arduino_STM32-generic_f4\STM32F4\libraries\STM32ADC\examples\MultiChannelContinuousConversion\MultiChannelContinuousConversion.ino:10:20: note: candidates are:

In file included from C:\arduino-1.8.2\hardware\Arduino_STM32-generic_f4\STM32F4\libraries\STM32ADC\examples\MultiChannelContinuousConversion\MultiChannelContinuousConversion.ino:7:0:

C:\arduino-1.8.2\hardware\Arduino_STM32-generic_f4\STM32F4\libraries\STM32ADC\src/STM32ADC.h:14:5: note: STM32ADC::STM32ADC(adc_dev*)

STM32ADC (adc_dev * dev);

^

stevestrong
Posts: 1611
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: #include <STM32ADC.h>

Post by stevestrong » Sat Jun 17, 2017 7:36 am

I see that you are using the generic F4 board.
If you use my branch, the ADC is a bit different from F103, you should use it as

Code: Select all

STM32ADC myADC(&ADC1); // passing the address of ADC1
Disclaimer: the ADC was not tested yet, so there is no guarantee that it will work.

EDIT
Please let us know if it works.


Regarding the static const float variables, according to this post, is related to our new c++11 standard for compiler.
Since float and double are not of integral or enumeration type, such members must either be constexpr, or non-static in order for the initializer in the class definition to be permitted.
Resolution: either remove static keyword, or use "constexpr" instead of "static const" for float and double members.

minime
Posts: 18
Joined: Mon Feb 13, 2017 11:10 am

Re: #include <STM32ADC.h>

Post by minime » Sun Jun 18, 2017 7:25 pm

it is your branch, many compiler comparability issues but found https://github.com/danieleff/STM32GENERIC very much working on stm32f4xx black v2 with interesting libraries also found https://github.com/avikde/koduino/tree/ ... /libraries and the eigen library already on it very very impressive work.

https://danieleff.github.io/STM32GENERIC/#stm32generic he is really good.

Post Reply