Skip to content

Commit

Permalink
Add HW test for temperature sensor
Browse files Browse the repository at this point in the history
  • Loading branch information
M-C-machts committed Dec 13, 2024
1 parent d2dc8ba commit 1f011a2
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Tests/HardwareTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ target_link_libraries(
)
add_watchdog_version_of(SpiSupervisor)

add_program(TemperatureSensor TemperatureSensor.test.cpp)
target_link_libraries(
Sts1CobcSwTests_TemperatureSensor PRIVATE rodos::rodos Sts1CobcSw_Periphery
Sts1CobcSwTests_RfLatchupDisablePin
)
add_watchdog_version_of(TemperatureSensor)

add_program(Gpio Gpio.test.cpp)
target_link_libraries(
Sts1CobcSwTests_Gpio PRIVATE rodos::rodos Sts1CobcSw_Hal Sts1CobcSwTests_RfLatchupDisablePin
Expand Down
43 changes: 43 additions & 0 deletions Tests/HardwareTests/TemperatureSensor.test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#include <Tests/HardwareTests/RfLatchupDisablePin.hpp>

#include <rodos_no_using_namespace.h>

#include <Sts1CobcSw/Periphery/TemperatureSensor.hpp>


namespace sts1cobcsw
{
class TermperatureSensorTest : public RODOS::StaticThread<>
{
public:
TermperatureSensorTest() : StaticThread("TermperatureSensorTest")
{
}


private:
void init() override
{
InitializeRfLatchupDisablePins();
rftemperaturesensor::Initialize();
}


void run() override
{
using RODOS::PRINTF;

EnableRfLatchupProtection();

PRINTF("\nRF termperature sensor test\n\n");

auto const conversionFactor = 0.0403;
TIME_LOOP(0, 1000 * RODOS::MILLISECONDS)
{
auto temperature = rftemperaturesensor::Read();
PRINTF("raw value = %d\n", temperature);
PRINTF("temperature = %5.1f °C\n", temperature * conversionFactor);
}
}
} termperatureSensorTest;
}

0 comments on commit 1f011a2

Please sign in to comment.