plpcdu stuff
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2022-02-10 15:39:54 +01:00
parent 77f718bfce
commit 9313fa4639
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
10 changed files with 91 additions and 9 deletions

View File

@ -46,6 +46,8 @@
#include "linux/devices/SolarArrayDeploymentHandler.h"
#include "linux/devices/SusHandler.h"
#include "linux/devices/devicedefinitions/SusDefinitions.h"
#include "linux/devices/PayloadPcduHandler.h"
#include "linux/devices/devicedefinitions/payloadPcduDefinitions.h"
#include "mission/core/GenericFactory.h"
#include "mission/devices/ACUHandler.h"
#include "mission/devices/BpxBatteryHandler.h"
@ -1034,6 +1036,55 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) {
#endif /* BOARD_TE0720 == 0 */
}
void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF) {
// Create all GPIO components first
GpioCookie* plPcduGpios = new GpioCookie;
GpiodRegularByLineName* gpio = nullptr;
std::string consumer;
// Switch pins are active high
consumer = "PLPCDU_ENB_VBAT_0";
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_VBAT0, consumer, gpio::DIR_OUT,
gpio::Levels::LOW);
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_VBAT0, gpio);
consumer = "PLPCDU_ENB_VBAT_1";
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_VBAT0, consumer, gpio::DIR_OUT,
gpio::Levels::LOW);
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_VBAT1, gpio);
consumer = "PLPCDU_ENB_DRO";
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_DRO, consumer, gpio::DIR_OUT,
gpio::Levels::LOW);
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_DRO, gpio);
consumer = "PLPCDU_ENB_HPA";
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_HPA, consumer, gpio::DIR_OUT,
gpio::Levels::LOW);
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_HPA, gpio);
consumer = "PLPCDU_ENB_MPA";
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_MPA, consumer, gpio::DIR_OUT,
gpio::Levels::LOW);
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_MPA, gpio);
consumer = "PLPCDU_ENB_X8";
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_X8, consumer, gpio::DIR_OUT,
gpio::Levels::LOW);
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_X8, gpio);
consumer = "PLPCDU_ENB_TX";
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_TX, consumer, gpio::DIR_OUT,
gpio::Levels::LOW);
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_TX, gpio);
// Chip select pin is active low
consumer = "PLPCDU_ADC_CS";
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ADC_CS, consumer, gpio::DIR_OUT,
gpio::Levels::HIGH);
plPcduGpios->addGpio(gpioIds::PLPCDU_ADC_CS, gpio);
gpioComIF->addGpios(plPcduGpios);
SpiCookie* spiCookie = new SpiCookie(addresses::PLPCDU_ADC, gpioIds::PLPCDU_ADC_CS,
q7s::SPI_DEFAULT_DEV, plpcdu::MAX_ADC_REPLY_SIZE, spi::DEFAULT_MAX_1227_MODE,
spi::DEFAULT_MAX_1227_SPEED);
// Create device handler components
auto plPcduHandler = PayloadPcduHandler(objects::PLPCDU_HANDLER, objects::SPI_COM_IF, spiCookie);
}
void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
#if BOARD_TE0720 == 0
new Q7STestTask(objects::TEST_TASK);

View File

@ -13,6 +13,8 @@ void produce(void* args);
void createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, UartComIF** uartComIF,
SpiComIF** spiComIF, I2cComIF** i2cComIF);
void createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF);
void createTmpComponents();
void createPcduComponents(LinuxLibgpioIF* gpioComIF);
void createRadSensorComponent(LinuxLibgpioIF* gpioComIF);

View File

@ -36,6 +36,7 @@ enum commonObjects: uint32_t {
GYRO_1_L3G_HANDLER = 0x44120111,
GYRO_2_ADIS_HANDLER = 0x44120212,
GYRO_3_L3G_HANDLER = 0x44120313,
PLPCDU_HANDLER = 0x44300000,
IMTQ_HANDLER = 0x44140014,
PLOC_MPSOC_HANDLER = 0x44330015,

View File

@ -33,9 +33,7 @@ ReturnValue_t PayloadPcduHandler::interpretDeviceReply(DeviceCommandId_t id,
return HasReturnvaluesIF::RETURN_OK;
}
uint32_t PayloadPcduHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) {
return 10000;
}
uint32_t PayloadPcduHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 10000; }
ReturnValue_t PayloadPcduHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) {

View File

@ -3,10 +3,11 @@
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
class PayloadPcduHandler: DeviceHandlerBase {
public:
class PayloadPcduHandler : DeviceHandlerBase {
public:
PayloadPcduHandler(object_id_t objectId, object_id_t comIF, CookieIF* cookie);
private:
private:
void doStartUp() override;
void doShutDown() override;
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
@ -20,7 +21,6 @@ private:
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override;
};
#endif /* LINUX_DEVICES_PLPCDUHANDLER_H_ */

View File

@ -0,0 +1,12 @@
#ifndef LINUX_DEVICES_DEVICEDEFINITIONS_PAYLOADPCDUDEFINITIONS_H_
#define LINUX_DEVICES_DEVICEDEFINITIONS_PAYLOADPCDUDEFINITIONS_H_
#include <cstddef>
namespace plpcdu {
static constexpr size_t MAX_ADC_REPLY_SIZE = 32;
}
#endif /* LINUX_DEVICES_DEVICEDEFINITIONS_PAYLOADPCDUDEFINITIONS_H_ */

View File

@ -52,6 +52,7 @@ debugging. */
#define OBSW_ADD_RTD_DEVICES 0
#define OBSW_ADD_TMP_DEVICES 0
#define OBSW_ADD_RAD_SENSORS 0
#define OBSW_ADD_PL_PCDU 0
#define OBSW_ADD_SYRLINKS 0
#define OBSW_ENABLE_SYRLINKS_TRANSMIT_TIMEOUT 0
#define OBSW_ENABLE_PERIODIC_HK 0

View File

@ -71,7 +71,8 @@ enum spiAddresses : address_t {
RW1,
RW2,
RW3,
RW4
RW4,
PLPCDU_ADC
};
/* Addresses of devices supporting the CSP protocol */

View File

@ -110,7 +110,16 @@ enum gpioId_t {
RS485_EN_RX_DATA,
RS485_EN_RX_CLOCK,
BIT_RATE_SEL
BIT_RATE_SEL,
PLPCDU_ENB_VBAT0,
PLPCDU_ENB_VBAT1,
PLPCDU_ENB_DRO,
PLPCDU_ENB_HPA,
PLPCDU_ENB_MPA,
PLPCDU_ENB_X8,
PLPCDU_ENB_TX,
PLPCDU_ADC_CS
};
}

View File

@ -28,6 +28,13 @@ ReturnValue_t pst::pstGpio(FixedTimeslotTaskIF *thisSequence) {
ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
uint32_t length = thisSequence->getPeriodMs();
static_cast<void>(length);
#if OBSW_ADD_PL_PCDU == 1
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
#endif
#if OBSW_ADD_TMP_DEVICES == 1
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0, DeviceHandlerIF::PERFORM_OPERATION);