test_lcd.c
115 lines
| 2.6 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> | ||||
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); | ||||
} | ||||
|
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); | ||||
} | ||||
} | ||||
} | ||||