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

📄 cscreen.c

📁 cirrus的ep7312的各个测试程序
💻 C
字号:
//****************************************************************************
//
// CSCREEN.C - Draws on the LCD panel.
//
// Copyright (c) 2001 Cirrus Logic, Inc.
//
//****************************************************************************
#include "lib7312.h"
#include <stdio.h>

//****************************************************************************
//
// This program draws a series of images on the LCD panel, using all 
// available drawing functions from the library, after which the program
// exits.  
//
//****************************************************************************
void
entry(void)
{
    int iPos, iXPos, iYPos;
    CPixel sColor;
    int i;

    //
    // Enable the LCD controller, clear the frame buffer, and turn on the LCD
    // panel.
    //
    LCDColorEnable();
    LCDColorCls();
    LCDColorOn();
    LCDColorBacklightOn();
    LCDColorContrastEnable();
aaa:
    //
    // Set the initial pixel color to red
    //
    sColor.r = 15;
    sColor.g = 0;
    sColor.b = 0;

    // 
    // Fill the display first with red.
    //
    for(iYPos = 0; iYPos < 240; iYPos++)
    {
       for(iXPos = 0; iXPos < 320; iXPos++)
	 {
    	    LCDColorSetPixel(iXPos, iYPos, sColor);
	 }
    }

    //
    // Set the pixel color to green.
    //
    sColor.r = 0;
    sColor.g = 15;
    sColor.b = 0;

    // 
    // Fill the display with green.
    //
    for(iYPos = 0; iYPos < 240; iYPos++)
    {
       for(iXPos = 0; iXPos < 320; iXPos++)
	 {
    	    LCDColorSetPixel(iXPos, iYPos, sColor);
	 }
    }

    //
    // Wait a bit
    //
    for(i = 0; i < 4096; i++)
    {
    }

    //
    // Set the pixel color to blue
    //
    sColor.r = 0;
    sColor.g = 0;
    sColor.b = 15;

    // 
    // Fill the display with blue
    //
    for(iYPos = 0; iYPos < 240; iYPos++)
    {
       for(iXPos = 0; iXPos < 320; iXPos++)
	 {
    	    LCDColorSetPixel(iXPos, iYPos, sColor);
	 }
    }
   
    //
    // Set the pixel color to red
    //
    sColor.r = 15;
    sColor.g = 0;
    sColor.b = 0;

    
    //
    // Draw two horizontal lines across the top and bottom of the screen by
    // individually setting the appropriate pixels.
    //
    for(iPos = 0; iPos < 320; iPos++)
    {
        LCDColorSetPixel(iPos, 0, sColor);
        LCDColorSetPixel(iPos, 239, sColor);
    }
 
    //
    // Draw diagonal lines from the upper-left corner to the lower-right
    // corner, and from the upper-right corner to the lower-left corner.
    //
    LCDColorLine(0, 0, 319, 239, sColor);
    LCDColorLine(0, 239, 319, 0, sColor);

    //
    // Tell the user to press a button to continue.
    //
    LCDColorPrintString("Press a User button to continue...", 10, 10, sColor);

    //
    // Wait until a user button on the keypad is pressed.
    //
    KPGetUserButton();
    KPNoButton();

    //
    // Clear the frame buffer.
    //
    LCDColorCls();

    //
    // Set the pixel color to green
    //
    sColor.r = 0;
    sColor.g = 15;
    sColor.b = 0;

    //
    // Draw a filled circle with a radius of 50 at location (160, 120).
    //
    LCDColorFillCircle(160, 120, 50, sColor);

    //
    // Draw a row of side-by-side circles of radius 4 across the screen.
    //
    for(iPos = 8; iPos < 320; iPos += 8)
    {
        LCDColorCircle(iPos, 100, 4, sColor);
    }

    //
    // Draw two horizontal lines across the top and bottom of the screen by
    // individually setting the appropriate pixels.
    //
    for(iPos = 0; iPos < 240; iPos++)
    {
        LCDColorSetPixel(0, iPos, sColor);
        LCDColorSetPixel(319, iPos, sColor);
    }

    //
    // Set the pixel color to purple?
    //
    sColor.r = 15;
    sColor.g = 0;
    sColor.b = 15;

    //
    // Tell the user to press a button to continue.
    //
    LCDColorPrintString("Hit one of the user buttons", 15, 30, sColor);
    LCDColorPrintString("on the keypad to exit the demo", 15, 45, sColor); 

    //
    // Wait until a user button is pressed, then exit
    //
    KPGetUserButton();
    KPNoButton();
goto aaa;
    //
    // Turn off the LCD panel.
    //
    LCDColorContrastDisable();
    LCDColorBacklightOff();
    LCDColorOff();
}

⌨️ 快捷键说明

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