44 lines
1.9 KiB
C
44 lines
1.9 KiB
C
|
/******************** (C) COPYRIGHT 2024 GeekRebot *****************************
|
|||
|
* File Name : bsp_GPIO.c
|
|||
|
* Current Version : V1.0 & ST 3.5.0
|
|||
|
* Author : zhanli 719901725@qq.com
|
|||
|
* Date of Issued : 2024.01.17 Create
|
|||
|
* Comments : GPIO<EFBFBD>弶֧<EFBFBD>ְ<EFBFBD>(Board Support Pack)<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>
|
|||
|
********************************************************************************/
|
|||
|
#include "bsp_GPIO.h"
|
|||
|
|
|||
|
/**----------------------------------------------------------------------
|
|||
|
* Function : LED_GPIO_Config
|
|||
|
* Description : <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>LED1<EFBFBD><EFBFBD>GPIO<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* Author : zhanli&719901725@qq.com
|
|||
|
* Date : 2024/01/17 zhanli
|
|||
|
*---------------------------------------------------------------------**/
|
|||
|
void LED_GPIO_Config(void)
|
|||
|
{
|
|||
|
/* <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>GPIO_InitTypeDef<65><66><EFBFBD>͵Ľṹ<C4BD><E1B9B9> */
|
|||
|
GPIO_InitTypeDef GPIO_InitStructure;
|
|||
|
RCC_APB2PeriphClockCmd(LED_BLUE_CLK, ENABLE); /* <20><><EFBFBD><EFBFBD>GPIO<49><4F><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */
|
|||
|
GPIO_InitStructure.GPIO_Pin = LED_BLUE_Pin; /* ѡ<><D1A1>Ҫ<EFBFBD><D2AA><EFBFBD>Ƶ<EFBFBD>GPIO<49><4F><EFBFBD><EFBFBD> */
|
|||
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽΪͨ<CEAA><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ50MHz */
|
|||
|
GPIO_Init(LED_BLUE_PORT, &GPIO_InitStructure); /* <20><><EFBFBD>ÿ⺯<C3BF><E2BAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>GPIOC13 */
|
|||
|
}
|
|||
|
|
|||
|
/**----------------------------------------------------------------------
|
|||
|
* Function : LED_Flash
|
|||
|
* Description : LED<EFBFBD><EFBFBD>˸
|
|||
|
* Author : zhanli&719901725@qq.com
|
|||
|
* Date : 2024/01/17 zhanli
|
|||
|
*---------------------------------------------------------------------**/
|
|||
|
void LED_Flash(int time)
|
|||
|
{
|
|||
|
static int temp;
|
|||
|
if(++temp == time){
|
|||
|
// LED <20><>ɫɫ״̬<D7B4><CCAC>ת
|
|||
|
GPIO_WriteBit(LED_BLUE_PORT, LED_BLUE_Pin,
|
|||
|
(BitAction) (1 - GPIO_ReadInputDataBit(LED_BLUE_PORT, LED_BLUE_Pin)));
|
|||
|
temp = 0;
|
|||
|
}
|
|||
|
}
|