CH552/usr/main.c

119 lines
2.5 KiB
C
Raw Normal View History

2018-10-17 05:37:36 +02:00
#include <stdio.h>
#include <string.h>
#include <intrins.h>
#include "CH554.h"
#include "common.h"
#include "Timer.h"
#include "USB.h"
#include "GPIO.h"
#include "lcd.h"
#include "font.h"
/******************************************************
GND=GND
VCC=3.3V
P00=CLK
P01=MOSI
P02=RES
P03=DC
P04=CS1
BLKΪLCD<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƹܽţ<EFBFBD><EFBFBD>͵<EFBFBD>ƽ<EFBFBD>رձ<EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD>ƽ<EFBFBD>򿪣<EFBFBD>Ĭ<EFBFBD>Ͽ<EFBFBD><EFBFBD>Բ<EFBFBD><EFBFBD>Ӵ򿪱<EFBFBD><EFBFBD><EFBFBD>
////////////////////////<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>LCD<43><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>/////////////////////////////////////
P05=FSO
P06=CS2
******************************************************/
u8 ref=0;//ˢ<><CBA2><EFBFBD><EFBFBD>ʾ
void xianshi()//<2F><>ʾ<EFBFBD><CABE>Ϣ
{
u16 lx,ly;
BACK_COLOR=WHITE;
POINT_COLOR=RED;
showhanzi(10,0,0); //<2F><>
showhanzi(45,0,1); //<2F><>
showhanzi(80,0,2); //԰
LCD_ShowString(10,35,"3.2 TFT SPI 240*320");
LCD_ShowString(10,55,"LCD_W:"); LCD_ShowNum(70,55,LCD_W,3);
LCD_ShowString(110,55,"LCD_H:");LCD_ShowNum(160,55,LCD_H,3);
lx=10;ly=75;
}
void showimage() //<2F><>ʾ40*40ͼƬ
{
int i,j,k;
//LCD_Clear(WHITE); //<2F><><EFBFBD><EFBFBD>
//xianshi(); //<2F><>ʾ<EFBFBD><CABE>Ϣ
for(k=3;k<4;k++)
{
for(j=0;j<3;j++)
{
Address_set(40*j,40*k,40*j+39,40*k+39); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
for(i=0;i<1600;i++)
{
//LCD_WR_DATA8(image[i*2+1]);
//LCD_WR_DATA8(image[i*2]);
}
}
}
ref=0;
}
void main1()
{
//Set_All_GPIO_Quasi_Mode; // Define in Function_define.h
BACK_COLOR=WHITE;
POINT_COLOR=RED;
//Lcd_Init(); //tft<66><74>ʼ<EFBFBD><CABC>
while(1)
{
LCD_CS1=0;
LCD_DC=1;
LCD_REST=0;
delayms (200);
LCD_CS1=1;
LCD_DC=0;
LCD_REST=1;
delayms (200);
//delayms (200);
}
}
void main()
{
//Set_All_GPIO_Quasi_Mode; // Define in Function_define.h
BACK_COLOR=WHITE;
POINT_COLOR=RED;
Lcd_Init(); //tft<66><74>ʼ<EFBFBD><CABC>
LCD_Clear(WHITE); //<2F><><EFBFBD><EFBFBD>
while(1)
{
//Display_Asc_String('6',0,0, "2.4'TFT"); //ASC 16X32<33><32><EFBFBD><EFBFBD>
//Display_Asc_String('1',0,34, "ASCII_5x7");//ASC 5X7<58><37><EFBFBD><EFBFBD>
//Display_Asc_String('2',0,45, "ASCII_7x8"); //ASC 7X8<58><38><EFBFBD><EFBFBD>
//Display_Asc_String('3',0,54, "ASCII_6x12"); //ASC 6X12<31><32><EFBFBD><EFBFBD>
//Display_Asc_String('4',0,70, "ASCII_8x16"); //ASC 8X16<31><36><EFBFBD><EFBFBD>
//Display_Asc_String('5',0,90, "AS12x24");//ASC 12X24<32><34><EFBFBD><EFBFBD>
//Display_Asc_String('6',0,130, "16x32"); //ASC 16X32<33><32><EFBFBD><EFBFBD>
delayms (2000);
LCD_Clear(RED); //<2F><><EFBFBD><EFBFBD>
//Display_GB2312_String('1',0,0, "רҵ<D7A8><D2B5>ʾ<EFBFBD><CABE>");//12x12<31><32><EFBFBD><EFBFBD>
//Display_GB2312_String('2',0,16, "<22>о<EFBFBD>԰<EFBFBD><D4B0><EFBFBD><EFBFBD>");//15x16<31><36><EFBFBD><EFBFBD>
//Display_GB2312_String('3',0,40, "<22>о<EFBFBD>԰<EFBFBD><D4B0><EFBFBD><EFBFBD>"); //24x24<32><34><EFBFBD><EFBFBD>
//Display_GB2312_String('4',16,70, "<22>о<EFBFBD>԰"); //32x32<33><32><EFBFBD><EFBFBD>
//showimage(); //<2F><>ʾ40*40ͼƬ
delayms (2000);
LCD_Clear(BLUE); //<2F><><EFBFBD><EFBFBD>
}
}