Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add second test for external watchdog timer #176

Merged
merged 1 commit into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Sts1CobcSw/Hal/IoNames.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ namespace sts1cobcsw::hal
inline constexpr auto led1Pin = pb12;
inline constexpr auto led2Pin = pb15;

inline constexpr auto watchdogClearPin = pa9;

inline constexpr auto epsBatteryGoodPin = pc15;
inline constexpr auto epsChargingPin = pc14;

Expand Down
3 changes: 3 additions & 0 deletions Tests/HardwareTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ target_link_libraries(Sts1CobcSwTests_Uart PRIVATE rodos::rodos Sts1CobcSw_Hal)
add_program(Watchdog Watchdog.test.cpp)
target_link_libraries(Sts1CobcSwTests_Watchdog PRIVATE rodos::rodos Sts1CobcSw_Hal)

add_program(WatchdogClear Watchdog.test.cpp WatchdogClear.test.cpp)
target_link_libraries(Sts1CobcSwTests_WatchdogClear PRIVATE rodos::rodos Sts1CobcSw_Hal)

get_property(
top_level_hw_test_targets
DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
Expand Down
8 changes: 4 additions & 4 deletions Tests/HardwareTests/Watchdog.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@

namespace sts1cobcsw
{
auto ledGpio = hal::GpioPin(hal::led1Pin);
static auto led1Gpio = hal::GpioPin(hal::led1Pin);


class WatchdogTest : public RODOS::StaticThread<>
{
void init() override
{
ledGpio.Direction(hal::PinDirection::out);
led1Gpio.Direction(hal::PinDirection::out);
}


void run() override
{
ledGpio.Reset();
led1Gpio.Reset();
RODOS::AT(RODOS::NOW() + 800 * RODOS::MILLISECONDS);
ledGpio.Set();
led1Gpio.Set();
}
} watchdogTest;
}
41 changes: 41 additions & 0 deletions Tests/HardwareTests/WatchdogClear.test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#include <Sts1CobcSw/Hal/GpioPin.hpp>
#include <Sts1CobcSw/Hal/IoNames.hpp>

#include <rodos_no_using_namespace.h>


namespace sts1cobcsw
{
static auto led2Gpio = hal::GpioPin(hal::led2Pin);
static auto watchdogClearGpio = hal::GpioPin(hal::watchdogClearPin);


class WatchdogClearTest : public RODOS::StaticThread<>
{
void init() override
{
led2Gpio.Direction(hal::PinDirection::out);
watchdogClearGpio.Direction(hal::PinDirection::out);
}


void run() override
{
auto toggle = true;
TIME_LOOP(0, 800 * RODOS::MILLISECONDS)
{
if(toggle)
{
led2Gpio.Reset();
watchdogClearGpio.Reset();
}
else
{
led2Gpio.Set();
watchdogClearGpio.Set();
}
toggle = not toggle;
}
}
} watchdogClearTest;
}
Loading