v1.10.0 #220
7
test/gpio/CMakeLists.txt
Normal file
7
test/gpio/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
||||
target_sources(${OBSW_NAME} PUBLIC
|
||||
DummyGpioIF.cpp
|
||||
)
|
||||
|
||||
target_include_directories(${OBSW_NAME} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
24
test/gpio/DummyGpioIF.cpp
Normal file
24
test/gpio/DummyGpioIF.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include "DummyGpioIF.h"
|
||||
|
||||
DummyGpioIF::DummyGpioIF() {
|
||||
}
|
||||
|
||||
DummyGpioIF::~DummyGpioIF() {
|
||||
}
|
||||
|
||||
ReturnValue_t DummyGpioIF::addGpios(GpioCookie* cookie) {
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t DummyGpioIF::pullHigh(gpioId_t gpioId) {
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t DummyGpioIF::pullLow(gpioId_t gpioId) {
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t DummyGpioIF::readGpio(gpioId_t gpioId, int* gpioState) {
|
||||
*gpioState = 0;
|
||||
return RETURN_OK;
|
||||
}
|
16
test/gpio/DummyGpioIF.h
Normal file
16
test/gpio/DummyGpioIF.h
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef TEST_GPIO_DUMMYGPIOIF_H_
|
||||
#define TEST_GPIO_DUMMYGPIOIF_H_
|
||||
|
||||
#include "fsfw_hal/common/gpio/GpioIF.h"
|
||||
|
||||
class DummyGpioIF : public GpioIF {
|
||||
public:
|
||||
DummyGpioIF();
|
||||
virtual ~DummyGpioIF();
|
||||
virtual ReturnValue_t addGpios(GpioCookie* cookie);
|
||||
virtual ReturnValue_t pullHigh(gpioId_t gpioId);
|
||||
virtual ReturnValue_t pullLow(gpioId_t gpioId);
|
||||
virtual ReturnValue_t readGpio(gpioId_t gpioId, int* gpioState);
|
||||
};
|
||||
|
||||
#endif /* TEST_GPIO_DUMMYGPIOIF_H_ */
|
30
test/gpio/GpioDummy.h
Normal file
30
test/gpio/GpioDummy.h
Normal file
@ -0,0 +1,30 @@
|
||||
#ifndef TEST_GPIODUMMY_H_
|
||||
#define TEST_GPIODUMMY_H_
|
||||
|
||||
#include "fsfw_hal/common/gpio/GpioIF.h"
|
||||
#include "fsfw_hal/common/gpio/gpioDefinitions.h"
|
||||
|
||||
/**
|
||||
* @brief Additional abstraction layer for handling GPIOs.
|
||||
*
|
||||
* @author J. Meier
|
||||
*/
|
||||
class Gpio {
|
||||
public:
|
||||
Gpio(gpioId_t gpioId, GpioIF* gpioIF) : gpioId(gpioId), gpioIF(gpioIF) {
|
||||
if (gpioIF == nullptr) {
|
||||
sif::error << "Gpio::Gpio: Invalid GpioIF" << std::endl;
|
||||
}
|
||||
}
|
||||
ReturnValue_t pullHigh() {
|
||||
return gpioIF->pullHigh(gpioId);
|
||||
}
|
||||
ReturnValue_t pullLow() {
|
||||
return gpioIF->pullLow(gpioId);
|
||||
}
|
||||
private:
|
||||
gpioId_t gpioId = gpio::NO_GPIO;
|
||||
GpioIF* gpioIF = nullptr;
|
||||
};
|
||||
|
||||
#endif /* TEST_GPIODUMMY_H_ */
|
Loading…
Reference in New Issue
Block a user