52 lines
2.1 KiB
C
52 lines
2.1 KiB
C
|
/******************** (C) COPYRIGHT 2020 GEEKIMU *******************************
|
|||
|
* File Name : led.c
|
|||
|
* Current Version : V2.0 & ST 3.5.0
|
|||
|
* Author : zhanli 719901725@qq.com & JustFeng.
|
|||
|
* Date of Issued : 2017.1.16 zhanli : Create
|
|||
|
* Comments : GEEK LED<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
********************************************************************************/
|
|||
|
#include "sys.h"
|
|||
|
#include "led.h"
|
|||
|
|
|||
|
#define LED_PERIPH_CLK RCC_APB2Periph_GPIOB // LEDʹ<44>ܶ˿<DCB6>ʱ<EFBFBD><CAB1>
|
|||
|
#define LED_GPIO_TYPE GPIOB // LEDʹ<44>ܶ˿<DCB6><CBBF><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define LED_PIN GPIO_Pin_7 // LEDʹ<44>ܶ˿<DCB6>PB7
|
|||
|
|
|||
|
/**----------------------------------------------------------------------
|
|||
|
* Function : LED_Init_GPIO(void)
|
|||
|
* Description : LED <EFBFBD><EFBFBD>IO<EFBFBD>ڳ<EFBFBD>ʼ<EFBFBD><EFBFBD>
|
|||
|
* Author : zhanli&719901725@qq.com
|
|||
|
* Date : 2015/2/13 zhanli
|
|||
|
*---------------------------------------------------------------------**/
|
|||
|
void LED_Init_GPIO(void)
|
|||
|
{
|
|||
|
GPIO_InitTypeDef GPIO_InitStructure;
|
|||
|
|
|||
|
RCC_APB2PeriphClockCmd(LED_PERIPH_CLK, ENABLE); /* ʹ<><CAB9>LED<45>˿<EFBFBD>ʱ<EFBFBD><CAB1> */
|
|||
|
|
|||
|
GPIO_InitStructure.GPIO_Pin = LED_PIN; /* LED0<44>˿<EFBFBD><CBBF><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; /* IO<49><4F><EFBFBD>ٶ<EFBFBD>Ϊ50MHz */
|
|||
|
GPIO_Init(LED_GPIO_TYPE, &GPIO_InitStructure); /* <20><><EFBFBD><EFBFBD><EFBFBD>趨<EFBFBD><E8B6A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>LED */
|
|||
|
}
|
|||
|
|
|||
|
/**----------------------------------------------------------------------
|
|||
|
* Function : LED_Off
|
|||
|
* Description : LED <EFBFBD>ƹر<EFBFBD>
|
|||
|
* Author : zhanli&719901725@qq.com
|
|||
|
* Date : 2015/2/13 zhanli
|
|||
|
*---------------------------------------------------------------------**/
|
|||
|
void LED_Off(void){
|
|||
|
GPIO_ResetBits(LED_GPIO_TYPE, LED_PIN);
|
|||
|
}
|
|||
|
|
|||
|
/**----------------------------------------------------------------------
|
|||
|
* Function : LED_Off
|
|||
|
* Description : LED <EFBFBD>ƴ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* Author : zhanli&719901725@qq.com
|
|||
|
* Date : 2015/2/13 zhanli
|
|||
|
*---------------------------------------------------------------------**/
|
|||
|
void LED_On(void){
|
|||
|
GPIO_SetBits(LED_GPIO_TYPE, LED_PIN);
|
|||
|
}
|