@@ -59,8 +59,8 LCD_t lcd0={ | |||
|
59 | 59 | |
|
60 | 60 | terminal_t terminal0; |
|
61 | 61 | |
|
62 |
volatile |
|
|
63 |
volatile |
|
|
62 | volatile int8_t* lcd0_CMD=(volatile int8_t*)0x60000000; | |
|
63 | volatile int8_t* lcd0_DATA=(volatile int8_t*)0x61FFFFF0; | |
|
64 | 64 | |
|
65 | 65 | float VREF0 =(float)3.3; |
|
66 | 66 | volatile vs10XXDev audioCodec0; |
@@ -175,33 +175,20 int bsp_FSMC_init() | |||
|
175 | 175 | /*-- FSMC Configuration ------------------------------------------------------*/ |
|
176 | 176 | /*----------------------- SRAM Bank 3 ----------------------------------------*/ |
|
177 | 177 | /* FSMC_Bank1_NORSRAM4 configuration */ |
|
178 |
p.FSMC_AddressSetupTime = |
|
|
179 |
p.FSMC_AddressHoldTime = |
|
|
178 | p.FSMC_AddressSetupTime = 3; | |
|
179 | p.FSMC_AddressHoldTime = 3; | |
|
180 | 180 | //ili9328 -> data setup time > 10ns |
|
181 |
p.FSMC_DataSetupTime = |
|
|
181 | p.FSMC_DataSetupTime = 1; | |
|
182 | 182 | if(getCpuFreq()>100*1000*1000) |
|
183 |
p.FSMC_DataSetupTime = |
|
|
184 |
p.FSMC_BusTurnAroundDuration = 0 |
|
|
183 | p.FSMC_DataSetupTime = 2;// 11; | |
|
184 | p.FSMC_BusTurnAroundDuration = 0; | |
|
185 | 185 | p.FSMC_CLKDivision = 0; |
|
186 |
p.FSMC_DataLatency = 0 |
|
|
186 | p.FSMC_DataLatency = 0; | |
|
187 | 187 | //ili9328 -> data hold time > 15ns |
|
188 | 188 | if(getCpuFreq()>66*1000*1000) |
|
189 |
p.FSMC_DataLatency = 0 |
|
|
189 | p.FSMC_DataLatency = 0; | |
|
190 | 190 | p.FSMC_AccessMode = FSMC_AccessMode_A; |
|
191 | 191 | |
|
192 | readtim.FSMC_AddressSetupTime = 0xf; | |
|
193 | readtim.FSMC_AddressHoldTime = 0xf; | |
|
194 | //p.FSMC_DataSetupTime = 9; | |
|
195 | readtim.FSMC_DataSetupTime = 0xf ;// 11; | |
|
196 | if(getCpuFreq()>100*1000*1000) | |
|
197 | readtim.FSMC_DataSetupTime = 0xf;// 11; | |
|
198 | readtim.FSMC_BusTurnAroundDuration = 0xf; | |
|
199 | readtim.FSMC_CLKDivision = 0; | |
|
200 | readtim.FSMC_DataLatency = 0xf; | |
|
201 | if(getCpuFreq()>66*1000*1000) | |
|
202 | readtim.FSMC_DataLatency = 0xf; | |
|
203 | readtim.FSMC_AccessMode = FSMC_AccessMode_A; | |
|
204 | ||
|
205 | 192 | |
|
206 | 193 | FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM1; |
|
207 | 194 | FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable; |
@@ -216,7 +203,7 int bsp_FSMC_init() | |||
|
216 | 203 | FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable; |
|
217 | 204 | FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable; |
|
218 | 205 | FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable; |
|
219 |
FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = & |
|
|
206 | FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p; | |
|
220 | 207 | FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p; |
|
221 | 208 | |
|
222 | 209 | FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure); |
@@ -407,10 +394,6 void bspsdcardselect(char YESNO) | |||
|
407 | 394 | void bsp_lcd0_write_reg(uint32_t reg,uint32_t data) |
|
408 | 395 | { |
|
409 | 396 | uint8_t* pt8 = (uint8_t*)(void*)(®); |
|
410 | *lcd0_CMD=(uint8_t)0; | |
|
411 | *lcd0_CMD=(uint8_t)0; | |
|
412 | *lcd0_CMD=(uint8_t)0; | |
|
413 | *lcd0_CMD=(uint8_t)0; | |
|
414 | 397 | #if __BYTE_ORDER__==__ORDER_BIG_ENDIAN__ |
|
415 | 398 | *lcd0_CMD=pt8[3]; |
|
416 | 399 | *lcd0_CMD=pt8[2]; |
@@ -418,6 +401,7 void bsp_lcd0_write_reg(uint32_t reg,uin | |||
|
418 | 401 | *lcd0_DATA=pt8[3]; |
|
419 | 402 | *lcd0_DATA=pt8[2]; |
|
420 | 403 | #else |
|
404 | ||
|
421 | 405 | *lcd0_CMD=pt8[1]; |
|
422 | 406 | *lcd0_CMD=pt8[0]; |
|
423 | 407 | pt8 = (uint8_t*)(void*)&data; |
@@ -431,10 +415,7 uint32_t bsp_lcd0_read_reg(uint32_t reg) | |||
|
431 | 415 | { |
|
432 | 416 | uint8_t* pt8 = (uint8_t*)(void*)(®); |
|
433 | 417 | uint32_t DATA=0; |
|
434 | *lcd0_CMD=(uint8_t)0; | |
|
435 | *lcd0_CMD=(uint8_t)0; | |
|
436 | *lcd0_CMD=(uint8_t)0; | |
|
437 | *lcd0_CMD=(uint8_t)0; | |
|
418 | ||
|
438 | 419 | #if __BYTE_ORDER__==__ORDER_BIG_ENDIAN__ |
|
439 | 420 | *lcd0_CMD=pt8[3]; |
|
440 | 421 | *lcd0_CMD=pt8[2]; |
@@ -457,10 +438,6 void bsp_lcd0_writeGRAM(void* buffer,uin | |||
|
457 | 438 | { |
|
458 | 439 | uint32_t reg =ILI9328_REGISTER_WRITEDATATOGRAM; |
|
459 | 440 | uint8_t* pt8 = (uint8_t*)(void*)(®); |
|
460 | *lcd0_CMD=(uint8_t)0; | |
|
461 | *lcd0_CMD=(uint8_t)0; | |
|
462 | *lcd0_CMD=(uint8_t)0; | |
|
463 | *lcd0_CMD=(uint8_t)0; | |
|
464 | 441 | #if __BYTE_ORDER__==__ORDER_BIG_ENDIAN__ |
|
465 | 442 | *lcd0_CMD=pt8[3]; |
|
466 | 443 | *lcd0_CMD=pt8[2]; |
@@ -486,13 +463,9 void bsp_lcd0_writeGRAM(void* buffer,uin | |||
|
486 | 463 | |
|
487 | 464 | void bsp_lcd0_readGRAM(void* buffer,uint32_t count) |
|
488 | 465 | { |
|
489 |
|
|
|
490 |
volatile uint8_t* pt8 |
|
|
491 | *lcd0_CMD=(uint8_t)0; | |
|
492 | *lcd0_CMD=(uint8_t)0; | |
|
493 | *lcd0_CMD=(uint8_t)0; | |
|
494 | *lcd0_CMD=(uint8_t)0; | |
|
495 | #if __BYTE_ORDER__==__ORDER_BIG_ENDIAN__ | |
|
466 | //uint32_t reg =ILI9328_REGISTER_WRITEDATATOGRAM; | |
|
467 | volatile uint8_t* pt8 ;// = (uint8_t*)(void*)® | |
|
468 | /* #if __BYTE_ORDER__==__ORDER_BIG_ENDIAN__ | |
|
496 | 469 | *lcd0_CMD=pt8[3]; |
|
497 | 470 | *lcd0_CMD=pt8[2]; |
|
498 | 471 | pt8 = (uint8_t*)(void*)buffer; |
@@ -502,13 +475,17 void bsp_lcd0_readGRAM(void* buffer,uint | |||
|
502 | 475 | pt8[2*i]=*lcd0_DATA; |
|
503 | 476 | } |
|
504 | 477 | #else |
|
478 | *lcd0_CMD=(uint8_t)0; | |
|
479 | *lcd0_CMD=(uint8_t)0; | |
|
480 | *lcd0_CMD=(uint8_t)0; | |
|
481 | *lcd0_CMD=(uint8_t)0; | |
|
505 | 482 | *lcd0_CMD=pt8[1]; |
|
506 | 483 | *lcd0_CMD=pt8[0]; |
|
507 |
|
|
|
484 | pt8 = (uint8_t*)buffer;*/ | |
|
508 | 485 | /* |
|
509 | 486 |
|
|
510 | 487 |
|
|
511 | pt8[0]=*lcd0_DATA; | |
|
488 | /* pt8[0]=*lcd0_DATA; | |
|
512 | 489 | pt8[1]=*lcd0_DATA; |
|
513 | 490 |
|
|
514 | 491 | for(int i=0;i<(int)count;i++) |
@@ -517,10 +494,21 void bsp_lcd0_readGRAM(void* buffer,uint | |||
|
517 | 494 | pt8[2*i]=*lcd0_DATA; |
|
518 | 495 | pt8[(2*i) +1]=*lcd0_DATA; |
|
519 | 496 | pt8[2*i]=*lcd0_DATA; |
|
520 | // pt8[(2*i) +1]=(uint8_t)0; | |
|
521 | // pt8[(2*i)]=(uint8_t)0; | |
|
522 | 497 | } |
|
523 |
|
|
|
498 | #endif*/ | |
|
499 | ||
|
500 | *lcd0_CMD=(uint8_t)0; | |
|
501 | *lcd0_CMD=(uint8_t)0x22; | |
|
502 | pt8 = (uint8_t*)buffer; | |
|
503 | pt8[1]=*lcd0_DATA; | |
|
504 | pt8[0]=*lcd0_DATA; | |
|
505 | for(int i=0;i<(int)count;i++) | |
|
506 | { | |
|
507 | //pt8[(2*i) +1]=0; | |
|
508 | //pt8[2*i]=0; | |
|
509 | pt8[(2*i)+1]= *lcd0_DATA; | |
|
510 | pt8[2*i]= *lcd0_DATA; | |
|
511 | } | |
|
524 | 512 | } |
|
525 | 513 | |
|
526 | 514 | void bsp_GTerm_init() |
@@ -528,7 +516,7 void bsp_GTerm_init() | |||
|
528 | 516 | if(__opnfiles__[1]==NULL) |
|
529 | 517 | { |
|
530 | 518 | streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice)); |
|
531 | terminal_init(&terminal0 ,&lcd0,&ComicSansMS_8,fd1); | |
|
519 | terminal_init(&terminal0 ,&lcd0,&ComicSansMS_18,fd1); | |
|
532 | 520 | __opnfiles__[1] = fd1; |
|
533 | 521 | } |
|
534 | 522 | else |
@@ -348,9 +348,7 void bsp_GTerm_init() | |||
|
348 | 348 | { |
|
349 | 349 | if(__opnfiles__[1]==NULL) |
|
350 | 350 | { |
|
351 | //uart_t* uart1 = (uart_t*)malloc(sizeof(uart_t)); | |
|
352 | 351 | streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice)); |
|
353 | ||
|
354 | 352 | ili9328paintFilRect(&lcd0,0,0,240,320,0x7FFF,5,0); |
|
355 | 353 | terminal_init(&terminal0,&lcd0,&ComicSansMS_8,fd1); |
|
356 | 354 | __opnfiles__[1] = fd1; |
@@ -6,7 +6,7 UCMODEL=stm32f4 | |||
|
6 | 6 | BSP = OPLAYER |
|
7 | 7 | #BSP = STM32F4Discovery-ILI9328-8bits |
|
8 | 8 | |
|
9 |
DEFINES += CPUFREQ= |
|
|
9 | DEFINES += CPUFREQ=100000000 | |
|
10 | 10 | |
|
11 | 11 | |
|
12 | 12 | SOURCES += \ |
@@ -21,6 +21,8 extern streamdevice* __opnfiles__[]; | |||
|
21 | 21 | extern void test_Block_Move(LCD_t* LCD,int x,int y,int w,int h,int color); |
|
22 | 22 | extern void test_all_colors(LCD_t* LCD); |
|
23 | 23 | extern void test_small_lines(LCD_t* LCD); |
|
24 | extern void test_lines(LCD_t* LCD); | |
|
25 | extern void test_address(LCD_t* LCD); | |
|
24 | 26 | void test_uniform_rw(LCD_t* LCD); |
|
25 | 27 | char buffer[512]; |
|
26 | 28 | |
@@ -143,11 +145,25 int main() | |||
|
143 | 145 | int i=0; |
|
144 | 146 | int color=0; |
|
145 | 147 |
|
|
146 | test_small_lines(&lcd0); | |
|
147 | test_uniform_rw(&lcd0); | |
|
148 | // test_small_lines(&lcd0); | |
|
149 | // test_uniform_rw(&lcd0); | |
|
148 | 150 | |
|
149 | 151 | printf("LCD ID REG = 0x%X\n\r",lcd0.interface->readreg(ILI9328_REGISTER_DRIVERCODEREAD)); |
|
150 | while(1); | |
|
152 | printf("LCD ENTRY MODE REG = 0x%X\n\r",lcd0.interface->readreg(ILI9328_REGISTER_ENTRYMODE)); | |
|
153 | uint16_t test[16]; | |
|
154 | for(int i=0;i<16;i++) | |
|
155 | { | |
|
156 | test[i]=0xF00F; | |
|
157 | } | |
|
158 | lcd0.paint(&lcd0,test,10,100,4,4); | |
|
159 | lcd0.getPix(&lcd0,test,10,100,4,4); | |
|
160 | for(int i=0;i<16;i++) | |
|
161 | { | |
|
162 | printf("@%d=0x%X\n",i,test[i]); | |
|
163 | } | |
|
164 | // test_lines(&lcd0); | |
|
165 | ||
|
166 | while(1)test_address(&lcd0); | |
|
151 | 167 | for(i=0;i<240;i++) |
|
152 | 168 | { |
|
153 | 169 | if(i>(240/3)) |
@@ -16,7 +16,7 | |||
|
16 | 16 | #include <terminal.h> |
|
17 | 17 | #include <ili9328.h> |
|
18 | 18 | |
|
19 | ||
|
19 | uint16_t buff[50*50]; | |
|
20 | 20 | void test_Block_Move(LCD_t* LCD,int x,int y,int w,int h,int color) |
|
21 | 21 | { |
|
22 | 22 | LCD->paintFilRect(LCD,x,y,w,h,0,0,color); |
@@ -68,3 +68,48 void test_all_colors(LCD_t* LCD) | |||
|
68 | 68 | color+=1; |
|
69 | 69 | } |
|
70 | 70 | } |
|
71 | ||
|
72 | void test_address(LCD_t* LCD) | |
|
73 | { | |
|
74 | LCD->paintFilRect(LCD,0,0,LCD->width,LCD->height,0,0,0xFFFF); | |
|
75 | uint16_t color[1]; | |
|
76 | for(int y=0;y<320;y++) | |
|
77 | { | |
|
78 | for(int x=0;x<240;x++) | |
|
79 | { | |
|
80 | color[0]=x*y; | |
|
81 | LCD->paint(LCD,color,x,y,1,1); | |
|
82 | //delay_100us(100); | |
|
83 | } | |
|
84 | } | |
|
85 | LCD->getPix(LCD,buff,50,50,50,50); | |
|
86 | delay_100us(5000); | |
|
87 | for(int i=0;i<50*50;i++) | |
|
88 | { | |
|
89 | buff[i]=i; | |
|
90 | } | |
|
91 | LCD->paint(LCD,buff,50,50,50,50); | |
|
92 | delay_100us(5000); | |
|
93 | } | |
|
94 | ||
|
95 | void test_lines(LCD_t* LCD) | |
|
96 | { | |
|
97 | uint16_t color[2];//=0x0FF0; | |
|
98 | int x=0; | |
|
99 | LCD->paintFilRect(LCD,0,0,LCD->width,LCD->height,0,0,0xFFFF); | |
|
100 | for(int l=0;l<0xFFFF;l++) | |
|
101 | { | |
|
102 | color[0]=l; | |
|
103 | color[1]=l; | |
|
104 | for(int i=0;i<320;i++) | |
|
105 | { | |
|
106 | x=i*240/320; | |
|
107 | LCD->paint(LCD,color,x,i,2,1); | |
|
108 | } | |
|
109 | for(int i=0;i<320;i++) | |
|
110 | { | |
|
111 | x=239-(i*240/320); | |
|
112 | LCD->paint(LCD,color,x,i,2,1); | |
|
113 | } | |
|
114 | } | |
|
115 | } |
@@ -26,6 +26,7 | |||
|
26 | 26 | #include <core.h> |
|
27 | 27 | #include <math.h> |
|
28 | 28 | #include <stdint.h> |
|
29 | #include <malloc.h> | |
|
29 | 30 | |
|
30 | 31 | #ifdef __OPTIMIZED_MATH |
|
31 | 32 | #include <optimised_math.h> |
@@ -166,17 +167,21 void ili9328refreshenable(struct LCD_t* | |||
|
166 | 167 | |
|
167 | 168 | void ili9328setFrame(LCD_t* LCD,uint16_t X,uint16_t Y,uint16_t W,uint16_t H) |
|
168 | 169 | { |
|
169 | LCD->interface->writereg(ILI9328_REGISTER_HORIZONTALGRAMADDRESSSET,(uint32_t)X); | |
|
170 | LCD->interface->writereg(ILI9328_REGISTER_VERTICALGRAMADDRESSSET,(uint32_t)Y); | |
|
170 | if((X>239) || (Y>319) || ((X+W)>240) || ((Y+H)>320)) | |
|
171 | { | |
|
172 | while (1); | |
|
173 | } | |
|
171 | 174 | LCD->interface->writereg(ILI9328_REGISTER_HORIZONTALADDRESSSTARTPOSITION,(uint32_t)X); |
|
172 | 175 | LCD->interface->writereg(ILI9328_REGISTER_HORIZONTALADDRESSENDPOSITION,(uint32_t)(W+X-1)); |
|
173 | 176 | LCD->interface->writereg(ILI9328_REGISTER_VERTICALADDRESSSTARTPOSITION,(uint32_t)Y); |
|
174 | 177 | LCD->interface->writereg(ILI9328_REGISTER_VERTICALADDRESSENDPOSITION,(uint32_t)(Y+H-1)); |
|
178 | LCD->interface->writereg(ILI9328_REGISTER_HORIZONTALGRAMADDRESSSET,(uint32_t)X); | |
|
179 | LCD->interface->writereg(ILI9328_REGISTER_VERTICALGRAMADDRESSSET,(uint32_t)Y); | |
|
175 | 180 | } |
|
176 | 181 | |
|
177 | 182 | void ili9328paint(LCD_t* LCD,void* buffer,uint16_t Xpos,uint16_t Ypos,uint16_t Width,uint16_t Height) |
|
178 | 183 | { |
|
179 | if((LCD!=NULL) && (LCD->interface!=NULL) && (LCD->interface->writeGRAM!=NULL) && (LCD->width>(Xpos+Width)) && (LCD->height>(Ypos+Height))) | |
|
184 | if((LCD!=NULL) && (LCD->interface!=NULL) && (LCD->interface->writeGRAM!=NULL) && (LCD->width>=(Xpos+Width)) && (LCD->height>=(Ypos+Height))) | |
|
180 | 185 | { |
|
181 | 186 | ili9328setFrame(LCD,Xpos,Ypos,Width,Height); |
|
182 | 187 | LCD->interface->writeGRAM(buffer,Width*Height); |
@@ -353,7 +358,7 void ili9328paintText(LCD_t* LCD,char* b | |||
|
353 | 358 | { |
|
354 | 359 | ili9328setFrame(LCD,Xpos+(charnum*w),Ypos + linenum -h,w,1); |
|
355 | 360 | LCD->interface->writeGRAM(tmp,w); |
|
356 | ili9328setFrame(LCD,Xpos+(charnum*w),Ypos + linenum + 1-h,w,1); | |
|
361 | //ili9328setFrame(LCD,Xpos+(charnum*w),Ypos + linenum + 1-h,w,1); | |
|
357 | 362 | // LCD->interface->readGRAM(tmp,w); |
|
358 | 363 | ili9328getPix(LCD,tmp,Xpos+(charnum*w),Ypos + linenum + 1-h,w,1); |
|
359 | 364 | pix=0; |
@@ -375,13 +380,61 void ili9328paintText(LCD_t* LCD,char* b | |||
|
375 | 380 | } |
|
376 | 381 | } |
|
377 | 382 | |
|
383 | ||
|
384 | void ili9328paintChar(LCD_t* LCD,char buffer,uint16_t Xpos,uint16_t Ypos,sFONT* font,uint32_t color) | |
|
385 | { | |
|
386 | int w=font->Width,h=font->Height,bpl=font->bytesPerLine,pix=0,tableoffset=0; | |
|
387 | uint16_t tmp[w]; | |
|
388 | uint16_t tmp2[w]; | |
|
389 | uint16_t linenum=0,charnum=0; | |
|
390 | uint8_t line=0; | |
|
391 | if(buffer<32)buffer=32; | |
|
392 | if(buffer>127)buffer=32; | |
|
393 | ili9328setFrame(LCD,Xpos,Ypos-h,w,1); | |
|
394 | // LCD->interface->readGRAM(tmp,w); | |
|
395 | ili9328getPix(LCD,tmp2,Xpos,Ypos-h,w,1); | |
|
396 | for(int i=0;i<w;i++) | |
|
397 | { | |
|
398 | tmp[i]=0; | |
|
399 | } | |
|
400 | for(int i=0;i<(h*w);i++) | |
|
401 | { | |
|
402 | if( ((i%w)==0) ) //read current line to apply text pixmap | |
|
403 | { | |
|
404 | if(linenum++>0) | |
|
405 | { | |
|
406 | ili9328setFrame(LCD,Xpos,Ypos + linenum -h,w,1); | |
|
407 | LCD->interface->writeGRAM(tmp,w); | |
|
408 | //ili9328setFrame(LCD,Xpos+(charnum*w),Ypos + linenum + 1-h,w,1); | |
|
409 | // LCD->interface->readGRAM(tmp,w); | |
|
410 | ili9328getPix(LCD,tmp2,Xpos,Ypos + linenum + 1-h,w,1); | |
|
411 | for(int i=0;i<w;i++) | |
|
412 | { | |
|
413 | tmp[i]=0; | |
|
414 | } | |
|
415 | pix=0; | |
|
416 | } | |
|
417 | } | |
|
418 | if((pix%8) == 0) | |
|
419 | { | |
|
420 | line=font->table[(((buffer)-32)*h*bpl)+tableoffset++]; | |
|
421 | } | |
|
422 | //tmp[pix]=0; | |
|
423 | if((line & (uint8_t)0x01)==(uint8_t)1)tmp[pix]=(uint16_t)color; | |
|
424 | pix++; | |
|
425 | line>>=1; | |
|
426 | } | |
|
427 | ||
|
428 | } | |
|
429 | ||
|
378 | 430 | int ili9328init(struct LCD_t* LCD) |
|
379 | 431 | { |
|
380 | 432 | if((LCD!=NULL) && (LCD->interface!=NULL) && (LCD->interface->writereg!=NULL)) |
|
381 | 433 | { |
|
382 | 434 | LCD->interface->writereg(ILI9328_REGISTER_DRIVEROUTPUTCONTROL1, 0x0100); // Driver Output Control Register (R01h) |
|
383 | 435 | LCD->interface->writereg(ILI9328_REGISTER_LCDDRIVINGCONTROL, 0x0700); // LCD Driving Waveform Control (R02h) |
|
384 |
LCD->interface->writereg(ILI9328_REGISTER_ENTRYMODE, 0x |
|
|
436 | LCD->interface->writereg(ILI9328_REGISTER_ENTRYMODE, 0x0230); // Entry Mode (R03h) | |
|
437 | LCD->interface->writereg(ILI9328_REGISTER_DISPLAYCONTROL1, 0xC000); | |
|
385 | 438 | LCD->interface->writereg(ILI9328_REGISTER_DISPLAYCONTROL2, 0x0302); |
|
386 | 439 | LCD->interface->writereg(ILI9328_REGISTER_DISPLAYCONTROL3, 0x0000); |
|
387 | 440 | LCD->interface->writereg(ILI9328_REGISTER_DISPLAYCONTROL4, 0x0000); // Fmark On |
@@ -450,12 +503,12 void ili9328getPix(struct LCD_t* LCD,uin | |||
|
450 | 503 | #define __set__Address__(_x_,_y_) LCD->interface->writereg(ILI9328_REGISTER_HORIZONTALGRAMADDRESSSET,_x_); \ |
|
451 | 504 | LCD->interface->writereg(ILI9328_REGISTER_VERTICALGRAMADDRESSSET,_y_) |
|
452 | 505 | |
|
453 | uint16_t* castedBuff = (uint16_t*)buffer; | |
|
454 | 506 | int cx=Xpos,cy=Ypos; |
|
507 | ili9328setFrame(LCD,Xpos,Ypos,w,h); | |
|
455 | 508 | for(int i=0;i<(w*h);i++) |
|
456 | 509 | { |
|
457 | 510 | __set__Address__(cx,cy); |
|
458 |
LCD->interface->readGRAM((void*)(& |
|
|
511 | LCD->interface->readGRAM((void*)(&buffer[i]),1); | |
|
459 | 512 | cx+=1; |
|
460 | 513 | if(cx>=(w+Xpos)) |
|
461 | 514 | { |
@@ -154,7 +154,9 int terminal_writenc(terminal_t* termina | |||
|
154 | 154 | if(terminal->column==0)terminal_clearCurentLine(terminal); |
|
155 | 155 | if(buffer[0]!='\r'){ |
|
156 | 156 | // terminal->LCD->paintFilRect(terminal->LCD,CHARXPOS(terminal,charw),CHARYPOS(terminal, charh)-charh,charw,charh,terminal->backgroundColor,0,terminal->backgroundColor); |
|
157 | terminal->LCD->paintText(terminal->LCD,buffer,CHARXPOS(terminal,charw),(CHARYPOS(terminal, charh))-(terminal->verticalSpace/2),terminal->font,terminal->textColor); | |
|
157 | // terminal->LCD->paintText(terminal->LCD,buffer,CHARXPOS(terminal,charw),(CHARYPOS(terminal, charh))-(terminal->verticalSpace/2),terminal->font,terminal->textColor); | |
|
158 | #include <ili9328.h> | |
|
159 | ili9328paintChar(terminal->LCD,buffer[0],CHARXPOS(terminal,charw),(CHARYPOS(terminal, charh))-(terminal->verticalSpace/2),terminal->font,terminal->textColor); | |
|
158 | 160 | terminal_movecursor(terminal,1); |
|
159 | 161 | } |
|
160 | 162 | } |
@@ -37,6 +37,7 extern void ili9328paintFilCirc(LCD_t* L | |||
|
37 | 37 | extern void ili9328paintFilCircMidPoint(LCD_t* LCD,uint16_t Xpos,uint16_t Ypos,uint16_t r,uint32_t contColor,uint16_t contSz,uint32_t fillColor); |
|
38 | 38 | extern void ili9328getPix(struct LCD_t* LCD,uint16_t* buffer,uint16_t Xpos,uint16_t Ypos,uint16_t w,uint16_t h); |
|
39 | 39 | extern void ili9328refreshenable(struct LCD_t* LCD,int enable); |
|
40 | extern void ili9328paintChar(LCD_t* LCD,char buffer,uint16_t Xpos,uint16_t Ypos,sFONT* font,uint32_t color); | |
|
40 | 41 | |
|
41 | 42 | #define ILI9328_REGISTER_DRIVERCODEREAD ((uint32_t) 0x0000 ) |
|
42 | 43 | #define ILI9328_REGISTER_DRIVEROUTPUTCONTROL1 ((uint32_t) 0x0001 ) |
@@ -79,27 +79,33 void SDLCD_writereg(uint32_t reg,uint32_ | |||
|
79 | 79 | { |
|
80 | 80 | switch (reg) { |
|
81 | 81 | case ILI9328_REGISTER_HORIZONTALGRAMADDRESSSET: |
|
82 | if((data>=screen->w) || (data<0))printf("Warning printing out of bounds HORIZONTALGRAMADDRESSSET=%d",data); | |
|
82 | if((data>=screen->w) || (data<0)) | |
|
83 | printf("Warning printing out of bounds HORIZONTALGRAMADDRESSSET=%d",data); | |
|
83 | 84 | SDLCD_Xpos = data; |
|
84 | 85 | break; |
|
85 | 86 | case ILI9328_REGISTER_VERTICALGRAMADDRESSSET: |
|
86 | if((data>=screen->h) || (data<0))printf("Warning printing out of bounds ILI9328_REGISTER_VERTICALGRAMADDRESSSET=%d",data); | |
|
87 | if((data>=screen->h) || (data<0)) | |
|
88 | printf("Warning printing out of bounds ILI9328_REGISTER_VERTICALGRAMADDRESSSET=%d",data); | |
|
87 | 89 | SDLCD_Ypos = data; |
|
88 | 90 | break; |
|
89 | 91 | case ILI9328_REGISTER_HORIZONTALADDRESSSTARTPOSITION: |
|
90 | if((data>=screen->w) || (data<0))printf("Warning printing out of bounds ILI9328_REGISTER_HORIZONTALADDRESSSTARTPOSITION=%d",data); | |
|
92 | if((data>=screen->w) || (data<0)) | |
|
93 | printf("Warning printing out of bounds ILI9328_REGISTER_HORIZONTALADDRESSSTARTPOSITION=%d",data); | |
|
91 | 94 | SDLCD_XWinStrt = data; |
|
92 | 95 | break; |
|
93 | 96 | case ILI9328_REGISTER_HORIZONTALADDRESSENDPOSITION: |
|
94 | if((data>=screen->w) || (data<0))printf("Warning printing out of bounds ILI9328_REGISTER_HORIZONTALADDRESSENDPOSITION=%d",data); | |
|
97 | if((data>=screen->w) || (data<0)) | |
|
98 | printf("Warning printing out of bounds ILI9328_REGISTER_HORIZONTALADDRESSENDPOSITION=%d",data); | |
|
95 | 99 | SDLCD_XWinEnd = data; |
|
96 | 100 | break; |
|
97 | 101 | case ILI9328_REGISTER_VERTICALADDRESSSTARTPOSITION: |
|
98 | if((data>=screen->h) || (data<0))printf("Warning printing out of bounds ILI9328_REGISTER_VERTICALADDRESSSTARTPOSITION=%d",data); | |
|
102 | if((data>=screen->h) || (data<0)) | |
|
103 | printf("Warning printing out of bounds ILI9328_REGISTER_VERTICALADDRESSSTARTPOSITION=%d",data); | |
|
99 | 104 | SDLCD_YWinStrt = data; |
|
100 | 105 | break; |
|
101 | 106 | case ILI9328_REGISTER_VERTICALADDRESSENDPOSITION: |
|
102 | if((data>=screen->h) || (data<0))printf("Warning printing out of bounds ILI9328_REGISTER_VERTICALADDRESSENDPOSITION=%d",data); | |
|
107 | if((data>=screen->h) || (data<0)) | |
|
108 | printf("Warning printing out of bounds ILI9328_REGISTER_VERTICALADDRESSENDPOSITION=%d",data); | |
|
103 | 109 | SDLCD_YWinEnd = data; |
|
104 | 110 | break; |
|
105 | 111 | default: |
General Comments 0
You need to be logged in to leave comments.
Login now