2021-02-14 18:39:50 +01:00
|
|
|
#ifndef LINUX_GPIO_GPIOCOOKIE_H_
|
|
|
|
#define LINUX_GPIO_GPIOCOOKIE_H_
|
2021-01-23 17:22:40 +01:00
|
|
|
|
2021-02-14 12:35:08 +01:00
|
|
|
#include "GpioIF.h"
|
2021-02-14 18:39:50 +01:00
|
|
|
#include "gpioDefinitions.h"
|
2021-01-23 17:22:40 +01:00
|
|
|
#include <fsfw/devicehandlers/CookieIF.h>
|
2021-01-28 14:55:21 +01:00
|
|
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
2021-01-23 17:22:40 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Cookie for the GpioIF. Allows the GpioIF to determine which
|
|
|
|
* GPIOs to initialize and whether they should be configured as in- or
|
|
|
|
* output.
|
|
|
|
* @details One GpioCookie can hold multiple GPIO configurations. To add a new
|
|
|
|
* GPIO configuration to a GpioCookie use the GpioCookie::addGpio
|
|
|
|
* function.
|
|
|
|
*
|
|
|
|
* @author J. Meier
|
|
|
|
*/
|
|
|
|
class GpioCookie: public CookieIF {
|
|
|
|
public:
|
|
|
|
|
2021-02-14 12:35:08 +01:00
|
|
|
GpioCookie();
|
2021-01-23 17:22:40 +01:00
|
|
|
|
2021-02-14 12:35:08 +01:00
|
|
|
virtual ~GpioCookie();
|
2021-01-23 17:22:40 +01:00
|
|
|
|
2021-02-22 17:36:44 +01:00
|
|
|
ReturnValue_t addGpio(gpioId_t gpioId, GpioConfig_t& gpioConfig);
|
2021-02-14 12:35:08 +01:00
|
|
|
/**
|
|
|
|
* @brief Get map with registered GPIOs.
|
|
|
|
*/
|
2021-02-14 18:21:59 +01:00
|
|
|
GpioMap getGpioMap() const;
|
2021-01-23 17:22:40 +01:00
|
|
|
|
|
|
|
private:
|
2021-02-14 18:21:59 +01:00
|
|
|
/**
|
|
|
|
* Returns a copy of the internal GPIO map.
|
|
|
|
*/
|
2021-02-14 12:35:08 +01:00
|
|
|
GpioMap gpioMap;
|
2021-01-23 17:22:40 +01:00
|
|
|
};
|
|
|
|
|
2021-02-14 18:39:50 +01:00
|
|
|
#endif /* LINUX_GPIO_GPIOCOOKIE_H_ */
|