Hello everybody,
When porting the SimpleFOC algorithm to an Arduino Nano (nRF52840) I get error messages from the IDE regarding the interrupt handler. Below you can see the error massages. I can not explain the error, maybe someone of you has a solution to my problem.
\\nafiler.foerster.net\Daten\User_Data\Marcel.Schuster\Documents\Arduino\libraries\Simple_FOC\src\communication\StepDirListener.cpp: In member function 'void StepDirListener::enableInterrupt(void (*)())':
\\nafiler.foerster.net\Daten\User_Data\Marcel.Schuster\Documents\Arduino\libraries\Simple_FOC\src\communication\StepDirListener.cpp:16:67: error: no matching function for call to 'attachInterrupt(int&, void (*&)(), int&)'
attachInterrupt(digitalPinToInterrupt(pin_step), doA, polarity);
^
In file included from C:\Users\Marcel.Schuster\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\4.0.6\variants\ARDUINO_NANO33BLE/pinmode_arduino.h:23:0,
from C:\Users\Marcel.Schuster\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\4.0.6\cores\arduino/Arduino.h:26,
from \\nafiler.foerster.net\Daten\User_Data\Marcel.Schuster\Documents\Arduino\libraries\Simple_FOC\src\communication\StepDirListener.h:4,
from \\nafiler.foerster.net\Daten\User_Data\Marcel.Schuster\Documents\Arduino\libraries\Simple_FOC\src\communication\StepDirListener.cpp:1:
C:\Users\Marcel.Schuster\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\4.0.6\cores\arduino/api/Common.h:113:6: note: candidate: void attachInterrupt(pin_size_t, voidFuncPtr, PinStatus) <near match>
void attachInterrupt(pin_size_t interruptNumber, voidFuncPtr callback, PinStatus mode);
^~~~~~~~~~~~~~~
C:\Users\Marcel.Schuster\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\4.0.6\cores\arduino/api/Common.h:113:6: note: conversion of argument 3 would be ill-formed:
\\nafiler.foerster.net\Daten\User_Data\Marcel.Schuster\Documents\Arduino\libraries\Simple_FOC\src\communication\StepDirListener.cpp:16:59: error: invalid conversion from 'int' to 'PinStatus' [-fpermissive]
attachInterrupt(digitalPinToInterrupt(pin_step), doA, polarity);
^~~~~~~~
In file included from C:\Users\Marcel.Schuster\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\4.0.6\cores\arduino/Arduino.h:127:0,
from \\nafiler.foerster.net\Daten\User_Data\Marcel.Schuster\Documents\Arduino\libraries\Simple_FOC\src\communication\StepDirListener.h:4,
from \\nafiler.foerster.net\Daten\User_Data\Marcel.Schuster\Documents\Arduino\libraries\Simple_FOC\src\communication\StepDirListener.cpp:1:
C:\Users\Marcel.Schuster\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\4.0.6\cores\arduino/overloads.h:35:6: note: candidate: void attachInterrupt(PinName, voidFuncPtr, PinStatus) <near match>
void attachInterrupt(PinName interruptNumber, voidFuncPtr callback, PinStatus mode);
^~~~~~~~~~~~~~~
C:\Users\Marcel.Schuster\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\4.0.6\cores\arduino/overloads.h:35:6: note: conversion of argument 3 would be ill-formed:
\\nafiler.foerster.net\Daten\User_Data\Marcel.Schuster\Documents\Arduino\libraries\Simple_FOC\src\communication\StepDirListener.cpp:16:59: error: invalid conversion from 'int' to 'PinStatus' [-fpermissive]
attachInterrupt(digitalPinToInterrupt(pin_step), doA, polarity);
^~~~~~~~
In file included from C:\Users\Marcel.Schuster\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\4.0.6\cores\arduino/api/ArduinoAPI.h:29:0,
from C:\Users\Marcel.Schuster\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\4.0.6\cores\arduino/Arduino.h:27,
from \\nafiler.foerster.net\Daten\User_Data\Marcel.Schuster\Documents\Arduino\libraries\Simple_FOC\src\communication\StepDirListener.h:4,
from \\nafiler.foerster.net\Daten\User_Data\Marcel.Schuster\Documents\Arduino\libraries\Simple_FOC\src\communication\StepDirListener.cpp:1:
C:\Users\Marcel.Schuster\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\4.0.6\cores\arduino/api/Interrupts.h:38:27: note: candidate: template<class T> void arduino::attachInterrupt(pin_size_t, arduino::voidTemplateFuncPtrParam<T*>, PinStatus, T*)
template<typename T> void attachInterrupt(pin_size_t interruptNum, voidTemplateFuncPtrParam<T*> userFunc, PinStatus mode, T* param) {
^~~~~~~~~~~~~~~
C:\Users\Marcel.Schuster\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\4.0.6\cores\arduino/api/Interrupts.h:38:27: note: template argument deduction/substitution failed:
\\nafiler.foerster.net\Daten\User_Data\Marcel.Schuster\Documents\Arduino\libraries\Simple_FOC\src\communication\StepDirListener.cpp:16:67: note: candidate expects 1 argument, 0 provided
attachInterrupt(digitalPinToInterrupt(pin_step), doA, polarity);
^
In file included from C:\Users\Marcel.Schuster\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\4.0.6\cores\arduino/api/ArduinoAPI.h:29:0,
from C:\Users\Marcel.Schuster\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\4.0.6\cores\arduino/Arduino.h:27,
from \\nafiler.foerster.net\Daten\User_Data\Marcel.Schuster\Documents\Arduino\libraries\Simple_FOC\src\communication\StepDirListener.h:4,
from \\nafiler.foerster.net\Daten\User_Data\Marcel.Schuster\Documents\Arduino\libraries\Simple_FOC\src\communication\StepDirListener.cpp:1:
C:\Users\Marcel.Schuster\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\4.0.6\cores\arduino/api/Interrupts.h:21:27: note: candidate: template<class T> void arduino::attachInterrupt(pin_size_t, arduino::voidTemplateFuncPtrParam<T>, PinStatus, T&)
template<typename T> void attachInterrupt(pin_size_t interruptNum, voidTemplateFuncPtrParam<T> userFunc, PinStatus mode, T& param) {
^~~~~~~~~~~~~~~
C:\Users\Marcel.Schuster\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\4.0.6\cores\arduino/api/Interrupts.h:21:27: note: template argument deduction/substitution failed:
\\nafiler.foerster.net\Daten\User_Data\Marcel.Schuster\Documents\Arduino\libraries\Simple_FOC\src\communication\StepDirListener.cpp:16:67: note: candidate expects 1 argument, 0 provided
attachInterrupt(digitalPinToInterrupt(pin_step), doA, polarity);
^
exit status 1
Compilation error: exit status 1