EasyManuals Logo

STMicroelectronics STM8 User Manual

STMicroelectronics STM8
126 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #43 background imageLoading...
Page #43 background image
{
BEEP_DeInit();
BEEP_LSICalibrationConfig(128000);
BEEP_Init(BEEP_FREQUENCY_2KHZ);
}
Explanation
As stated earlier beeper module is dependent on the AWU module and so we need to enable this
module’s peripheral clock:
CLK_PeripheralClockConfig(CLK_PERIPHERAL_AWU, ENABLE);
We need to set the beeper port pin as an output pin:
GPIO_Init(GPIOD, GPIO_PIN_4, GPIO_MODE_OUT_PP_HIGH_FAST);
Configuring the beeper is straight. Just like other peripherals, we deinitialize it first and set both LSI
and beep frequency. Optionally we can calibrate the LSI.
void beeper_setup(void)
{
BEEP_DeInit();
BEEP_LSICalibrationConfig(128000);
BEEP_Init(BEEP_FREQUENCY_2KHZ);
}
To activate/deactivate the beeper we need to use the following instructions:
BEEP_Cmd(ENABLE);
BEEP_Cmd(DISABLE);
Demo
Video link: https://www.youtube.com/watch?v=LDPtULsJao8

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the STMicroelectronics STM8 and is the answer not in the manual?

STMicroelectronics STM8 Specifications

General IconGeneral
BrandSTMicroelectronics
ModelSTM8
CategoryMicrocontrollers
LanguageEnglish

Related product manuals