📄 main.c
字号:
/*****************************************************************************
* $Workfile: main.c $
* $Revision: 1.0 $
* $Author: WellsK $
* $Date: Sep 22 2002 11:00:00 $
*
* Project: Picture demo with SWIM
*
* Description:
* Shows a series of images on the display when a pushbutton is
* pressed.
*
* Revision History:
* $Log: //smaicnt2/pvcs/VM/CDROM/archives/KEV7A400/Software/Examples/pictures/main.c-arc $
*
* Rev 1.0 Sep 22 2002 11:00:00 WellsK
* Initial revision.
*
*
* COPYRIGHT (C) 2001 SHARP MICROELECTRONICS OF THE AMERICAS, INC.
* CAMAS, WA
****************************************************************************/
#include "SMA_colors.h"
#include "SMA_types.h"
#include "SMA_swim.h"
#include "SMA_swim_image.h"
#include "SMA_lcd_driver.h"
#include "KEV7A400_LQ039Q2DS53.h"
#include "LH7A400_cp15_driver.h"
#include "LH7A400_EVB_CPLD_driver.h"
#include "tower1.h"
#include "bird1.h"
#include "bluest1.h"
#include "bridge1.h"
#include "buildn1.h"
#include "buildn2.h"
#include "buildn3.h"
#include "cliff1.h"
#include "frame1.h"
#include "palms1.h"
#include "park1.h"
#include "plane1.h"
#include "sisters31.h"
// Physical and logical addresses of frame buffer
#define FBPHY (color_type *) 0xDD000000
#define FBLOG (color_type *) 0x03C00000
#define MAX_IMAGES 13
typedef const color_type *color_type_ptr;
const color_type_ptr image_list [MAX_IMAGES] = {
tower1, bird1, bluest1, bridge1, buildn1, buildn2, buildn3,
cliff1, frame1, palms1, park1, plane1, sisters31};
void wait_for_press (void)
{
volatile UNS_8 pb;
INT_32 i;
// Wait for depress first
pb = LH7A400_pld_get_pb ();
while (pb == 0)
{
// This small loop prevents the bus from getting hammered
for (i = 0; i < 1000; i++);
pb = LH7A400_pld_get_pb ();
}
// Now, wait for a press state
while (pb != 0)
{
// This small loop prevents the bus from getting hammered
for (i = 0; i < 1000; i++);
pb = LH7A400_pld_get_pb ();
}
}
int main (void)
{
INT_32 maxx, maxy;
INT_32 win;
INT_32 image_index = 0;
// Init LCD driver for '53 display
lcd_initialize (&KEV7A400_LQ039Q2DS53, FBPHY);
// Get horiz and vert size of display from driver
maxx = (INT_32) lcd_get_xsize ();
maxy = (INT_32) lcd_get_ysize ();
// Enable the LCD power and LCD signal buffers
lcd_disable_enable (1);
// Turn on the LCD backlight to full brightness
lcd_set_backlight_intens (lcd_get_max_intens ());
// Setup SWIM window
win = swim_window_open (maxx, maxy, FBLOG, 0, 0, (maxx - 1),
(maxy - 1), 1, WHITE, BLACK, WHITE, 1);
while (1)
{
// Show first image
swim_put_scale_image (win, image_list [image_index], 320, 240);
image_index++;
if (image_index >= MAX_IMAGES)
{
image_index = 0;
}
wait_for_press ();
}
return 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -