fix based on https://gist.github.com/timbrom/1942280
[DSO138] / Screen.h
1 //////////////////////////////////////////////////////////////////////////////
2 //
3 //      Filename:       Board.h
4 //      Version:                
5 //      Data:           
6 //
7 //      Author:         Liu, Zemin
8 //      Company:        JYE Tech Ltd.
9 //      Web:            www.jyetech.com
10 //
11 //-----------------------------------------------------------------------------
12 //
13 //      Target:                 STM32F103C8
14 //      Tool chain:     CodeSourcery G++
15 //
16 //-----------------------------------------------------------------------------
17 //      Required files:
18 //
19 //-----------------------------------------------------------------------------
20 //      Notes:
21 //
22 //
23 //-----------------------------------------------------------------------------
24 //      Revision History:
25 //
26 ///////////////////////////////////////////////////////////////////////////////
27 //
28
29 #ifndef Screen_h
30
31 #define Screen_h
32
33 #include        "Common.h"
34
35 // ------------ Display parameters -----------------------
36 // Overall display parameters
37 #define         ScreenX0                0
38 #define         ScreenY0                0
39 #define         ScreenXsize             320
40 #define         ScreenYsize             240
41
42 #define         Rbits                   0               // Red bits position
43 #define         Gbits                   5               // Green bits position
44 #define         Bbits                   11              // Blue bits position
45 #define         RGB(R, G, B)    (((R >> 3) << Rbits) | ((G >> 2) << Gbits) | ((B >> 3) << Bbits))
46
47 enum  COLOR{
48         clBlack                         =       RGB(0, 0, 0),
49         clWhite                 =       RGB(255, 255, 255),
50         clRed                   =       RGB(255, 0, 0),
51         clGreen                 =       RGB(0, 255, 0),
52         clBlue                  =       RGB(0, 0, 255),
53         clYellow                        =       RGB(255, 255, 0),
54         clGainsboro             =       RGB(220, 220, 220),
55         clNavy                  =       RGB(0, 0, 128),
56         clAqua                  =       RGB(0, 255, 255),
57         clHotpink               =       RGB(255, 105, 180),
58         clOrange                =       RGB(255, 165, 0),
59         clDeepskyblue   =       RGB(0, 191, 255),
60         clDimgray               =       RGB(105, 105, 105),
61         cllightsalmon   =       RGB(255, 160, 122),
62         cllightcoral            =       RGB(240, 128, 128),
63         clpaleturquoise =       RGB(175, 238, 238),
64         clturquoise             =       RGB(64, 224, 208),
65         clViolet                        =       RGB(238, 130, 238),
66         clGray1                 =       RGB(90, 90, 90),
67         clGray2                 =       RGB(220, 220, 220),
68         clGray3                 =       RGB(240, 240, 240),
69         clDarkgray              =       RGB(169, 169, 169),
70         clSkyblue               =       RGB(135, 206, 235),
71         clChocolate             =       RGB(210, 105, 30),
72         clMediumseagreen        =       RGB(60, 179, 113),
73         clPeachpuff             =       RGB(255, 218, 185),
74         clSeagreen              =       RGB(46, 139, 87),
75
76         clBG1                   =       clGainsboro,
77         
78         clActiveItem1   =       clAqua,
79         clActiveItem2   =       clturquoise,
80
81         clBtnBG1                =       clOrange,
82         clBtnBG2                =       clBlue,
83         clBtnBG3                =       clGainsboro,
84         clBtnBG4                =       clSkyblue,
85         clBtnBG5                =       clRed,
86         
87         clBtnFG1                =       clBlack,
88         clBtnFG2                =       clWhite,
89
90         clCh1                   =       clYellow,
91         clTB                            =       clGreen,
92         clTrigger               =       clHotpink,
93
94         clCursorT               =       clMediumseagreen,
95         clCursorV               =       clOrange,
96         clCursorActive  =       clAqua,
97         clMeasurement   =       clGray3,
98 } ;
99
100 typedef struct {
101         U8      *Array;
102         U8      Xsize;
103         U8      Ysize;
104         U8      CharPitch;
105         U8      LinePitch;
106         U8      IndexOfs;
107         } FONT;
108
109
110 //      Display Panel
111 // =======================================================
112 // Display parameters
113 #define WWindowx0                       10
114 #define WWindowy0                       15
115 #define WWindowSizex            300
116 #define WWindowSizey            200
117 #define WWindowMidValue 0x800
118
119 #define WDsize                          300             // Wave display size
120 #define HBarSize                        140             // HPos indicator length
121
122 // ===========================================================
123 //      Declarations of external variables
124 // ===========================================================
125 //
126 extern  FONT ASC8X16;
127
128 // ===========================================================
129 //      Function Prototype Declarations
130 // ===========================================================
131 //
132 void    ClrScreen(void);
133 void    SetWindow(U16 x, U16 xsize, U16 y, U16 ysize);
134 void FillRect(S16 x, S16 y, S16 xsize, S16 ysize, U16 color);
135 void    PutcGenic(U16 x, U16 y, U8 ch, U16 fgcolor, U16 bgcolor, FONT *font);
136 void    PutsGenic(U16 x, U16 y, U8 *str, U16 fgcolor, U16 bgcolor, FONT *font);
137
138 #endif
139