Page 1 of 1

[Solved] Bounce Library

Posted: Thu Feb 13, 2020 10:12 pm
by Korb
Hello

my name is Marcus and I am pretty new to this complete "Blue Pill Thingy" :)
I'm trying to make the Arduino Bounce2 Lib run, without any success. :?
C:\Users\m_kor\Documents\Arduino\libraries\Bounce2\Bounce2.cpp: In member function 'void Bounce::attach(int, int)':

C:\Users\m_kor\Documents\Arduino\libraries\Bounce2\Bounce2.cpp:36:20: error: invalid conversion from 'int' to 'WiringPinMode' [-fpermissive]

pinMode(pin, mode);

^

In file included from C:\Users\m_kor\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F1\2020.1.24\cores\maple/wirish.h:55:0,

from C:\Users\m_kor\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F1\2020.1.24\cores\maple/Arduino.h:30,

from C:\Users\m_kor\Documents\Arduino\libraries\Bounce2\Bounce2.cpp:4:

C:\Users\m_kor\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F1\2020.1.24\cores\maple/io.h:110:6: error: initializing argument 2 of 'void pinMode(uint8, WiringPinMode)' [-fpermissive]

void pinMode(uint8 pin, WiringPinMode mode);

^

exit status 1
Any Ideas?

Cheers Marcus

Re: Bounce Library

Posted: Fri Feb 14, 2020 6:49 am
by fpiSTM
Simply that the library do not cast the pin to a WiringPinMode type and the compiler do not allow this.
https://github.com/thomasfredericks/Bou ... #L193-L198

Code: Select all

    virtual void setPinMode(int pin, int mode) {
#if defined(ARDUINO_STM_NUCLEO_F103RB) || defined(ARDUINO_GENERIC_STM32F103C)
        pinMode(pin, (WiringPinMode)mode);
#else
        pinMode(pin, mode);
#endif
You can redefine your own setPinMode to avoid the issue or define the switch before the header include.
Anyway, I would open an issue to the library because the define used to do this seems not enough to handle properly the correct call in all case.
As it seems you use Roger's core, it should use a generic define like:

Code: Select all

ARDUINO_ARCH_STM32F1

Re: Bounce Library

Posted: Fri Feb 14, 2020 7:06 am
by fpiSTM

Re: Bounce Library

Posted: Fri Feb 14, 2020 1:09 pm
by Korb
Thank you so much, now it's working :D