[Solved] Bounce Library

Working libraries, libraries being ported and related hardware
Post Reply
Korb
Posts: 2
Joined: Thu Feb 13, 2020 9:56 pm

[Solved] Bounce Library

Post 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
by fpiSTM » Fri Feb 14, 2020 6:49 am
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
Go to full post
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: Bounce Library

Post 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
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: Bounce Library

Post by fpiSTM »

Korb
Posts: 2
Joined: Thu Feb 13, 2020 9:56 pm

Re: Bounce Library

Post by Korb »

Thank you so much, now it's working :D
Post Reply

Return to “Libraries & Hardware”