Libary for control.

Dependencies:   FastPWM

Dependents:   RT2_Cuboid

LinearCharacteristics.h

Committer:
pmic
Date:
2022-05-05
Revision:
10:eb29810d831b
Parent:
6:e93f67d98616

File content as of revision 10:eb29810d831b:

#ifndef LINEAR_CHARACTERISTICS_H_
#define LINEAR_CHARACTERISTICS_H_

class LinearCharacteristics
{

public:

    LinearCharacteristics(float gain, float offset);
    LinearCharacteristics(float x0, float x1, float y0, float y1);
    LinearCharacteristics(float x0, float x1, float y0, float y1, float yMin, float yMax);

    LinearCharacteristics() {};

    virtual ~LinearCharacteristics();

    float operator()(float x)
    {
        return evaluate(x);
    }

    float evaluate(float x);

    void setup(float gain, float offset);
    void setup(float x0, float x1, float y0, float y1);
    void setup(float x0, float x1, float y0, float y1, float yMin, float yMax);

    void correctExistingOffset(float);

private:

    float gain;
    float offset;
    float yMin;
    float yMax;

};

#endif