📄 irrecv.c
字号:
//****************************************************************************
//
// IRRECV.C - Prints characters received via the IR port on the LCD panel.
//
// Copyright (c) 1998-2001 Cirrus Logic, Inc.
//
//****************************************************************************
#include "lib7312.h"
#include <stdio.h>
//****************************************************************************
//
// This program receives characters from the IR port and displays them on the
// LCD panel. When a '-' character is received, the program exits (but the
// '-' character is not displayed).
//
//****************************************************************************
void
entry(void)
{
int iX = 0, iY = 0;
char cChar;
CPixel sColor;
//
// Enable the LCD controller, clear the frame buffer, and turn on the LCD
// panel.
//
LCDColorEnable();
LCDColorCls();
LCDColorOn();
LCDColorBacklightOn();
LCDColorContrastEnable();
//
// Enable the IR port at 9600 baud.
//
IREnable(9600);
//
// Set the pixel color to white
//
sColor.r = 15;
sColor.g = 15;
sColor.b = 15;
//
// Read characters from the IR port until we receive a '-' character.
//
while((cChar = IRReceiveChar()) != '-')
{
//
// Print the character which we received.
//
LCDColorPrintChar(cChar, iX, iY, sColor);
//
// Advance the cursor to the next column.
//
iX += 8;
//
// If we've just stepped past the right column, then skip down to the
// next line.
//
if(iX == 320)
{
//
// Adjust the cursor to the beginning of the next line.
//
iX = 0;
iY += 8;
//
// If we've just stepped below the last line, then move back to the
// first line.
//
if(iY == 240)
{
//
// Move the cursor to the first line.
//
iY = 0;
}
}
}
//
// Disable the IR port.
//
IRDisable();
//
// Turn off the LCD panel.
//
LCDColorContrastDisable();
LCDColorBacklightOff();
LCDColorOff();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -