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

標題: stm32f407-LED燈 [打印本頁]

作者: Crazy·    時間: 2020-5-14 17:23
標題: stm32f407-LED燈
菜鳥新學的32,望大神指點,共進步:

#include "bitband.h"

/**********
LED1-->PG9
LED2-->PE4
LED3-->PE3
低電平亮 AHB1
***********/

void led_init(void){
        GPIO_InitTypeDef GpioInitValue;
       
        RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOE|RCC_AHB1Periph_GPIOG,ENABLE);
        //GPIO配置
        GpioInitValue.GPIO_Mode = GPIO_Mode_OUT;//輸出
        GpioInitValue.GPIO_OType = GPIO_OType_PP;//推挽
        GpioInitValue.GPIO_Pin = GPIO_Pin_3|GPIO_Pin_4;//引腳
        GpioInitValue.GPIO_PuPd =  GPIO_PuPd_UP;//上拉
        GpioInitValue.GPIO_Speed = GPIO_Speed_50MHz;//速率
        GPIO_Init(GPIOE,&GpioInitValue);
        GpioInitValue.GPIO_Pin = GPIO_Pin_9;
        GPIO_Init(GPIOG,&GpioInitValue);}


void led_switch(int num,int state){
        if(state!=0)
                state = 1;
        switch(num){
                case 0:
                        PGOut(9) = state;
                        break;
                case 1:
                        PGOut(4) = state;
                        break;
                case 2:
                        PGOut(3) = state;
                        break;
                default :break;
        }
}






歡迎光臨 (http://www.raoushi.com/bbs/) Powered by Discuz! X3.1