| 12345678910111213141516171819202122232425 |
- #include "stm32f10x.h" // Device header
- void Buzzer_Init(void)
- {
- RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
-
- GPIO_InitTypeDef GPIO_InitStruture;
- GPIO_InitStruture.GPIO_Mode = GPIO_Mode_Out_PP;
- GPIO_InitStruture.GPIO_Pin = GPIO_Pin_12;
- GPIO_InitStruture.GPIO_Speed = GPIO_Speed_50MHz;
- GPIO_Init(GPIOB, &GPIO_InitStruture);
-
- GPIO_ResetBits(GPIOB, GPIO_Pin_12);
- }
- void Buzzer_ON(void)
- {
- GPIO_SetBits(GPIOB, GPIO_Pin_12);
- }
- void Buzzer_OFF(void)
- {
- GPIO_ResetBits(GPIOB, GPIO_Pin_12);
- }
|