TaskManagerIO
Loading...
Searching...
No Matches
ExecWithParameter< TParam > Class Template Reference

#include <ExecWithParameter.h>

Inheritance diagram for ExecWithParameter< TParam >:
Executable

Public Member Functions

 ExecWithParameter (void(*fn)(TParam), TParam storedParam)
void exec () override
Public Member Functions inherited from Executable
virtual ~Executable ()=default

Detailed Description

template<class TParam>
class ExecWithParameter< TParam >

Gives the ability to register a task with task manager that will call a function with a stored parameter An example usage would be to store a Stream upon which to write to. Note that if you use the new method below you absolutely must provide the deleteWhenDone defaulted parameter as true.

taskManager.scheduleFixedRate(1000, new ExecWithParameter<Stream*>(&Serial), TIME_MILLIS, true);

To use static memory, create an ExecWithParameter instance globally, and then pass a pointer to the schedule.

Template Parameters
TParamThe type that you want to store until called back.

Constructor & Destructor Documentation

◆ ExecWithParameter()

template<class TParam>
ExecWithParameter< TParam >::ExecWithParameter ( void(* fn )(TParam),
TParam storedParam )
inline

Constructs an instance giving the function to call and the parameter to pass to the function

Parameters
fnthe function to be called.
storedParamthe parameter to pass to the function

Member Function Documentation

◆ exec()

template<class TParam>
void ExecWithParameter< TParam >::exec ( )
inlineoverridevirtual

Called when the schedule is reached

Implements Executable.


The documentation for this class was generated from the following file: