I'm writing a library for arduino which at a certain point must call a function after a fixed delay without using the delay function.
Since standard c++ libraries are not included, I have to use arduino libraries, and I opted for FlexiTimer2 which is useful to run a function every X time units (this is just an introduction, the problem is not arduino related but c++ related).
.h file
#ifndef StepperDriverController_h
#define StepperDriverController_h
#include <stdlib.h>
#if ARDUINO >= 100
#include <Arduino.h>
#else
#include <WProgram.h>
#include <wiring.h>
#endif
class StepperDriverController
{
    public:
        StepperDriverController(unsigned char step, unsigned char direction);
        void setPulseWidth(unsigned short width);
        // other methods
    protected:
        void stepPinDown();
        void step(bool blocking = true);
    private:
        unsigned char _pins[2];
        // some attributes
};
#endif
.cpp file
#include "StepperDriverController.h"
#include <Thread.h>
void StepperDriverController::stepPinDown()
{
    digitalWrite(_pins[0], LOW);
    FlexiTimer2::stop();
}
void StepperDriverController::setPulseWidth(unsigned short width)
{
    _pulseWidth = width;
    FlexiTimer2::set(width, 1/1000000, stepPinDown);
}
void StepperDriverController::step()
{
    digitalWrite(_pins[1], _direction ? HIGH : LOW);
    digitalWrite(_pins[0], HIGH);
    FlexiTimer2::start();
}
I get invalid use of non-static member function on code FlexiTimer2::set(width, 1/1000000, stepPinDown); and '_pins' was not declared in this scope on digitalWrite(_pins[0], LOW);
I've read many questions related to this error but couldn't find a way to solve it anyway
EDIT
FlexiTimer should not be instantiated, but used as I did, as shown in an official library example
 
    