eive-obsw/bsp_q7s/comIF/GpioComIF.h

58 lines
1.7 KiB
C++

#ifndef BSP_Q7S_COMIF_I2s COMIF_H_
#define BSP_Q7S_COMIF_I2COMIF_H_
#include <fsfw/objectmanager/SystemObject.h>
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
#include <bsp_q7s/comIF/cookies/GpioCookie.h>
/**
* @brief This is the communication interface to drive GPIOs by using the
* the linux sysfs.
*
* @author J. Meier
*/
class GpioComIF: public DeviceCommunicationIF, public SystemObject {
public:
GpioComIF(object_id_t objectId);
virtual ~GpioComIF();
ReturnValue_t initializeInterface(CookieIF * cookie) override;
ReturnValue_t sendMessage(CookieIF *cookie,const uint8_t *sendData,
size_t sendLen) override;
ReturnValue_t getSendSuccess(CookieIF *cookie) override;
ReturnValue_t requestReceiveMessage(CookieIF *cookie,
size_t requestLen) override;
ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer,
size_t *size) override;
private:
/* All GPIOs will be stored in this map after successful initialization */
GpioMap gpioMap;
GpioMapIter gpioMapIter;
/**
* @brief This function checks if GPIOs are already registered and whether
* there exists a conflict in the GPIO configuration. E.g. the
* direction.
*
* @param mapToAdd The GPIOs which shall be added to the gpioMap
*
* @return RETURN_OK if successful, otherwise RETURN_FAILED
*/
ReturnValue_t checkForConflicts(GpioMap mapToAdd);
/**
* @brief This function initializes all GPIOs specified in the mapToAdd.
*
* @param Map with the GPIOs to initialize.
*
* @return RETURN_OK if successful, otherwise RETURN_FAILED
*/
ReturnValue_t GpioComIF::initializeAndConfigure(GpioMap mapToAdd);
};
#endif /* BSP_Q7S_COMIF_I2COMIF_H_ */