Update Linux GPIO #20

Merged
meierj merged 26 commits from mueller/update-linux-gpio into eive/develop 2021-09-27 15:28:20 +02:00
8 changed files with 23 additions and 17 deletions
Showing only changes of commit 2b6c996364 - Show all commits

View File

@ -59,7 +59,6 @@ protected:
LocalDataPoolManager &poolManager) override; LocalDataPoolManager &poolManager) override;
private: private:
uint8_t switchId = 0;
uint32_t transitionDelayMs = 0; uint32_t transitionDelayMs = 0;
GyroPrimaryDataset dataset; GyroPrimaryDataset dataset;

View File

@ -154,7 +154,7 @@ enum MgmPoolIds: lp_id_t {
TEMPERATURE_CELCIUS TEMPERATURE_CELCIUS
}; };
class MgmPrimaryDataset: public StaticLocalDataSet<5> { class MgmPrimaryDataset: public StaticLocalDataSet<4> {
public: public:
MgmPrimaryDataset(HasLocalDataPoolIF* hkOwner): MgmPrimaryDataset(HasLocalDataPoolIF* hkOwner):
StaticLocalDataSet(hkOwner, MGM_DATA_SET_ID) {} StaticLocalDataSet(hkOwner, MGM_DATA_SET_ID) {}

View File

@ -108,7 +108,7 @@ enum MgmPoolIds: lp_id_t {
FIELD_STRENGTH_Z, FIELD_STRENGTH_Z,
}; };
class Rm3100PrimaryDataset: public StaticLocalDataSet<3 * sizeof(float)> { class Rm3100PrimaryDataset: public StaticLocalDataSet<3> {
public: public:
Rm3100PrimaryDataset(HasLocalDataPoolIF* hkOwner): Rm3100PrimaryDataset(HasLocalDataPoolIF* hkOwner):
StaticLocalDataSet(hkOwner, MGM_DATASET_ID) {} StaticLocalDataSet(hkOwner, MGM_DATASET_ID) {}

View File

@ -36,4 +36,5 @@
#ifndef FSFW_HAL_LIS3MDL_MGM_DEBUG #ifndef FSFW_HAL_LIS3MDL_MGM_DEBUG
#define FSFW_HAL_LIS3MDL_MGM_DEBUG 0 #define FSFW_HAL_LIS3MDL_MGM_DEBUG 0
#endif /* FSFW_HAL_LIS3MDL_MGM_DEBUG */ #endif /* FSFW_HAL_LIS3MDL_MGM_DEBUG */
#endif /* FSFW_FSFW_H_ */ #endif /* FSFW_FSFW_H_ */

View File

@ -16,15 +16,18 @@ InternalUnitTester::~InternalUnitTester() {}
ReturnValue_t InternalUnitTester::performTests( ReturnValue_t InternalUnitTester::performTests(
const struct InternalUnitTester::TestConfig& testConfig) { const struct InternalUnitTester::TestConfig& testConfig) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "Running internal unit tests.." << std::endl; sif::info << "Running internal unit tests.. Error messages might follow" <<
std::endl;
#else #else
sif::printInfo("Running internal unit tests..\n"); sif::printInfo("Running internal unit tests..\n");
#endif #endif
testserialize::test_serialization(); testserialize::test_serialization();
testmq::testMq(); testmq::testMq();
testsemaph::testBinSemaph(); if(testConfig.testSemaphores) {
testsemaph::testCountingSemaph(); testsemaph::testBinSemaph();
testsemaph::testCountingSemaph();
}
testmutex::testMutex(); testmutex::testMutex();
if(testConfig.testArrayPrinter) { if(testConfig.testArrayPrinter) {
arrayprinter::testArrayPrinter(); arrayprinter::testArrayPrinter();

View File

@ -18,6 +18,7 @@ class InternalUnitTester: public HasReturnvaluesIF {
public: public:
struct TestConfig { struct TestConfig {
bool testArrayPrinter = false; bool testArrayPrinter = false;
bool testSemaphores = true;
}; };
InternalUnitTester(); InternalUnitTester();

View File

@ -1,10 +1,12 @@
#include "fsfw_tests/internal/osal/IntTestMutex.h" #include "fsfw_tests/internal/osal/IntTestMutex.h"
#include "fsfw_tests/internal/UnittDefinitions.h" #include "fsfw_tests/internal/UnittDefinitions.h"
#include "fsfw/platform.h"
#include <fsfw/ipc/MutexFactory.h> #include <fsfw/ipc/MutexFactory.h>
#if defined(WIN32) || defined(UNIX) #if defined PLATFORM_WIN || defined PLATFORM_UNIX
#include <fsfw/osal/host/Mutex.h> #include "fsfw/osal/host/Mutex.h"
#include <thread> #include <thread>
#include <future> #include <future>
#endif #endif
@ -20,7 +22,7 @@ void testmutex::testMutex() {
// timed_mutex from the C++ library specifies undefined behaviour if // timed_mutex from the C++ library specifies undefined behaviour if
// the timed mutex is locked twice from the same thread. // the timed mutex is locked twice from the same thread.
// TODO: we should pass a define like FSFW_OSAL_HOST to the build. // TODO: we should pass a define like FSFW_OSAL_HOST to the build.
#if defined(WIN32) || defined(UNIX) #if defined PLATFORM_WIN || defined PLATFORM_UNIX
// This calls the function from // This calls the function from
// another thread and stores the returnvalue in a future. // another thread and stores the returnvalue in a future.
auto future = std::async(&MutexIF::lockMutex, mutex, MutexIF::TimeoutType::WAITING, 1); auto future = std::async(&MutexIF::lockMutex, mutex, MutexIF::TimeoutType::WAITING, 1);
@ -37,8 +39,7 @@ void testmutex::testMutex() {
unitt::put_error(id); unitt::put_error(id);
} }
// TODO: we should pass a define like FSFW_OSAL_HOST to the build. #if !defined PLATFORM_WIN && !defined PLATFORM_UNIX
#if !defined(WIN32) && !defined(UNIX)
result = mutex->unlockMutex(); result = mutex->unlockMutex();
if(result != MutexIF::CURR_THREAD_DOES_NOT_OWN_MUTEX) { if(result != MutexIF::CURR_THREAD_DOES_NOT_OWN_MUTEX) {
unitt::put_error(id); unitt::put_error(id);

View File

@ -1,9 +1,10 @@
#include "fsfw/FSFW.h"
#include "fsfw_tests/internal/osal/IntTestSemaphore.h" #include "fsfw_tests/internal/osal/IntTestSemaphore.h"
#include "fsfw_tests/internal/UnittDefinitions.h" #include "fsfw_tests/internal/UnittDefinitions.h"
#include <fsfw/tasks/SemaphoreFactory.h> #include "fsfw/tasks/SemaphoreFactory.h"
#include <fsfw/serviceinterface/ServiceInterface.h> #include "fsfw/serviceinterface/ServiceInterface.h"
#include <fsfw/timemanager/Stopwatch.h> #include "fsfw/timemanager/Stopwatch.h"
#include <cstdlib> #include <cstdlib>
@ -16,7 +17,7 @@ void testsemaph::testBinSemaph() {
} }
testBinSemaphoreImplementation(binSemaph, id); testBinSemaphoreImplementation(binSemaph, id);
SemaphoreFactory::instance()->deleteSemaphore(binSemaph); SemaphoreFactory::instance()->deleteSemaphore(binSemaph);
#if defined(freeRTOS) #if defined FSFW_OSAL_FREERTOS
SemaphoreIF* binSemaphUsingTask = SemaphoreIF* binSemaphUsingTask =
SemaphoreFactory::instance()->createBinarySemaphore(1); SemaphoreFactory::instance()->createBinarySemaphore(1);
testBinSemaphoreImplementation(binSemaphUsingTask, id); testBinSemaphoreImplementation(binSemaphUsingTask, id);
@ -36,7 +37,7 @@ void testsemaph::testCountingSemaph() {
} }
testBinSemaphoreImplementation(countingSemaph, id); testBinSemaphoreImplementation(countingSemaph, id);
SemaphoreFactory::instance()->deleteSemaphore(countingSemaph); SemaphoreFactory::instance()->deleteSemaphore(countingSemaph);
#if defined(freeRTOS) #if defined FSFW_OSAL_FREERTOS
countingSemaph = SemaphoreFactory::instance()-> countingSemaph = SemaphoreFactory::instance()->
createCountingSemaphore(1, 1, 1); createCountingSemaphore(1, 1, 1);
testBinSemaphoreImplementation(countingSemaph, id); testBinSemaphoreImplementation(countingSemaph, id);
@ -50,7 +51,7 @@ void testsemaph::testCountingSemaph() {
createCountingSemaphore(3,3); createCountingSemaphore(3,3);
testCountingSemaphImplementation(countingSemaph, id); testCountingSemaphImplementation(countingSemaph, id);
SemaphoreFactory::instance()->deleteSemaphore(countingSemaph); SemaphoreFactory::instance()->deleteSemaphore(countingSemaph);
#if defined(freeRTOS) #if defined FSFW_OSAL_FREERTOS
countingSemaph = SemaphoreFactory::instance()-> countingSemaph = SemaphoreFactory::instance()->
createCountingSemaphore(3, 0, 1); createCountingSemaphore(3, 0, 1);
uint8_t semaphCount = countingSemaph->getSemaphoreCounter(); uint8_t semaphCount = countingSemaph->getSemaphoreCounter();