better missed deadline handling

This commit is contained in:
2021-02-22 18:46:45 +01:00
parent b03420c706
commit e9ffa930de
19 changed files with 136 additions and 227 deletions

View File

@ -1,5 +1,4 @@
target_sources(${TARGET_NAME} PRIVATE
SpiTest.cpp
)

View File

@ -1,61 +0,0 @@
#include "SpiTest.h"
#include <fsfw/serviceinterface/ServiceInterface.h>
#include <fcntl.h>
#include <sys/ioctl.h>
SpiTest::SpiTest(object_id_t objectId): SystemObject(objectId) {
sif::info << "Setting up Raspberry Pi WiringPi library." << std::endl;
// wiringPiSetupGpio();
// pinMode(SS_MGM_0_LIS3, OUTPUT);
// pinMode(SS_MGM_1_RM, OUTPUT);
// pinMode(SS_GYRO_0_ADIS, OUTPUT);
// pinMode(SS_GYRO_1_L3G, OUTPUT);
// pinMode(SS_GYRO_2_L3G, OUTPUT);
// pinMode(SS_MGM_2_LIS3, OUTPUT);
// pinMode(SS_MGM_3_RM, OUTPUT);
//
// digitalWrite(SS_MGM_0_LIS3, HIGH);
// digitalWrite(SS_MGM_1_RM, HIGH);
// digitalWrite(SS_GYRO_0_ADIS, HIGH);
// digitalWrite(SS_GYRO_1_L3G, HIGH);
// digitalWrite(SS_GYRO_2_L3G, HIGH);
// digitalWrite(SS_MGM_2_LIS3, HIGH);
// digitalWrite(SS_MGM_3_RM, HIGH);
int spiFd = open(spiDeviceName.c_str(), O_RDWR);
if (spiFd < 0){
sif::error << "Could not open SPI device!" << std::endl;
}
spiMode = SPI_MODE_3;
int ret = ioctl(spiFd, SPI_IOC_WR_MODE, &spiMode);
if(ret < 0) {
sif::error << "Could not set write mode!" << std::endl;
}
/* Datenrate setzen */
ret = ioctl(spiFd, SPI_IOC_WR_MAX_SPEED_HZ, &spiSpeed);
if(ret < 0) {
sif::error << "Could not SPI speed!" << std::endl;
}
}
ReturnValue_t SpiTest::performOperation(uint8_t opCode) {
if(oneShot) {
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t SpiTest::initialize() {
//transferHandle.rx_buf = reinterpret_cast<__u64>(receiveBuffer);
//transferHandle.tx_buf = reinterpret_cast<__u64>(sendBuffer);
//transferHandle.speed_hz = 976000;
//transferHandle.len = 2;
return HasReturnvaluesIF::RETURN_OK;
}

View File

@ -1,45 +0,0 @@
#ifndef BSP_LINUX_TEST_SPITEST_H_
#define BSP_LINUX_TEST_SPITEST_H_
#include <fsfw/objectmanager/SystemObject.h>
#include <fsfw/tasks/ExecutableObjectIF.h>
#include <linux/spi/spidev.h>
#include <string>
class SpiTest:
public SystemObject,
public ExecutableObjectIF {
public:
SpiTest(object_id_t objectId);
ReturnValue_t performOperation(uint8_t opCode) override;
ReturnValue_t initialize() override;
private:
// These chip selects (BCM number) will be pulled high if not used
// ACS board specific.
enum SpiChipSelects {
SS_MGM_0_LIS3 = 0, //!< MGM 0, LIS3MDLTR, U6, A side
SS_MGM_1_RM = 1, //!< MGM 1, RM3100, U7, A side
SS_GYRO_0_ADIS = 2, //!< Gyro 0, ADIS16485, U3, A side
SS_GYRO_1_L3G = 3, //!< Gyro 1, L3GD20H, U4, A side
SS_GYRO_2_L3G = 4, //!< Gyro 2, L3GD20h, U5, B side
SS_MGM_2_LIS3 = 17, //!< MGM 2, LIS3MDLTR, U8, B side
SS_MGM_3_RM = 27, //!< MGM 3, RM3100, U9, B side
};
const std::string spiDeviceName = "/dev/spidev0.0";
int spiFd = 0;
uint8_t spiMode = SPI_MODE_3;
uint32_t spiSpeed = 976000;
uint8_t sendBuffer[32];
uint8_t receiveBuffer[32];
struct spi_ioc_transfer transferHandle;
bool oneShot = true;
};
#endif /* BSP_LINUX_TEST_SPITEST_H_ */