generated from Template/H563ZI-HAL-CMake-Template
优化 App 类,重构 Setup 和 AppStart 函数,清理未使用的代码,增强可读性
All checks were successful
Build and Upload Artifact / build and upload-artifact (push) Successful in 19m58s
All checks were successful
Build and Upload Artifact / build and upload-artifact (push) Successful in 19m58s
This commit is contained in:
@@ -1,10 +1,17 @@
|
|||||||
#include "Helper/delay_helper.h"
|
#include "Helper/delay_helper.h"
|
||||||
#include "stm32h563xx.h"
|
#include "stm32h563xx.h"
|
||||||
|
|
||||||
#include "Common/serial_port.hpp"
|
|
||||||
#include "Helper/gpio_helper.hpp"
|
|
||||||
#include "Center/common_center.hpp"
|
#include "Center/common_center.hpp"
|
||||||
|
#include "Helper/gpio_helper.hpp"
|
||||||
|
#include "Helper/delay_helper.h"
|
||||||
|
|
||||||
|
void TerminateHandler() {
|
||||||
|
auto led = GpioHelper::GpioInit(GPIOB, GPIO_PIN_0, GPIO_MODE_OUTPUT_PP, GPIO_NOPULL, GPIO_PIN_SET);
|
||||||
|
while (true) {
|
||||||
|
led.Toggle();
|
||||||
|
DelayS(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Setup() {
|
void Setup() {
|
||||||
GpioHelper::EnableAllGpioPeripheral();
|
GpioHelper::EnableAllGpioPeripheral();
|
||||||
@@ -16,9 +23,14 @@ void Setup() {
|
|||||||
|
|
||||||
extern "C" void AppStart() {
|
extern "C" void AppStart() {
|
||||||
Setup();
|
Setup();
|
||||||
auto gpio = GpioHelper::GpioInit(GPIOB, GPIO_PIN_0, GPIO_MODE_OUTPUT_PP, GPIO_NOPULL, GPIO_PIN_SET);
|
auto ultrasonic = CommonCenter::GetUltrasonic();
|
||||||
|
auto dfPlayer = CommonCenter::GetDfPlayer();
|
||||||
|
auto canMv = CommonCenter::GetCanMv();
|
||||||
while (true) {
|
while (true) {
|
||||||
gpio.Toggle();
|
// Example usage of the classes
|
||||||
DelayS(1);
|
ultrasonic.GetDistance();
|
||||||
|
dfPlayer.PlayTrack(1);
|
||||||
|
|
||||||
|
DelayMs(1000); // Delay for 1 second
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user