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

📄 qs_ek-lm3s811.c

📁 最新版IAR FOR ARM(EWARM)5.11中的代码例子
💻 C
📖 第 1 页 / 共 3 页
字号:
//*****************************************************************************
//
// qs_ek-lm3s811.c - The quick start application for the LM3S811 Evaluation
//                   Board.
//
// Copyright (c) 2006-2007 Luminary Micro, Inc.  All rights reserved.
// 
// Software License Agreement
// 
// Luminary Micro, Inc. (LMI) is supplying this software for use solely and
// exclusively on LMI's microcontroller products.
// 
// The software is owned by LMI and/or its suppliers, and is protected under
// applicable copyright laws.  All rights are reserved.  You may not combine
// this software with "viral" open-source software in order to form a larger
// program.  Any use in violation of the foregoing restrictions may subject
// the user to criminal sanctions under applicable laws, as well as to civil
// liability for the breach of the terms and conditions of this license.
// 
// THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
// LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
// 
// This is part of revision 1952 of the Stellaris Peripheral Driver Library.
//
//*****************************************************************************

#include "../../../hw_ints.h"
#include "../../../hw_memmap.h"
#include "../../../hw_types.h"
#include "../../../src/adc.h"
#include "../../../src/debug.h"
#include "../../../src/gpio.h"
#include "../../../src/interrupt.h"
#include "../../../src/sysctl.h"
#include "../../../src/timer.h"
#include "../../../src/uart.h"
#include "../osram96x16x1.h"
#include "game.h"
#include "globals.h"
#include "random.h"
#include "screen_saver.h"

//*****************************************************************************
//
//! \addtogroup ek_lm3s811_list
//! <h1>EK-LM3S811 Quickstart Application (qs_ek-lm3s811)</h1>
//!
//! A game in which a ship is navigated through an endless tunnel.  The
//! potentiometer is used to move the ship up and down, and the user push
//! button is used to fire a missile to destroy obstacles in the tunnel.  Score
//! accumulates for survival and for destroying obstacles.  The game lasts for
//! only one ship; the score is displayed on the virtual UART at 115,200, 8-N-1
//! during game play and will be displayed on the screen at the end of the
//! game.
//!
//! Since the OLED display on the evaluation board has burn-in characteristics
//! similar to a CRT, the application also contains a screen saver.  The screen
//! saver will only become active if two minutes have passed without the user
//! push button being pressed while waiting to start the game (that is, it will
//! never come on during game play).  An implementation of the Game of Life is
//! run with a field of random data as the seed value.
//!
//! After two minutes of running the screen saver, the display will be turned
//! off and the user LED will blink.  Either mode of screen saver (Game of Life
//! or blank display) will be exited by pressing the user push button.  The
//! button will then need to be pressed again to start the game.
//
//*****************************************************************************

