⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 kpad.c

📁 cirrus的ep7312的各个测试程序
💻 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 + -