fsfw/src/fsfw_hal/common/gpio/GpioCookie.h

41 lines
931 B
C
Raw Normal View History

2021-07-13 19:19:25 +02:00
#ifndef COMMON_GPIO_GPIOCOOKIE_H_
#define COMMON_GPIO_GPIOCOOKIE_H_
#include <fsfw/devicehandlers/CookieIF.h>
2022-08-16 12:48:22 +02:00
#include <fsfw/returnvalues/returnvalue.h>
2021-07-13 19:19:25 +02:00
2022-02-02 10:29:30 +01:00
#include "GpioIF.h"
#include "gpioDefinitions.h"
2021-07-13 19:19:25 +02: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
*/
2022-02-02 10:29:30 +01:00
class GpioCookie : public CookieIF {
public:
GpioCookie();
2021-07-13 19:19:25 +02:00
2022-02-02 10:29:30 +01:00
virtual ~GpioCookie();
2021-07-13 19:19:25 +02:00
2022-02-02 10:29:30 +01:00
ReturnValue_t addGpio(gpioId_t gpioId, GpioBase* gpioConfig);
2021-07-13 19:19:25 +02:00
2022-02-02 10:29:30 +01:00
/**
* @brief Get map with registered GPIOs.
*/
GpioMap getGpioMap() const;
2021-07-13 19:19:25 +02:00
2022-02-02 10:29:30 +01:00
private:
/**
* Returns a copy of the internal GPIO map.
*/
GpioMap gpioMap;
2021-07-13 19:19:25 +02:00
};
#endif /* COMMON_GPIO_GPIOCOOKIE_H_ */