GPIO HAL Updates #36

Merged
meierj merged 35 commits from mueller/gpio-hal-updates into eive/develop 2022-03-03 09:44:47 +01:00
2 changed files with 25 additions and 6 deletions
Showing only changes of commit 6739890d53 - Show all commits

View File

@ -1,4 +1,13 @@
#include "fsfw_hal/linux/i2c/I2cComIF.h" #include "I2cComIF.h"
#include "fsfw/FSFW.h"
#include "fsfw/serviceinterface.h"
#include "fsfw_hal/linux/UnixFileGuard.h"
#include "fsfw_hal/linux/utility.h"
#if FSFW_HAL_I2C_WIRETAPPING == 1
#include "fsfw/globalfunctions/arrayprinter.h"
#endif
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
@ -8,11 +17,6 @@
#include <cstring> #include <cstring>
#include "fsfw/FSFW.h"
#include "fsfw/serviceinterface.h"
#include "fsfw_hal/linux/UnixFileGuard.h"
#include "fsfw_hal/linux/utility.h"
I2cComIF::I2cComIF(object_id_t objectId) : SystemObject(objectId) {} I2cComIF::I2cComIF(object_id_t objectId) : SystemObject(objectId) {}
I2cComIF::~I2cComIF() {} I2cComIF::~I2cComIF() {}
@ -112,6 +116,11 @@ ReturnValue_t I2cComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s
#endif #endif
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
#if FSFW_HAL_I2C_WIRETAPPING == 1
sif::info << "Sent I2C data to bus " << deviceFile << ":" << std::endl;
arrayprinter::print(sendData, sendLen);
#endif
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
@ -176,6 +185,11 @@ ReturnValue_t I2cComIF::requestReceiveMessage(CookieIF* cookie, size_t requestLe
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
#if FSFW_HAL_I2C_WIRETAPPING == 1
sif::info << "I2C read bytes from bus " << deviceFile << ":" << std::endl;
arrayprinter::print(replyBuffer, requestLen);
#endif
i2cDeviceMapIter->second.replyLen = requestLen; i2cDeviceMapIter->second.replyLen = requestLen;
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }

View File

@ -69,4 +69,9 @@
#define FSFW_HAL_LIS3MDL_MGM_DEBUG 0 #define FSFW_HAL_LIS3MDL_MGM_DEBUG 0
#endif /* FSFW_HAL_LIS3MDL_MGM_DEBUG */ #endif /* FSFW_HAL_LIS3MDL_MGM_DEBUG */
// Can be used for low-level debugging of the I2C bus
#ifndef FSFW_HAL_I2C_WIRETAPPING
#define FSFW_HAL_I2C_WIRETAPPING 0
#endif
#endif /* FSFW_FSFW_H_ */ #endif /* FSFW_FSFW_H_ */