(10) Embedded blue bridge cup-buzzer

(1) Personal habits

A separate BUZZ.c and BUZZ.h will be created and placed under the HARAWARE folder

(2) Preparation

  • 1. The pin connected to the buzzer of the CT117E development board is PB4, which is also connected to the RST pin of the JTAG interface.
    Insert picture description here
    Insert picture description here

  • 2. When we reset the stm32, the PB4 pin is the RST pin of the JTAG interface by default, so we must remap PB4 back to our ordinary IO port before using the buzzer.

  • 3. So we have to add this sentence

      GPIO_PinRemapConfig(GPIO_Remap_SWJ_NoJTRST,ENABLE);
    
  • 4. Other than that: the other configuration of the buzzer is similar to that of LED

(3) Write void BUZZ_init(void) initial function

Insert picture description here

(4) Write void BUZZ(u16 buzz_temp) BUZZ function

Insert picture description here

(5) Write void DealWith_0(void) processing function

Insert picture description here

Guess you like

Origin blog.csdn.net/m0_46278925/article/details/113633712