mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/rtos2-utils.git
synced 2025-08-06 19:17:34 +00:00
Move watchdog files
This commit is contained in:
18
src/rtos/system/watchdog/handles.hpp
Normal file
18
src/rtos/system/watchdog/handles.hpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef STA_RTOS_SYSTEM_WATCHDOG_HANDLES_HPP
|
||||
#define STA_RTOS_SYSTEM_WATCHDOG_HANDLES_HPP
|
||||
|
||||
#include <sta/rtos/system/watchdog.hpp>
|
||||
|
||||
#include <cmsis_os2.h>
|
||||
|
||||
|
||||
#define WATCHDOG_TASK_HANDLE STA_RTOS_MAKE_HANDLE_NAME(STA_RTOS_WATCHDOG_TASK_NAME)
|
||||
#define WATCHDOG_TIMER_HANDLE STA_RTOS_MAKE_HANDLE_NAME(STA_RTOS_WATCHDOG_TIMER_NAME)
|
||||
|
||||
|
||||
// Access handles from freertos.c
|
||||
extern osThreadId_t WATCHDOG_TASK_HANDLE;
|
||||
extern osTimerId_t WATCHDOG_TIMER_HANDLE;
|
||||
|
||||
|
||||
#endif // STA_RTOS_SYSTEM_WATCHDOG_HANDLES_HPP
|
@@ -1,19 +1,15 @@
|
||||
#include <sta/rtos/watchdog.hpp>
|
||||
#include <sta/rtos/system/watchdog.hpp>
|
||||
|
||||
#ifdef STA_RTOS_WATCHDOG_ENABLE
|
||||
|
||||
#include <cmsis_os2.h>
|
||||
|
||||
|
||||
// Access handles from freertos.c
|
||||
extern osTimerId_t STA_RTOS_WATCHDOG_TIMER_HANDLE;
|
||||
#include "handles.hpp"
|
||||
|
||||
|
||||
namespace sta
|
||||
{
|
||||
void startWatchdogTimer()
|
||||
{
|
||||
osTimerStart(STA_RTOS_WATCHDOG_TIMER_HANDLE, STA_RTOS_WATCHDOG_TIMER_PERIOD);
|
||||
osTimerStart(WATCHDOG_TIMER_HANDLE, STA_RTOS_WATCHDOG_TIMER_PERIOD);
|
||||
}
|
||||
} // namespace sta
|
||||
|
||||
@@ -25,7 +21,7 @@ extern "C"
|
||||
{
|
||||
// Notify watchdog task to send heartbeat message
|
||||
// Required because blocking in a timer callback is not allowed
|
||||
sta::notifyWatchdog(STA_WATCHDOG_FLAG_HEARTBEAT);
|
||||
osThreadFlagsSet(WATCHDOG_TASK_HANDLE, STA_WATCHDOG_FLAG_HEARTBEAT);
|
||||
}
|
||||
}
|
||||
|
@@ -1,24 +1,19 @@
|
||||
#include <sta/rtos/watchdog.hpp>
|
||||
#include <sta/rtos/system/watchdog.hpp>
|
||||
|
||||
#ifdef STA_RTOS_WATCHDOG_ENABLE
|
||||
|
||||
#include <sta/rtos/defs.hpp>
|
||||
#include <sta/rtos/system_event.hpp>
|
||||
|
||||
#include <main.h>
|
||||
|
||||
#include <cmsis_os2.h>
|
||||
#include <sta/rtos/system/system_event.hpp>
|
||||
|
||||
|
||||
// Access handle from freertos.c
|
||||
extern osThreadId_t STA_RTOS_WATCHDOG_HANDLE;
|
||||
#include "handles.hpp"
|
||||
|
||||
|
||||
namespace sta
|
||||
{
|
||||
void notifyWatchdog(uint32_t flags)
|
||||
{
|
||||
osThreadFlagsSet(STA_RTOS_WATCHDOG_HANDLE, flags);
|
||||
osThreadFlagsSet(WATCHDOG_TASK_HANDLE, flags);
|
||||
}
|
||||
} // namespace sta
|
||||
|
Reference in New Issue
Block a user