基于STMSKY網(wǎng)絡(luò)的2.8寸LCD驅(qū)動(dòng)開發(fā)
#include <stm32f10x_lib.h>
#include "key.h"
#include "delay.h"
//正點(diǎn)原子
//2009/12/23
//按鍵輸入
#define KEY1 (1<<6) //PC6
#define KEY2 (1<<7) //PC7
#define KEY3 (1<<8) //PC8
//按鍵初始化函數(shù)
//PC.6.7.8 設(shè)置成帶上拉的輸入
void key_init(void)
{
RCC->APB2ENR|=1<<4; //使能PORTC時(shí)鐘
GPIOC->CRL&=0X00FFFFFF;//PC6.7設(shè)置成輸入
GPIOC->CRL|=0X88000000;
GPIOC->CRH&=0XFFFFFFF0;//PC8,設(shè)置成輸入
GPIOC->CRH|=0X08;
GPIOC->ODR|=0X1C0; //PC 6 7 8 上拉輸入
}
//按鍵處理函數(shù)
u8 key_scan(void)