Merge branch 'meier/master' into mueller/master

This commit is contained in:
Robin Müller 2021-06-15 16:04:45 +02:00
commit 4f825a10cd
3 changed files with 22 additions and 6 deletions

View File

@ -61,7 +61,7 @@ public:
virtual~ GpioBase() {}; virtual~ GpioBase() {};
/* Can be used to cast GpioBase to a concrete child implementation */ // Can be used to cast GpioBase to a concrete child implementation
gpio::GpioTypes gpioType = gpio::GpioTypes::NONE; gpio::GpioTypes gpioType = gpio::GpioTypes::NONE;
std::string consumer; std::string consumer;
gpio::Direction direction = gpio::Direction::IN; gpio::Direction direction = gpio::Direction::IN;
@ -70,13 +70,21 @@ public:
class GpiodRegular: public GpioBase { class GpiodRegular: public GpioBase {
public: public:
GpiodRegular(): GpioBase(gpio::GpioTypes::GPIO_REGULAR, std::string(), GpiodRegular() :
gpio::Direction::IN, 0) {}; GpioBase(gpio::GpioTypes::GPIO_REGULAR, std::string(), gpio::Direction::IN, 0) {
}
;
GpiodRegular(std::string chipname_, int lineNum_, std::string consumer_, GpiodRegular(std::string chipname_, int lineNum_, std::string consumer_,
gpio::Direction direction_, int initValue_) : gpio::Direction direction_, int initValue_) :
GpioBase(gpio::GpioTypes::GPIO_REGULAR, consumer_, direction_, initValue_), GpioBase(gpio::GpioTypes::GPIO_REGULAR, consumer_, direction_, initValue_),
chipname(chipname_), lineNum(lineNum_) {} chipname(chipname_), lineNum(lineNum_) {
}
GpiodRegular(std::string chipname_, int lineNum_, std::string consumer_) :
GpioBase(gpio::GpioTypes::GPIO_REGULAR, consumer_, gpio::Direction::IN, 0),
chipname(chipname_), lineNum(lineNum_) {
}
std::string chipname; std::string chipname;
int lineNum = 0; int lineNum = 0;
struct gpiod_line* lineHandle = nullptr; struct gpiod_line* lineHandle = nullptr;

View File

@ -146,10 +146,16 @@ ReturnValue_t I2cComIF::requestReceiveMessage(CookieIF *cookie,
uint8_t* replyBuffer = i2cDeviceMapIter->second.replyBuffer.data(); uint8_t* replyBuffer = i2cDeviceMapIter->second.replyBuffer.data();
if (read(fd, replyBuffer, requestLen) != static_cast<int>(requestLen)) { int readLen = read(fd, replyBuffer, requestLen);
if (readLen != static_cast<int>(requestLen)) {
#if FSFW_VERBOSE_LEVEL >= 1 and FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "I2cComIF::requestReceiveMessage: Reading from I2C " sif::error << "I2cComIF::requestReceiveMessage: Reading from I2C "
<< "device failed with error code " << errno <<". Description" << "device failed with error code " << errno <<". Description"
<< " of error: " << strerror(errno) << std::endl; << " of error: " << strerror(errno) << std::endl;
sif::error << "I2cComIF::requestReceiveMessage: Read only " << readLen << " from "
<< requestLen << " bytes" << std::endl;
#endif
i2cDeviceMapIter->second.replyLen = 0; i2cDeviceMapIter->second.replyLen = 0;
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }

View File

@ -12,6 +12,8 @@
* @brief This is the communication interface for i2c devices connected * @brief This is the communication interface for i2c devices connected
* to a system running a linux OS. * to a system running a linux OS.
* *
* @note The xilinx linux kernel does not support to read more than 255 bytes at once.
*
* @author J. Meier * @author J. Meier
*/ */
class I2cComIF: public DeviceCommunicationIF, public SystemObject { class I2cComIF: public DeviceCommunicationIF, public SystemObject {