- ANALOG METER, initial offering - Emulation of an analog/mechanical meter using the SPI TFT display \"http://mbed.org/cookbook/SPI-driven-QVGA-TFT\" (touch not used) Meter takes an integer number from 0 - 100 and uses that number to position the meter\'s needle - An additional auto-scaling feature allows for + floating numbers from 0.0 - 10000.0 in \"NewfNumb\" Scaling is noted two ways a. Color of the meter body changes b. A text scale factor is displayed in the upper, right-hand corner, near the full scale reading Value of \"NewfNumb\" Meter_Body Scale_Factor < -0.0 Blue 0 0.1 - 9.9 Green x1 10.0 - 99.0 Yellow x10 100.0 - 999.0 Orange x100 1000.0 - 9990.0 Red x1k >= 10000.0 Red peg! - If NewfNumb is > 600.0, a flashing yellow warning message appears in the center of the meter movement - The date and time are displayed in the lower right corner of the display - The value of NewfNumb being shown in the movement is also displayed in the lower left coener of the display - A timer ISR automatically updates the meter\'s movement Other Stuff: - Additional demo test program, walks analog meter up and down through all auto scales by manipulating the value of NewfNumb - USB serial port used to dump a few messages. Not needed, set to 921600 BAUD - LED1 slowly gets brighter and dimmer as main loop runs - If for some reason, the \"MeterNumber\" int register ends up >100 or <0, a Purple display appears at 50% movement with a \"bad#\" scale factor - There is NO provision for setting the RTC. Note that TimeZone and DST are added to the RTC number
SPI_TFT/GraphicsDisplay.h@0:fc70640071d2, 2012-01-31 (annotated)
- Committer:
- loopsva
- Date:
- Tue Jan 31 19:40:57 2012 +0000
- Revision:
- 0:fc70640071d2
100
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
loopsva | 0:fc70640071d2 | 1 | /* mbed GraphicsDisplay Display Library Base Class |
loopsva | 0:fc70640071d2 | 2 | * Copyright (c) 2007-2009 sford |
loopsva | 0:fc70640071d2 | 3 | * Released under the MIT License: http://mbed.org/license/mit |
loopsva | 0:fc70640071d2 | 4 | * |
loopsva | 0:fc70640071d2 | 5 | * A library for providing a common base class for Graphics displays |
loopsva | 0:fc70640071d2 | 6 | * To port a new display, derive from this class and implement |
loopsva | 0:fc70640071d2 | 7 | * the constructor (setup the display), pixel (put a pixel |
loopsva | 0:fc70640071d2 | 8 | * at a location), width and height functions. Everything else |
loopsva | 0:fc70640071d2 | 9 | * (locate, printf, putc, cls, window, putp, fill, blit, blitbit) |
loopsva | 0:fc70640071d2 | 10 | * will come for free. You can also provide a specialised implementation |
loopsva | 0:fc70640071d2 | 11 | * of window and putp to speed up the results |
loopsva | 0:fc70640071d2 | 12 | */ |
loopsva | 0:fc70640071d2 | 13 | |
loopsva | 0:fc70640071d2 | 14 | #ifndef MBED_GRAPHICSDISPLAY_H |
loopsva | 0:fc70640071d2 | 15 | #define MBED_GRAPHICSDISPLAY_H |
loopsva | 0:fc70640071d2 | 16 | |
loopsva | 0:fc70640071d2 | 17 | #include "TextDisplay.h" |
loopsva | 0:fc70640071d2 | 18 | |
loopsva | 0:fc70640071d2 | 19 | class GraphicsDisplay : public TextDisplay { |
loopsva | 0:fc70640071d2 | 20 | |
loopsva | 0:fc70640071d2 | 21 | public: |
loopsva | 0:fc70640071d2 | 22 | |
loopsva | 0:fc70640071d2 | 23 | GraphicsDisplay(const char* name); |
loopsva | 0:fc70640071d2 | 24 | |
loopsva | 0:fc70640071d2 | 25 | virtual void pixel(int x, int y, int colour) = 0; |
loopsva | 0:fc70640071d2 | 26 | virtual int width() = 0; |
loopsva | 0:fc70640071d2 | 27 | virtual int height() = 0; |
loopsva | 0:fc70640071d2 | 28 | |
loopsva | 0:fc70640071d2 | 29 | virtual void window(int x, int y, int w, int h); |
loopsva | 0:fc70640071d2 | 30 | virtual void putp(int colour); |
loopsva | 0:fc70640071d2 | 31 | |
loopsva | 0:fc70640071d2 | 32 | virtual void cls(); |
loopsva | 0:fc70640071d2 | 33 | virtual void fill(int x, int y, int w, int h, int colour); |
loopsva | 0:fc70640071d2 | 34 | virtual void blit(int x, int y, int w, int h, const int *colour); |
loopsva | 0:fc70640071d2 | 35 | virtual void blitbit(int x, int y, int w, int h, const char* colour); |
loopsva | 0:fc70640071d2 | 36 | |
loopsva | 0:fc70640071d2 | 37 | virtual void character(int column, int row, int value); |
loopsva | 0:fc70640071d2 | 38 | virtual int columns(); |
loopsva | 0:fc70640071d2 | 39 | virtual int rows(); |
loopsva | 0:fc70640071d2 | 40 | |
loopsva | 0:fc70640071d2 | 41 | protected: |
loopsva | 0:fc70640071d2 | 42 | |
loopsva | 0:fc70640071d2 | 43 | // pixel location |
loopsva | 0:fc70640071d2 | 44 | short _x; |
loopsva | 0:fc70640071d2 | 45 | short _y; |
loopsva | 0:fc70640071d2 | 46 | |
loopsva | 0:fc70640071d2 | 47 | // window location |
loopsva | 0:fc70640071d2 | 48 | short _x1; |
loopsva | 0:fc70640071d2 | 49 | short _x2; |
loopsva | 0:fc70640071d2 | 50 | short _y1; |
loopsva | 0:fc70640071d2 | 51 | short _y2; |
loopsva | 0:fc70640071d2 | 52 | |
loopsva | 0:fc70640071d2 | 53 | }; |
loopsva | 0:fc70640071d2 | 54 | |
loopsva | 0:fc70640071d2 | 55 | #endif |