欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

˜Ëî}: stm32ÖДàÓò»ÁËÔõô»ØÊ [´òÓ¡±¾í“]

×÷Õß: ÌìË{É«µÄToto    •rég: 2019-2-24 00:25
˜Ëî}: stm32ÖДàÓò»ÁËÔõô»ØÊÂ
„‚„‚é_ʼŒWstm32£¬ÏëÓÃÖДࣨgpioC13£©¿ØÖÆledŸô£¨gpioB12£©ëŠÆ½·­ÞD¡£½Y¹û×Ô¼ºŒ‘ÁË‚€³ÌÐòʧ”¡ÁË¡£¡£¡£¡£¡£¡£
#include<stm32f10x.h>
#include<stm32f10x_gpio.h>
#include<misc.h>
#include<stm32f10x_rcc.h>
#include<stm32f10x_it.h>

#define LED GPIO_Pin_12
#define Key GPIO_Pin_13
#define LEDCLK RCC_APB2Periph_GPIOB
#define KEYCLK (RCC_APB2Periph_GPIOC|RCC_APB2Periph_AFIO)
#define ON (BitAction)1
#define OFF (BitAction)0
#define Toggle (BitAction)(1-GPIO_ReadOutputDataBit(GPIOB, LED))


#define KeyPORT GPIO_PortSourceGPIOC
#define KeySOURCE GPIO_PinSource0
#define KeyLINE EXTI_Line0
#define KeyHander EXTI0_IRQHandler



void LEDInit()
{
GPIO_InitTypeDef GPIO_InitStructure;
  RCC_APB2PeriphClockCmd(LEDCLK, ENABLE); // ʹÄܶ˿ڕr犠 
  GPIO_InitStructure.GPIO_Pin = LED;       
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;      
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_Init(GPIOB, &GPIO_InitStructure);  //³õʼ»¯¶Ë¿Ú
        GPIO_SetBits(GPIOB, LED);         // êPé]ËùÓÐLED
}

void NVICStart()
{
NVIC_InitTypeDef NVIC_InitStructure;
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
NVIC_InitStructure.NVIC_IRQChannel=EXTI0_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority=1;
NVIC_InitStructure.NVIC_IRQChannelCmd=ENABLE;
NVIC_Init(&NVIC_InitStructure);
}

void InterruptStart()
{
GPIO_InitTypeDef GPIO_InitStructure;
EXTI_InitTypeDef EXTI_InitStructure;
RCC_APB2PeriphClockCmd(KEYCLK, ENABLE); // ʹÄܶ˿ڕrçŠ
NVICStart();
GPIO_InitStructure.GPIO_Pin = Key;       
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;     
GPIO_Init(GPIOC,&GPIO_InitStructure);  
GPIO_EXTILineConfig(KeyPORT,KeySOURCE);
EXTI_InitStructure.EXTI_Line=KeyLINE;
EXTI_InitStructure.EXTI_Mode= EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger= EXTI_Trigger_Falling;
EXTI_InitStructure.EXTI_LineCmd=ENABLE;
EXTI_Init(&EXTI_InitStructure);
}

void LEDON()
{
GPIO_WriteBit(GPIOB, LED,ON);
}

void LEDOFF()
{
GPIO_WriteBit(GPIOB, LED,OFF);
}

void LEDToggle()
{
GPIO_WriteBit(GPIOB, LED,Toggle);
}

void delayXus(u16 i)
{
        unsigned char t = 0;
        for(;i>0;i--)
        {
                for(t=0;t<2;t++)
                {}
        }
}
void delayXms(u16 g)
{
while(g--)
{
delayXus(1000);
}
}

void ZD()
{
if(EXTI_GetITStatus(EXTI_Line0)!=RESET)
{
LEDToggle();
EXTI_ClearITPendingBit(EXTI_Line0);
}
}



int main()
{
SystemInit();
        LEDInit();
        InterruptStart();
        LEDOFF();
        while(1);
}



×÷Õß: laigs218    •rég: 2019-2-24 07:51
stm32ÖÐ”à‘ªÊ¹ÓÃÔÚ stm32f10x_it.c
Main Interrupt Service Routines
×÷Õß: ÌìË{É«µÄToto    •rég: 2019-2-26 23:42
laigs218 °l±íÓÚ 2019-2-24 07:51
stm32ÖÐ”à‘ªÊ¹ÓÃÔÚ stm32f10x_it.c
Main Interrupt Service Routines

ÖxÖxŽÍ棡£¡£¡£¡
×÷Õß: 906869996    •rég: 2019-2-27 08:34
һĘã±ơ£ÖДຯ”µÃûŒ‘åeÁ˰É£¿




šgÓ­¹âÅR (http://www.raoushi.com/bbs/) Powered by Discuz! X3.1