test_lcd.c
134 lines
| 2.9 KiB
| text/x-c
|
CLexer
r63 | #include <stdio.h> | |||
#include <fat32.h> | ||||
#include <gpio.h> | ||||
#include <uart.h> | ||||
#include <stm32f4xx.h> | ||||
#include <bsp.h> | ||||
#include <core.h> | ||||
#include <VS10XX.h> | ||||
#include <bsp.h> | ||||
#include <spi.h> | ||||
#include <sdcard.h> | ||||
#include <sdcard-spi.h> | ||||
#include <fat32.h> | ||||
#include <ucdirent.h> | ||||
#include <string.h> | ||||
#include <terminal.h> | ||||
#include <ili9328.h> | ||||
r71 | #include <ADS7843.h> | |||
r63 | ||||
r67 | uint16_t buff[50*50]; | |||
r63 | void test_Block_Move(LCD_t* LCD,int x,int y,int w,int h,int color) | |||
{ | ||||
LCD->paintFilRect(LCD,x,y,w,h,0,0,color); | ||||
} | ||||
Jeandet Alexis
|
r66 | |||
void test_small_lines(LCD_t* LCD) | ||||
{ | ||||
int i=0; | ||||
for(i=0;i<LCD->height;i+=2) | ||||
{ | ||||
LCD->paintFilRect(LCD,0,i,LCD->width,1,0,0,0xaa00); | ||||
} | ||||
for(i=1;i<LCD->height;i+=2) | ||||
{ | ||||
LCD->paintFilRect(LCD,0,i,LCD->width,1,0,0,0x5500); | ||||
} | ||||
} | ||||
void test_uniform_rw(LCD_t* LCD) | ||||
{ | ||||
uint16_t buffer[50*50]; | ||||
LCD->paintFilRect(LCD,0,0,LCD->width,LCD->height/2,0,0,0xfaa0); | ||||
delay_100us(10000); | ||||
LCD->paintFilRect(LCD,0,0,LCD->width,LCD->height,0,0,0xfaa0); | ||||
ili9328setFrame(LCD,10,100,50,50); | ||||
while(1) | ||||
{ | ||||
// LCD->interface->readGRAM((void*)buffer,50*50); | ||||
LCD->getPix(LCD,buffer,10,100,50,50); | ||||
LCD->paint(LCD,buffer,10,100,50,50); | ||||
delay_100us(10000); | ||||
//ili9328setFrame(LCD,10,100,50,50); | ||||
//LCD->interface->writeGRAM((void*)buffer,50*50); | ||||
} | ||||
} | ||||
void test_all_colors(LCD_t* LCD) | ||||
{ | ||||
uint16_t color=0; | ||||
char colorch[]=" "; | ||||
while(1) | ||||
{ | ||||
LCD->paintFilRect(LCD,0,0,LCD->width,LCD->height,0,0,color); | ||||
sprintf(colorch,"0x%x",0xFFFF & ((int)color)); | ||||
LCD->paintText(LCD,colorch,10,100,&ComicSansMS_18,color^-1); | ||||
//delay_100us(10); | ||||
color+=1; | ||||
} | ||||
} | ||||
r67 | ||||
void test_address(LCD_t* LCD) | ||||
{ | ||||
LCD->paintFilRect(LCD,0,0,LCD->width,LCD->height,0,0,0xFFFF); | ||||
uint16_t color[1]; | ||||
for(int y=0;y<320;y++) | ||||
{ | ||||
for(int x=0;x<240;x++) | ||||
{ | ||||
color[0]=x*y; | ||||
LCD->paint(LCD,color,x,y,1,1); | ||||
//delay_100us(100); | ||||
} | ||||
} | ||||
LCD->getPix(LCD,buff,50,50,50,50); | ||||
delay_100us(5000); | ||||
for(int i=0;i<50*50;i++) | ||||
{ | ||||
buff[i]=i; | ||||
} | ||||
LCD->paint(LCD,buff,50,50,50,50); | ||||
delay_100us(5000); | ||||
} | ||||
void test_lines(LCD_t* LCD) | ||||
{ | ||||
uint16_t color[2];//=0x0FF0; | ||||
int x=0; | ||||
LCD->paintFilRect(LCD,0,0,LCD->width,LCD->height,0,0,0xFFFF); | ||||
for(int l=0;l<0xFFFF;l++) | ||||
{ | ||||
color[0]=l; | ||||
color[1]=l; | ||||
for(int i=0;i<320;i++) | ||||
{ | ||||
x=i*240/320; | ||||
LCD->paint(LCD,color,x,i,2,1); | ||||
} | ||||
for(int i=0;i<320;i++) | ||||
{ | ||||
x=239-(i*240/320); | ||||
LCD->paint(LCD,color,x,i,2,1); | ||||
} | ||||
} | ||||
} | ||||
r71 | ||||
void test_TC() | ||||
{ | ||||
int x,y; | ||||
char coord[256]=""; | ||||
while(1) | ||||
{ | ||||
ads7843read(&TC0,&x,&y); | ||||
sprintf(coord,"%d;%d",x,y); | ||||
lcd0.paintFilRect(&lcd0,0,0,240,100,0,0,0xF0F0); | ||||
lcd0.paintText(&lcd0,coord,10,50,&ComicSansMS_18,0); | ||||
for(int i =0;i<256;i++)coord[i]=' '; | ||||
delay_100us(100); | ||||
x=0; | ||||
y=0; | ||||
} | ||||
} | ||||