Skip to content

Instantly share code, notes, and snippets.

@Warwolt
Created July 16, 2019 07:32
Show Gist options
  • Save Warwolt/c7af04cf968723e68dcae9d0ca6c62fa to your computer and use it in GitHub Desktop.
Save Warwolt/c7af04cf968723e68dcae9d0ca6c62fa to your computer and use it in GitHub Desktop.
class Counter
{
public:
void count() { counter++; }
int getCount() { return counter; }
private:
int counter = 0;
};
static void(*funcptr)(void) = nullptr;
static Counter myCounter;
void interrupt_handler()
{
if(funcptr != nullptr)
{
funcptr();
}
}
int main()
{
funcptr = []{ myCounter.count(); };
interrupt_handler();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment