Update FSFW #24

Merged
muellerr merged 160 commits from mueller/master into master 2021-09-26 22:54:37 +02:00
2 changed files with 36 additions and 7 deletions
Showing only changes of commit e02879184b - Show all commits

View File

@ -85,7 +85,19 @@ public:
GpioBase(gpio::GpioTypes::GPIO_REGULAR, consumer_, gpio::Direction::IN, 0),
chipname(chipname_), lineNum(lineNum_) {
}
std::string chipname;
GpiodRegular(std::string consumer_, gpio::Direction direction_, int initValue_,
std::string label_, int lineNum_) :
GpioBase(gpio::GpioTypes::GPIO_REGULAR, consumer_, direction_, initValue_), label(
label_), lineNum(lineNum_) {
}
GpiodRegular(std::string consumer_, std::string label_, int lineNum_) :
GpioBase(gpio::GpioTypes::GPIO_REGULAR, consumer_, gpio::Direction::IN, 0), label(
label_), lineNum(lineNum_) {
}
std::string chipname = "NONE";
std::string label = "NONE";
int lineNum = 0;
struct gpiod_line* lineHandle = nullptr;
};

View File

@ -20,7 +20,7 @@ LinuxLibgpioIF::~LinuxLibgpioIF() {
ReturnValue_t LinuxLibgpioIF::addGpios(GpioCookie* gpioCookie) {
ReturnValue_t result;
if(gpioCookie == nullptr) {
sif::error << "LinuxLibgpioIF::initialize: Invalid cookie" << std::endl;
sif::error << "LinuxLibgpioIF::addGpios: Invalid cookie" << std::endl;
return RETURN_FAILED;
}
@ -72,6 +72,7 @@ ReturnValue_t LinuxLibgpioIF::configureGpios(GpioMap& mapToAdd) {
ReturnValue_t LinuxLibgpioIF::configureRegularGpio(gpioId_t gpioId, GpiodRegular *regularGpio) {
std::string chipname;
std::string label;
unsigned int lineNum;
struct gpiod_chip *chip;
gpio::Direction direction;
@ -80,12 +81,28 @@ ReturnValue_t LinuxLibgpioIF::configureRegularGpio(gpioId_t gpioId, GpiodRegular
int result = 0;
chipname = regularGpio->chipname;
if (chipname != "NONE") {
chip = gpiod_chip_open_by_name(chipname.c_str());
if (!chip) {
sif::warning << "LinuxLibgpioIF::configureRegularGpio: Failed to open chip "
<< chipname << ". Gpio ID: " << gpioId << std::endl;
return RETURN_FAILED;
}
}
else if (label != "NONE") {
label = regularGpio->label;
chip = gpiod_chip_open_by_label(label.c_str());
if (!chip) {
sif::warning << "LinuxLibgpioIF::configureRegularGpio: Failed to open gpio from gpio "
<< "group with label " << label << ". Gpio ID: " << gpioId << std::endl;
return RETURN_FAILED;
}
}
else {
sif::warning << "LinuxLibgpioIF::configureRegularGpio: No gpio group specified"
<< std::endl;
}
lineNum = regularGpio->lineNum;
lineHandle = gpiod_chip_get_line(chip, lineNum);