GeBalanceBot/Reference/MiniBalance_HARDWARE/EXTI/exti.c

53 lines
2.0 KiB
C
Raw Permalink Normal View History

2024-01-14 19:28:00 +08:00
/***********************************************
<EFBFBD><EFBFBD>˾<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȥ<EFBFBD>Ƽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޹<EFBFBD>˾
Ʒ<EFBFBD>ƣ<EFBFBD>WHEELTEC
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>wheeltec.net
<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>̣<EFBFBD>shop114407458.taobao.com
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ: https://minibalance.aliexpress.com/store/4455017
<EFBFBD><EFBFBD><EFBFBD>5.7
<EFBFBD>޸<EFBFBD>ʱ<EFBFBD>2021-04-29
Brand: WHEELTEC
Website: wheeltec.net
Taobao shop: shop114407458.taobao.com
Aliexpress: https://minibalance.aliexpress.com/store/4455017
Version:5.7
Update<EFBFBD><EFBFBD>2021-04-29
All rights reserved
***********************************************/
#include "exti.h"
/**************************************************************************
Function: External interrupt initialization
Input : none
Output : none
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><EFBFBD>ⲿ<EFBFBD>жϳ<EFBFBD>ʼ<EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD> ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
**************************************************************************/
void MiniBalance_EXTI_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
EXTI_InitTypeDef EXTI_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO,ENABLE); //<2F>ⲿ<EFBFBD>жϣ<D0B6><CFA3><EFBFBD>Ҫʹ<D2AA><CAB9>AFIOʱ<4F><CAB1>
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE); //ʹ<><CAB9>GPIO<49>˿<EFBFBD>ʱ<EFBFBD><CAB1>
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12; //<2F>˿<EFBFBD><CBBF><EFBFBD><EFBFBD><EFBFBD>
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
GPIO_Init(GPIOA, &GPIO_InitStructure); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E8B6A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>GPIO
GPIO_EXTILineConfig(GPIO_PortSourceGPIOA,GPIO_PinSource12);
EXTI_InitStructure.EXTI_Line=EXTI_Line12;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;//<2F>½<EFBFBD><C2BD>ش<EFBFBD><D8B4><EFBFBD>
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure); //<2F><><EFBFBD><EFBFBD>EXTI_InitStruct<63><74>ָ<EFBFBD><D6B8><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>EXTI<54>Ĵ<EFBFBD><C4B4><EFBFBD>
NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn; //ʹ<>ܰ<EFBFBD><DCB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5>ⲿ<EFBFBD>ж<EFBFBD>ͨ<EFBFBD><CDA8>
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x02; //<2F><>ռ<EFBFBD><D5BC><EFBFBD>ȼ<EFBFBD>2<EFBFBD><32>
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x01; //<2F><><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD>1
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //ʹ<><CAB9><EFBFBD>ⲿ<EFBFBD>ж<EFBFBD>ͨ<EFBFBD><CDA8>
NVIC_Init(&NVIC_InitStructure);
}