| Line No. | Rev | Author | Line |
|---|---|---|---|
| 1 | 32 | kaklik | /***************************************************************************** |
| 2 | * Module for Microchip Graphics Library |
||
| 3 | * Densitron HIT1270 LCD controller driver |
||
| 4 | * Landscape orientation only |
||
| 5 | ***************************************************************************** |
||
| 6 | * FileName: HIT1270.h |
||
| 7 | * Dependencies: p24Fxxxx.h |
||
| 8 | * Processor: PIC24 |
||
| 9 | * Compiler: MPLAB C30 |
||
| 10 | * Linker: MPLAB LINK30 |
||
| 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 | * Anton Alkhimenok 11/12/07 Version 1.0 release |
||
| 40 | *****************************************************************************/ |
||
| 41 | #ifndef _HIT1270L_H |
||
| 42 | #define _HIT1270L_H |
||
| 43 | |||
| 44 | #include <p24Fxxxx.h> |
||
| 45 | #include "GraphicsConfig.h" |
||
| 46 | #include "GenericTypeDefs.h" |
||
| 47 | |||
| 48 | // Additional hardware-accelerated functions implemented in the driver. |
||
| 49 | // These definitions exclude the PutPixel()-based functions from compilation |
||
| 50 | // in the primitives layer (Primitive.c file). |
||
| 51 | //#define USE_DRV_FONT |
||
| 52 | //#define USE_DRV_LINE |
||
| 53 | //#define USE_DRV_CIRCLE |
||
| 54 | //#define USE_DRV_FILLCIRCLE |
||
| 55 | #define USE_DRV_BAR |
||
| 56 | #define USE_DRV_CLEARDEVICE |
||
| 57 | #define USE_DRV_PUTIMAGE |
||
| 58 | |||
| 59 | #ifdef USE_16BIT_PMP |
||
| 60 | #error This driver doesn't support 16-bit PMP (remove USE_16BIT_PMP option from HardwareProfile.h) |
||
| 61 | #endif |
||
| 62 | #ifndef DISP_HOR_RESOLUTION |
||
| 63 | #error DISP_HOR_RESOLUTION must be defined in HardwareProfile.h |
||
| 64 | #endif |
||
| 65 | #ifndef DISP_VER_RESOLUTION |
||
| 66 | #error DISP_VER_RESOLUTION must be defined in HardwareProfile.h |
||
| 67 | #endif |
||
| 68 | #ifndef COLOR_DEPTH |
||
| 69 | #error COLOR_DEPTH must be defined in HardwareProfile.h |
||
| 70 | #endif |
||
| 71 | #ifndef DISP_ORIENTATION |
||
| 72 | #error DISP_ORIENTATION must be defined in HardwareProfile.h |
||
| 73 | #endif |
||
| 74 | |||
| 75 | // Horizontal and vertical screen size |
||
| 76 | #if (DISP_HOR_RESOLUTION != 320) |
||
| 77 | #error This driver doesn't supports this resolution. Horisontal resolution must be 320 pixels. |
||
| 78 | #endif |
||
| 79 | #if (DISP_VER_RESOLUTION > 234) |
||
| 80 | #error This driver doesn't supports this resolution. Vertical resolution must be less than 234 pixels. |
||
| 81 | #endif |
||
| 82 | |||
| 83 | // Display orientation |
||
| 84 | #if (DISP_ORIENTATION != 0) |
||
| 85 | #error This driver doesn't support this orientation. |
||
| 86 | #endif |
||
| 87 | |||
| 88 | // Color depth |
||
| 89 | #if (COLOR_DEPTH != 16) |
||
| 90 | #error This driver doesn't support this color depth. It should be 16. |
||
| 91 | #endif |
||
| 92 | |||
| 93 | // Memory pitch for line |
||
| 94 | #define LINE_MEM_PITCH 320 |
||
| 95 | |||
| 96 | // Video buffer offset |
||
| 97 | #define BUF_MEM_OFFSET (DWORD) 0x18000 |
||
| 98 | |||
| 99 | // Clipping region control codes |
||
| 100 | #define CLIP_DISABLE 0 |
||
| 101 | #define CLIP_ENABLE 1 |
||
| 102 | |||
| 103 | // HIT1270 commands |
||
| 104 | #define SET_DATA_POINTER 0x50 |
||
| 105 | #define SRAM_WRITE 0x51 |
||
| 106 | #define STAMP_ICON 0x52 |
||
| 107 | #define FILL_BLOCK 0x53 |
||
| 108 | |||
| 109 | #define FLASH_WRITE 0x60 |
||
| 110 | #define FLASH_READ 0x61 |
||
| 111 | |||
| 112 | // Color codes |
||
| 113 | #define BLACK (WORD) 0x0000 |
||
| 114 | #define BRIGHTBLUE (WORD) 0x001f |
||
| 115 | #define BRIGHTGREEN (WORD) 0x07e0 |
||
| 116 | #define BRIGHTCYAN (WORD) 0x07ff |
||
| 117 | #define BRIGHTRED (WORD) 0xf800 |
||
| 118 | #define BRIGHTMAGENTA (WORD) 0xf81f |
||
| 119 | #define BRIGHTYELLOW (WORD) 0xffe0 |
||
| 120 | #define BLUE (WORD) 0x0010 |
||
| 121 | #define GREEN (WORD) 0x0400 |
||
| 122 | #define CYAN (WORD) 0x0410 |
||
| 123 | #define RED (WORD) 0x8000 |
||
| 124 | #define MAGENTA (WORD) 0x8010 |
||
| 125 | #define BROWN (WORD) 0xfc00 |
||
| 126 | #define LIGHTGRAY (WORD) 0x8410 |
||
| 127 | #define DARKGRAY (WORD) 0x4208 |
||
| 128 | #define LIGHTBLUE (WORD) 0x841f |
||
| 129 | #define LIGHTGREEN (WORD) 0x87f0 |
||
| 130 | #define LIGHTCYAN (WORD) 0x87ff |
||
| 131 | #define LIGHTRED (WORD) 0xfc10 |
||
| 132 | #define LIGHTMAGENTA (WORD) 0xfc1f |
||
| 133 | #define YELLOW (WORD) 0xfff0 |
||
| 134 | #define WHITE (WORD) 0xffff |
||
| 135 | |||
| 136 | #define GRAY0 (WORD) 0xe71c |
||
| 137 | #define GRAY1 (WORD) 0xc618 |
||
| 138 | #define GRAY2 (WORD) 0xa514 |
||
| 139 | #define GRAY3 (WORD) 0x8410 |
||
| 140 | #define GRAY4 (WORD) 0x630c |
||
| 141 | #define GRAY5 (WORD) 0x4208 |
||
| 142 | #define GRAY6 (WORD) 0x2104 |
||
| 143 | |||
| 144 | // Color |
||
| 145 | extern WORD_VAL _color; |
||
| 146 | |||
| 147 | // Clipping region control |
||
| 148 | extern SHORT _clipRgn; |
||
| 149 | |||
| 150 | // Clipping region borders |
||
| 151 | extern SHORT _clipLeft; |
||
| 152 | extern SHORT _clipTop; |
||
| 153 | extern SHORT _clipRight; |
||
| 154 | extern SHORT _clipBottom; |
||
| 155 | |||
| 156 | /********************************************************************* |
||
| 157 | * Function: void ResetDevice() |
||
| 158 | * |
||
| 159 | * PreCondition: none |
||
| 160 | * |
||
| 161 | * Input: none |
||
| 162 | * |
||
| 163 | * Output: none |
||
| 164 | * |
||
| 165 | * Side Effects: none |
||
| 166 | * |
||
| 167 | * Overview: resets device, initialize PMP |
||
| 168 | * |
||
| 169 | * Note: none |
||
| 170 | * |
||
| 171 | ********************************************************************/ |
||
| 172 | void ResetDevice(void); |
||
| 173 | |||
| 174 | /********************************************************************* |
||
| 175 | * Macros: GetMaxX() |
||
| 176 | * |
||
| 177 | * PreCondition: none |
||
| 178 | * |
||
| 179 | * Input: none |
||
| 180 | * |
||
| 181 | * Output: maximum horizontal coordinate |
||
| 182 | * |
||
| 183 | * Side Effects: none |
||
| 184 | * |
||
| 185 | * Overview: returns maximum horizontal coordinate |
||
| 186 | * |
||
| 187 | * Note: none |
||
| 188 | * |
||
| 189 | ********************************************************************/ |
||
| 190 | #define GetMaxX() (DISP_HOR_RESOLUTION - 1) |
||
| 191 | |||
| 192 | /********************************************************************* |
||
| 193 | * Macros: GetMaxY() |
||
| 194 | * |
||
| 195 | * PreCondition: none |
||
| 196 | * |
||
| 197 | * Input: none |
||
| 198 | * |
||
| 199 | * Output: maximum vertical coordinate |
||
| 200 | * |
||
| 201 | * Side Effects: none |
||
| 202 | * |
||
| 203 | * Overview: returns maximum vertical coordinate |
||
| 204 | * |
||
| 205 | * Note: none |
||
| 206 | * |
||
| 207 | ********************************************************************/ |
||
| 208 | #define GetMaxY() (DISP_VER_RESOLUTION - 1) |
||
| 209 | |||
| 210 | /********************************************************************* |
||
| 211 | * Function: void SetColor(WORD color) |
||
| 212 | * |
||
| 213 | * PreCondition: none |
||
| 214 | * |
||
| 215 | * Input: color coded in format: |
||
| 216 | * bits 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 |
||
| 217 | * color R R R R R G G G G G G B B B B B |
||
| 218 | * |
||
| 219 | * Output: none |
||
| 220 | * |
||
| 221 | * Side Effects: none |
||
| 222 | * |
||
| 223 | * Overview: sets current color |
||
| 224 | * |
||
| 225 | * Note: none |
||
| 226 | * |
||
| 227 | ********************************************************************/ |
||
| 228 | void SetColor(WORD color); |
||
| 229 | |||
| 230 | /********************************************************************* |
||
| 231 | * Macros: GetColor() |
||
| 232 | * |
||
| 233 | * PreCondition: none |
||
| 234 | * |
||
| 235 | * Input: none |
||
| 236 | * |
||
| 237 | * Output: color coded in format: |
||
| 238 | * bits 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 |
||
| 239 | * color R R R R R G G G G G G B B B B B |
||
| 240 | * |
||
| 241 | * Side Effects: none |
||
| 242 | * |
||
| 243 | * Overview: returns current color |
||
| 244 | * |
||
| 245 | * Note: none |
||
| 246 | * |
||
| 247 | ********************************************************************/ |
||
| 248 | #define GetColor() _color.Val |
||
| 249 | |||
| 250 | /********************************************************************* |
||
| 251 | * Macros: SetActivePage(page) |
||
| 252 | * |
||
| 253 | * PreCondition: none |
||
| 254 | * |
||
| 255 | * Input: graphic page number |
||
| 256 | * |
||
| 257 | * Output: none |
||
| 258 | * |
||
| 259 | * Side Effects: none |
||
| 260 | * |
||
| 261 | * Overview: sets active graphic page |
||
| 262 | * |
||
| 263 | * Note: the controller has only page |
||
| 264 | * |
||
| 265 | ********************************************************************/ |
||
| 266 | #define SetActivePage(page) |
||
| 267 | |||
| 268 | /********************************************************************* |
||
| 269 | * Macros: SetVisualPage(page) |
||
| 270 | * |
||
| 271 | * PreCondition: none |
||
| 272 | * |
||
| 273 | * Input: graphic page number |
||
| 274 | * |
||
| 275 | * Output: none |
||
| 276 | * |
||
| 277 | * Side Effects: none |
||
| 278 | * |
||
| 279 | * Overview: sets graphic page to display |
||
| 280 | * |
||
| 281 | * Note: the controller has only page |
||
| 282 | * |
||
| 283 | ********************************************************************/ |
||
| 284 | #define SetVisualPage(page) |
||
| 285 | |||
| 286 | /********************************************************************* |
||
| 287 | * Function: void PutPixel(SHORT x, SHORT y) |
||
| 288 | * |
||
| 289 | * PreCondition: none |
||
| 290 | * |
||
| 291 | * Input: x,y - pixel coordinates |
||
| 292 | * |
||
| 293 | * Output: none |
||
| 294 | * |
||
| 295 | * Side Effects: none |
||
| 296 | * |
||
| 297 | * Overview: puts pixel |
||
| 298 | * |
||
| 299 | * Note: none |
||
| 300 | * |
||
| 301 | ********************************************************************/ |
||
| 302 | void PutPixel(SHORT x, SHORT y); |
||
| 303 | |||
| 304 | /********************************************************************* |
||
| 305 | * Macros: GetPixel(x, y) |
||
| 306 | * |
||
| 307 | * PreCondition: none |
||
| 308 | * |
||
| 309 | * Input: x,y - pixel coordinates |
||
| 310 | * |
||
| 311 | * Output: pixel color |
||
| 312 | * |
||
| 313 | * Side Effects: none |
||
| 314 | * |
||
| 315 | * Overview: returns pixel color at x,y position |
||
| 316 | * |
||
| 317 | * Note: this glass doesn't support reading |
||
| 318 | * |
||
| 319 | ********************************************************************/ |
||
| 320 | #define GetPixel(x, y) 0 |
||
| 321 | |||
| 322 | /********************************************************************* |
||
| 323 | * Macros: SetClipRgn(left, top, right, bottom) |
||
| 324 | * |
||
| 325 | * PreCondition: none |
||
| 326 | * |
||
| 327 | * Input: left,top,right,bottom - clipping region borders |
||
| 328 | * |
||
| 329 | * Output: none |
||
| 330 | * |
||
| 331 | * Side Effects: none |
||
| 332 | * |
||
| 333 | * Overview: sets clipping region |
||
| 334 | * |
||
| 335 | * Note: none |
||
| 336 | * |
||
| 337 | ********************************************************************/ |
||
| 338 | #define SetClipRgn(left, top, right, bottom) \ |
||
| 339 | _clipLeft = left; \ |
||
| 340 | _clipTop = top; \ |
||
| 341 | _clipRight = right; \ |
||
| 342 | _clipBottom = bottom; |
||
| 343 | |||
| 344 | /********************************************************************* |
||
| 345 | * Macros: GetClipLeft() |
||
| 346 | * |
||
| 347 | * PreCondition: none |
||
| 348 | * |
||
| 349 | * Input: none |
||
| 350 | * |
||
| 351 | * Output: left clipping border |
||
| 352 | * |
||
| 353 | * Side Effects: none |
||
| 354 | * |
||
| 355 | * Overview: returns left clipping border |
||
| 356 | * |
||
| 357 | * Note: none |
||
| 358 | * |
||
| 359 | ********************************************************************/ |
||
| 360 | #define GetClipLeft() _clipLeft |
||
| 361 | |||
| 362 | /********************************************************************* |
||
| 363 | * Macros: GetClipRight() |
||
| 364 | * |
||
| 365 | * PreCondition: none |
||
| 366 | * |
||
| 367 | * Input: none |
||
| 368 | * |
||
| 369 | * Output: right clipping border |
||
| 370 | * |
||
| 371 | * Side Effects: none |
||
| 372 | * |
||
| 373 | * Overview: returns right clipping border |
||
| 374 | * |
||
| 375 | * Note: none |
||
| 376 | * |
||
| 377 | ********************************************************************/ |
||
| 378 | #define GetClipRight() _clipRight |
||
| 379 | |||
| 380 | /********************************************************************* |
||
| 381 | * Macros: GetClipTop() |
||
| 382 | * |
||
| 383 | * PreCondition: none |
||
| 384 | * |
||
| 385 | * Input: none |
||
| 386 | * |
||
| 387 | * Output: top clipping border |
||
| 388 | * |
||
| 389 | * Side Effects: none |
||
| 390 | * |
||
| 391 | * Overview: returns top clipping border |
||
| 392 | * |
||
| 393 | * Note: none |
||
| 394 | * |
||
| 395 | ********************************************************************/ |
||
| 396 | #define GetClipTop() _clipTop |
||
| 397 | |||
| 398 | /********************************************************************* |
||
| 399 | * Macros: GetClipBottom() |
||
| 400 | * |
||
| 401 | * PreCondition: none |
||
| 402 | * |
||
| 403 | * Input: none |
||
| 404 | * |
||
| 405 | * Output: bottom clipping border |
||
| 406 | * |
||
| 407 | * Side Effects: none |
||
| 408 | * |
||
| 409 | * Overview: returns bottom clipping border |
||
| 410 | * |
||
| 411 | * Note: none |
||
| 412 | * |
||
| 413 | ********************************************************************/ |
||
| 414 | #define GetClipBottom() _clipBottom |
||
| 415 | |||
| 416 | /********************************************************************* |
||
| 417 | * Macros: SetClip(control) |
||
| 418 | * |
||
| 419 | * PreCondition: none |
||
| 420 | * |
||
| 421 | * Input: control - 0 disable/ 1 enable |
||
| 422 | * |
||
| 423 | * Output: none |
||
| 424 | * |
||
| 425 | * Side Effects: none |
||
| 426 | * |
||
| 427 | * Overview: enables/disables clipping |
||
| 428 | * |
||
| 429 | * Note: none |
||
| 430 | * |
||
| 431 | ********************************************************************/ |
||
| 432 | #define SetClip(control) _clipRgn = control; |
||
| 433 | |||
| 434 | /********************************************************************* |
||
| 435 | * Macros: IsDeviceBusy() |
||
| 436 | * |
||
| 437 | * PreCondition: none |
||
| 438 | * |
||
| 439 | * Input: none |
||
| 440 | * |
||
| 441 | * Output: busy status |
||
| 442 | * |
||
| 443 | * Side Effects: none |
||
| 444 | * |
||
| 445 | * Overview: returns non-zero if LCD controller is busy |
||
| 446 | * (previous drawing operation is not complete). |
||
| 447 | * |
||
| 448 | * |
||
| 449 | ********************************************************************/ |
||
| 450 | #define IsDeviceBusy() (WAIT_PORT_BIT == 0) |
||
| 451 | |||
| 452 | /********************************************************************* |
||
| 453 | * Macros: SetPalette(colorNum, color) |
||
| 454 | * |
||
| 455 | * PreCondition: none |
||
| 456 | * |
||
| 457 | * Input: colorNum - register number, color - color |
||
| 458 | * |
||
| 459 | * Output: none |
||
| 460 | * |
||
| 461 | * Side Effects: none |
||
| 462 | * |
||
| 463 | * Overview: sets palette register |
||
| 464 | * |
||
| 465 | * Note: S6D0129 has no palette |
||
| 466 | * |
||
| 467 | ********************************************************************/ |
||
| 468 | #define SetPalette(colorNum, color) |
||
| 469 | |||
| 470 | #endif // HIT1270L.h |
Powered by WebSVN v2.8.3