main.c

来自「NOKIA6100手机彩色液晶显示屏的控制驱动程序」· C语言 代码 · 共 72 行

C
72
字号
#include <inttypes.h>
#include <stdio.h>

#include "font6x8.h"
#include "font12x16.h"
#include "n6100.h"


int main(void) {
	font smallFont, largeFont;
	volatile uint32_t i;
	
	DDRB = 0xFF;			// PortB = Output
	
	smallFont.width = FONT6X8_WIDTH;
	smallFont.height = FONT6X8_HEIGHT;
	smallFont.charData = Font6x8;
	
	largeFont.width = FONT12X16_WIDTH;
	largeFont.height = FONT12X16_HEIGHT;
	largeFont.charData = Font12x16;
	
	n6100Init();
	fdevopen(n6100DrawChar, NULL, 0);
	
	n6100TestScreen();
	for(i=0; i<300000; i++);
	
	n6100Clear();
	
	n6100SetColor(GREEN);
	n6100FillRect(15,5,40,70);
	
	// ein nikolaus haus
	n6100SetColor(MAGENTA);
	n6100DrawLine(20,100,70,100);	// unten
	n6100DrawLine(20,100,20,70);	// links
	n6100DrawLine(20,70,70,70);		// oben
	n6100DrawLine(70,70,70,100);	// rechts
	n6100DrawLine(20,70,45,40);		// schr鋑e links
	n6100DrawLine(45,40,70,70);		// schr鋑e rechts
	n6100DrawLine(20,100,70,70);
	n6100DrawLine(20,70,70,100);
	
	n6100SetColor(YELLOW);
	n6100DrawCircle(90, 50, 30);
	
	n6100SetColor(CYAN);
	n6100DrawRect(65,65,55,55);
	
	/*n6100SetColor(RED);
	n6100SetFont(smallFont);
	n6100GotoXY(0,1);
	printf("Hallo Welt!");
	
	n6100SetColor(BLUE);
	n6100SetFont(largeFont);
	n6100SetFontOffset(14);
	n6100GotoXY(10,25);
	printf("Hallo\nWelt!");
	
	n6100SetColor(BLACK);
	n6100SetFont(smallFont);
	n6100SetFontOffset(0);
	n6100GotoXY(0,102);
	printf("http://www.apetech.de\n\nme@apetech.de");*/
	
	while(1);
	
	return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?