📄 main.c
字号:
//====================================================================================
// The information contained herein is the exclusive property of
// Sunnorth Technology Co. And shall not be distributed, reproduced,
// or disclosed in whole in part without prior written permission.
// (C) COPYRIGHT 2003 SUNNORTH TECHNOLOGY CO.
// ALL RIGHTS RESERVED
// The entire notice above must be reproduced on all authorized copies.
//====================================================================================
//======================================================================
// 工程名称: TFT Demo
// 功能描述: TFT输出Demo范例(配合SPCE3200试验箱使用,与其它试验设备连接请修改相应接口)
// IDE环境: SUNPLUS S+core IDE 2.2.0(or later)
// 涉及的库: 无
// 组成文件: main.c,
//
// .\TFT\ BitMap.c BitMap.h BLNDMA.c BLNDMA.h JPEG.c JPEG.h
// MPEG4_Driver.c MPEG4_Driver.h TFT_API.c TFT_API.h TFT_Config.h
// TFT_Driver.c TFT_Driver.h TFT_Font.c TFT_Font.h
// TFT_ImgControl.c TFT_ImgControl.h TypeDef.h
//
// .\IRQ\ Sys_IRQ.c Sys_isr.s User_IRQ.c
// SPCE3200_Register.h,SPCE3200_Constant.h
// 硬件连接: J13的LIGHT与3.3V短接,其他默认连接
// 维护记录: 2007-11-13 V1.0 by liuxue
//======================================================================
//=============================================================
// 文件名称: main.c
// 功能描述: 主函数
// 维护记录: 2007-11-13 V1.0
//=============================================================
//====================================================
// 包含头文件区
//====================================================
#include "SPCE3200_Register.h"
#include "SPCE3200_Constant.h"
#include "./TFT/TFT_API.h"
#include "Resource.h"
//====================================================
// 语法格式:int main(void)
// 功能描述: 调用简易GUI完成图形绘制
// 入口参数: 无
// 出口参数: 无
//====================================================
int main(void)
{
WIN_HANDLE DemoWindow1;
WIN_HANDLE DemoWindow2;
TFT_Init(); // 驱动程序初始化
// 使用2种方式创建工作窗口
DemoWindow1 = TFT_CreateWindow( 20, // 左上角坐标
20,
400, // 右下角坐标
300,
COLOR_RED); // 背景颜色
DemoWindow2 = TFT_CreateWindowEx( 300, // 左上角坐标
200,
340, // 宽度、高度
280,
COLOR_BLUE); // 背景颜色
TFT_SetColor(DemoWindow1, COLOR_YELLOW); // 设置工作窗口1颜色
TFT_PutPixel(DemoWindow1, 20, 20); // 在工作窗口1中画点
TFT_PutPixelAbsolute(DemoWindow1, 20, 20); // 在显示缓冲区中画点
TFT_Line(DemoWindow1, 30, 30, 50, 50); // 在工作窗口1中画线
TFT_Circle(DemoWindow1, 100, 100, 30, PAINT_SOLID); // 在工作窗口1中画圆
TFT_SetTransparency(DemoWindow1, 20); // 设置工作窗口1的透明色
TFT_Circle(DemoWindow1, 200, 100, 30, PAINT_SOLID); // 在工作窗口1中画圆
TFT_SetColor(DemoWindow1, COLOR_CYAN); // 设置工作窗口1颜色
TFT_Rectangle( DemoWindow1, // 窗体指针
100, // 左上角坐标
100,
500, // 右下角坐标
400,
PAINT_SOLID); // PAINT_HOLLOW: 空心
// PAINT_SOLID : 实心
TFT_SetTransparency(DemoWindow1, 0); // 显示字符串
TFT_SetColor(DemoWindow1, COLOR_BLACK);
TFT_SetTextPos(DemoWindow1, 30, 240);
TFT_PutString(DemoWindow1, "TFT Demo程序示例");
TFT_PutPicture(DemoWindow2, 0, 0, RES_CAT_BMP, IMAGE_NO_SCALE); // 显示图片
TFT_PutPicture(DemoWindow2, 0, 0, RES_CAT_BMP, IMAGE_SCALE);
while(1);
return 0;
}
//====================================================
// main.c End
//====================================================
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -