|
|
|
|
#include "led.h"
|
|
|
|
|
|
|
|
|
|
void Motor_Init(void)
|
|
|
|
|
{
|
|
|
|
|
GPIO_InitTypeDef GPIO_InitStructure;
|
|
|
|
|
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_AFIO|RCC_APB2Periph_GPIOB, ENABLE); //ʹ<EFBFBD><EFBFBD>PA,PD<EFBFBD>˿<EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE);
|
|
|
|
|
|
|
|
|
|
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_15; //LED0-->PA.8 <EFBFBD>˿<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //IO<EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>Ϊ50MHz
|
|
|
|
|
GPIO_Init(GPIOA, &GPIO_InitStructure); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>趨<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>GPIOA.8
|
|
|
|
|
GPIO_SetBits(GPIOA,GPIO_Pin_12 | GPIO_Pin_15); //PA.8 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_9; //LED0-->PA.8 <EFBFBD>˿<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //IO<EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>Ϊ50MHz
|
|
|
|
|
GPIO_Init(GPIOB, &GPIO_InitStructure); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>趨<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>GPIOA.8
|
|
|
|
|
GPIO_SetBits(GPIOB,GPIO_Pin_8 | GPIO_Pin_9); //PA.8 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Relay_Beep_Init(void)
|
|
|
|
|
{
|
|
|
|
|
GPIO_InitTypeDef GPIO_InitStructure;
|
|
|
|
|
|
|
|
|
|
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); //ʹ<EFBFBD><EFBFBD>PA,PD<EFBFBD>˿<EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13; //LED0-->PA.8 <EFBFBD>˿<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //IO<EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>Ϊ50MHz
|
|
|
|
|
GPIO_Init(GPIOB, &GPIO_InitStructure); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>趨<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>GPIOA.8
|
|
|
|
|
GPIO_SetBits(GPIOB,GPIO_Pin_12 | GPIO_Pin_13); //PA.8 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>PB5<EFBFBD><EFBFBD>PE5Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.<EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
//LED IO<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>
|
|
|
|
|
void LED_Init(void)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
GPIO_InitTypeDef GPIO_InitStructure;
|
|
|
|
|
|
|
|
|
|
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); //ʹ<EFBFBD><EFBFBD>PA,PD<EFBFBD>˿<EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7; //LED0-->PA.8 <EFBFBD>˿<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //IO<EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>Ϊ50MHz
|
|
|
|
|
GPIO_Init(GPIOB, &GPIO_InitStructure); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>趨<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>GPIOA.8
|
|
|
|
|
GPIO_SetBits(GPIOB,GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7); //PA.8 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|