A PWM-controlled passive buzzer is reserved in the IO of the development board. To drive it, an external oscillation frequency must be given, so this time we modify the routine to add our test function.
First, add our PWM basic package to the configuration. This will generate PWM operation functions in the BSP.
Add the command serial port command test function in the test, so that the test can be carried out. Then generate the test project.
scons --target=eclipse generates an eclipse test project, which makes it easier to modify the code.
If we look at the directory structure, we can see that two files have been added from the existing files.
The main body of the Main function still revolves around the previous LVGL. We comment it and let it run the following functions.
The last thing executed is the serial terminal.
There is also an error when compiling the test function. This is because its BSP adds a parameter, so we need to add a parameter to it.
When we enable PWM1 output, the hardware has done the IO initialization and its multiplexing has also been changed.
After the flash is complete, enter the system. Then use the command to test.
The output can be measured with an oscilloscope.