yincheng.zhong
2024-03-03 cae9d270866f095318e8c31ea7c4a8fe741f465d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "beep.h"
 
void Beep_Init(void)
{
    GPIO_InitTypeDef GPIO_InitStructure;
        
    /* Enable GPIO clock */
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB,ENABLE);
 
      GPIO_InitStructure.GPIO_Pin = KEY0_PIN;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
    GPIO_Init(KEY0_GPIO, &GPIO_InitStructure);
    
    //    // Enable GPIO used for beep
    GPIO_InitStructure.GPIO_Pin = RELAY1_PIN|RELAY2_PIN;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_Init(RELAY1_GPIO, &GPIO_InitStructure);
    
    
//    // Enable GPIO used for beep
//    GPIO_InitStructure.GPIO_Pin = BEEP_PIN;
//    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
//    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
//    GPIO_Init(BEEP_GPIO, &GPIO_InitStructure);
//    
//    // Enable GPIO used for beep
//    GPIO_InitStructure.GPIO_Pin = BEEP2_PIN;
//    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
//    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
//    GPIO_Init(BEEP2_GPIO, &GPIO_InitStructure);
//    
//    // Enable GPIO used for OUT
//    GPIO_InitStructure.GPIO_Pin = OUT2_PIN;
//    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
//    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
//    GPIO_Init(OUT2_GPIO, &GPIO_InitStructure);
}