eive-obsw/archive/gpio/GpioIF.h

55 lines
1.6 KiB
C
Raw Permalink Normal View History

#ifndef LINUX_GPIO_GPIOIF_H_
#define LINUX_GPIO_GPIOIF_H_
2021-01-23 17:22:40 +01:00
#include <fsfw/devicehandlers/CookieIF.h>
2022-01-17 15:58:27 +01:00
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include "gpioDefinitions.h"
2021-01-23 17:22:40 +01:00
class GpioCookie;
2021-01-23 17:22:40 +01:00
/**
* @brief This class defines the interface for objects requiring the control
* over GPIOs.
* @author J. Meier
*/
2021-02-14 18:21:59 +01:00
class GpioIF : public HasReturnvaluesIF {
2022-01-17 15:58:27 +01:00
public:
virtual ~GpioIF(){};
/**
* @brief Called by the GPIO using object.
* @param cookie Cookie specifying informations of the GPIOs required
* by a object.
*/
virtual ReturnValue_t addGpios(GpioCookie* cookie) = 0;
/**
* @brief By implementing this function a child must provide the
* functionality to pull a certain GPIO to high logic level.
*
* @param gpioId A unique number which specifies the GPIO to drive.
* @return Returns RETURN_OK for success. This should never return RETURN_FAILED.
*/
virtual ReturnValue_t pullHigh(gpioId_t gpioId) = 0;
/**
* @brief By implementing this function a child must provide the
* functionality to pull a certain GPIO to low logic level.
*
* @param gpioId A unique number which specifies the GPIO to drive.
*/
virtual ReturnValue_t pullLow(gpioId_t gpioId) = 0;
/**
* @brief This function requires a child to implement the functionality to read the state of
* an ouput or input gpio.
*
* @param gpioId A unique number which specifies the GPIO to read.
* @param gpioState State of GPIO will be written to this pointer.
*/
virtual ReturnValue_t readGpio(gpioId_t gpioId, int* gpioState) = 0;
2021-01-23 17:22:40 +01:00
};
#endif /* LINUX_GPIO_GPIOIF_H_ */