simple GUI elements for drawing on a canvas, works with adafruit graphics lib

Dependents:   ezSBC_MPU9250

Controls.h

Committer:
JojoS
Date:
2017-04-24
Revision:
0:ccdf1edcbba6

File content as of revision 0:ccdf1edcbba6:

#ifndef _Controls_h_
#define _Controls_h_

#include "mbed.h"
#include "SmallGUIBase.h"

#if (USE_BARGRAPH == 1)
class barGraph : public baseControl
{
    public:
    enum bgOrientation {bgHorizontal, bgVertical};
    
    barGraph(bgOrientation orientation, int16_t x0, int16_t y0, int16_t x1, int16_t y1);
    
    void setScale(float valMin, float valMax);
    void setValue(float val);
    
    virtual void draw(Adafruit_GFX &canvas);
    
    private:
    bgOrientation   orientation;
    int16_t x0;
    int16_t y0;
    int16_t x1;
    int16_t y1;
    int16_t zeroPos;
    float valMin;
    float valMax;
    float valScaleFactor;
    float val;
    
};
#endif

#endif