RobotHardware-UESTC/Hardware/Firmware/GeekRobotTiny_Firmware v1.0/DRV/bsp_GPIO.c

56 lines
1.8 KiB
C
Raw Normal View History

/*
********************************************************************************************************
<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>bsp_GPIO.c
<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>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>https://shop60670850.taobao.com
<EFBFBD><EFBFBD> <EFBFBD>ߣ<EFBFBD>lilianhe
<EFBFBD><EFBFBD> <EFBFBD><EFBFBD>: 2017-2-6
*********************************************************************************************************
*/
/*
********************************************************************************************************
GPIO<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־<EFBFBD><EFBFBD>
1.2017-2-6<EFBFBD><EFBFBD><EFBFBD><EFBFBD>дLED<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*********************************************************************************************************
*/
#include "bsp_GPIO.h"
/*
********************************************************************************************************
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD>void LED_GPIO_Config(void)
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>LED1<EFBFBD><EFBFBD>GPIO<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Ӳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD>LED1----PC13
<EFBFBD><EFBFBD> ע<EFBFBD><EFBFBD>
<EFBFBD><EFBFBD> <EFBFBD><EFBFBD>: 2017-2-6
*********************************************************************************************************
*/
void LED_GPIO_Config(void)
{
/*<2A><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>GPIO_InitTypeDef<65><66><EFBFBD>͵Ľṹ<C4BD><E1B9B9>*/
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd( LED1_CLK, ENABLE); /*<2A><><EFBFBD><EFBFBD>GPIO<49><4F><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>*/
GPIO_InitStructure.GPIO_Pin = LED1_Pin; /*ѡ<><D1A1>Ҫ<EFBFBD><D2AA><EFBFBD>Ƶ<EFBFBD>GPIO<49><4F><EFBFBD><EFBFBD>*/
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽΪͨ<CEAA><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ50MHz */
GPIO_Init(LED1_PORT, &GPIO_InitStructure);/*<2A><><EFBFBD>ÿ⺯<C3BF><E2BAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>GPIOC13*/
}
//LED<45><44>˸
void LED_Flash(int time)
{
static int temp;
if(++temp==time)
{
GPIO_WriteBit(GPIOC, GPIO_Pin_13, (BitAction) (1 - GPIO_ReadInputDataBit(GPIOC, GPIO_Pin_13))) ;//LED <20><>ɫɫ״̬<D7B4><CCAC>ת
temp=0;
}
}
//------------------End of File----------------------------