Closed Denages closed 7 years ago
Actual only for ESP8266
Hi,
Do you still want to push this forward? If so, try to make it compatible with all the current boards ass well?
It doesn't seem like board-dependent feature. If toolchain (compiler and libraries) supports this C++ feature, it should work everywhere on any kind of board.
@CAHEK7 @ivanseidel The STL library is not included with AVR-GCC. Any ideas how to make it work?
fatal error: functional: No such file or directory
include
^
compilation terminated. exit status 1 Error compiling for board Arduino/Genuino Uno.
@Denages Have you found answer for this? I really need method to insert lambda functions and I used your way, but I can't be sure that it will work in every project. Maybe including https://github.com/maniacbug/StandardCplusplus will solve this problem?
Seems that library port could help. You can try use @Denages patch with https://github.com/maniacbug/StandardCplusplus and it should work.
But the patch won't be merged into master branch because it brings heavy dependencies.
@CAHEK7 On NodeMCU LoLin v3 everything works fine even without StandardCplusplus (i didn't try on other ESP platforms). BUT on platforms like Arduino Nano (atmega328) / Uno even WITH StandardCplusplus it doesn't compile. Error is: "error: 'std::function' has not been declared"
I'm using PlatformIO. with this platformio.ini: [env:nanoatmega328] platform = atmelavr board = nanoatmega328 framework = arduino
My main aim is to have possibility to use lambda functions in Thread.onRun or some kind of function that will give me opportunity to predefine some arguments in function that will be used in Thread.onRun.
@CAHEK7 On NodeMCU LoLin v3 everything works fine even without StandardCplusplus (i didn't try on other ESP platforms). BUT on platforms like Arduino Nano (atmega328) / Uno even WITH StandardCplusplus it doesn't compile. Error is: "error: 'std::function' has not been declared"
I'm using PlatformIO. with this platformio.ini: [env:nanoatmega328] platform = atmelavr board = nanoatmega328 framework = arduino
My main aim is to have possibility to use lambda functions in Thread.onRun or some kind of function that will give me opportunity to predefine some arguments in function that will be used in Thread.onRun.
I know this is old but I want to say that StandardCplusplus I haven't ever gotten to work with modern Arduino versions. A library called ArduinoSTL does though, and it contains <functional>
much like StandardCPlusPlus
Now we can use lambdas and method pointers in addition to function pointer as onRun action