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

Make stm32_interrupt_enable() and stm32_interrupt_disable() callable from C #188

Open
terrillmoore opened this issue Dec 12, 2021 · 2 comments
Assignees

Comments

@terrillmoore
Copy link
Member

terrillmoore commented Dec 12, 2021

It appears that the intent was that stm32_interrupt_enable() and stm32_interrupt_disable() should be callable from C. But the header file (cores/arduino/stm32/interrupt.h) neglected to declare them extern "C", so they can't be. (There's an overload from stm32_interrupt_enable() using a std::function<> wrapper, and the header file makes that invisible when included in a .c file. But since the visible stm32_interrupt_enable() is implemented in a C++ file, you get a link error when you try to link. Ditto for stm32_interrupt_disable().

The solution is to wrap in the C-ish things in extern "C" in interrupt.h when compiling in C++; that way, the functions will be callable from C.

@dhineshkumarmcci
Copy link

@terrillmoore have tested with these changes. application works good but that requires changes in Sigfox library where interrupt_enable function is being called.

https://github.com/mcci-catena/MCCI_Sigfox_Image/blob/5f794cb04a1e47553b5d88410813491d41fde0ef/src/arduino_wrapper.c#L518-L526

I will do the necessary changes and push them to the Sigfox lib.

Also for PR #187 I will include the changes of branch issue188.

@terrillmoore
Copy link
Member Author

requires changes in Sigfox library where interrupt_enable function is being called.

That's as expected. Thanks!

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

No branches or pull requests

2 participants