?lang_form? ?lang_select? ?lang_submit? ?lang_endform?
{HEADER END}
{BLAME START}

library

?curdirlinks? -

Blame information for rev 32

Line No. Rev Author Line
1 32 kaklik /*****************************************************************************
2 * Module for Microchip Graphics Library
3 * GOL Layer
4 * Static text
5 *****************************************************************************
6 * FileName: DigitalMeter.h
7 * Dependencies: None
8 * Processor: PIC24F, PIC24H, dsPIC, PIC32
9 * Compiler: MPLAB C30 V3.00, MPLAB C32
10 * Linker: MPLAB LINK30, MPLAB LINK32
11 * Company: Microchip Technology Incorporated
12 *
13 * Software License Agreement
14 *
15 * Copyright © 2008 Microchip Technology Inc. All rights reserved.
16 * Microchip licenses to you the right to use, modify, copy and distribute
17 * Software only when embedded on a Microchip microcontroller or digital
18 * signal controller, which is integrated into your product or third party
19 * product (pursuant to the sublicense terms in the accompanying license
20 * agreement).
21 *
22 * You should refer to the license agreement accompanying this Software
23 * for additional information regarding your rights and obligations.
24 *
25 * SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS” WITHOUT WARRANTY OF ANY
26 * KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY
27 * OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR
28 * PURPOSE. IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR
29 * OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION,
30 * BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT
31 * DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL,
32 * INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA,
33 * COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY
34 * CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF),
35 * OR OTHER SIMILAR COSTS.
36 *
37 * Author Date Comment
38 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
39 * Arpan kumar 06/11/09 Version 1.0 release
40 * PAT 01/18/10 Added draw state to redraw only text.
41 *****************************************************************************/
42 #ifndef _DIGITALMETER_H
43 #define _DIGITALMETER_H
44  
45 #include <Graphics\GOL.h>
46  
47 /*********************************************************************
48 * Object States Definition:
49 *********************************************************************/
50 #define DM_DISABLED 0x0002 // Bit for disabled state.
51 #define DM_RIGHT_ALIGN 0x0004 // Bit to indicate value is left aligned.
52 #define DM_CENTER_ALIGN 0x0008 // Bit to indicate value is center aligned.
53 #define DM_FRAME 0x0010 // Bit to indicate frame is displayed.
54 #define DM_DRAW 0x4000 // Bit to indicate object must be redrawn.
55 #define DM_UPDATE 0x2000 // Bit to indicate that only text must be redrawn.
56 #define DM_HIDE 0x8000 // Bit to remove object from screen.
57  
58 /* Indent constant for the text used in the frame. */
59 #define DM_INDENT 0x02 // Text indent constant.
60  
61 /* User should change this value depending on the number of digits he wants to display */
62 #define DM_WIDTH 0x0A // This value should be more than the no of digits displayed
63  
64 /*********************************************************************
65 * Structure: DIGITALMETER
66 * Overview: Defines the parameters required for a <link Digital Meter> Object.
67 *********************************************************************/
68 typedef struct
69 {
70 OBJ_HEADER hdr; // Generic header for all Objects (see OBJ_HEADER).
71 SHORT textHeight; // Pre-computed text height
72 DWORD Cvalue; // Current value
73 DWORD Pvalue; // Previous value
74 BYTE NoOfDigits; // Number of digits to be displayed
75 BYTE DotPos; // Position of decimal point
76 } DIGITALMETER;
77  
78 /*********************************************************************
79 * Macros: DmGetValue(pDm)
80 *
81 * Overview: This macro returns the current
82 * value used for the object.
83 *
84 * PreCondition: none
85 *
86 * Input: pDm - Pointer to the object.
87 *
88 * Output: Returns the value used.
89 *
90 * Side Effects: none
91 *
92 ********************************************************************/
93 #define DmGetValue(pDm) pDm->Cvalue
94  
95 /*********************************************************************
96 * Function: DmSetValue(DIGITALMETER *pDm, DWORD Value)
97 *
98 * Overview: This function sets the value that will be used for the object.
99 *
100 * PreCondition: none
101 *
102 * Input: pDm - The pointer to the object whose value will be modified.
103 * Value - New value to be set for the <link Digital Meter>.
104 *
105 * Output: none
106 *
107 * Side Effects: none
108 *
109 ********************************************************************/
110 void DmSetValue(DIGITALMETER *pDm, DWORD Value);
111  
112 /*********************************************************************
113 * Macros: DmIncVal(pDm, deltaValue)
114 *
115 * Overview: This macro is used to directly increment the value.
116 *
117 * PreCondition: none
118 *
119 * Input: pDm - Pointer to the object.
120 * deltaValue - Number to be added to the current <link Digital Meter> value.
121 *
122 * Output: none
123 *
124 * Side Effects: none
125 *
126 ********************************************************************/
127 #define DmIncVal(pDm, deltaValue) DmSetValue(pDm, (pDm->Cvalue + deltaValue))
128  
129 /*********************************************************************
130 * Macros: DmDecVal(pDm, deltaValue)
131 *
132 * Overview: This macro is used to directly decrement the value.
133 *
134 * PreCondition: none
135 *
136 * Input: pDm - Pointer to the object.
137 * deltaValue - Number to be subtracted to the current <link Digital Meter> value.
138 *
139 * Output: none
140 *
141 * Side Effects: none
142 *
143 ********************************************************************/
144 #define DmDecVal(pDm, deltaValue) DmSetValue(pDm, (pDm->Cvalue - deltaValue))
145  
146 /*********************************************************************
147 * Function: DIGITALMETER *DmCreate(WORD ID, SHORT left, SHORT top, SHORT right, SHORT bottom,
148 * WORD state , DWORD Value, BYTE NoOfDigits, BYTE DotPos, GOL_SCHEME *pScheme)
149 *
150 * Overview: This function creates a DIGITALMETER object with the
151 * parameters given. It automatically attaches the new
152 * object into a global linked list of objects and returns
153 * the address of the object.
154 *
155 * PreCondition: none
156 *
157 * Input: ID - Unique user defined ID for the object instance.
158 * left - Left most position of the object.
159 * top - Top most position of the object.
160 * right - Right most position of the object.
161 * bottom - Bottom most position of the object.
162 * state - Sets the initial state of the object.
163 * Value - Sets the initial value to be displayed
164 * NoOfDigits - Sets the number of digits to be displayed
165 * DotPos - Sets the position of decimal point in the display
166 * pScheme - Pointer to the style scheme. Set to NULL if
167 * default style scheme is used.
168 *
169 * Output: Returns the pointer to the object created.
170 *
171 * Example:
172 * <PRE>
173 * GOL_SCHEME *pScheme;
174 * DIGITALMETER *pDm;
175 *
176 * pScheme = GOLCreateScheme();
177 * state = DM_DRAW | DM_FRAME | DM_CENTER_ALIGN;
178 * DmCreate(ID_DIGITALMETER1, // ID
179 * 30,80,235,160, // dimension
180 * state, // has frame and center aligned
181 * 789,4,1, // to display 078.9
182 * pScheme); // use given scheme
183 *
184 * while(!DmDraw(pDm)); // draw the object
185 * </PRE>
186 *
187 * Side Effects: none
188 *
189 ********************************************************************/
190 DIGITALMETER *DmCreate
191 (
192 WORD ID,
193 SHORT left,
194 SHORT top,
195 SHORT right,
196 SHORT bottom,
197 WORD state,
198 DWORD Value,
199 BYTE NoOfDigits,
200 BYTE DotPos,
201 GOL_SCHEME *pScheme
202 );
203  
204 /*********************************************************************
205 * Function: WORD DmTranslateMsg(DIGITALMETER *pDm, GOL_MSG *pMsg)
206 *
207 * Overview: This function evaluates the message from a user if the
208 * message will affect the object or not. The table below
209 * enumerates the translated messages for each event of the
210 * touch screen and keyboard inputs.
211 *
212 * <TABLE>
213 * Translated Message Input Source Events Description
214 * ################## ############ ###### ###########
215 * DM_MSG_SELECTED Touch Screen EVENT_PRESS, EVENT_RELEASE If events occurs and the x,y position falls in the area of the <link Digital Meter>.
216 * OBJ_MSG_INVALID Any Any If the message did not affect the object.
217 * </TABLE>
218 *
219 * PreCondition: none
220 *
221 * Input: pDm - The pointer to the object where the message will be
222 * evaluated to check if the message will affect the object.
223 * pMsg - Pointer to the message struct containing the message from
224 * the user interface.
225 *
226 * Output: Returns the translated message depending on the received GOL message:
227 * - DM_MSG_SELECTED – <link Digital Meter> is selected
228 * - OBJ_MSG_INVALID – <link Digital Meter> is not affected
229 *
230 * Example:
231 * Usage is similar to BtnTranslateMsg() example.
232 *
233 * Side Effects: none
234 *
235 ********************************************************************/
236 WORD DmTranslateMsg(DIGITALMETER *pDm, GOL_MSG *pMsg);
237  
238 /*********************************************************************
239 * Function: WORD DmDraw(DIGITALMETER *pDm)
240 *
241 * Overview: This function renders the object on the screen using
242 * the current parameter settings. Location of the object
243 * is determined by the left, top, right and bottom
244 * parameters. The colors used are dependent on the state
245 * of the object. The font used is determined by the style
246 * scheme set.
247 *
248 * When rendering objects of the same type, each object must
249 * be rendered completely before the rendering of the next
250 * object is started. This is to avoid incomplete object rendering.
251 *
252 * PreCondition: Object must be created before this function is called.
253 *
254 * Input: pDm - Pointer to the object to be rendered.
255 *
256 * Output: Returns the status of the drawing
257 * - 1 - If the rendering was completed and
258 * - 0 - If the rendering is not yet finished.
259 * Next call to the function will resume the
260 * rendering on the pending drawing state.
261 *
262 * Example:
263 * See DmCreate() Example.
264 *
265 * Side Effects: none
266 *
267 ********************************************************************/
268 WORD DmDraw(DIGITALMETER *pDm);
269 #endif // _DIGITALMETER_H
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3