-
大小: 2KB文件類型: .zip金幣: 1下載: 0 次發布日期: 2021-01-06
- 語言: 其他
- 標簽: stm32f103X??
資源簡介
在各種應用和比賽中我們都會用到矩陣鍵盤,所以矩陣鍵盤必不可少。我已經幫大家封裝好了,大家只需要移植就行。管腳直接可修改。
這是他的頭文件:
#ifndef __keyboad_h__
#define __keyboad_h__
#include "stm32f10x.h"
#include "stdint.h"
#include "delay.h"
#include "oled1.h"
//#define val_GPIO GPIO_ReadInputData(GPIOA);
#define GPIO_4_4 GPIOA
/**
* >A7
* >A6
* >A5
* >A4
代碼片段和文件信息
#include?“keyboard.h“
//GPIO初始化函數
void?GPIO_Configuration_init(void)
{
?GPIO_InitTypeDef?GPIO_InitStructuress;
?RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA?ENABLE);???????????//打開時鐘???????????????
?GPIO_InitStructuress.GPIO_Pin?=?GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3;??//初始化PD0-PD3
?GPIO_InitStructuress.GPIO_Mode?=?GPIO_Mode_Out_PP?;?????//?重要
????????????????????????????????????????????
?GPIO_InitStructuress.GPIO_Speed?=?GPIO_Speed_50MHz;
?GPIO_Init(GPIOA?&GPIO_InitStructuress);?
?GPIO_InitStructuress.GPIO_Pin?=GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7;????//初始化PD4-PD7
?GPIO_InitStructuress.GPIO_Mode?=GPIO_Mode_IPD?;//重要
?GPIO_InitStructuress.GPIO_Speed?=?GPIO_Speed_50MHz;
?GPIO_Init(GPIOA?&GPIO_InitStructuress);?
?GPIO_SetBits(?GPIOAGPIO_Pin_0|GPIO_Pin_1|GPIO
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-07-10?18:13??keyBoard4_4\
?????文件????????3874??2018-07-10?18:13??keyBoard4_4\keyBoard.c
?????文件?????????243??2018-07-10?12:31??keyBoard4_4\keyboard.h
評論
共有 條評論