//*****************************************************************************
//
// A bitmap for the Luminary Micro logo.  The bitmap is as follows:
//
//     xx...xxxxxxx.........
//     xx...xxxxxxxxx.......
//     xx...xx...xxxxx......
//     xx...xx...xx..xx.....
//     xx...xx...xx..xx.....
//     xx...xx...xx...xx....
//     xx...xx...xx...xx....
//     xx...xx...xx...xx....
//     xx...xx...xx...xx....
//     xx...xx...xx...xx....
//     xx....x...xx...xx....
//     .xx...x...xx...xx....
//     .xx............xx....
//     ..xxx..........xx....
//     ...xxxxxxxxxxxxxx....
//     .....xxxxxxxxxxxx....
//
// Continued...
//
//     xx......xx..xx..xx.....xx..xx..xx...xx...xxxx...xxxxx...xx..xx
//     xx......xx..xx..xxx...xxx..xx..xxx..xx..xxxxxx..xxxxxx..xx..xx
//     xx......xx..xx..xxxx.xxxx..xx..xxxx.xx..xx..xx..xx..xx..xx..xx
//     xx......xx..xx..xx.xxx.xx..xx..xx.xxxx..xxxxxx..xxxxx....xxxx.
//     xx......xx..xx..xx..x..xx..xx..xx..xxx..xxxxxx..xxxxx.....xx..
//     xxxxxx..xxxxxx..xx.....xx..xx..xx...xx..xx..xx..xx..xx....xx..
//     xxxxxx...xxxx...xx.....xx..xx..xx...xx..xx..xx..xx..xx....xx..
//     ..............................................................
//     x.....x..x...xxxx...xxxxx....xxxx.............................
//     xx...xx..x..x....x..x....x..x....x............................
//     x.x.x.x..x..x.......x....x..x....x............................
//     x..x..x..x..x.......xxxxx...x....x............................
//     x.....x..x..x.......x....x..x....x............................
//     x.....x..x..x....x..x....x..x....x............................
//     x.....x..x...xxxx...x....x...xxxx.............................
//     ..............................................................
//
//*****************************************************************************
static const unsigned char g_pucLMILogo[166] =
{
    0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x03, 0x03, 0x03, 0xff, 0xff,
    0x06, 0x06, 0x1c, 0xf8, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x60,
    0x60, 0x60, 0x60, 0x00, 0x00, 0x3f, 0x7f, 0x60, 0x60, 0x7f, 0x3f, 0x00,
    0x00, 0x7f, 0x7f, 0x06, 0x0c, 0x18, 0x0c, 0x06, 0x7f, 0x7f, 0x00, 0x00,
    0x7f, 0x7f, 0x00, 0x00, 0x7f, 0x7f, 0x06, 0x0c, 0x18, 0x7f, 0x7f, 0x00,
    0x00, 0x7e, 0x7f, 0x1b, 0x1b, 0x7f, 0x7e, 0x00, 0x00, 0x7f, 0x7f, 0x1b,
    0x1b, 0x7f, 0x76, 0x00, 0x00, 0x07, 0x0f, 0x78, 0x78, 0x0f, 0x07,
    0x07, 0x1f, 0x38, 0x60, 0x60, 0xc3, 0xcf, 0xc0, 0xc0, 0xc0, 0xcf, 0xcf,
    0xc0, 0xc0, 0xc0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f,
    0x02, 0x04, 0x08, 0x04, 0x02, 0x7f, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x3e,
    0x41, 0x41, 0x41, 0x22, 0x00, 0x00, 0x7f, 0x09, 0x09, 0x09, 0x09, 0x76,
    0x00, 0x00, 0x3e, 0x41, 0x41, 0x41, 0x41, 0x3e, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

//*****************************************************************************
//
// A bitmap for the Keil/ARM logo.  The bitmap is as follows:
//
//     x..xxxxxxxxxxxxxxx...
//     xx..x............x...
//     x.x..x...........x...
//     x..x..x..........x...
//     x...x..x.........x...
//     x....x..x........x...
//     x.....x..x.......x...
//     x......x..x......x...
//     x.....x..x.......x...
//     x....x..x........x...
//     x...x..x.........x...
//     x..x..x..........x...
//     x.x..x...........x...
//     xx..x............x...
//     x..xxxxxxxxxxxxxxx...
//     .....................
//
// Continued...
//
//     xxx.......xxxx....xxxxxxxxxxxxx....xxx....xxx..........
//     xxx.....xxxx......xxxxxxxxxxxxx....xxx....xxx..........
//     xxx...xxxx........xxx..............xxx....xxx..........
//     xxxxxxxx..........xxxxxxxxxxxxx....xxx....xxx..........
//     xxxxxxxx..........xxxxxxxxxxxxx....xxx....xxx..........
//     xxx...xxxx........xxx..............xxx....xxx..........
//     xxx.....xxxx......xxxxxxxxxxxxx....xxx....xxxxxxxxxxxxx
//     xxx.......xxxx....xxxxxxxxxxxxx....xxx....xxxxxxxxxxxxx
//     .......................................................
//     .......................................................
//     .x.........x..xx..x...x....xx..........................
//     x.x.......x.x.x.x.xx.xx...x............................
//     xxx.xx....xxx.xx..x.x.x...x....x..xx.x..xx...xx.xx..x.x
//     x.x.x.x...x.x.x.x.x...x...x...x.x.x.x.x.x.x.x.x.x.x.x.x
//     x.x.x.x...x.x.x.x.x...x....xx..x..x.x.x.xx...xx.x.x..x.
//     ........................................x...........x..
//
//*****************************************************************************
#if defined(rvmdk) || defined(__ARMCC_VERSION)
static const unsigned char g_pucKeilLogo[152] =
{
    0xff, 0x02, 0x04, 0x09, 0x13, 0x25, 0x49, 0x91, 0x21, 0x41, 0x81, 0x01,
    0x01, 0x01, 0x01, 0x01, 0x01, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
    0x18, 0x18, 0x18, 0x3c, 0x3c, 0x66, 0x66, 0xc3, 0xc3, 0x81, 0x81, 0x00,
    0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb,
    0xdb, 0xdb, 0xdb, 0xdb, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00,
    0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
    0xc0, 0xc0, 0xc0, 0xc0,
    0x7f, 0x20, 0x10, 0x48, 0x64, 0x52, 0x49, 0x44, 0x42, 0x41, 0x40, 0x40,
    0x40, 0x40, 0x40, 0x40, 0x40, 0x7f, 0x00, 0x00, 0x00, 0x78, 0x14, 0x78,
    0x00, 0x70, 0x10, 0x60, 0x00, 0x00, 0x00, 0x78, 0x14, 0x78, 0x00, 0x7c,
    0x14, 0x68, 0x00, 0x7c, 0x08, 0x10, 0x08, 0x7c, 0x00, 0x00, 0x00, 0x38,
    0x44, 0x44, 0x00, 0x20, 0x50, 0x20, 0x00, 0x70, 0x10, 0x60, 0x10, 0x60,
    0x00, 0xf0, 0x50, 0x20, 0x00, 0x20, 0x50, 0x70, 0x00, 0x70, 0x10, 0x60,
    0x00, 0xb0, 0x40, 0x30
};
#endif

//*****************************************************************************
//
// A bitmap for the CodeSourcery logo.  The bitmap is as follows:
//
//    .....xxx....xx.........
//    ...xx......x..x........
//    ..x.......x............
//    .x.......x.............
//    .x......x..............
//    x......x...............
//    x.....x....xxx.........
//    x......xxxx...x........
//    x.............x........
//    .x...........x.........
//    .x..........x..........
//    ..x........x...........
//    ...xx.....x............
//    .....x...x.............
//    ........x..............
//    ........x..............
//
// Continued...
//
//    ............................................................
//    ...x..................x.....................................
//    ..x..................x......................................
//    .x..................x.......................................
//    .x....xx..xx...xxxx.x.....xx..x..x.xxx.....x.xxxx.xxx..x...x
//    x....x..x.x.x..x.....x...x..x.x..x.x..x...x..x....x..x.x...x
//    x....x..x.x..x.x.....x...x..x.x..x.x..x..x...x....x..x..x.x.
//    x....x..x.x..x.xxx...x...x..x.x..x.x..x..x...xxx..x..x...x..
//    x....x..x.x..x.x......x..x..x.x..x.xxx..x....x....xxx....x..
//    x....x..x.x..x.x......x..x..x.x..x.x..x.x....x....x..x...x..
//    x....x..x.x..x.x.......x.x..x.x..x.x..x.x....x....x..x...x..
//    x....x..x.x..x.x.......x.x..x.x..x.x..x.x....x....x..x...x..
//    .x...x..x.x.x..x.......x.x..x.x..x.x..x..x...x....x..x...x..
//    ..xx..xx..xx...xxxx...x...xx...xx..x..x...xx.xxxx.x..x...x..
//    ....................xx......................................
//    ............................................................
//
//*****************************************************************************
#if defined(gcc) || defined(sourcerygxx)
static const unsigned char g_pucCodeSourceryLogo[166] =
{
    0xe0, 0x18, 0x04, 0x02, 0x02, 0x01, 0x41, 0xa1, 0x90, 0x88, 0x84, 0x42,
    0x41, 0x41, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0,
    0x18, 0x04, 0x02, 0x00, 0xe0, 0x10, 0x10, 0xe0, 0x00, 0xf0, 0x10, 0x20,
    0xc0, 0x00, 0xf0, 0x90, 0x90, 0x10, 0x00, 0x18, 0xe4, 0x02, 0x00, 0x00,
    0xe0, 0x10, 0x10, 0xe0, 0x00, 0xf0, 0x00, 0x00, 0xf0, 0x00, 0xf0, 0x10,
    0x10, 0xe0, 0x00, 0x00, 0xc0, 0x20, 0x10, 0x00, 0xf0, 0x90, 0x90, 0x10,
    0x00, 0xf0, 0x10, 0x10, 0xe0, 0x00, 0x30, 0x40, 0x80, 0x40, 0x30,
    0x01, 0x06, 0x08, 0x10, 0x10, 0x20, 0x00, 0x00, 0xc0, 0x20, 0x10, 0x08,
    0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f,
    0x10, 0x20, 0x20, 0x00, 0x1f, 0x20, 0x20, 0x1f, 0x00, 0x3f, 0x20, 0x10,
    0x0f, 0x00, 0x3f, 0x20, 0x20, 0x20, 0x00, 0x40, 0x40, 0x23, 0x1c, 0x00,
    0x1f, 0x20, 0x20, 0x1f, 0x00, 0x1f, 0x20, 0x20, 0x1f, 0x00, 0x3f, 0x01,
    0x01, 0x3e, 0x00, 0x0f, 0x10, 0x20, 0x20, 0x00, 0x3f, 0x20, 0x20, 0x20,
    0x00, 0x3f, 0x01, 0x01, 0x3e, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00
};
#endif

//*****************************************************************************
//
// A bitmap for the IAR logo.  The bitmap is as follows:
//
//     .......xxx................................
//     .....xxxxxxx..............................
//     ..x.xxxxxxxxx.x...........................
//     .xx.xxxxxxxxx.xx...xx....xxx....xxxxxx....
//     .xx...........xx...xx....xxx....xx...xx...
//     xxx.xxxxxxxxx.xxx..xx...xx.xx...xx...xx...
//     xxx.xxxxxxxxx.xxx..xx...xx.xx...xx...xx...
//     xxx...........xxx..xx...xx.xx...xx...xx...
//     xxx.xxxxxxxxx.xxx..xx..xx...xx..xxxxxx....
//     xxx...........xxx..xx..xx...xx..xx..xx....
//     xxx..xxxxxxx..xxx..xx..xxxxxxx..xx...xx...
//     .xxx.........xxx...xx.xx.....xx.xx...xx...
//     .xxxxx.....xxxxx...xx.xx.....xx.xx....xx..
//     ..xxxxxxxxxxxxx...........................
//     ....xxxxxxxxx.............................
//     ......xxxxx...............................
//
// Continued...
//
//     ..................................................
//     ..................................................
//     ..................................................
//     .xxxxx............................................
//     xx...xx................x..........................
//     xx....................xx..........................
//     xxx.....xx...xx.xxxx.xxxx..xxxx..xx.xxx.xx...xxxx.
//     .xxxx...xx...xxxx..xx.xx..xx..xx.xxx.xxx.xx.xx..xx
//     ..xxxx...xx.xx.xxx....xx..xx..xx.xx..xx..xx.xxx...
//     ....xxx..xx.xx..xxxx..xx..xxxxxx.xx..xx..xx..xxxx.
//     .....xx..xx.xx....xxx.xx..xx.....xx..xx..xx....xxx
//     xx...xx...xxx..xx..xx.xx..xx..xx.xx..xx..xx.xx..xx
//     .xxxxx....xxx...xxxx...xx..xxxx..xx..xx..xx..xxxx.
//     ..........xxx.....................................
//     ..........xx......................................
//     .........xx.......................................
//
//*****************************************************************************
#if defined(ewarm)
static const unsigned char g_pucIarLogo[184] = {
    0xe0, 0xf8, 0xfc, 0x00, 0x6c, 0x6e, 0x6e, 0x6f, 0x6f, 0x6f, 0x6e, 0x6e,
    0x6c, 0x00, 0xfc, 0xf8, 0xe0, 0x00, 0x00, 0xf8, 0xf8, 0x00, 0x00, 0x00,
    0xe0, 0xf8, 0x18, 0xf8, 0xe0, 0x00, 0x00, 0x00, 0xf8, 0xf8, 0x08, 0x08,
    0x08, 0xf8, 0xf0, 0x00, 0x00, 0x00, 0x70, 0xf8, 0xc8, 0x88, 0x88, 0x18,
    0x10, 0x00, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0x80, 0xc0, 0x40,
    0x40, 0xc0, 0x80, 0x40, 0xe0, 0xf0, 0x40, 0x00, 0x80, 0xc0, 0x40, 0x40,
    0xc0, 0x80, 0x00, 0xc0, 0xc0, 0x80, 0x40, 0xc0, 0xc0, 0x80, 0x40, 0xc0,
    0x80, 0x00, 0x80, 0xc0, 0x40, 0x40, 0xc0, 0x80,
    0x07, 0x1f, 0x3f, 0x38, 0x71, 0x75, 0xe5, 0xe5, 0xe5, 0xe5, 0xe5, 0x75,
    0x71, 0x38, 0x3f, 0x1f, 0x07, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x18, 0x1f,
    0x07, 0x04, 0x04, 0x04, 0x07, 0x1f, 0x18, 0x00, 0x1f, 0x1f, 0x01, 0x01,
    0x03, 0x0f, 0x1c, 0x10, 0x00, 0x00, 0x08, 0x18, 0x11, 0x11, 0x13, 0x1f,
    0x0e, 0x00, 0x00, 0x87, 0xff, 0x78, 0x3f, 0x07, 0x00, 0x09, 0x1b, 0x13,
    0x16, 0x1e, 0x0c, 0x00, 0x0f, 0x1f, 0x10, 0x00, 0x0f, 0x1f, 0x12, 0x12,
    0x1b, 0x0b, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x1f,
    0x1f, 0x00, 0x09, 0x1b, 0x13, 0x16, 0x1e, 0x0c
};
#endif

//*****************************************************************************
//
// A bitmap for the design context URL.  The bitmap is as follows:
//
//     ........................................................................
//     ........................................................................
//     ....................................xx.......................xx.........
//     ....................................xx.......................xx.........
//     ....................................xx..................................
//     xx......xx.xx......xx.xx......xx....xx......xx...xx.xxxx.xx..xx.xxxxxx..
//     xx..xx..xx.xx..xx..xx.xx..xx..xx....xx......xx...xx.xxxxxxxx.xx.xxxxxxx.
//     xx..xx..xx.xx..xx..xx.xx..xx..xx....xx......xx...xx.xx.xx.xx.xx.xx...xx.
//     xx..xx..xx.xx..xx..xx.xx..xx..xx....xx......xx...xx.xx.xx.xx.xx.xx...xx.
//     xx..xx..xx.xx..xx..xx.xx..xx..xx....xx......xx...xx.xx.xx.xx.xx.xx...xx.
//     .xxxxxxxx...xxxxxxxx...xxxxxxxx.....xx......xx...xx.xx.xx.xx.xx.xx...xx.
//     .xxxxxxxx...xxxxxxxx...xxxxxxxx..xx.xxxxxxx.xxxxxxx.xx.xx.xx.xx.xx...xx.
//     ..xx..xx.....xx..xx.....xx..xx...xx.xxxxxxx..xxxxx..xx.xx.xx.xx.xx...xx.
//     ........................................................................
//     ........................................................................
//     ........................................................................
//
// Continued...
//
//     ........................................................................
//     ........................................................................
//     ........................xx.......xx.xx..................................
//     ........................xxx.....xxx.xx..................................
//     ........................xxxx...xxxx.....................................
//     .xxxxx..xx.xxx..xx...xx.xx.xx.xx.xx.xx..xxxxx..xx.xxx...xxxxx......xxxxx
//     xxxxxxx.xxxxxxx.xx...xx.xx..xxx..xx.xx.xxxxxxx.xxxxxxx.xxxxxxx....xxxxxx
//     xx...xx.xxx..xx.xx...xx.xx...x...xx.xx.xx......xxx..xx.xx...xx....xx....
//     xx...xx.xx......xx...xx.xx.......xx.xx.xx......xx......xx...xx....xx....
//     xx...xx.xx......xx...xx.xx.......xx.xx.xx......xx......xx...xx....xx....
//     xx...xx.xx......xx...xx.xx.......xx.xx.xx......xx......xx...xx....xx....
//     xxxxxxx.xx......xxxxxxx.xx.......xx.xx.xxxxxxx.xx......xxxxxxx.xx.xxxxxx
//     .xxx.xx.xx.......xxx.xx.xx.......xx.xx..xxxxx..xx.......xxxxx..xx..xxxxx
//     .....................xx.................................................
//     ................xxxxxxx.................................................
//     .................xxxxx..................................................
//

⌨️ 快捷键说明

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