//
#include "Define.h"
//
#ifndef StepperDRV8825_h
#define StepperDRV8825_h
//
enum EStepDirection
{
    sdNegative  = 0,
    sdPositive  = 1
};
//
enum EStepResolution
{
    srFull      = 0,
    srHalf      = 1,
    srQuarter   = 2,
    srEight     = 3,
    srSixteen   = 4,
    srThirtyTwo = 5
};
//
enum EStateStep
{
    ssIdle = 0,
    ssStepHigh = 1,
    ssStepLow = 2
};
//
class CStepperDRV8825
{
    private:
    EStateStep FStateStep;
    int FPinStep, FPinDirection;
    int FPinM0, FPinM1, FPinM2;
    int FPinEnableN;
    long unsigned FMicrosPeriod;
    long unsigned FMicrosPreset;
    long unsigned FStepCount;
    //
    public:
    CStepperDRV8825(int pinstep, int pindirection,
                    int pinm0, int pinm1, int pinm2,
                    int pinenablen);
    //
    EStateStep GetStateStep(void) { return FStateStep; }
    void SetStateStep(EStateStep statestep);
    void SetStepDirection(EStepDirection stepdirection);
    void SetStepResolution(EStepResolution stepresolution);
    void Enable(void);
    void Disable(void);
    //
    bool Open(void);
    bool Close(void);
    bool Move(EStepDirection stepdirection,
               EStepResolution stepresolution,
               long unsigned stepperiod,
               long unsigned stepcount);
    bool Halt(void);
    //
    void Execute(void);
};
//
#endif // StepperDRV8825_h
//
