Skip to content

Ticker fix solving #6155 #7664

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

Merged
merged 8 commits into from
Feb 6, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Wrapped Ticker functions with #pragma disabling -Wcast-function-type
  • Loading branch information
PilnyTomas committed Jan 5, 2023
commit 160be7e67a10d01b6e44c4bf2521c0ccd6348976
10 changes: 8 additions & 2 deletions libraries/Ticker/src/Ticker.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class Ticker
_attach_ms(milliseconds, true, reinterpret_cast<callback_with_arg_t>(callback), 0);
}

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
template<typename TArg>
void attach(float seconds, void (*callback)(TArg), TArg arg)
{
Expand All @@ -65,6 +67,7 @@ class Ticker
uint32_t arg32 = (uint32_t)arg;
_attach_ms(milliseconds, true, reinterpret_cast<callback_with_arg_t>(callback), arg32);
}
#pragma GCC diagnostic pop

void once(float seconds, callback_t callback)
{
Expand All @@ -73,9 +76,11 @@ class Ticker

void once_ms(uint32_t milliseconds, callback_t callback)
{
_attach_ms(milliseconds, false, reinterpret_cast<callback_with_arg_t>(callback), 0);
_attach_ms(milliseconds, false, reinterpret_cast<callback_with_arg_t>(callback), 0);
}

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
template<typename TArg>
void once(float seconds, void (*callback)(TArg), TArg arg)
{
Expand All @@ -91,11 +96,12 @@ class Ticker
uint32_t arg32 = (uint32_t)(arg);
_attach_ms(milliseconds, false, reinterpret_cast<callback_with_arg_t>(callback), arg32);
}
#pragma GCC diagnostic pop

void detach();
bool active();

protected:
protected:
void _attach_ms(uint32_t milliseconds, bool repeat, callback_with_arg_t callback, uint32_t arg);


Expand Down