资源简介
在各种应用和比赛中我们都会用到矩阵键盘,所以矩阵键盘必不可少。我已经帮大家封装好了,大家只需要移植就行。管脚直接可修改。
这是他的头文件:
#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
评论
共有 条评论