?? kpad.c
字號:
//*********************************************************************************
//
// keypad.c uses the user buttons on the keypad
//
//*********************************************************************************
#include "lib7312.h"
#include <stdio.h>
//*********************************************************************************
//
// This program will print a message on the color LCD indicating a user button
// on the keypad is pressed.
//
//*********************************************************************************
void entry()
{
unsigned long ulButton;
CPixel sColor;
unsigned long ulYLocation = 10;
//
// Enable the LCD controller.
//
LCDColorEnable();
LCDColorCls();
LCDColorOn();
LCDColorBacklightOn();
LCDColorContrastEnable();
//
// Set the pixel color to red
//
sColor.r = 15;
sColor.g = 0;
sColor.b = 0;
//
// Tell the user to press a user button
//
LCDColorPrintString("Push a user button on the keypad.", 10, ulYLocation, sColor);
ulYLocation += 10;
LCDColorPrintString("Push user button 6 to exit the demo.", 10, ulYLocation, sColor);
ulYLocation +=20;
while(1)
{
//
// Wait until a user button is pressed and released
//
ulButton = (unsigned long)KPGetUserButton();
KPNoButton();
//
// If button 6 is pressed, we exit this demo.
//
if (ulButton == 5)
{
break;
}
//
// If it's not button 6, then send a message to the LCD indicating which
// button was pressed.
//
switch (ulButton)
{
case 0:
LCDColorPrintString("Button 1 was pushed", 10, ulYLocation, sColor);
ulYLocation += 10;
break;
case 1:
LCDColorPrintString("Button 2 was pushed", 10, ulYLocation, sColor);
ulYLocation += 10;
break;
case 2:
LCDColorPrintString("Button 3 was pushed", 10, ulYLocation, sColor);
ulYLocation += 10;
break;
case 3:
LCDColorPrintString("Button 4 was pushed", 10, ulYLocation, sColor);
ulYLocation += 10;
break;
case 4:
LCDColorPrintString("Button 5 was pushed", 10, ulYLocation, sColor);
ulYLocation += 10;
break;
}
//
// If we're printing near the bottom of the LCD, reset the Y value.
//
if (ulYLocation >= 230)
{
ulYLocation = 40;
}
}
//
// Disable the LCD controller.
//
LCDColorContrastDisable();
LCDColorBacklightOff();
LCDColorOff();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -