Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: invalid conversion from 'int' to 'WiringPinMode' [-fpermissive] #49

Open
elmarfaber opened this issue Oct 18, 2018 · 4 comments
Open

Comments

@elmarfaber
Copy link

Hello,
I try to use the bounce2 under STM32 arduino code and get the following error:
.platformio\lib\Bounce2_ID1106\src/Bounce2.h:188:26: error: invalid conversion from 'int' to 'WiringPinMode' [-fpermissive]
I use VisualStudioCode with the PlatformIO extension.

Best regards
Elmar

@thomasfredericks
Copy link
Owner

Hum, it seems that the platform you are using defines pin modes as an enum.

This is a similar issue: https://www.stm32duino.com/viewtopic.php?t=463&start=20

I do not use PlatformIO yet. Sorry I can not help with this right now.

@krukhlis
Copy link

krukhlis commented Apr 18, 2019

invalid conversion from 'int' to 'WiringPinMode' [-fpermissive]

This is not VS/PlatformIO issue. This is result of conversion of the Arduino Wire library to STM32 ( some company originally, stm32duino nowadays).
In original Arduino function is declared as:
void pinMode(uint8_t pin, uint8_t mode) Whilst in stm32 version ( STM32 io.h ) it is defined for Hell-known reasons as:
void pinMode(uint8 pin, WiringPinMode mode) Obviously code in Bounce2 targets traditional Arduino Wire API.
For your issue -- just copy void pinMode(uint8 pin, WiringPinMode mode) implementation, but change param to uint8_t and do corresponding changes in implementation to parse byte instead of Enum.
It's few hours work with testing and watching new series of GoT in parallel :).

@thomasfredericks
Copy link
Owner

Hi, there is already an #ifdef in Bounce.h at line 184:

#if defined(ARDUINO_STM_NUCLEO_F103RB) || defined(ARDUINO_GENERIC_STM32F103C)
        pinMode(pin, (WiringPinMode)mode);
#else
        pinMode(pin, mode);
#endif

Could you please add your test case and see if it compiles?

@thomasfredericks
Copy link
Owner

Maybe a more generic #if defined would be better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants