Repository navigation
Conversation
private struct handling limited to one compilation unit real funcs get pulled whenever attachInterrupt requests std::function overload weakly linked stubs are used by default
add a note about unsafe execution from isr context
ref. esp8266#5922 still utilize section split, but put both operator and invoker latter being was omitted for some reason in the original pr additionally, resolve ambigous overload of base attachInterrupt in case functor can be converted into a pointer but cannot decide between std::function<void(void)> and void(*)(void)
note that the same restrictions as w/ free also apply here specific use-case for right now is detaching interrupt callers allocating things is a whole other matter
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ref. #5922 for the original .ld snippet
add the missing member function pointer to invoker aka actual func obj
remove everything else that sort-of matches std::function signature. w/ a simple web server app this frees up ~600bytes of IRAM.
function dispatch rewrite inlines interrupt caller operator()(), but the lambda still needs to be in iram. this happens by matching the invoker func signature, which has
esp8266::FunctionalInterrupt::Tagin its arguments list. caller may useauto, since the struct does nothing otherwise(also choosing to ignore the throw on null func check inside operator()(). at least for now. in case there is a way to shorten the operator method w/o rewriting the header, it would be a nice addition here specifically. barring an option of a whole other lambda functor container&caller class)
SPISlave plus example rewritten to accept pointers, since sample lambdas were not actually utilizing std::function container in any way.
note that scheduled_function & scheduled interrupt sort-of work (?) under the same assumption
but, it has a whole bunch of other issues like malloc/new, constructors and copies being done all at once