Merge remote-tracking branch 'upstream/development' into mueller/gpio-hal-updates

This commit is contained in:
Robin Müller 2022-02-28 15:21:39 +01:00
commit 27267b7cb0
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
3 changed files with 29 additions and 6 deletions

View File

@ -16,6 +16,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
`IN` and `OUT` in `Direction` changed to `DIR_IN` and `DIR_OUT`. `IN` and `OUT` in `Direction` changed to `DIR_IN` and `DIR_OUT`.
`CALLBACK` in `GpioTypes` changed to `TYPE_CALLBACK` `CALLBACK` in `GpioTypes` changed to `TYPE_CALLBACK`
## Additions
- Linux HAL: Add wiretapping option for I2C. Enabled with `FSFW_HAL_I2C_WIRETAPPING` defined to 1
# [v4.0.0] # [v4.0.0]
## Additions ## Additions

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_ */