stm32_ota/HARDWARE/KEY/key.c

41 lines
2.5 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include "key.h"
#include "io.h"
/********************************************************************************
* @file iodevice.c
* @author 晏诚科技 Mr.Wang
* @version V1.0.0
* @date 11-Dec-2018
* @brief 提供ABM-EC20主板GPIO外设的驱动
* ABM-EC20主板GPIO外设包括按键、蜂鸣器、RS485收发控制引脚、3.6V稳压片使能引脚等
******************************************************************************
*******************************************************************************/
/**************************************************************************************************
* 名 称: void KeyInit(void)
* 功能说明:
* 按键开关UP、DOWN、LEFT、RIGHT、Menu、BACK IO引脚设置为内部上拉输入中断模式 上升沿触发中断中断优先级INT_RANK_6
* KEY0 KEY1 KEY2 KEY3 KEY7 KEY9设置为GPIO 上拉输入模式,不开启中断
*************************************************************************************************/
void KeyInit(void)
{
IoExti_Init(MENU_KEY_PORT, MENU_KEY_PIN, GPIO_Mode_IPU, EXTI_Trigger_Falling, INT_RANK_6) ; //引脚设置为上拉输入模式、上升沿触发中断中断优先级INT_RANK_6
IoExti_Init(BACK_KEY_PORT, BACK_KEY_PIN, GPIO_Mode_IPU, EXTI_Trigger_Rising, INT_RANK_6) ; //引脚设置为上拉输入模式、上升沿触发中断中断优先级INT_RANK_6
IoExti_Init(KEYUP_PORT, KEYUP_PIN, GPIO_Mode_IPU, EXTI_Trigger_Rising, INT_RANK_6) ; //引脚设置为上拉输入模式、上升沿触发中断中断优先级INT_RANK_6
IoExti_Init(KEYLEFT_PORT, KEYLEFT_PIN, GPIO_Mode_IPU, EXTI_Trigger_Rising, INT_RANK_6) ; //引脚设置为上拉输入模式、上升沿触发中断中断优先级INT_RANK_6
IoExti_Init(KEYOK_PORT, KEYOK_PIN, GPIO_Mode_IPU, EXTI_Trigger_Rising, INT_RANK_6) ; //引脚设置为上拉输入模式、上升沿触发中断中断优先级INT_RANK_6
IoExti_Init(KEYRIGHT_PORT, KEYRIGHT_PIN, GPIO_Mode_IPU, EXTI_Trigger_Rising, INT_RANK_6) ; //引脚设置为上拉输入模式、上升沿触发中断中断优先级INT_RANK_6
IoExti_Init(KEYDOWN_PORT, KEYDOWN_PIN, GPIO_Mode_IPU, EXTI_Trigger_Rising, INT_RANK_6) ; //引脚设置为上拉输入模式、上升沿触发中断中断优先级INT_RANK_6
Gpio_Init(KEY0_PORT, KEY0_PIN, GPIO_Mode_IPU) ; //引脚设置为 GPIO 上拉输入模式,不开启中断
Gpio_Init(KEY1_PORT, KEY1_PIN, GPIO_Mode_IPU) ;
Gpio_Init(KEY2_PORT, KEY2_PIN, GPIO_Mode_IPU) ;
Gpio_Init(KEY3_PORT, KEY3_PIN, GPIO_Mode_IPU) ;
Gpio_Init(KEY7_PORT, KEY7_PIN, GPIO_Mode_IPU) ;
Gpio_Init(KEY9_PORT, KEY9_PIN, GPIO_Mode_IPU) ;
}