config(cmake): deleted unneedded files

This commit is contained in:
zys 2026-03-04 13:48:16 +08:00
parent d906bd7987
commit c277f1d9ac
3 changed files with 29 additions and 7 deletions

View File

@ -3,11 +3,7 @@ cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(app_photomagnetic)
target_include_directories(app PRIVATE include)
target_sources(app PRIVATE src/main.cpp)
set(ZEPHYR_EXTRA_MODULES "${CMAKE_SOURCE_DIR}/../../modules/godtek_temp")
set(ZEPHYR_EXTRA_MODULES "${CMAKE_SOURCE_DIR}/../../modules/photomagnetic_com")
target_include_directories(app PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/../../modules/photomagnetic_com/include
)

26
include/watchdog.hpp Normal file
View File

@ -0,0 +1,26 @@
#ifndef __ZPP_WATCHDOG_HPP
#define __ZPP_WATCHDOG_HPP
#include <zephyr/drivers/watchdog.h>
#include <zpp/assert.hpp>
namespace app {
class WatchDogConfig {
public:
WatchDogConfig() {
if (!device_is_ready(m_wtd)) {
__ASSERT_NO_MSG(0);
}
wdt_install_timeout(m_wtd, &wdt_timeout_cfg);
if (auto err = wdt_setup(m_wtd, WDT_OPT_PAUSE_HALTED_BY_DBG); err < 0) {
__ASSERT_NO_MSG(0);
}
wdt_timeout_cfg cfg;
}
private:
const device *m_wtd{DEVICE_DT_GET(DT_ALIAS(watchdog0))};
};
} // namespace app
#endif

View File

@ -1,3 +1,4 @@
#include "watchdog.h"
#include "zpp/fmt.hpp"
#include <etl/vector.h>
#include <led_strip_indicator/led_strip_indicator.hpp>
@ -13,7 +14,6 @@ enum Command { kTemp = 0x00, kGetId, kRunningState };
enum RunningState {};
constexpr auto kDeviceIdSize = 20;
enum StatusId : uint8_t { kRunning, kPause, kError, kStandby };
} // namespace
volatile bool flag{false};
@ -21,7 +21,7 @@ auto main(void) -> int {
pmc.SetRxCallback(kGetId, [](uart_com::DataType data) -> void {
uint8_t buffer[kDeviceIdSize];
auto size = hwinfo_get_device_id(buffer, sizeof(buffer));
pmc.Send("id", uart_com::DataType(buffer, size));
pmc.Send(kGetId, uart_com::DataType(buffer, size));
});
pmc.SetRxCallback(kRunningState, [](uart_com::DataType data) -> void {