2021-02-14 18:39:50 +01:00
|
|
|
#ifndef LINUX_GPIO_GPIOIF_H_
|
|
|
|
#define LINUX_GPIO_GPIOIF_H_
|
2021-01-23 17:22:40 +01:00
|
|
|
|
2021-02-14 18:39:50 +01:00
|
|
|
#include "gpioDefinitions.h"
|
2021-01-23 17:22:40 +01:00
|
|
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
|
|
|
#include <fsfw/devicehandlers/CookieIF.h>
|
|
|
|
|
2021-02-14 18:39:50 +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 {
|
2021-01-23 17:22:40 +01:00
|
|
|
public:
|
2021-01-28 14:55:21 +01:00
|
|
|
|
2021-02-01 11:17:20 +01:00
|
|
|
virtual ~GpioIF() {};
|
2021-01-23 17:22:40 +01:00
|
|
|
|
|
|
|
/**
|
2021-02-14 18:39:50 +01:00
|
|
|
* @brief Called by the GPIO using object.
|
2021-01-23 17:22:40 +01:00
|
|
|
* @param cookie Cookie specifying informations of the GPIOs required
|
|
|
|
* by a object.
|
|
|
|
*/
|
2021-02-23 13:24:05 +01:00
|
|
|
virtual ReturnValue_t addGpios(GpioCookie* cookie) = 0;
|
2021-01-23 17:22:40 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @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.
|
2021-02-22 17:36:44 +01:00
|
|
|
* @return Returns RETURN_OK for success. This should never return RETURN_FAILED.
|
2021-01-23 17:22:40 +01:00
|
|
|
*/
|
|
|
|
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;
|
2021-02-12 21:23:35 +01:00
|
|
|
|
|
|
|
/**
|
2021-02-14 15:49:03 +01:00
|
|
|
* @brief This function requires a child to implement the functionality to read the state of
|
2021-02-12 21:23:35 +01:00
|
|
|
* 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
|
|
|
};
|
|
|
|
|
2021-02-14 18:39:50 +01:00
|
|
|
#endif /* LINUX_GPIO_GPIOIF_H_ */
|