spi com if finished

This commit is contained in:
2021-02-23 11:56:48 +01:00
parent 3550fb6ca7
commit e1e0c07746
5 changed files with 121 additions and 85 deletions

View File

@ -4,6 +4,7 @@
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
#include <fsfw/objectmanager/SystemObject.h>
#include <linux/gpio/GpioIF.h>
#include <returnvalues/classIds.h>
#include <vector>
#include <unordered_map>
@ -16,6 +17,16 @@
*/
class SpiComIF: public DeviceCommunicationIF, public SystemObject {
public:
static constexpr uint8_t spiRetvalId = CLASS_ID::LINUX_SPI_COM_IF;
static constexpr ReturnValue_t OPENING_FILE_FAILED =
HasReturnvaluesIF::makeReturnCode(spiRetvalId, 0);
/* Full duplex (ioctl) transfer failure */
static constexpr ReturnValue_t FULL_DUPLEX_TRANSFER_FAILED =
HasReturnvaluesIF::makeReturnCode(spiRetvalId, 1);
/* Half duplex (read/write) transfer failure */
static constexpr ReturnValue_t HALF_DUPLEX_TRANSFER_FAILED =
HasReturnvaluesIF::makeReturnCode(spiRetvalId, 2);
SpiComIF(object_id_t objectId, GpioIF* gpioComIF);
ReturnValue_t initializeInterface(CookieIF * cookie) override;
@ -43,15 +54,15 @@ private:
SpiDeviceMap spiDeviceMap;
/**
* @brief This function opens an SPI device and binds the opened file
* to a specific SPI address.
* @param deviceFile The name of the device file. E.g. spi-0
* @param i2cAddress The address of the SPI slave device.
* @param fileDescriptor Pointer to device descriptor.
* @return RETURN_OK if successful, otherwise RETURN_FAILED.
*/
ReturnValue_t openDevice(std::string deviceFile, int* fileDescriptor, bool nonBlocking = false);
// /**
// * @brief This function opens an SPI device and binds the opened file
// * to a specific SPI address.
// * @param deviceFile The name of the device file. E.g. spi-0
// * @param i2cAddress The address of the SPI slave device.
// * @param fileDescriptor Pointer to device descriptor.
// * @return RETURN_OK if successful, otherwise RETURN_FAILED.
// */
// ReturnValue_t openDevice(std::string deviceFile, int* fileDescriptor, bool nonBlocking = false);
ReturnValue_t getReadBuffer(address_t spiAddress, uint8_t** buffer);
};