新手上路
- 积分
- 39
- 金钱
- 39
- 注册时间
- 2014-12-12
- 在线时间
- 0 小时
|

楼主 |
发表于 2014-12-28 18:16:18
|
显示全部楼层
为简单的显示和可以触屏进行控制,我只移植了blcd.c, ctiic.c, gt811.c ,
#include "sys.h"
#include "usart.h"
#include "delay.h"
#include "lcd.h"
#include "ctiic.h"
#include "gt811.h"
#include "led.h"
void gui_draw_hline(u16 x0,u16 y0,u16 len,u16 color)
{
if(len==0)return;
LCD_Fill(x0,y0,x0+len-1,y0,color);
}
void gui_fill_circle(u16 x0,u16 y0,u16 r,u16 color)
{
u32 i;
u32 imax = ((u32)r*707)/1000+1;
u32 sqmax = (u32)r*(u32)r+(u32)r/2;
u32 x=r;
gui_draw_hline(x0-r,y0,2*r,color);
for (i=1;i<=imax;i++)
{
if ((i*i+x*x)>sqmax)// draw lines from outside
{
if (x>imax)
{
gui_draw_hline (x0-i+1,y0+x,2*(i-1),color);
gui_draw_hline (x0-i+1,y0-x,2*(i-1),color);
}
x--;
}
// draw lines from inside (center)
gui_draw_hline(x0-x,y0+i,2*x,color);
gui_draw_hline(x0-x,y0-i,2*x,color);
}
}
int main(void)
{
u8 t=0;
u8 a=0;
Stm32_Clock_Init(9); //?????±???è??
uart_init(72,9600); //?®??????????9600
delay_init(72); //???±??????
LCD_Init();
LED_init();
POINT_COLOR=BLUE;
//ctp_dev.init();
// LCD_DrawRectangle(300, 350, 400, 450);
while(ctp_dev.init()) //初始化
{
LCD_ShowString(60,50,200,16,16,"WarShip STM32");
delay_ms(200);
LCD_ShowString(60,70,200,16,16,"TOUCH TEST");
delay_ms(200);
};
while(1)
{
LCD_DrawRectangle(300, 350, 400, 450);
ctp_dev.scan();
if(ctp_dev.tpsta&0X1F) //触屏
{
if(ctp_dev.x[t]>300&&ctp_dev.x[t]<400&&ctp_dev.y[t]>350&&ctp_dev.y[t]<450)
{
LED0=0;
/*a++;
if(a==1)
{
LCD_ShowxNum(112,210,0,1,16,0);
LCD_ShowxNum(120,210,1,1,16,0);
}
if(a==2)
{
LCD_ShowxNum(112,210,0,1,16,0);
LCD_ShowxNum(120,210,2,1,16,0);
}
if(a==3)
{
LCD_ShowxNum(112,210,0,1,16,0);
LCD_ShowxNum(120,210,3,1,16,0);
}*/
}
}
}
}
结果是这样的
|
|