標題:
stm32f103單片機USB_HID游戲手柄的實現(xiàn),可以直接燒寫 兼容win7
[打印本頁]
作者:
東方神鹿2017
時間:
2017-7-18 14:27
標題:
stm32f103單片機USB_HID游戲手柄的實現(xiàn),可以直接燒寫 兼容win7
附件是用STM32F103實現(xiàn)的USB_HID有關(guān)游戲手柄的實現(xiàn),希望對有相關(guān)需求的客戶有所幫助
本程序能夠模擬手柄基本功能的鍵,并可以做一般的游戲應用,增加了鍵盤掃描程序,不使用中斷來處理。
將方向鍵換為搖桿來使用。 兼容win7
0.png
(49.42 KB, 下載次數(shù): 105)
下載附件
2017-7-18 17:15 上傳
所有資料51hei提供下載:
stm32_手柄(增強版)VET6,兼容win7.rar
(982.69 KB, 下載次數(shù): 116)
2017-7-18 17:20 上傳
點擊文件名下載附件
USB—HID
下載積分: 黑幣 -5
單片機源程序如下:
#include "stm32f10x.h"
#include "user_lib.h"
#include "stdio.h"
#include "usb_hw.h"
#include "key.h"
#include "adc.h"
#include "termi.h"
extern BYTE USB_Configuration;
/**************************************************************************
* 函數(shù)名 : GpioInitialisation
* 函數(shù)描述 : 設(shè)置各GPIO端口功能
* 輸入?yún)?shù) : 無
* 輸出結(jié)果 : 無
* 返回值 : 無
**************************************************************************/
void GpioInitialisation(void)
{
/* 定義GPIO初始化結(jié)構(gòu)體 GPIO_InitStructure*/
GPIO_InitTypeDef GPIO_InitStructure;
/* 打開APB2總線上的GPIOA時鐘*/
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
/* 設(shè)置 GPIOA0 , GPIOA1 為上拉輸入 */
GPIO_InitStructure.GPIO_Pin = KEYPIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
GPIO_Init(KEYPORT, &GPIO_InitStructure);
/* 設(shè)置 GPIOA4 ,GPIOA5 為推挽輸出,最大翻轉(zhuǎn)頻率為50MHz*/
// GPIO_InitStructure.GPIO_Pin = LED0PIN | LED1PIN;
// GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
// GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
// GPIO_Init(LEDPORT, &GPIO_InitStructure);
}
int main(void)
{
/*此處與調(diào)試宏assert_param有關(guān),在調(diào)試階段不準刪除*/
GpioInitialisation();
USART_Config();
NVIC_Config();
//EXTI_Config();
key_init();
USB_Init();
USB_Connect(TRUE);
/*等待USB枚舉成功*/
while (! USB_Configuration)
;
termi_clr();
printf("Hello\n");
……………………
…………限于本文篇幅 余下代碼請從51黑下載附件…………
復制代碼
作者:
alan_jiang
時間:
2017-7-27 12:21
嘗試下
作者:
7839502
時間:
2017-9-7 20:23
謝謝分享,可惜積分不夠
作者:
ranxy
時間:
2020-6-16 01:09
下了不能用啊
作者:
tarchen
時間:
2024-10-21 11:34
好代碼,有空看看.
作者:
yanggo
時間:
2024-11-12 15:41
還不會,感謝分享,有錢再下載。
作者:
happy82828
時間:
2024-11-21 16:13
很想學習關(guān)于HID的這部分,謝謝分享
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1