stm32 游戏手柄实验

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
LCD_ShowString(60,70,200,16,16,"JOYPAD TEST");
LCD_ShowString(60,90,200,16,16,"ATOM@ALIENTEK");
LCD_ShowString(60,110,200,16,16,"2012/9/12");
LCD_ShowString(60,130,200,16,16,"KEYVAL:");
#include "tpad.h"
#include "oled.h"
#include "lcd.h"
#include "usmart.h"
#include "rtc.h"
#include "wkup.h"
#include "adc.h"
#include "dac.h"
#include "dma.h"
t++;
if(t==20)
{
t=0;
LED0=!LED0;
}
}
}
#include "24cxx.h"
#include "flash.h"
#include "rs485.h"
#include "can.h"
#include "touch.h"
#include "remote.h"
#include "joypad.h"
constu8*JOYPAD_SYMBOL_TBL[8]=
delay_init(72);//延时初始化
LED_Init();//初始化与LED连接的硬件接口
LCD_Init();//初始化LCD
usmart_dev.init(72);//初始化USMART
JOYPAD_Init();//手柄初始化
POINT_COLOR=RED;//设置字体为红色
LCD_ShowString(60,50,200,16,16,"WarShip STM32");
{
if((key&(1<<i))==0)
{
LCD_Fill(60+56,150,60+56+48,150+16,WHITE);//清除之前的显示
LCD_ShowString(60+56,150,200,16,16,(u8*)JOYPAD_SYMBOL_TBL[i]);//显示符号
}
}
}
delay_ms(10);
LCD_ShowString(60,150,200,16,16,"SYMBOL:");
POINT_COLOR=BLUE;//设置字体为红色
while(1)
{wk.baidu.com
key=JOYPAD_Read();
if(key!=0XFF)
{
LCD_ShowNum(116,130,key,3,16);//显示键值
for(i=0;i<8;i++)
{"Right","Left","Down","Up","Start","Select","A","B"};//手柄按键符号定义
intmain(void)
{
u8key;
u8t=0,i=0;
Stm32_Clock_Init(9);//系统时钟设置
uart_init(72,9600);//串口初始化为9600
#include "sys.h"
#include "usart.h"
#include "delay.h"
#include "led.h"
#include "beep.h"
#include "key.h"
#include "exti.h"
#include "wdg.h"
#include "timer.h"
相关文档
最新文档