| Line No. | Rev | Author | Line |
|---|---|---|---|
| 1 | 32 | kaklik | /***************************************************************************** |
| 2 | * Module for Microchip Graphics Library |
||
| 3 | * Solomon Systech. SSD1906 LCD controllers driver. |
||
| 4 | ***************************************************************************** |
||
| 5 | * FileName: SSD1906.h |
||
| 6 | * Dependencies: p24Fxxxx.h or plib.h |
||
| 7 | * Processor: PIC24, PIC32 |
||
| 8 | * Compiler: MPLAB C30, MPLAB C32 |
||
| 9 | * Linker: MPLAB LINK30, MPLAB LINK32 |
||
| 10 | * Company: Microchip Technology Incorporated |
||
| 11 | * |
||
| 12 | * Software License Agreement |
||
| 13 | * |
||
| 14 | * Copyright © 2008 Microchip Technology Inc. All rights reserved. |
||
| 15 | * Microchip licenses to you the right to use, modify, copy and distribute |
||
| 16 | * Software only when embedded on a Microchip microcontroller or digital |
||
| 17 | * signal controller, which is integrated into your product or third party |
||
| 18 | * product (pursuant to the sublicense terms in the accompanying license |
||
| 19 | * agreement). |
||
| 20 | * |
||
| 21 | * You should refer to the license agreement accompanying this Software |
||
| 22 | * for additional information regarding your rights and obligations. |
||
| 23 | * |
||
| 24 | * SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY |
||
| 25 | * KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY |
||
| 26 | * OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR |
||
| 27 | * PURPOSE. IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR |
||
| 28 | * OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, |
||
| 29 | * BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT |
||
| 30 | * DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, |
||
| 31 | * INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, |
||
| 32 | * COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY |
||
| 33 | * CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), |
||
| 34 | * OR OTHER SIMILAR COSTS. |
||
| 35 | * |
||
| 36 | * Author Date Comment |
||
| 37 | *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
||
| 38 | * Anton Alkhimenok 01/29/08 |
||
| 39 | * Anton Alkhimenok 01/31/08 combined portrait and landscape, PIC32 support |
||
| 40 | * Anton Alkhimenok 08/22/08 driver configuration is simplified, |
||
| 41 | * new image rotation modes |
||
| 42 | *****************************************************************************/ |
||
| 43 | #ifndef _SSD1906_H |
||
| 44 | #define _SSD1906_H |
||
| 45 | |||
| 46 | #ifdef __PIC32MX |
||
| 47 | #include <plib.h> |
||
| 48 | #define PMDIN1 PMDIN |
||
| 49 | #else |
||
| 50 | #ifdef __PIC24F__ |
||
| 51 | #include <p24Fxxxx.h> |
||
| 52 | #else |
||
| 53 | #error CONTROLLER IS NOT SUPPORTED |
||
| 54 | #endif |
||
| 55 | #endif |
||
| 56 | #include "GraphicsConfig.h" |
||
| 57 | #include "GenericTypeDefs.h" |
||
| 58 | |||
| 59 | /********************************************************************* |
||
| 60 | * Overview: Additional hardware-accelerated functions can be implemented |
||
| 61 | * in the driver. These definitions exclude the PutPixel()-based |
||
| 62 | * functions in the primitives layer (Primitive.c file) from compilation. |
||
| 63 | *********************************************************************/ |
||
| 64 | |||
| 65 | // Define this to implement Font related functions in the driver. |
||
| 66 | //#define USE_DRV_FONT |
||
| 67 | // Define this to implement Line function in the driver. |
||
| 68 | //#define USE_DRV_LINE |
||
| 69 | // Define this to implement Circle function in the driver. |
||
| 70 | //#define USE_DRV_CIRCLE |
||
| 71 | // Define this to implement FillCircle function in the driver. |
||
| 72 | //#define USE_DRV_FILLCIRCLE |
||
| 73 | // Define this to implement Bar function in the driver. |
||
| 74 | #define USE_DRV_BAR |
||
| 75 | |||
| 76 | // Define this to implement ClearDevice function in the driver. |
||
| 77 | #define USE_DRV_CLEARDEVICE |
||
| 78 | |||
| 79 | // Define this to implement PutImage function in the driver. |
||
| 80 | #define USE_DRV_PUTIMAGE |
||
| 81 | |||
| 82 | #ifdef USE_16BIT_PMP |
||
| 83 | #error This driver doesn't support 16-bit PMP (remove USE_16BIT_PMP option from GraphicsConfig.h) |
||
| 84 | #endif |
||
| 85 | |||
| 86 | #ifndef DISP_HOR_RESOLUTION |
||
| 87 | #error DISP_HOR_RESOLUTION must be defined in HardwareProfile.h |
||
| 88 | #endif |
||
| 89 | #ifndef DISP_VER_RESOLUTION |
||
| 90 | #error DISP_VER_RESOLUTION must be defined in HardwareProfile.h |
||
| 91 | #endif |
||
| 92 | #ifndef COLOR_DEPTH |
||
| 93 | #error COLOR_DEPTH must be defined in HardwareProfile.h |
||
| 94 | #endif |
||
| 95 | #ifndef DISP_ORIENTATION |
||
| 96 | #error DISP_ORIENTATION must be defined in HardwareProfile.h |
||
| 97 | #endif |
||
| 98 | |||
| 99 | /********************************************************************* |
||
| 100 | * Overview: Horizontal synchronization timing in pixels |
||
| 101 | * (from the glass datasheet). |
||
| 102 | *********************************************************************/ |
||
| 103 | |||
| 104 | #ifndef DISP_HOR_PULSE_WIDTH |
||
| 105 | #error DISP_HOR_PULSE_WIDTH must be defined in HardwareProfile.h |
||
| 106 | #endif |
||
| 107 | #ifndef DISP_HOR_BACK_PORCH |
||
| 108 | #error DISP_HOR_BACK_PORCH must be defined in HardwareProfile.h |
||
| 109 | #endif |
||
| 110 | #ifndef DISP_HOR_FRONT_PORCH |
||
| 111 | #error DISP_HOR_FRONT_PORCH must be defined in HardwareProfile.h |
||
| 112 | #endif |
||
| 113 | |||
| 114 | /********************************************************************* |
||
| 115 | * Overview: Vertical synchronization timing in lines |
||
| 116 | * (from the glass datasheet). |
||
| 117 | *********************************************************************/ |
||
| 118 | #ifndef DISP_VER_PULSE_WIDTH |
||
| 119 | #error DISP_VER_PULSE_WIDTH must be defined in HardwareProfile.h |
||
| 120 | #endif |
||
| 121 | #ifndef DISP_VER_BACK_PORCH |
||
| 122 | #error DISP_VER_BACK_PORCH must be defined in HardwareProfile.h |
||
| 123 | #endif |
||
| 124 | #ifndef DISP_VER_FRONT_PORCH |
||
| 125 | #error DISP_VER_FRONT_PORCH must be defined in HardwareProfile.h |
||
| 126 | #endif |
||
| 127 | |||
| 128 | /********************************************************************* |
||
| 129 | * PARAMETERS VALIDATION |
||
| 130 | *********************************************************************/ |
||
| 131 | #if COLOR_DEPTH != 16 |
||
| 132 | #error This driver supports 16 BPP only. |
||
| 133 | #endif |
||
| 134 | #if (DISP_HOR_RESOLUTION % 8) != 0 |
||
| 135 | #error Horizontal resolution must be divisible by 8. |
||
| 136 | #endif |
||
| 137 | #if ((DISP_HOR_PULSE_WIDTH + DISP_HOR_BACK_PORCH + DISP_HOR_FRONT_PORCH) % 8) != 0 |
||
| 138 | #error The sum of horizontal synchronization pulse width, front and back porches must be divisible by 8. |
||
| 139 | #endif |
||
| 140 | #if (DISP_ORIENTATION != 0) && (DISP_ORIENTATION != 180) && (DISP_ORIENTATION != 90) && (DISP_ORIENTATION != 270) |
||
| 141 | #error The display orientation selected is not supported. It can be only 0,90,180 or 270. |
||
| 142 | #endif |
||
| 143 | |||
| 144 | /********************************************************************* |
||
| 145 | * Overview: Clipping region control codes to be used with SetClip(...) |
||
| 146 | * function. |
||
| 147 | *********************************************************************/ |
||
| 148 | #define CLIP_DISABLE 0 // Disables clipping. |
||
| 149 | #define CLIP_ENABLE 1 // Enables clipping. |
||
| 150 | |||
| 151 | /********************************************************************* |
||
| 152 | * Overview: Some basic colors definitions. |
||
| 153 | *********************************************************************/ |
||
| 154 | #define BLACK RGB565CONVERT(0, 0, 0) |
||
| 155 | #define BRIGHTBLUE RGB565CONVERT(0, 0, 255) |
||
| 156 | #define BRIGHTGREEN RGB565CONVERT(0, 255, 0) |
||
| 157 | #define BRIGHTCYAN RGB565CONVERT(0, 255, 255) |
||
| 158 | #define BRIGHTRED RGB565CONVERT(255, 0, 0) |
||
| 159 | #define BRIGHTMAGENTA RGB565CONVERT(255, 0, 255) |
||
| 160 | #define BRIGHTYELLOW RGB565CONVERT(255, 255, 0) |
||
| 161 | #define BLUE RGB565CONVERT(0, 0, 128) |
||
| 162 | #define GREEN RGB565CONVERT(0, 128, 0) |
||
| 163 | #define CYAN RGB565CONVERT(0, 128, 128) |
||
| 164 | #define RED RGB565CONVERT(128, 0, 0) |
||
| 165 | #define MAGENTA RGB565CONVERT(128, 0, 128) |
||
| 166 | #define BROWN RGB565CONVERT(255, 128, 0) |
||
| 167 | #define LIGHTGRAY RGB565CONVERT(128, 128, 128) |
||
| 168 | #define DARKGRAY RGB565CONVERT(64, 64, 64) |
||
| 169 | #define LIGHTBLUE RGB565CONVERT(128, 128, 255) |
||
| 170 | #define LIGHTGREEN RGB565CONVERT(128, 255, 128) |
||
| 171 | #define LIGHTCYAN RGB565CONVERT(128, 255, 255) |
||
| 172 | #define LIGHTRED RGB565CONVERT(255, 128, 128) |
||
| 173 | #define LIGHTMAGENTA RGB565CONVERT(255, 128, 255) |
||
| 174 | #define YELLOW RGB565CONVERT(255, 255, 128) |
||
| 175 | #define WHITE RGB565CONVERT(255, 255, 255) |
||
| 176 | #define GRAY0 RGB565CONVERT(224, 224, 224) |
||
| 177 | #define GRAY1 RGB565CONVERT(192, 192, 192) |
||
| 178 | #define GRAY2 RGB565CONVERT(160, 160, 160) |
||
| 179 | #define GRAY3 RGB565CONVERT(128, 128, 128) |
||
| 180 | #define GRAY4 RGB565CONVERT(96, 96, 96) |
||
| 181 | #define GRAY5 RGB565CONVERT(64, 64, 64) |
||
| 182 | #define GRAY6 RGB565CONVERT(32, 32, 32) |
||
| 183 | |||
| 184 | // SSD1906 registers names definitions |
||
| 185 | #define REG_DISP_BUFFER_SIZE 0x01 |
||
| 186 | #define REG_CONFIG_READBACK 0x02 |
||
| 187 | #define REG_REVISION_CODE 0x03 |
||
| 188 | #define REG_MEMCLK_CONFIG 0x04 |
||
| 189 | #define REG_PCLK_CONFIG 0x05 |
||
| 190 | #define REG_LUT_BLUE_WRITE_DATA 0x08 |
||
| 191 | #define REG_LUT_GREEN_WRITE_DATA 0x09 |
||
| 192 | #define REG_LUT_RED_WRITE_DATA 0x0a |
||
| 193 | #define REG_LUT_WRITE_ADDR 0x0b |
||
| 194 | #define REG_LUT_BLUE_READ_DATA 0x0c |
||
| 195 | #define REG_LUT_GREEN_READ_DATA 0x0d |
||
| 196 | #define REG_LUT_RED_READ_DATA 0x0e |
||
| 197 | #define REG_LUT_READ_ADDR 0x0f |
||
| 198 | #define REG_PANEL_TYPE 0x10 |
||
| 199 | #define REG_MOD_RATE 0x11 |
||
| 200 | #define REG_HORIZ_TOTAL 0x12 |
||
| 201 | #define REG_HDP 0x14 |
||
| 202 | #define REG_HDP_START_POS0 0x16 |
||
| 203 | #define REG_HDP_START_POS1 0x17 |
||
| 204 | #define REG_VERT_TOTAL0 0x18 |
||
| 205 | #define REG_VERT_TOTAL1 0x19 |
||
| 206 | #define REG_VDP0 0x1c |
||
| 207 | #define REG_VDP1 0x1d |
||
| 208 | #define REG_VDP_START_POS0 0x1e |
||
| 209 | #define REG_VDP_START_POS1 0x1f |
||
| 210 | #define REG_HSYNC_PULSE_WIDTH 0x20 |
||
| 211 | #define REG_HSYNC_PULSE_START_POS0 0x22 |
||
| 212 | #define REG_HSYNC_PULSE_START_POS1 0x23 |
||
| 213 | #define REG_VSYNC_PULSE_WIDTH 0x24 |
||
| 214 | #define REG_VSYNC_PULSE_START_POS0 0x26 |
||
| 215 | #define REG_VSYNC_PULSE_START_POS1 0x27 |
||
| 216 | |||
| 217 | #define REG_FPFRAME_START_OFFSET0 0x30 |
||
| 218 | #define REG_FPFRAME_START_OFFSET1 0x31 |
||
| 219 | #define REG_FPFRAME_STOP_OFFSET0 0x34 |
||
| 220 | #define REG_FPFRAME_STOP_OFFSET1 0x35 |
||
| 221 | #define REG_HRTFT_SPECIAL_OUTPUT 0x38 |
||
| 222 | #define REG_GPIO1_PULSE_START 0x3c |
||
| 223 | #define REG_GPIO1_PULSE_STOP 0x3e |
||
| 224 | #define REG_GPIO2_PULSE_DELAY 0x40 |
||
| 225 | #define REG_STN_COLOR_DEPTH 0x45 |
||
| 226 | #define REG_DYN_DITHER_CONTROL 0x50 |
||
| 227 | |||
| 228 | #define REG_DISPLAY_MODE 0x70 |
||
| 229 | #define REG_SPECIAL_EFFECTS 0x71 |
||
| 230 | #define REG_MAIN_WIN_DISP_START_ADDR0 0x74 |
||
| 231 | #define REG_MAIN_WIN_DISP_START_ADDR1 0x75 |
||
| 232 | #define REG_MAIN_WIN_DISP_START_ADDR2 0x76 |
||
| 233 | #define REG_MAIN_WIN_ADDR_OFFSET0 0x78 |
||
| 234 | #define REG_MAIN_WIN_ADDR_OFFSET1 0x79 |
||
| 235 | #define REG_FLOAT_WIN_DISP_START_ADDR0 0x7c |
||
| 236 | #define REG_FLOAT_WIN_DISP_START_ADDR1 0x7d |
||
| 237 | #define REG_FLOAT_WIN_DISP_START_ADDR2 0x7e |
||
| 238 | #define REG_FLOAT_WIN_ADDR_OFFSET0 0x80 |
||
| 239 | #define REG_FLOAT_WIN_ADDR_OFFSET1 0x81 |
||
| 240 | #define REG_FLOAT_WIN_X_START_POS0 0x84 |
||
| 241 | #define REG_FLOAT_WIN_X_START_POS1 0x85 |
||
| 242 | #define REG_FLOAT_WIN_Y_START_POS0 0x88 |
||
| 243 | #define REG_FLOAT_WIN_Y_START_POS1 0x89 |
||
| 244 | #define REG_FLOAT_WIN_X_END_POS0 0x8c |
||
| 245 | #define REG_FLOAT_WIN_X_END_POS1 0x8d |
||
| 246 | #define REG_FLOAT_WIN_Y_END_POS0 0x90 |
||
| 247 | #define REG_FLOAT_WIN_Y_END_POS1 0x91 |
||
| 248 | #define REG_POWER_SAVE_CONFIG 0xa0 |
||
| 249 | #define REG_SOFTWARE_RESET 0xa2 |
||
| 250 | #define REG_SCRATCH_PAD0 0xa4 |
||
| 251 | #define REG_SCRATCH_PAD1 0xa5 |
||
| 252 | #define REG_GPIO_CONFIG0 0xa8 |
||
| 253 | #define REG_GPIO_CONFIG1 0xa9 |
||
| 254 | #define REG_GPIO_STATUS_CONTROL0 0xac |
||
| 255 | #define REG_GPIO_STATUS_CONTROL1 0xad |
||
| 256 | #define REG_PWM_CV_CLOCK_CONTROL 0xb0 |
||
| 257 | #define REG_PWM_CV_CLOCK_CONFIG 0xb1 |
||
| 258 | #define REG_CV_CLOCK_BURST_LENGTH 0xb2 |
||
| 259 | #define REG_PWM_CLOCK_DUTY_CYCLE 0xb3 |
||
| 260 | |||
| 261 | #define REG_CURSOR_FEATURE 0xc0 |
||
| 262 | #define REG_CURSOR1_BLINK_TOTAL0 0xc4 |
||
| 263 | #define REG_CURSOR1_BLINK_TOTAL1 0xc5 |
||
| 264 | #define REG_CURSOR1_BLINK_ON0 0xc8 |
||
| 265 | #define REG_CURSOR1_BLINK_ON1 0xc9 |
||
| 266 | #define REG_CURSOR1_MEM_START0 0xcc |
||
| 267 | #define REG_CURSOR1_MEM_START1 0xcd |
||
| 268 | #define REG_CURSOR1_MEM_START2 0xce |
||
| 269 | #define REG_CURSOR1_POSX0 0xd0 |
||
| 270 | #define REG_CURSOR1_POSX1 0xd1 |
||
| 271 | #define REG_CURSOR1_POSY0 0xd4 |
||
| 272 | #define REG_CURSOR1_POSY1 0xd5 |
||
| 273 | #define REG_CURSOR1_HORIZ_SIZE 0xd8 |
||
| 274 | #define REG_CURSOR1_VERT_SIZE 0xdc |
||
| 275 | #define REG_CURSOR1_COL_IND1_0 0xe0 |
||
| 276 | #define REG_CURSOR1_COL_IND1_1 0xe1 |
||
| 277 | #define REG_CURSOR1_COL_IND2_0 0xe4 |
||
| 278 | #define REG_CURSOR1_COL_IND2_1 0xe5 |
||
| 279 | #define REG_CURSOR1_COL_IND3_0 0xe8 |
||
| 280 | #define REG_CURSOR1_COL_IND3_1 0xe9 |
||
| 281 | #define REG_CURSOR2_BLINK_TOTAL0 0xec |
||
| 282 | #define REG_CURSOR2_BLINK_TOTAL1 0xed |
||
| 283 | #define REG_CURSOR2_BLINK_ON0 0xf0 |
||
| 284 | #define REG_CURSOR2_BLINK_ON1 0xf1 |
||
| 285 | #define REG_CURSOR2_MEM_START0 0xf4 |
||
| 286 | #define REG_CURSOR2_MEM_START1 0xf5 |
||
| 287 | #define REG_CURSOR2_MEM_START2 0xf6 |
||
| 288 | #define REG_CURSOR2_POSX0 0xf8 |
||
| 289 | #define REG_CURSOR2_POSX1 0xf9 |
||
| 290 | #define REG_CURSOR2_POSY0 0xfc |
||
| 291 | #define REG_CURSOR2_POSY1 0xfd |
||
| 292 | #define REG_CURSOR2_HORIZ_SIZE 0x100 |
||
| 293 | #define REG_CURSOR2_VERT_SIZE 0x104 |
||
| 294 | #define REG_CURSOR2_COL_IND1_0 0x108 |
||
| 295 | #define REG_CURSOR2_COL_IND1_1 0x109 |
||
| 296 | #define REG_CURSOR2_COL_IND2_0 0x10c |
||
| 297 | #define REG_CURSOR2_COL_IND2_1 0x10d |
||
| 298 | #define REG_CURSOR2_COL_IND3_0 0x110 |
||
| 299 | #define REG_CURSOR2_COL_IND3_1 0x111 |
||
| 300 | |||
| 301 | // Color |
||
| 302 | extern WORD _color; |
||
| 303 | |||
| 304 | /********************************************************************* |
||
| 305 | * Overview: Clipping region control and border settings. |
||
| 306 | * |
||
| 307 | *********************************************************************/ |
||
| 308 | |||
| 309 | // Clipping region enable control |
||
| 310 | extern SHORT _clipRgn; |
||
| 311 | |||
| 312 | // Left clipping region border |
||
| 313 | extern SHORT _clipLeft; |
||
| 314 | |||
| 315 | // Top clipping region border |
||
| 316 | extern SHORT _clipTop; |
||
| 317 | |||
| 318 | // Right clipping region border |
||
| 319 | extern SHORT _clipRight; |
||
| 320 | |||
| 321 | // Bottom clipping region border |
||
| 322 | extern SHORT _clipBottom; |
||
| 323 | |||
| 324 | /********************************************************************* |
||
| 325 | * Macros: PMPWaitBusy() |
||
| 326 | * |
||
| 327 | * Overview: Delays execution for PMP cycle time. |
||
| 328 | * |
||
| 329 | * PreCondition: none |
||
| 330 | * |
||
| 331 | * Input: none |
||
| 332 | * |
||
| 333 | * Output: none |
||
| 334 | * |
||
| 335 | * Side Effects: none |
||
| 336 | * |
||
| 337 | ********************************************************************/ |
||
| 338 | #define PMPWaitBusy() while(PMMODEbits.BUSY); |
||
| 339 | |||
| 340 | /********************************************************************* |
||
| 341 | * Macros or function: WriteData(data) |
||
| 342 | * |
||
| 343 | * PreCondition: none |
||
| 344 | * |
||
| 345 | * Input: data - 16 bit value to be written to RAM |
||
| 346 | * |
||
| 347 | * Output: none |
||
| 348 | * |
||
| 349 | * Side Effects: none |
||
| 350 | * |
||
| 351 | * Overview: writes data into controller's RAM |
||
| 352 | * |
||
| 353 | * Note: none |
||
| 354 | * |
||
| 355 | ********************************************************************/ |
||
| 356 | #ifdef __PIC32MX |
||
| 357 | void WriteData(WORD value); |
||
| 358 | |||
| 359 | #else |
||
| 360 | #define WriteData(data) \ |
||
| 361 | RS_LAT_BIT = 1; \ |
||
| 362 | PMDIN1 = data; \ |
||
| 363 | PMPWaitBusy(); \ |
||
| 364 | if(PMADDR == 0) \ |
||
| 365 | if(A17_LAT_BIT) \ |
||
| 366 | A17_LAT_BIT = 0; \ |
||
| 367 | else \ |
||
| 368 | A17_LAT_BIT = 1; |
||
| 369 | #endif |
||
| 370 | |||
| 371 | /********************************************************************* |
||
| 372 | * Function: void ResetDevice() |
||
| 373 | * |
||
| 374 | * Overview: Initializes LCD module. |
||
| 375 | * |
||
| 376 | * PreCondition: none |
||
| 377 | * |
||
| 378 | * Input: none |
||
| 379 | * |
||
| 380 | * Output: none |
||
| 381 | * |
||
| 382 | * Side Effects: none |
||
| 383 | * |
||
| 384 | ********************************************************************/ |
||
| 385 | void ResetDevice(void); |
||
| 386 | |||
| 387 | /********************************************************************* |
||
| 388 | * Macros: GetMaxX() |
||
| 389 | * |
||
| 390 | * Overview: Returns maximum horizontal coordinate. |
||
| 391 | * |
||
| 392 | * PreCondition: none |
||
| 393 | * |
||
| 394 | * Input: none |
||
| 395 | * |
||
| 396 | * Output: Maximum horizontal coordinate. |
||
| 397 | * |
||
| 398 | * Side Effects: none |
||
| 399 | * |
||
| 400 | ********************************************************************/ |
||
| 401 | #if (DISP_ORIENTATION == 90) || (DISP_ORIENTATION == 270) |
||
| 402 | #define GetMaxX() (DISP_VER_RESOLUTION - 1) |
||
| 403 | #elif (DISP_ORIENTATION == 0) || (DISP_ORIENTATION == 180) |
||
| 404 | #define GetMaxX() (DISP_HOR_RESOLUTION - 1) |
||
| 405 | #endif |
||
| 406 | |||
| 407 | /********************************************************************* |
||
| 408 | * Macros: GetMaxY() |
||
| 409 | * |
||
| 410 | * Overview: Returns maximum vertical coordinate. |
||
| 411 | * |
||
| 412 | * PreCondition: none |
||
| 413 | * |
||
| 414 | * Input: none |
||
| 415 | * |
||
| 416 | * Output: Maximum vertical coordinate. |
||
| 417 | * |
||
| 418 | * Side Effects: none |
||
| 419 | * |
||
| 420 | ********************************************************************/ |
||
| 421 | #if (DISP_ORIENTATION == 90) || (DISP_ORIENTATION == 270) |
||
| 422 | #define GetMaxY() (DISP_HOR_RESOLUTION - 1) |
||
| 423 | #elif (DISP_ORIENTATION == 0) || (DISP_ORIENTATION == 180) |
||
| 424 | #define GetMaxY() (DISP_VER_RESOLUTION - 1) |
||
| 425 | #endif |
||
| 426 | |||
| 427 | /********************************************************************* |
||
| 428 | * Macros: SetColor(color) |
||
| 429 | * |
||
| 430 | * Overview: Sets current drawing color. |
||
| 431 | * |
||
| 432 | * PreCondition: none |
||
| 433 | * |
||
| 434 | * Input: color - Color coded in 5:6:5 RGB format. |
||
| 435 | * |
||
| 436 | * Output: none |
||
| 437 | * |
||
| 438 | * Side Effects: none |
||
| 439 | * |
||
| 440 | ********************************************************************/ |
||
| 441 | #define SetColor(color) _color = color |
||
| 442 | |||
| 443 | /********************************************************************* |
||
| 444 | * Macros: GetColor() |
||
| 445 | * |
||
| 446 | * Overview: Returns current drawing color. |
||
| 447 | * |
||
| 448 | * PreCondition: none |
||
| 449 | * |
||
| 450 | * Input: none |
||
| 451 | * |
||
| 452 | * Output: Color coded in 5:6:5 RGB format. |
||
| 453 | * |
||
| 454 | * Side Effects: none |
||
| 455 | * |
||
| 456 | ********************************************************************/ |
||
| 457 | #define GetColor() _color |
||
| 458 | |||
| 459 | /********************************************************************* |
||
| 460 | * Macros: SetActivePage(page) |
||
| 461 | * |
||
| 462 | * Overview: Sets active graphic page. |
||
| 463 | * |
||
| 464 | * PreCondition: none |
||
| 465 | * |
||
| 466 | * Input: page - Graphic page number. |
||
| 467 | * |
||
| 468 | * Output: none |
||
| 469 | * |
||
| 470 | * Side Effects: none |
||
| 471 | * |
||
| 472 | ********************************************************************/ |
||
| 473 | #define SetActivePage(page) |
||
| 474 | |||
| 475 | /********************************************************************* |
||
| 476 | * Macros: SetVisualPage(page) |
||
| 477 | * |
||
| 478 | * Overview: Sets graphic page to display. |
||
| 479 | * |
||
| 480 | * PreCondition: none |
||
| 481 | * |
||
| 482 | * Input: page - Graphic page number |
||
| 483 | * |
||
| 484 | * Output: none |
||
| 485 | * |
||
| 486 | * Side Effects: none |
||
| 487 | * |
||
| 488 | ********************************************************************/ |
||
| 489 | #define SetVisualPage(page) |
||
| 490 | |||
| 491 | /********************************************************************* |
||
| 492 | * Function: void PutPixel(SHORT x, SHORT y) |
||
| 493 | * |
||
| 494 | * Overview: Puts pixel with the given x,y coordinate position. |
||
| 495 | * |
||
| 496 | * PreCondition: none |
||
| 497 | * |
||
| 498 | * Input: x - x position of the pixel. |
||
| 499 | * y - y position of the pixel. |
||
| 500 | * |
||
| 501 | * Output: none |
||
| 502 | * |
||
| 503 | * Side Effects: none |
||
| 504 | * |
||
| 505 | ********************************************************************/ |
||
| 506 | void PutPixel(SHORT x, SHORT y); |
||
| 507 | |||
| 508 | /********************************************************************* |
||
| 509 | * Function: WORD GetPixel(SHORT x, SHORT y) |
||
| 510 | * |
||
| 511 | * Overview: Returns pixel color at the given x,y coordinate position. |
||
| 512 | * |
||
| 513 | * PreCondition: none |
||
| 514 | * |
||
| 515 | * Input: x - x position of the pixel. |
||
| 516 | * y - y position of the pixel. |
||
| 517 | * |
||
| 518 | * Output: pixel color |
||
| 519 | * |
||
| 520 | * Side Effects: none |
||
| 521 | * |
||
| 522 | ********************************************************************/ |
||
| 523 | WORD GetPixel(SHORT x, SHORT y); |
||
| 524 | |||
| 525 | /********************************************************************* |
||
| 526 | * Macros: SetClipRgn(left, top, right, bottom) |
||
| 527 | * |
||
| 528 | * Overview: Sets clipping region. |
||
| 529 | * |
||
| 530 | * PreCondition: none |
||
| 531 | * |
||
| 532 | * Input: left - Defines the left clipping region border. |
||
| 533 | * top - Defines the top clipping region border. |
||
| 534 | * right - Defines the right clipping region border. |
||
| 535 | * bottom - Defines the bottom clipping region border. |
||
| 536 | * |
||
| 537 | * Output: none |
||
| 538 | * |
||
| 539 | * Side Effects: none |
||
| 540 | * |
||
| 541 | ********************************************************************/ |
||
| 542 | #define SetClipRgn(left, top, right, bottom) \ |
||
| 543 | _clipLeft = left; \ |
||
| 544 | _clipTop = top; \ |
||
| 545 | _clipRight = right; \ |
||
| 546 | _clipBottom = bottom; |
||
| 547 | |||
| 548 | /********************************************************************* |
||
| 549 | * Macros: GetClipLeft() |
||
| 550 | * |
||
| 551 | * Overview: Returns left clipping border. |
||
| 552 | * |
||
| 553 | * PreCondition: none |
||
| 554 | * |
||
| 555 | * Input: none |
||
| 556 | * |
||
| 557 | * Output: Left clipping border. |
||
| 558 | * |
||
| 559 | * Side Effects: none |
||
| 560 | * |
||
| 561 | ********************************************************************/ |
||
| 562 | #define GetClipLeft() _clipLeft |
||
| 563 | |||
| 564 | /********************************************************************* |
||
| 565 | * Macros: GetClipRight() |
||
| 566 | * |
||
| 567 | * Overview: Returns right clipping border. |
||
| 568 | * |
||
| 569 | * PreCondition: none |
||
| 570 | * |
||
| 571 | * Input: none |
||
| 572 | * |
||
| 573 | * Output: Right clipping border. |
||
| 574 | * |
||
| 575 | * Side Effects: none |
||
| 576 | * |
||
| 577 | ********************************************************************/ |
||
| 578 | #define GetClipRight() _clipRight |
||
| 579 | |||
| 580 | /********************************************************************* |
||
| 581 | * Macros: GetClipTop() |
||
| 582 | * |
||
| 583 | * Overview: Returns top clipping border. |
||
| 584 | * |
||
| 585 | * PreCondition: none |
||
| 586 | * |
||
| 587 | * Input: none |
||
| 588 | * |
||
| 589 | * Output: Top clipping border. |
||
| 590 | * |
||
| 591 | * Side Effects: none |
||
| 592 | * |
||
| 593 | ********************************************************************/ |
||
| 594 | #define GetClipTop() _clipTop |
||
| 595 | |||
| 596 | /********************************************************************* |
||
| 597 | * Macros: GetClipBottom() |
||
| 598 | * |
||
| 599 | * Overview: Returns bottom clipping border. |
||
| 600 | * |
||
| 601 | * PreCondition: none |
||
| 602 | * |
||
| 603 | * Input: none |
||
| 604 | * |
||
| 605 | * Output: Bottom clipping border. |
||
| 606 | * |
||
| 607 | * Side Effects: none |
||
| 608 | * |
||
| 609 | ********************************************************************/ |
||
| 610 | #define GetClipBottom() _clipBottom |
||
| 611 | |||
| 612 | /********************************************************************* |
||
| 613 | * Macros: SetClip(control) |
||
| 614 | * |
||
| 615 | * Overview: Enables/disables clipping. |
||
| 616 | * |
||
| 617 | * PreCondition: none |
||
| 618 | * |
||
| 619 | * Input: control - Enables or disables the clipping. |
||
| 620 | * - 0: Disable clipping |
||
| 621 | * - 1: Enable clipping |
||
| 622 | * |
||
| 623 | * Output: none |
||
| 624 | * |
||
| 625 | * Side Effects: none |
||
| 626 | * |
||
| 627 | ********************************************************************/ |
||
| 628 | #define SetClip(control) _clipRgn = control; |
||
| 629 | |||
| 630 | /********************************************************************* |
||
| 631 | * Macros: IsDeviceBusy() |
||
| 632 | * |
||
| 633 | * Overview: Returns non-zero if LCD controller is busy |
||
| 634 | * (previous drawing operation is not completed). |
||
| 635 | * |
||
| 636 | * PreCondition: none |
||
| 637 | * |
||
| 638 | * Input: none |
||
| 639 | * |
||
| 640 | * Output: Busy status. |
||
| 641 | * |
||
| 642 | * Side Effects: none |
||
| 643 | * |
||
| 644 | ********************************************************************/ |
||
| 645 | #define IsDeviceBusy() 0 |
||
| 646 | |||
| 647 | /********************************************************************* |
||
| 648 | * Macros: SetPalette(colorNum, color) |
||
| 649 | * |
||
| 650 | * Overview: Sets palette register. |
||
| 651 | * |
||
| 652 | * PreCondition: none |
||
| 653 | * |
||
| 654 | * Input: colorNum - Register number. |
||
| 655 | * color - Color. |
||
| 656 | * |
||
| 657 | * Output: none |
||
| 658 | * |
||
| 659 | * Side Effects: none |
||
| 660 | * |
||
| 661 | ********************************************************************/ |
||
| 662 | #define SetPalette(colorNum, color) |
||
| 663 | |||
| 664 | |||
| 665 | #endif // _SSD1906_H |
Powered by WebSVN v2.8.3