stm32_ota/SYSTEM/IO/io.c

286 lines
13 KiB
C
Raw Normal View History

2023-12-15 06:28:06 +00:00
#include "io.h"
#include <math.h>
#include "stm32f10x_exti.h"
#include "usart.h"
/********************************************************************************
* @file io.c
* @author <EFBFBD>̳ϿƼ<EFBFBD> Mr.Wang
* @version V1.0.0
* @date 11-Dec-2018
* @brief <EFBFBD>IO <EFBFBD>ⲿ<EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
******************************************************************************
* @<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD>
* 1<EFBFBD><EFBFBD>GPIO<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>
* 2<EFBFBD><EFBFBD>IOEXTI<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>
* 3<EFBFBD><EFBFBD><EFBFBD>ⲿ<EFBFBD>жϻص<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD><EFBFBD>
* 4<EFBFBD><EFBFBD>GPIO<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽ<EFBFBD><EFBFBD>ת
* 5<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD>ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IO<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>ߵ͵<EFBFBD>ƽ
* @ʹ<EFBFBD>÷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* 1<EFBFBD><EFBFBD><EFBFBD>ȵ<EFBFBD><EFBFBD><EFBFBD>IoExti_Init()<EFBFBD><EFBFBD>IO<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>NVIC<EFBFBD><EFBFBD>EXTI<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>
* 2<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><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
****************************************/
IOFP ioFp[PINSUM] = {NULL} ; //EXTI_Line0~EXTI_Line15 <20><><EFBFBD><EFBFBD>16<31><36>IO<49>ж<EFBFBD><D0B6>߶<EFBFBD>Ӧ<EFBFBD>Ļص<C4BB><D8B5><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
/****************************************************************************
* IO EXTI<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
****************************************************************************/
const uint32_t portRcc[PSUM] = {RCC_APB2Periph_GPIOA, RCC_APB2Periph_GPIOB, RCC_APB2Periph_GPIOC, RCC_APB2Periph_GPIOD,
RCC_APB2Periph_GPIOE, RCC_APB2Periph_GPIOF, RCC_APB2Periph_GPIOG} ; //<2F><><EFBFBD><EFBFBD>IO<49>˿ڵ<CBBF>ʱ<EFBFBD><CAB1>
GPIO_TypeDef* portx[PSUM] = {GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF, GPIOG} ; //<2F><><EFBFBD><EFBFBD>IO<49>˿<EFBFBD>
const uint16_t pinx[PINSUM] = {GPIO_Pin_0, GPIO_Pin_1, GPIO_Pin_2, GPIO_Pin_3,
GPIO_Pin_4, GPIO_Pin_5, GPIO_Pin_6, GPIO_Pin_7,
GPIO_Pin_8, GPIO_Pin_9, GPIO_Pin_10, GPIO_Pin_11,
GPIO_Pin_12,GPIO_Pin_13, GPIO_Pin_14, GPIO_Pin_15} ; //IO<49>˿<EFBFBD><CBBF>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD>IO<49><4F><EFBFBD><EFBFBD>
const uint8_t extiPort[PSUM] = {GPIO_PortSourceGPIOA, GPIO_PortSourceGPIOB, GPIO_PortSourceGPIOC,
GPIO_PortSourceGPIOD, GPIO_PortSourceGPIOE, GPIO_PortSourceGPIOF,
GPIO_PortSourceGPIOG} ; //<2F><><EFBFBD><EFBFBD><EFBFBD>ж϶˿<CFB6>
const uint8_t extiPin[PINSUM] = {GPIO_PinSource0, GPIO_PinSource1, GPIO_PinSource2, GPIO_PinSource3,
GPIO_PinSource4, GPIO_PinSource5, GPIO_PinSource6, GPIO_PinSource7,
GPIO_PinSource8, GPIO_PinSource9, GPIO_PinSource10, GPIO_PinSource11,
GPIO_PinSource12, GPIO_PinSource13, GPIO_PinSource14, GPIO_PinSource15,} ; //<2F><><EFBFBD><EFBFBD>IO<49>ⲿ<EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>
const uint32_t extiLine[PINSUM] = {EXTI_Line0, EXTI_Line1, EXTI_Line2, EXTI_Line3,
EXTI_Line4, EXTI_Line5, EXTI_Line6, EXTI_Line7,
EXTI_Line8, EXTI_Line9, EXTI_Line10, EXTI_Line11,
EXTI_Line12, EXTI_Line13, EXTI_Line14, EXTI_Line15} ; //<2F><><EFBFBD><EFBFBD><EFBFBD>ⲿ<EFBFBD>ж<EFBFBD><D0B6><EFBFBD>
const uint8_t extiChannel[PINSUM] = {EXTI0_IRQn, EXTI1_IRQn, EXTI2_IRQn, EXTI3_IRQn,
EXTI4_IRQn, EXTI9_5_IRQn, EXTI9_5_IRQn, EXTI9_5_IRQn,
EXTI9_5_IRQn, EXTI9_5_IRQn, EXTI15_10_IRQn, EXTI15_10_IRQn,
EXTI15_10_IRQn, EXTI15_10_IRQn, EXTI15_10_IRQn, EXTI15_10_IRQn, } ; //<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>ͨ<EFBFBD><CDA8>
/**************************************************************************************************
* <EFBFBD><EFBFBD> <EFBFBD>ƣ<EFBFBD>void Gpio_Init(PORT_e ePortx, PIN_e ePinx, GPIOMode_TypeDef gpioMode)
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD>GPIO<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param1 ePortx PORT_eö<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><EFBFBD><EFBFBD>ʾIO<EFBFBD>˿<EFBFBD>
* @param2 ePinx PIN_eö<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><EFBFBD><EFBFBD>ʾIO<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param3 gpioMode GPIOMode_TypeDefö<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><EFBFBD><EFBFBD>ʾIO<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 Gpio_Init(PORT_e ePortx, PIN_e ePinx, GPIOMode_TypeDef gpioMode)
{
/*ͨ<><CDA8>IO<49><4F><EFBFBD>ų<EFBFBD>ʼ<EFBFBD><CABC>*/
GPIO_InitTypeDef GPIO_InitStructure ; //GPIO<49><4F><EFBFBD><EFBFBD> <20><EFBFBD><EFBFBD><E5B6A8>
RCC_APB2PeriphClockCmd(portRcc[ePortx] , ENABLE); //GPIO <20>˿<EFBFBD>ʱ<EFBFBD>ӿ<EFBFBD><D3BF><EFBFBD>
GPIO_InitStructure.GPIO_Pin = pinx[ePinx] ; //<2F><>Ҫ<EFBFBD><D2AA>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
GPIO_InitStructure.GPIO_Mode = gpioMode ; //IO<49><4F><EFBFBD><EFBFBD>ģʽ
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //IO<49>ٶ<EFBFBD><D9B6><EFBFBD><EFBFBD><EFBFBD>
GPIO_Init(portx[ePortx], &GPIO_InitStructure); //GPIO <20><><EFBFBD>ų<EFBFBD>ʼ<EFBFBD><CABC>
}
/**************************************************************************************************
* <EFBFBD><EFBFBD> <EFBFBD>ƣ<EFBFBD>void IoExti_Init(PORT_e ePortx, PIN_e ePinx, GPIOMode_TypeDef gpioMode, EXTITrigger_TypeDef exitTrigger,
* IntPriority_e ePriority, IOFP pCallback)
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD>io<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>GPIO<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>gpioMode<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ⲿ<EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>EXTI<EFBFBD><EFBFBD>NVIC<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD><EFBFBD>жϻص<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param1 ePortx PORT_eö<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><EFBFBD><EFBFBD>ʾIO<EFBFBD>˿<EFBFBD>
* @param2 ePinx PIN_eö<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><EFBFBD><EFBFBD>ʾIO<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param3 gpioMode GPIOMode_TypeDefö<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><EFBFBD><EFBFBD>ʾIO<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽ
* @param4 exitTrigger EXTITrigger_TypeDefö<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><EFBFBD><EFBFBD>ʾIO<EFBFBD>жϴ<EFBFBD><EFBFBD><EFBFBD>ģʽ
* @param5 ePriority IntPriority_eö<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><EFBFBD><EFBFBD>ʾIO<EFBFBD>˿<EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD>
* @param6 pCallback IOFP<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 IoExti_Init(PORT_e ePortx, PIN_e ePinx, GPIOMode_TypeDef gpioMode, EXTITrigger_TypeDef exitTrigger,
IntPriority_e ePriority)
{
Gpio_Init(ePortx, ePinx, gpioMode) ; //ͨ<><CDA8>IO<49><4F><EFBFBD>ų<EFBFBD>ʼ<EFBFBD><CABC>
if((GPIO_Mode_IPD==gpioMode) || (GPIO_Mode_IPU==gpioMode)) //<2F>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IO<49>ⲿ<EFBFBD>ж<EFBFBD>
{
/*<2A><><EFBFBD><EFBFBD>EXIT<49><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ <20><><EFBFBD><EFBFBD>AFIOʱ<4F><CAB1><EFBFBD>ҳ<EFBFBD>ʼ<EFBFBD><CABC> EXIT<49><54>NVIC*/
EXTI_InitTypeDef EXTI_InitStructure ; //EXIT<49><54><EFBFBD><EFBFBD> <20><EFBFBD><EFBFBD><E5B6A8>
NVIC_InitTypeDef NVIC_InitStructure ; //NVIC<49><43><EFBFBD><EFBFBD> <20><EFBFBD><EFBFBD><E5B6A8>
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); //GPIO EXIT<49><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>AFIOʱ<4F><CAB1>
NVIC_InitStructure.NVIC_IRQChannel = extiChannel[ePinx] ; //<2F>ⲿ<EFBFBD>ж<EFBFBD><D0B6><EFBFBD>
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = ePriority ; //<2F><>ռ<EFBFBD><D5BC><EFBFBD>ȼ<EFBFBD><C8BC><EFBFBD><EFBFBD><EFBFBD>
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0 ; //freertos<6F><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD>
NVIC_InitStructure.NVIC_IRQChannelCmd = DISABLE ; //ʧ<><CAA7><EFBFBD>ⲿ<EFBFBD>ж<EFBFBD>ͨ<EFBFBD><CDA8>
NVIC_Init(&NVIC_InitStructure); //<2F>ж<EFBFBD>NVIC<49><43><EFBFBD><EFBFBD>
GPIO_EXTILineConfig( extiPort[ePortx], extiPin[ePinx] ) ; //<2F>ж<EFBFBD>Line<6E><65><EFBFBD><EFBFBD>
EXTI_InitStructure.EXTI_Line = extiLine[ePinx] ; //<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt ; //<2F>ж<EFBFBD>ģʽ
EXTI_InitStructure.EXTI_Trigger = exitTrigger ; //IO<49>ⲿ<EFBFBD>жϴ<D0B6><CFB4><EFBFBD><EFBFBD><EFBFBD>ʽ
EXTI_InitStructure.EXTI_LineCmd = ENABLE; //ʹ<><CAB9><EFBFBD>ⲿ<EFBFBD>ж<EFBFBD>
EXTI_Init( &EXTI_InitStructure ); //<2F>ⲿ<EFBFBD>жϳ<D0B6>ʼ<EFBFBD><CABC>
/*<2A><><EFBFBD>жϱ<D0B6>־λ<D6BE><CEBB><EFBFBD>ٿ<EFBFBD><D9BF>ж<EFBFBD>*/
EXTI_ClearITPendingBit( extiLine[ePinx] );
NVIC_EnableIRQ(extiChannel[ePinx]) ;
}
}
/**************************************************************************************************
* <EFBFBD><EFBFBD> <EFBFBD>ƣ<EFBFBD>void Io_Reverse(PORT_e ePortx, PIN_e ePinx)
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD>GPIO<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽ<EFBFBD><EFBFBD>ת
* <EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param1 ePortx PORT_eö<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><EFBFBD><EFBFBD>ʾIO<EFBFBD>˿<EFBFBD>
* @param2 ePinx PIN_eö<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><EFBFBD><EFBFBD>ʾIO<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD>÷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ⲿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*************************************************************************************************/
void Io_Reverse(PORT_e ePortx, PIN_e ePinx)
{
portx[ePortx]->ODR ^= pinx[ePinx] ;
}
/**************************************************************************************************
* <EFBFBD><EFBFBD> <EFBFBD>ƣ<EFBFBD>IOFP Io_RegHookCallback(PIN_e ePinx, IOFP pCallback)
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD>io<EFBFBD>ⲿ<EFBFBD>жϻص<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-ע<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>EXTI<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IOFP<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ioFp16<EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* Io_RegHookCallback<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǽ<EFBFBD><EFBFBD>ص<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>ݸ<EFBFBD>ioFpָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param1 ePinx PIN_eö<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param2 pCallback IOFP<EFBFBD><EFBFBD><EFBFBD>ͺ<EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param1 pCallback IOFP<EFBFBD><EFBFBD><EFBFBD>ͺ<EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD>÷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ⲿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*************************************************************************************************/
IOFP Io_RegHookCallback(PIN_e ePinx, IOFP pCallback)
{
if( ioFp[ePinx] == NULL )
ioFp[ePinx] = pCallback ;
else
SysErr("IO Callback repeat reg!") ;
return pCallback ;
}
/**************************************************************************************************
* <EFBFBD><EFBFBD> <EFBFBD>ƣ<EFBFBD>void Io_Hook(uint32_t extiLine)
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD>io<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><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><EFBFBD>ٺٺ١<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD>Ȼ<EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD>ߣ<EFBFBD>extiLine<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD>Ļص<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ioFp[]<EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param1 extiLine <EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD>EXTI_Line0~EXTI_Line15
*************************************************************************************************/
void Io_Hook(uint32_t extiLine)
{
int n = log(extiLine)/log(2) ; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㽫extiLine<6E><65>ֵת<D6B5><D7AA>Ϊ<EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>Ҫ0~15
if( ioFp[n] != NULL)
ioFp[n]() ; //ͨ<><CDA8>ipFP<46><50><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD>Ѿ<EFBFBD>ע<EFBFBD><D7A2><EFBFBD>Ļص<C4BB><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}
/**************************************************************************************************
* <EFBFBD><EFBFBD> <EFBFBD>ƣ<EFBFBD> void EXTI0_IRQHandler(void)
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD> EXTI0_IRQn<EFBFBD>жϴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*************************************************************************************************/
void EXTI0_IRQHandler(void)
{
if( EXTI_GetFlagStatus(EXTI_Line0) != RESET )
{
EXTI_ClearFlag( EXTI_Line0 ); //<2F><><EFBFBD><EFBFBD>LINE0<45>ϵ<EFBFBD><CFB5>жϱ<D0B6>־λ
SysLog("EXTI0 IRQ!") ;
Io_Hook(EXTI_Line0) ; //<2F><>ת<EFBFBD><D7AA>EXTI0<49>жϻص<CFBB><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}
EXTI_ClearITPendingBit( EXTI_Line0 ); //<2F><><EFBFBD><EFBFBD>LINE0<45>ϵ<EFBFBD><CFB5>жϱ<D0B6>־λ
}
/**************************************************************************************************
* <EFBFBD><EFBFBD> <EFBFBD>ƣ<EFBFBD> void EXTI1_IRQHandler(void)
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD> EXTI1_IRQn<EFBFBD>жϴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*************************************************************************************************/
void EXTI1_IRQHandler(void)
{
if( EXTI_GetFlagStatus( EXTI_Line1 ) == SET )
{
EXTI_ClearFlag( EXTI_Line1 );
SysLog("EXTI1 IRQ!") ;
Io_Hook(EXTI_Line1) ; //EXTI1<49>жϻص<CFBB><D8B5><EFBFBD><EFBFBD><EFBFBD>
}
EXTI_ClearITPendingBit( EXTI_Line1 ); //<2F><><EFBFBD><EFBFBD>LINE1<45>ϵ<EFBFBD><CFB5>жϱ<D0B6>־λ
}
/**************************************************************************************************
* <EFBFBD><EFBFBD> <EFBFBD>ƣ<EFBFBD> void EXTI2_IRQHandler(void)
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD> EXTI2_IRQn<EFBFBD>жϴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*************************************************************************************************/
void EXTI2_IRQHandler(void)
{
if( EXTI_GetFlagStatus(EXTI_Line2) != RESET )
{
EXTI_ClearFlag( EXTI_Line2 ); //<2F><><EFBFBD><EFBFBD>LINE2<45>ϵ<EFBFBD><CFB5>жϱ<D0B6>־λ
SysLog("EXTI2 IRQ!") ;
Io_Hook(EXTI_Line2) ; //EXTI2<49>жϻص<CFBB><D8B5><EFBFBD><EFBFBD><EFBFBD>
}
EXTI_ClearITPendingBit( EXTI_Line2 ); //<2F><><EFBFBD><EFBFBD>LINE2<45>ϵ<EFBFBD><CFB5>жϱ<D0B6>־λ
}
/**************************************************************************************************
* <EFBFBD><EFBFBD> <EFBFBD>ƣ<EFBFBD> void EXTI3_IRQHandler(void)
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD> EXTI3_IRQn<EFBFBD>жϴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*************************************************************************************************/
void EXTI3_IRQHandler(void)
{
if( EXTI_GetFlagStatus( EXTI_Line3 ) == SET )
{
EXTI_ClearFlag( EXTI_Line3 );
SysLog("EXTI3 IRQ!") ;
Io_Hook(EXTI_Line3) ; //EXTI3<49>жϻص<CFBB><D8B5><EFBFBD><EFBFBD><EFBFBD>
}
EXTI_ClearITPendingBit( EXTI_Line3 ); //<2F><><EFBFBD><EFBFBD>LINE3<45>ϵ<EFBFBD><CFB5>жϱ<D0B6>־λ
}
/**************************************************************************************************
* <EFBFBD><EFBFBD> <EFBFBD>ƣ<EFBFBD> void EXTI4_IRQHandler(void)
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD> EXTI4_IRQn<EFBFBD>жϴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*************************************************************************************************/
void EXTI4_IRQHandler(void)
{
if( EXTI_GetFlagStatus(EXTI_Line4) != RESET )
{
EXTI_ClearFlag( EXTI_Line4 ); //<2F><><EFBFBD><EFBFBD>LINE4<45>ϵ<EFBFBD><CFB5>жϱ<D0B6>־λ
SysLog("EXTI4 IRQ!") ;
Io_Hook(EXTI_Line4) ; //EXTI4<49>жϻص<CFBB><D8B5><EFBFBD><EFBFBD><EFBFBD>
}
EXTI_ClearITPendingBit( EXTI_Line4 ); //<2F><><EFBFBD><EFBFBD>LINE4<45>ϵ<EFBFBD><CFB5>жϱ<D0B6>־λ
}
/**************************************************************************************************
* <EFBFBD><EFBFBD> <EFBFBD>ƣ<EFBFBD> void EXTI9_5_IRQHandler(void)
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD> EXTI_Line5~EXTI_Line9<EFBFBD>жϴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*************************************************************************************************/
void EXTI9_5_IRQHandler(void)
{
for( int n=5; n<=9; n++ )
{
if( EXTI_GetITStatus(extiLine[n]) != RESET )
{
EXTI_ClearFlag( extiLine[n] ); //<2F><><EFBFBD><EFBFBD>EXTI9_5<5F>ϵ<EFBFBD><CFB5>жϱ<D0B6>־λ
char log[64] = {0} ;
snprintf(log, 64, "EXTI%d IRQ!", n) ;
SysLog(log) ;
Io_Hook(extiLine[n]) ; //EXTI9_5<5F>жϻص<CFBB><D8B5><EFBFBD><EFBFBD><EFBFBD>
}
}
}
/**************************************************************************************************
* <EFBFBD><EFBFBD> <EFBFBD>ƣ<EFBFBD> void EXTI15_10_IRQHandler(void)
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD> EXTI_Line15~EXTI_Line10<EFBFBD>жϴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*************************************************************************************************/
void EXTI15_10_IRQHandler(void)
{
for( int n=10; n<=15; n++ )
{
if( EXTI_GetITStatus(extiLine[n]) != RESET )
{
EXTI_ClearFlag( extiLine[n] ); //<2F><><EFBFBD><EFBFBD>EXTI15_10<31>ϵ<EFBFBD><CFB5>жϱ<D0B6>־λ
char log[64] = {0} ;
snprintf(log, 64, "EXTI%d IRQ!", n) ;
SysLog(log) ;
Io_Hook(extiLine[n]) ; //EXTI15_10<31>жϻص<CFBB><D8B5><EFBFBD><EFBFBD><EFBFBD>
}
}
}