Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add extra parameter to all callbacks #4659

Open
Labels
Component: CoreRelated to the code for the standard Arduino API Library: OtherArduino libraries that don't have their own label Library: WireThe Wire Arduino library feature requestA request to make an enhancement (not a bug fix)
@paulo-raca

Description

On Arduino, you'll tipically declare a new callback on the main file for each thing you are listening on.

It's very difficult to write generic, reusable libraries that attach to interruptions or other callbacks.

In C/C++ world, we usually specify an extra void* parameter when registering the callback, where the listener can store any context necessary.

I suggest we adopt this on all Arduino callbacks: attachInterrupt(), Serial.serialEvent(), Wire.OnReceive(), etc

I've already create #4519, which upgrades attachInterrupt().

Keep in mind that the changes can be done in a backwars-compatible way, and the impact in performance, memory and flash storage is quite low (But not zero)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: CoreRelated to the code for the standard Arduino API Library: OtherArduino libraries that don't have their own label Library: WireThe Wire Arduino library feature requestA request to make an enhancement (not a bug fix)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /