Touch screen drivers control dashboard for miniature locomotive. Features meters for speed, volts, power. Switches for lights, horns. Drives multiple STM3_ESC brushless motor controllers for complete brushless loco system as used in "The Brute" - www.jons-workshop.com

Dependencies:   TS_DISCO_F746NG mbed Servo LCD_DISCO_F746NG BSP_DISCO_F746NG QSPI_DISCO_F746NG AsyncSerial FastPWM

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers movingcoilmeter.h Source File

movingcoilmeter.h

00001 #ifndef JON_FREEMAN_MOVING_COIL_METER
00002 #define JON_FREEMAN_MOVING_COIL_METER
00003 #include "mbed.h"
00004 
00005 /**
00006 class    moving_coil_meter
00007 Create moving coil meter graphic using STM32F746G-DISCO.
00008 Usage example :
00009 
00010 top line of constructor :
00011 moving_coil_meter::moving_coil_meter   (    int bod_col, int bgcol, int needlecol, int textcol, int scalecol,
00012                                             int cx, int cy, int size, double lo, double hi, double start_ang, double end_ang, 
00013                                             int scaleticks, char * units, int decimal_places, bool sign)
00014 
00015 moving_coil_meter   Voltmeter   (   LCD_COLOR_BLACK,    //  Frame / body colour
00016                                     LCD_COLOR_WHITE,    //  Dial face colour
00017                                     LCD_COLOR_RED,      //  Moving needle colour
00018                                     LCD_COLOR_BLUE,     //  Text colour for Units e.g. 'V' and e.g. '32.7'
00019                                     LCD_COLOR_MAGENTA,  //  Scale graduations colour
00020                                     VOLTMETER_X,        //  X co-ord, centre of meter
00021                                     VOLTMETER_Y,        //  Y co-ord, centre of meter
00022                                     V_A_SIZE,           //  Meter is square with rounded corners. This is meter dial face radius
00023                                     22.0,               //  Scale not limited to e.g. 0 to 10. This is reading at anti-clock limit
00024                                     59.0,               //  This is reading at full scale deflection
00025                                     1.25 * PI,          //  Angle of needle at anti-clockwise limit
00026                                     -0.25 * PI ,        //  Angle of needle at full scale deflection (clockwise max)
00027                                     30,                 //  Number of scale graduation marks drwan
00028                                     "V",                //  Text for Units, e.g. 'V' or 'MPH'
00029                                     ONE_DP,             //  NO_DPS or ONE_DP - supports only no decimal places or one
00030                                     false) ;            //  true to show '+' or '-', false to supress sign display
00031 
00032 */
00033 class    moving_coil_meter
00034 {
00035     int     meter_radius, cent_x, cent_y, needle_len, scale_ticks,
00036             disc_colour,    needle_colour,  scale_colour,   text_colour, body_colour, dec_places;
00037     int corner_rad,         //          = (meter_radius / 6),
00038         screw_hole_offset,  //   = (meter_radius * 92 / 100),
00039         screw_rad   ;       //           = (meter_radius / 13);
00040     char    unit_txt[8];
00041     double  start_angle, end_angle, old_angle, value_min, value_max, swept_angle, value_range;
00042     bool    draw_sign;
00043 
00044     void    DrawNeedle          (double alpha, int colour)  ;
00045     double  get_pointer_angle   (double value)  ;
00046     int     get_font_size       ()  ;
00047 
00048 public:
00049     moving_coil_meter   () {} ;//  default constructor
00050     moving_coil_meter   (int, int, int, int, int, int, int, int, double, double, double, double, int, char *, int, bool) ;
00051     void    set_value   (double v)  ;
00052     void    redraw  ()  ;
00053     void    LED (int, int)  ;
00054 }   ;
00055 
00056 #endif