fan.c
#include"fan.h"
//延时函数
void delay_ms(int ms)
{
int i,j;
for(i = 0; i < ms;i++)
for (j = 0; j < 1800; j++);
}
//led灯设置初始化
void all_init()
{
RCC |= (0x32);
//蜂鸣器
GPIOB->moder &= (~(0X3<<12));
GPIOB->moder |= (0X1<<12);
GPIOB->otyper &=(~(0X1<<6));
GPIOB->ospeedr &= (~(0X3<<12));
GPIOB->pupdr &= (~(0X3<<12));
//风扇
GPIOE->moder &= (~(0X3<<18));
GPIOE->moder |= (0X1<<18);
GPIOE->otyper &=(~(0X1<<9));
GPIOE->ospeedr &= (~(0X3<<18));
GPIOE->pupdr &= (~(0X3<<18));
//震动马达
GPIOF->moder &= (~(0X3<<12));
GPIOF->moder |= (0X1<<12);
GPIOF->otyper &=(~(0X1<<6));
GPIOF->ospeedr &= (~(0X3<<12));
GPIOF->pupd