Move watchdog files

This commit is contained in:
Henrik Stickann
2022-05-24 14:04:24 +02:00
parent 8e4dbe1100
commit 1cfae97cae
4 changed files with 52 additions and 28 deletions

View 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

View File

@@ -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);
}
}

View File

@@ -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