added service 20
This commit is contained in:
@ -4,17 +4,23 @@
|
||||
GpioCookie::GpioCookie() {
|
||||
}
|
||||
|
||||
void GpioCookie::addGpio(gpioId_t gpioId, GpioConfig_t gpioConfig){
|
||||
ReturnValue_t GpioCookie::addGpio(gpioId_t gpioId, GpioConfig_t& gpioConfig){
|
||||
auto gpioMapIter = gpioMap.find(gpioId);
|
||||
if(gpioMapIter == gpioMap.end()) {
|
||||
auto statusPair = gpioMap.emplace(gpioId, gpioConfig);
|
||||
if (statusPair.second == false) {
|
||||
#if FSFW_VERBOSE_LEVEL >= 1
|
||||
sif::error << "GpioCookie::addGpio: Failed to add GPIO " << gpioId <<
|
||||
"to GPIO map" << std::endl;
|
||||
#endif
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
return;
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
#if FSFW_VERBOSE_LEVEL >= 1
|
||||
sif::error << "GpioCookie::addGpio: GPIO already exists in GPIO map " << std::endl;
|
||||
#endif
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
||||
GpioMap GpioCookie::getGpioMap() const {
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
|
||||
virtual ~GpioCookie();
|
||||
|
||||
void addGpio(gpioId_t gpioId, GpioConfig_t gpioConfig);
|
||||
ReturnValue_t addGpio(gpioId_t gpioId, GpioConfig_t& gpioConfig);
|
||||
/**
|
||||
* @brief Get map with registered GPIOs.
|
||||
*/
|
||||
|
@ -29,6 +29,7 @@ public:
|
||||
* functionality to pull a certain GPIO to high logic level.
|
||||
*
|
||||
* @param gpioId A unique number which specifies the GPIO to drive.
|
||||
* @return Returns RETURN_OK for success. This should never return RETURN_FAILED.
|
||||
*/
|
||||
virtual ReturnValue_t pullHigh(gpioId_t gpioId) = 0;
|
||||
|
||||
|
@ -58,6 +58,7 @@ private:
|
||||
* @brief Performs the initial configuration of all GPIOs specified in the GpioMap mapToAdd.
|
||||
*/
|
||||
ReturnValue_t configureGpios(GpioMap& mapToAdd);
|
||||
|
||||
};
|
||||
|
||||
#endif /* LINUX_GPIO_LINUXLIBGPIOIF_H_ */
|
||||
|
@ -28,6 +28,9 @@ enum Direction {
|
||||
* pointer.
|
||||
*/
|
||||
typedef struct GpioConfig {
|
||||
GpioConfig(): chipname(), lineNum(0), consumer(), direction(gpio::Direction::OUT),
|
||||
initValue(0) {};
|
||||
|
||||
GpioConfig(std::string chipname_, int lineNum_, std::string consumer_,
|
||||
gpio::Direction direction_, int initValue_):
|
||||
chipname(chipname_), lineNum(lineNum_), consumer(consumer_),
|
||||
|
Reference in New Issue
Block a user