2021-01-23 17:22:40 +01:00
|
|
|
#ifndef BSP_Q7S_GPIO_GPIOIF_H_
|
|
|
|
#define BSP_Q7S_GPIO_GPIOIF_H_
|
|
|
|
|
|
|
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
|
|
|
#include <fsfw/devicehandlers/CookieIF.h>
|
|
|
|
|
|
|
|
typedef uint16_t gpioId_t;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief This class defines the interface for objects requiring the control
|
|
|
|
* over GPIOs.
|
|
|
|
* @author J. Meier
|
|
|
|
*/
|
|
|
|
class GpioIF : public HasReturnvaluesIF{
|
|
|
|
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
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Called by the GPIO using object.
|
|
|
|
* @param cookie Cookie specifying informations of the GPIOs required
|
|
|
|
* by a object.
|
|
|
|
*/
|
|
|
|
virtual ReturnValue_t initialize(CookieIF * 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.
|
|
|
|
*/
|
|
|
|
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
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief This function requires a child to implement the functionaliy 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 /* BSP_Q7S_GPIO_GPIOIF_H_ */
|