Merge branch 'mueller/plpcdu-sus-updates' into mueller/master
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
This commit is contained in:
commit
8abd6c39e7
@ -44,11 +44,9 @@
|
||||
#include "linux/csp/CspComIF.h"
|
||||
#include "linux/csp/CspCookie.h"
|
||||
#include "linux/devices/GPSHyperionLinuxController.h"
|
||||
#include "linux/devices/PayloadPcduHandler.h"
|
||||
#include "linux/devices/SolarArrayDeploymentHandler.h"
|
||||
#include "linux/devices/SusHandler.h"
|
||||
#include "linux/devices/devicedefinitions/SusDefinitions.h"
|
||||
#include "linux/devices/devicedefinitions/payloadPcduDefinitions.h"
|
||||
#include "mission/core/GenericFactory.h"
|
||||
#include "mission/devices/ACUHandler.h"
|
||||
#include "mission/devices/BpxBatteryHandler.h"
|
||||
@ -60,6 +58,7 @@
|
||||
#include "mission/devices/PCDUHandler.h"
|
||||
#include "mission/devices/PDU1Handler.h"
|
||||
#include "mission/devices/PDU2Handler.h"
|
||||
#include "mission/devices/PayloadPcduHandler.h"
|
||||
#include "mission/devices/PlocMPSoCHandler.h"
|
||||
#include "mission/devices/RadiationSensorHandler.h"
|
||||
#include "mission/devices/RwHandler.h"
|
||||
@ -71,6 +70,7 @@
|
||||
#include "mission/devices/devicedefinitions/RadSensorDefinitions.h"
|
||||
#include "mission/devices/devicedefinitions/RwDefinitions.h"
|
||||
#include "mission/devices/devicedefinitions/SyrlinksDefinitions.h"
|
||||
#include "mission/devices/devicedefinitions/payloadPcduDefinitions.h"
|
||||
#include "mission/tmtc/CCSDSHandler.h"
|
||||
#include "mission/tmtc/VirtualChannel.h"
|
||||
#include "mission/utility/TmFunnel.h"
|
||||
@ -463,6 +463,20 @@ void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComI
|
||||
susHandler9->setToGoToNormalMode(true);
|
||||
susHandler10->setToGoToNormalMode(true);
|
||||
susHandler11->setToGoToNormalMode(true);
|
||||
#if OBSW_DEBUG_SUS == 1
|
||||
susHandler0->enablePeriodicPrintout(true, 3);
|
||||
susHandler1->enablePeriodicPrintout(true, 3);
|
||||
susHandler2->enablePeriodicPrintout(true, 3);
|
||||
susHandler3->enablePeriodicPrintout(true, 3);
|
||||
susHandler4->enablePeriodicPrintout(true, 3);
|
||||
susHandler5->enablePeriodicPrintout(true, 3);
|
||||
susHandler6->enablePeriodicPrintout(true, 3);
|
||||
susHandler7->enablePeriodicPrintout(true, 3);
|
||||
susHandler8->enablePeriodicPrintout(true, 3);
|
||||
susHandler9->enablePeriodicPrintout(true, 3);
|
||||
susHandler10->enablePeriodicPrintout(true, 3);
|
||||
susHandler11->enablePeriodicPrintout(true, 3);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* OBSW_ADD_SUN_SENSORS == 1 */
|
||||
@ -1193,8 +1207,15 @@ void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF*
|
||||
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, gpioComIF);
|
||||
auto plPcduHandler = new PayloadPcduHandler(objects::PLPCDU_HANDLER, objects::SPI_COM_IF,
|
||||
spiCookie, gpioComIF, false);
|
||||
#if OBSW_TEST_PL_PCDU == 1
|
||||
plPcduHandler->setStartUpImmediately();
|
||||
#if OBSW_DEBUG_PL_PCDU == 1
|
||||
plPcduHandler->setToGoToNormalModeImmediately(true);
|
||||
plPcduHandler->enablePeriodicPrintout(true, 5);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
|
||||
|
@ -4,19 +4,18 @@
|
||||
0x43400001;THERMAL_CONTROLLER
|
||||
0x44120006;MGM_0_LIS3_HANDLER
|
||||
0x44120010;GYRO_0_ADIS_HANDLER
|
||||
0x44120032;SUS_1
|
||||
0x44120033;SUS_2
|
||||
0x44120034;SUS_3
|
||||
0x44120035;SUS_4
|
||||
0x44120036;SUS_5
|
||||
0x44120037;SUS_6
|
||||
0x44120038;SUS_7
|
||||
0x44120039;SUS_8
|
||||
0x44120040;SUS_9
|
||||
0x44120041;SUS_10
|
||||
0x44120042;SUS_11
|
||||
0x44120043;SUS_12
|
||||
0x44120044;SUS_13
|
||||
0x44120032;SUS_0
|
||||
0x44120033;SUS_1
|
||||
0x44120034;SUS_2
|
||||
0x44120035;SUS_3
|
||||
0x44120036;SUS_4
|
||||
0x44120037;SUS_5
|
||||
0x44120038;SUS_6
|
||||
0x44120039;SUS_7
|
||||
0x44120040;SUS_8
|
||||
0x44120041;SUS_9
|
||||
0x44120042;SUS_10
|
||||
0x44120043;SUS_11
|
||||
0x44120047;RW1
|
||||
0x44120107;MGM_1_RM3100_HANDLER
|
||||
0x44120111;GYRO_1_L3G_HANDLER
|
||||
@ -36,6 +35,7 @@
|
||||
0x44250002;PDU2_HANDLER
|
||||
0x44250003;ACU_HANDLER
|
||||
0x44260000;BPX_BATT_HANDLER
|
||||
0x44300000;PLPCDU_HANDLER
|
||||
0x443200A5;RAD_SENSOR
|
||||
0x44330000;PLOC_UPDATER
|
||||
0x44330001;PLOC_MEMORY_DUMPER
|
||||
@ -101,6 +101,7 @@
|
||||
0x53ffffff;FSFW_OBJECTS_END
|
||||
0x54000010;SPI_TEST
|
||||
0x54000020;UART_TEST
|
||||
0x54000030;I2C_TEST
|
||||
0x5400AFFE;DUMMY_HANDLER
|
||||
0x5400CAFE;DUMMY_INTERFACE
|
||||
0x54123456;LIBGPIOD_TEST
|
||||
|
|
@ -1,8 +1,8 @@
|
||||
/**
|
||||
* @brief Auto-generated object translation file.
|
||||
* @details
|
||||
* Contains 110 translations.
|
||||
* Generated on: 2022-02-03 12:01:36
|
||||
* Contains 111 translations.
|
||||
* Generated on: 2022-02-21 17:31:37
|
||||
*/
|
||||
#include "translateObjects.h"
|
||||
|
||||
@ -12,6 +12,7 @@ const char *ACS_CONTROLLER_STRING = "ACS_CONTROLLER";
|
||||
const char *THERMAL_CONTROLLER_STRING = "THERMAL_CONTROLLER";
|
||||
const char *MGM_0_LIS3_HANDLER_STRING = "MGM_0_LIS3_HANDLER";
|
||||
const char *GYRO_0_ADIS_HANDLER_STRING = "GYRO_0_ADIS_HANDLER";
|
||||
const char *SUS_0_STRING = "SUS_0";
|
||||
const char *SUS_1_STRING = "SUS_1";
|
||||
const char *SUS_2_STRING = "SUS_2";
|
||||
const char *SUS_3_STRING = "SUS_3";
|
||||
@ -23,8 +24,6 @@ const char *SUS_8_STRING = "SUS_8";
|
||||
const char *SUS_9_STRING = "SUS_9";
|
||||
const char *SUS_10_STRING = "SUS_10";
|
||||
const char *SUS_11_STRING = "SUS_11";
|
||||
const char *SUS_12_STRING = "SUS_12";
|
||||
const char *SUS_13_STRING = "SUS_13";
|
||||
const char *RW1_STRING = "RW1";
|
||||
const char *MGM_1_RM3100_HANDLER_STRING = "MGM_1_RM3100_HANDLER";
|
||||
const char *GYRO_1_L3G_HANDLER_STRING = "GYRO_1_L3G_HANDLER";
|
||||
@ -44,6 +43,7 @@ const char *PDU1_HANDLER_STRING = "PDU1_HANDLER";
|
||||
const char *PDU2_HANDLER_STRING = "PDU2_HANDLER";
|
||||
const char *ACU_HANDLER_STRING = "ACU_HANDLER";
|
||||
const char *BPX_BATT_HANDLER_STRING = "BPX_BATT_HANDLER";
|
||||
const char *PLPCDU_HANDLER_STRING = "PLPCDU_HANDLER";
|
||||
const char *RAD_SENSOR_STRING = "RAD_SENSOR";
|
||||
const char *PLOC_UPDATER_STRING = "PLOC_UPDATER";
|
||||
const char *PLOC_MEMORY_DUMPER_STRING = "PLOC_MEMORY_DUMPER";
|
||||
@ -109,6 +109,7 @@ const char *TIME_STAMPER_STRING = "TIME_STAMPER";
|
||||
const char *FSFW_OBJECTS_END_STRING = "FSFW_OBJECTS_END";
|
||||
const char *SPI_TEST_STRING = "SPI_TEST";
|
||||
const char *UART_TEST_STRING = "UART_TEST";
|
||||
const char *I2C_TEST_STRING = "I2C_TEST";
|
||||
const char *DUMMY_HANDLER_STRING = "DUMMY_HANDLER";
|
||||
const char *DUMMY_INTERFACE_STRING = "DUMMY_INTERFACE";
|
||||
const char *LIBGPIOD_TEST_STRING = "LIBGPIOD_TEST";
|
||||
@ -132,31 +133,29 @@ const char* translateObject(object_id_t object) {
|
||||
case 0x44120010:
|
||||
return GYRO_0_ADIS_HANDLER_STRING;
|
||||
case 0x44120032:
|
||||
return SUS_1_STRING;
|
||||
return SUS_0_STRING;
|
||||
case 0x44120033:
|
||||
return SUS_2_STRING;
|
||||
return SUS_1_STRING;
|
||||
case 0x44120034:
|
||||
return SUS_3_STRING;
|
||||
return SUS_2_STRING;
|
||||
case 0x44120035:
|
||||
return SUS_4_STRING;
|
||||
return SUS_3_STRING;
|
||||
case 0x44120036:
|
||||
return SUS_5_STRING;
|
||||
return SUS_4_STRING;
|
||||
case 0x44120037:
|
||||
return SUS_6_STRING;
|
||||
return SUS_5_STRING;
|
||||
case 0x44120038:
|
||||
return SUS_7_STRING;
|
||||
return SUS_6_STRING;
|
||||
case 0x44120039:
|
||||
return SUS_8_STRING;
|
||||
return SUS_7_STRING;
|
||||
case 0x44120040:
|
||||
return SUS_9_STRING;
|
||||
return SUS_8_STRING;
|
||||
case 0x44120041:
|
||||
return SUS_10_STRING;
|
||||
return SUS_9_STRING;
|
||||
case 0x44120042:
|
||||
return SUS_11_STRING;
|
||||
return SUS_10_STRING;
|
||||
case 0x44120043:
|
||||
return SUS_12_STRING;
|
||||
case 0x44120044:
|
||||
return SUS_13_STRING;
|
||||
return SUS_11_STRING;
|
||||
case 0x44120047:
|
||||
return RW1_STRING;
|
||||
case 0x44120107:
|
||||
@ -195,6 +194,8 @@ const char* translateObject(object_id_t object) {
|
||||
return ACU_HANDLER_STRING;
|
||||
case 0x44260000:
|
||||
return BPX_BATT_HANDLER_STRING;
|
||||
case 0x44300000:
|
||||
return PLPCDU_HANDLER_STRING;
|
||||
case 0x443200A5:
|
||||
return RAD_SENSOR_STRING;
|
||||
case 0x44330000:
|
||||
@ -325,6 +326,8 @@ const char* translateObject(object_id_t object) {
|
||||
return SPI_TEST_STRING;
|
||||
case 0x54000020:
|
||||
return UART_TEST_STRING;
|
||||
case 0x54000030:
|
||||
return I2C_TEST_STRING;
|
||||
case 0x5400AFFE:
|
||||
return DUMMY_HANDLER_STRING;
|
||||
case 0x5400CAFE:
|
||||
|
@ -296,35 +296,29 @@ void SpiTestClass::performOneShotMax1227Test() {
|
||||
adcCfg.testRadSensorExtConvWithDelay = false;
|
||||
adcCfg.testRadSensorIntConv = false;
|
||||
|
||||
adcCfg.testSus[0].doTest = true;
|
||||
adcCfg.testSus[0].intConv = true;
|
||||
adcCfg.testSus[6].doTest = true;
|
||||
adcCfg.testSus[6].intConv = true;
|
||||
bool setAllSusOn = false;
|
||||
bool susIntConv = false;
|
||||
bool susExtConv = false;
|
||||
if (setAllSusOn) {
|
||||
for (uint8_t idx = 0; idx < 12; idx++) {
|
||||
adcCfg.testSus[idx].doTest = true;
|
||||
}
|
||||
} else {
|
||||
for (uint8_t idx = 0; idx < 12; idx++) {
|
||||
adcCfg.testSus[idx].doTest = false;
|
||||
}
|
||||
}
|
||||
|
||||
adcCfg.testSus[1].doTest = true;
|
||||
adcCfg.testSus[1].intConv = true;
|
||||
adcCfg.testSus[7].doTest = true;
|
||||
adcCfg.testSus[7].intConv = true;
|
||||
|
||||
adcCfg.testSus[10].doTest = true;
|
||||
adcCfg.testSus[10].intConv = true;
|
||||
adcCfg.testSus[4].doTest = true;
|
||||
adcCfg.testSus[4].intConv = true;
|
||||
|
||||
adcCfg.testSus[11].doTest = true;
|
||||
adcCfg.testSus[11].intConv = true;
|
||||
adcCfg.testSus[5].doTest = true;
|
||||
adcCfg.testSus[5].intConv = true;
|
||||
|
||||
adcCfg.testSus[2].doTest = true;
|
||||
adcCfg.testSus[2].intConv = true;
|
||||
adcCfg.testSus[3].doTest = true;
|
||||
adcCfg.testSus[3].intConv = true;
|
||||
|
||||
adcCfg.testSus[8].doTest = true;
|
||||
adcCfg.testSus[8].intConv = true;
|
||||
adcCfg.testSus[9].doTest = true;
|
||||
adcCfg.testSus[9].intConv = true;
|
||||
if (susIntConv) {
|
||||
for (uint8_t idx = 0; idx < 12; idx++) {
|
||||
adcCfg.testSus[idx].intConv = true;
|
||||
}
|
||||
}
|
||||
if (susExtConv) {
|
||||
for (uint8_t idx = 0; idx < 12; idx++) {
|
||||
adcCfg.testSus[idx].extConv = true;
|
||||
}
|
||||
}
|
||||
|
||||
adcCfg.plPcduAdcExtConv = false;
|
||||
adcCfg.plPcduAdcIntConv = true;
|
||||
@ -334,7 +328,7 @@ void SpiTestClass::performOneShotMax1227Test() {
|
||||
void SpiTestClass::performPeriodicMax1227Test() {
|
||||
using namespace max1227;
|
||||
adcCfg.testRadSensorExtConvWithDelay = false;
|
||||
adcCfg.testRadSensorIntConv = false;
|
||||
adcCfg.testRadSensorIntConv = true;
|
||||
|
||||
adcCfg.plPcduAdcExtConv = false;
|
||||
adcCfg.plPcduAdcIntConv = false;
|
||||
|
@ -1,6 +1,5 @@
|
||||
target_sources(${OBSW_NAME} PRIVATE
|
||||
SolarArrayDeploymentHandler.cpp
|
||||
PayloadPcduHandler.cpp
|
||||
SusHandler.cpp
|
||||
)
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "devicedefinitions/GPSDefinitions.h"
|
||||
#include "fsfw/datapool/PoolReadGuard.h"
|
||||
#include "fsfw/timemanager/Clock.h"
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
#ifndef MISSION_DEVICES_GPSHYPERIONHANDLER_H_
|
||||
#define MISSION_DEVICES_GPSHYPERIONHANDLER_H_
|
||||
|
||||
#include "devicedefinitions/GPSDefinitions.h"
|
||||
#include "fsfw/FSFW.h"
|
||||
#include "fsfw/controller/ExtendedControllerBase.h"
|
||||
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
|
||||
#include "mission/devices/devicedefinitions/GPSDefinitions.h"
|
||||
|
||||
#ifdef FSFW_OSAL_LINUX
|
||||
#include <gps.h>
|
||||
|
@ -1,161 +0,0 @@
|
||||
#include "PayloadPcduHandler.h"
|
||||
|
||||
#include "devices/gpioIds.h"
|
||||
|
||||
PayloadPcduHandler::PayloadPcduHandler(object_id_t objectId, object_id_t comIF, CookieIF* cookie,
|
||||
GpioIF* gpioIF)
|
||||
: DeviceHandlerBase(objectId, comIF, cookie), gpioIF(gpioIF) {}
|
||||
|
||||
void PayloadPcduHandler::doStartUp() {
|
||||
if ((state != States::PCDU_OFF) and (state != States::ON_TRANS_SSR)) {
|
||||
// Config error
|
||||
sif::error << "PayloadPcduHandler::doStartUp: Invalid state" << std::endl;
|
||||
}
|
||||
if (state == States::PCDU_OFF) {
|
||||
// Switch on relays here
|
||||
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_VBAT0);
|
||||
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_VBAT1);
|
||||
state = States::ON_TRANS_SSR;
|
||||
transitionOk = true;
|
||||
}
|
||||
if (state == States::ON_TRANS_SSR) {
|
||||
// If necessary, check whether a certain amount of time has elapsed
|
||||
if (transitionOk) {
|
||||
transitionOk = false;
|
||||
// We are now in ON mode
|
||||
setMode(MODE_ON);
|
||||
// The ADC can now be read. If the values are not close to zero, we should not allow
|
||||
// transition
|
||||
monMode = MonitoringMode::CLOSE_TO_ZERO;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PayloadPcduHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
|
||||
if (mode == _MODE_TO_NORMAL) {
|
||||
if (state == States::ON_TRANS_ADC_CLOSE_ZERO) {
|
||||
if (not commandExecuted) {
|
||||
countdown.resetTimer();
|
||||
commandExecuted = true;
|
||||
}
|
||||
// ADC values are ok, 5 seconds have elapsed
|
||||
if (transitionOk and countdown.hasTimedOut()) {
|
||||
state = States::ON_TRANS_DRO;
|
||||
// Now start monitoring for negative voltages instead
|
||||
monMode = MonitoringMode::NEGATIVE;
|
||||
countdown.resetTimer();
|
||||
commandExecuted = false;
|
||||
transitionOk = false;
|
||||
}
|
||||
}
|
||||
if (state == States::ON_TRANS_DRO) {
|
||||
if (not commandExecuted) {
|
||||
// Switch on DRO and start monitoring for negative voltagea
|
||||
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_DRO);
|
||||
commandExecuted = true;
|
||||
}
|
||||
// ADC values are ok, 5 seconds have elapsed
|
||||
if (transitionOk and countdown.hasTimedOut()) {
|
||||
state = States::ON_TRANS_X8;
|
||||
countdown.resetTimer();
|
||||
commandExecuted = false;
|
||||
transitionOk = false;
|
||||
}
|
||||
}
|
||||
if (state == States::ON_TRANS_X8) {
|
||||
if (not commandExecuted) {
|
||||
// Switch on X8
|
||||
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_X8);
|
||||
commandExecuted = true;
|
||||
}
|
||||
// ADC values are ok, 5 seconds have elapsed
|
||||
if (transitionOk and countdown.hasTimedOut()) {
|
||||
state = States::ON_TRANS_TX;
|
||||
countdown.resetTimer();
|
||||
commandExecuted = false;
|
||||
transitionOk = false;
|
||||
}
|
||||
}
|
||||
if (state == States::ON_TRANS_TX) {
|
||||
if (not commandExecuted) {
|
||||
// Switch on TX
|
||||
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_TX);
|
||||
commandExecuted = true;
|
||||
}
|
||||
// ADC values are ok, 5 seconds have elapsed
|
||||
if (transitionOk and countdown.hasTimedOut()) {
|
||||
state = States::ON_TRANS_MPA;
|
||||
countdown.resetTimer();
|
||||
commandExecuted = false;
|
||||
transitionOk = false;
|
||||
}
|
||||
}
|
||||
if (state == States::ON_TRANS_MPA) {
|
||||
if (not commandExecuted) {
|
||||
// Switch on MPA
|
||||
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_MPA);
|
||||
commandExecuted = true;
|
||||
}
|
||||
// ADC values are ok, 5 seconds have elapsed
|
||||
if (transitionOk and countdown.hasTimedOut()) {
|
||||
state = States::ON_TRANS_HPA;
|
||||
countdown.resetTimer();
|
||||
commandExecuted = false;
|
||||
transitionOk = false;
|
||||
}
|
||||
}
|
||||
if (state == States::ON_TRANS_HPA) {
|
||||
if (not commandExecuted) {
|
||||
// Switch on HPA
|
||||
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_HPA);
|
||||
commandExecuted = true;
|
||||
}
|
||||
// ADC values are ok, 5 seconds have elapsed
|
||||
if (transitionOk and countdown.hasTimedOut()) {
|
||||
state = States::PCDU_ON;
|
||||
setMode(MODE_NORMAL);
|
||||
countdown.resetTimer();
|
||||
commandExecuted = false;
|
||||
transitionOk = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PayloadPcduHandler::doShutDown() {}
|
||||
|
||||
ReturnValue_t PayloadPcduHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PayloadPcduHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
void PayloadPcduHandler::fillCommandAndReplyMap() {}
|
||||
|
||||
ReturnValue_t PayloadPcduHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||
const uint8_t* commandData,
|
||||
size_t commandDataLen) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PayloadPcduHandler::scanForReply(const uint8_t* start, size_t remainingSize,
|
||||
DeviceCommandId_t* foundId, size_t* foundLen) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PayloadPcduHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||
const uint8_t* packet) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
uint32_t PayloadPcduHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) {
|
||||
// 20 minutes transition delay is allowed
|
||||
return 20 * 60 * 60;
|
||||
}
|
||||
|
||||
ReturnValue_t PayloadPcduHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
@ -1,74 +0,0 @@
|
||||
#ifndef LINUX_DEVICES_PLPCDUHANDLER_H_
|
||||
#define LINUX_DEVICES_PLPCDUHANDLER_H_
|
||||
|
||||
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||
#include <fsfw/timemanager/Countdown.h>
|
||||
|
||||
#include "fsfw_hal/common/gpio/GpioIF.h"
|
||||
|
||||
/**
|
||||
* @brief Device handler for the EIVE Payload PCDU
|
||||
* @details
|
||||
* Documentation:
|
||||
* https://egit.irs.uni-stuttgart.de/eive/eive_dokumente/src/branch/master/400_Raumsegment/412_PayloaPCDUDocumentation/release/EIVE-D-421-001_PLPCDU_Documentation.pdf
|
||||
*
|
||||
* Important components:
|
||||
* - SSR - Solid State Relay: Decouples voltages from battery
|
||||
* - DRO - Dielectric Resonsant Oscillator: Generates modulation signal
|
||||
* - X8: Frequency X8 Multiplicator
|
||||
* - TX: Transmitter/Sender module. Modulates data onto carrier signal
|
||||
* - MPA - Medium Power Amplifier
|
||||
* - HPA - High Power Amplifier
|
||||
*/
|
||||
class PayloadPcduHandler : DeviceHandlerBase {
|
||||
public:
|
||||
PayloadPcduHandler(object_id_t objectId, object_id_t comIF, CookieIF* cookie, GpioIF* gpioIF);
|
||||
|
||||
private:
|
||||
enum class States {
|
||||
PCDU_OFF,
|
||||
// Solid State Relay, enable battery voltages VBAT0 and VBAT1. This will also switch on
|
||||
// the ADC
|
||||
ON_TRANS_SSR,
|
||||
ON_TRANS_ADC_CLOSE_ZERO,
|
||||
// Enable Dielectric Resonant Oscillator and start monitoring voltages as
|
||||
// soon as DRO voltage reaches 6V
|
||||
ON_TRANS_DRO,
|
||||
// Switch on X8 compoennt and monitor voltages for 5 seconds
|
||||
ON_TRANS_X8,
|
||||
// Switch on TX component and monitor voltages for 5 seconds
|
||||
ON_TRANS_TX,
|
||||
// Switch on MPA component and monitor voltages for 5 seconds
|
||||
ON_TRANS_MPA,
|
||||
// Switch on HPA component and monitor voltages for 5 seconds
|
||||
ON_TRANS_HPA,
|
||||
// All components of the experiment are on
|
||||
PCDU_ON,
|
||||
} state = States::PCDU_OFF;
|
||||
|
||||
enum class MonitoringMode { NONE, CLOSE_TO_ZERO, NEGATIVE } monMode = MonitoringMode::NONE;
|
||||
|
||||
// This variable is tied to DRO +6 V voltage. Voltages, currents are monitored and the experiment
|
||||
// is shut down immediately if there is a negative voltage.
|
||||
bool transitionOk = false;
|
||||
bool commandExecuted = false;
|
||||
Countdown countdown = Countdown(5000);
|
||||
GpioIF* gpioIF;
|
||||
|
||||
void doTransition(Mode_t modeFrom, Submode_t subModeFrom) override;
|
||||
void doStartUp() override;
|
||||
void doShutDown() override;
|
||||
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
|
||||
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t* id) override;
|
||||
void fillCommandAndReplyMap() override;
|
||||
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t* commandData,
|
||||
size_t commandDataLen) override;
|
||||
ReturnValue_t scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId,
|
||||
size_t* foundLen) override;
|
||||
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) override;
|
||||
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) override;
|
||||
};
|
||||
|
||||
#endif /* LINUX_DEVICES_PLPCDUHANDLER_H_ */
|
@ -226,7 +226,7 @@ ReturnValue_t SusHandler::initializeLocalDataPool(localpool::DataPool &localData
|
||||
void SusHandler::setToGoToNormalMode(bool enable) { this->goToNormalModeImmediately = enable; }
|
||||
|
||||
void SusHandler::printDataset() {
|
||||
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_SUS == 1
|
||||
if (periodicPrintout) {
|
||||
if (divider.checkAndIncrement()) {
|
||||
sif::info << "SUS " << std::setw(2) << std::dec << static_cast<int>(susIdx) << " ID "
|
||||
<< std::hex << "0x" << this->getObjectId() << " [" << std::hex << std::setw(3);
|
||||
@ -238,5 +238,10 @@ void SusHandler::printDataset() {
|
||||
sif::info << dataset.ain5 << "] ";
|
||||
sif::info << "T[C] " << dataset.temperatureCelcius << " C" << std::endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void SusHandler::enablePeriodicPrintout(bool enable, uint8_t divider) {
|
||||
this->periodicPrintout = enable;
|
||||
this->divider.setDivider(divider);
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ class SusHandler : public DeviceHandlerBase {
|
||||
LinuxLibgpioIF* gpioComIF, gpioId_t chipSelectId);
|
||||
virtual ~SusHandler();
|
||||
|
||||
// virtual ReturnValue_t performOperation(uint8_t counter) override;
|
||||
void enablePeriodicPrintout(bool enable, uint8_t divider);
|
||||
|
||||
virtual ReturnValue_t initialize() override;
|
||||
void setToGoToNormalMode(bool enable);
|
||||
@ -48,7 +48,6 @@ class SusHandler : public DeviceHandlerBase {
|
||||
ReturnValue_t scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId,
|
||||
size_t* foundLen) override;
|
||||
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) override;
|
||||
// void setNormalDatapoolEntriesInvalid() override;
|
||||
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) override;
|
||||
@ -68,9 +67,8 @@ class SusHandler : public DeviceHandlerBase {
|
||||
READ_INT_CLOCKED_CONVERSIONS
|
||||
};
|
||||
|
||||
bool periodicPrintout = false;
|
||||
PeriodicOperationDivider divider;
|
||||
// LinuxLibgpioIF* gpioComIF = nullptr;
|
||||
// gpioId_t chipSelectId = gpio::NO_GPIO;
|
||||
bool goToNormalModeImmediately = false;
|
||||
bool commandExecuted = false;
|
||||
|
||||
|
@ -1,63 +0,0 @@
|
||||
#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_GPSDEFINITIONS_H_
|
||||
#define MISSION_DEVICES_DEVICEDEFINITIONS_GPSDEFINITIONS_H_
|
||||
|
||||
#include "fsfw/datapoollocal/StaticLocalDataSet.h"
|
||||
#include "fsfw/devicehandlers/DeviceHandlerIF.h"
|
||||
|
||||
namespace GpsHyperion {
|
||||
|
||||
static constexpr DeviceCommandId_t GPS_REPLY = 0;
|
||||
static constexpr DeviceCommandId_t TRIGGER_RESET_PIN = 5;
|
||||
|
||||
static constexpr uint32_t DATASET_ID = 0;
|
||||
|
||||
enum GpsPoolIds : lp_id_t {
|
||||
LATITUDE = 0,
|
||||
LONGITUDE = 1,
|
||||
ALTITUDE = 2,
|
||||
SPEED = 3,
|
||||
FIX_MODE = 4,
|
||||
SATS_IN_USE = 5,
|
||||
SATS_IN_VIEW = 6,
|
||||
UNIX_SECONDS = 7,
|
||||
YEAR = 8,
|
||||
MONTH = 9,
|
||||
DAY = 10,
|
||||
HOURS = 11,
|
||||
MINUTES = 12,
|
||||
SECONDS = 13
|
||||
};
|
||||
|
||||
enum GpsFixModes : uint8_t { INVALID = 0, NO_FIX = 1, FIX_2D = 2, FIX_3D = 3 };
|
||||
|
||||
} // namespace GpsHyperion
|
||||
|
||||
class GpsPrimaryDataset : public StaticLocalDataSet<18> {
|
||||
public:
|
||||
GpsPrimaryDataset(object_id_t gpsId) : StaticLocalDataSet(sid_t(gpsId, GpsHyperion::DATASET_ID)) {
|
||||
setAllVariablesReadOnly();
|
||||
}
|
||||
|
||||
lp_var_t<double> latitude = lp_var_t<double>(sid.objectId, GpsHyperion::LATITUDE, this);
|
||||
lp_var_t<double> longitude = lp_var_t<double>(sid.objectId, GpsHyperion::LONGITUDE, this);
|
||||
lp_var_t<double> altitude = lp_var_t<double>(sid.objectId, GpsHyperion::ALTITUDE, this);
|
||||
lp_var_t<double> speed = lp_var_t<double>(sid.objectId, GpsHyperion::SPEED, this);
|
||||
lp_var_t<uint8_t> fixMode = lp_var_t<uint8_t>(sid.objectId, GpsHyperion::FIX_MODE, this);
|
||||
lp_var_t<uint8_t> satInUse = lp_var_t<uint8_t>(sid.objectId, GpsHyperion::SATS_IN_USE, this);
|
||||
lp_var_t<uint8_t> satInView = lp_var_t<uint8_t>(sid.objectId, GpsHyperion::SATS_IN_VIEW, this);
|
||||
lp_var_t<uint16_t> year = lp_var_t<uint16_t>(sid.objectId, GpsHyperion::YEAR, this);
|
||||
lp_var_t<uint8_t> month = lp_var_t<uint8_t>(sid.objectId, GpsHyperion::MONTH, this);
|
||||
lp_var_t<uint8_t> day = lp_var_t<uint8_t>(sid.objectId, GpsHyperion::DAY, this);
|
||||
lp_var_t<uint8_t> hours = lp_var_t<uint8_t>(sid.objectId, GpsHyperion::HOURS, this);
|
||||
lp_var_t<uint8_t> minutes = lp_var_t<uint8_t>(sid.objectId, GpsHyperion::MINUTES, this);
|
||||
lp_var_t<uint8_t> seconds = lp_var_t<uint8_t>(sid.objectId, GpsHyperion::SECONDS, this);
|
||||
lp_var_t<uint32_t> unixSeconds =
|
||||
lp_var_t<uint32_t>(sid.objectId, GpsHyperion::UNIX_SECONDS, this);
|
||||
|
||||
private:
|
||||
friend class GPSHyperionLinuxController;
|
||||
GpsPrimaryDataset(HasLocalDataPoolIF* hkOwner)
|
||||
: StaticLocalDataSet(hkOwner, GpsHyperion::DATASET_ID) {}
|
||||
};
|
||||
|
||||
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_GPSDEFINITIONS_H_ */
|
@ -50,7 +50,7 @@ static constexpr uint8_t SETUP_EXT_CLOCKED = 0b01111000;
|
||||
*/
|
||||
static const uint8_t CONVERSION = 0b10101001;
|
||||
|
||||
static const uint8_t SUS_DATA_SET_ID = READ_EXT_TIMED_CONVERSIONS;
|
||||
static const uint8_t SUS_DATA_SET_ID = READ_INT_TIMED_CONVERSIONS;
|
||||
|
||||
/** Size of data replies. Temperature and 6 channel convesions (AIN0 - AIN5) */
|
||||
static const uint8_t SIZE_READ_INT_CONVERSIONS = 14;
|
||||
|
@ -1,12 +0,0 @@
|
||||
#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_ */
|
@ -85,6 +85,8 @@ debugging. */
|
||||
#define OBSW_DEBUG_RTD 0
|
||||
#define OBSW_TEST_RAD_SENSOR 0
|
||||
#define OBSW_DEBUG_RAD_SENSOR 0
|
||||
#define OBSW_TEST_PL_PCDU 0
|
||||
#define OBSW_DEBUG_PL_PCDU 0
|
||||
#define OBSW_TEST_LIBGPIOD 0
|
||||
#define OBSW_TEST_PLOC_HANDLER 0
|
||||
#define OBSW_TEST_BPX_BATT 0
|
||||
|
@ -1,8 +1,8 @@
|
||||
/**
|
||||
* @brief Auto-generated object translation file.
|
||||
* @details
|
||||
* Contains 110 translations.
|
||||
* Generated on: 2022-02-03 12:01:36
|
||||
* Contains 111 translations.
|
||||
* Generated on: 2022-02-21 17:31:37
|
||||
*/
|
||||
#include "translateObjects.h"
|
||||
|
||||
@ -12,6 +12,7 @@ const char *ACS_CONTROLLER_STRING = "ACS_CONTROLLER";
|
||||
const char *THERMAL_CONTROLLER_STRING = "THERMAL_CONTROLLER";
|
||||
const char *MGM_0_LIS3_HANDLER_STRING = "MGM_0_LIS3_HANDLER";
|
||||
const char *GYRO_0_ADIS_HANDLER_STRING = "GYRO_0_ADIS_HANDLER";
|
||||
const char *SUS_0_STRING = "SUS_0";
|
||||
const char *SUS_1_STRING = "SUS_1";
|
||||
const char *SUS_2_STRING = "SUS_2";
|
||||
const char *SUS_3_STRING = "SUS_3";
|
||||
@ -23,8 +24,6 @@ const char *SUS_8_STRING = "SUS_8";
|
||||
const char *SUS_9_STRING = "SUS_9";
|
||||
const char *SUS_10_STRING = "SUS_10";
|
||||
const char *SUS_11_STRING = "SUS_11";
|
||||
const char *SUS_12_STRING = "SUS_12";
|
||||
const char *SUS_13_STRING = "SUS_13";
|
||||
const char *RW1_STRING = "RW1";
|
||||
const char *MGM_1_RM3100_HANDLER_STRING = "MGM_1_RM3100_HANDLER";
|
||||
const char *GYRO_1_L3G_HANDLER_STRING = "GYRO_1_L3G_HANDLER";
|
||||
@ -44,6 +43,7 @@ const char *PDU1_HANDLER_STRING = "PDU1_HANDLER";
|
||||
const char *PDU2_HANDLER_STRING = "PDU2_HANDLER";
|
||||
const char *ACU_HANDLER_STRING = "ACU_HANDLER";
|
||||
const char *BPX_BATT_HANDLER_STRING = "BPX_BATT_HANDLER";
|
||||
const char *PLPCDU_HANDLER_STRING = "PLPCDU_HANDLER";
|
||||
const char *RAD_SENSOR_STRING = "RAD_SENSOR";
|
||||
const char *PLOC_UPDATER_STRING = "PLOC_UPDATER";
|
||||
const char *PLOC_MEMORY_DUMPER_STRING = "PLOC_MEMORY_DUMPER";
|
||||
@ -109,6 +109,7 @@ const char *TIME_STAMPER_STRING = "TIME_STAMPER";
|
||||
const char *FSFW_OBJECTS_END_STRING = "FSFW_OBJECTS_END";
|
||||
const char *SPI_TEST_STRING = "SPI_TEST";
|
||||
const char *UART_TEST_STRING = "UART_TEST";
|
||||
const char *I2C_TEST_STRING = "I2C_TEST";
|
||||
const char *DUMMY_HANDLER_STRING = "DUMMY_HANDLER";
|
||||
const char *DUMMY_INTERFACE_STRING = "DUMMY_INTERFACE";
|
||||
const char *LIBGPIOD_TEST_STRING = "LIBGPIOD_TEST";
|
||||
@ -117,8 +118,8 @@ const char *TM_FUNNEL_STRING = "TM_FUNNEL";
|
||||
const char *CCSDS_IP_CORE_BRIDGE_STRING = "CCSDS_IP_CORE_BRIDGE";
|
||||
const char *NO_OBJECT_STRING = "NO_OBJECT";
|
||||
|
||||
const char *translateObject(object_id_t object) {
|
||||
switch ((object & 0xFFFFFFFF)) {
|
||||
const char* translateObject(object_id_t object) {
|
||||
switch( (object & 0xFFFFFFFF) ) {
|
||||
case 0x00005060:
|
||||
return P60DOCK_TEST_TASK_STRING;
|
||||
case 0x43000003:
|
||||
@ -132,31 +133,29 @@ const char *translateObject(object_id_t object) {
|
||||
case 0x44120010:
|
||||
return GYRO_0_ADIS_HANDLER_STRING;
|
||||
case 0x44120032:
|
||||
return SUS_1_STRING;
|
||||
return SUS_0_STRING;
|
||||
case 0x44120033:
|
||||
return SUS_2_STRING;
|
||||
return SUS_1_STRING;
|
||||
case 0x44120034:
|
||||
return SUS_3_STRING;
|
||||
return SUS_2_STRING;
|
||||
case 0x44120035:
|
||||
return SUS_4_STRING;
|
||||
return SUS_3_STRING;
|
||||
case 0x44120036:
|
||||
return SUS_5_STRING;
|
||||
return SUS_4_STRING;
|
||||
case 0x44120037:
|
||||
return SUS_6_STRING;
|
||||
return SUS_5_STRING;
|
||||
case 0x44120038:
|
||||
return SUS_7_STRING;
|
||||
return SUS_6_STRING;
|
||||
case 0x44120039:
|
||||
return SUS_8_STRING;
|
||||
return SUS_7_STRING;
|
||||
case 0x44120040:
|
||||
return SUS_9_STRING;
|
||||
return SUS_8_STRING;
|
||||
case 0x44120041:
|
||||
return SUS_10_STRING;
|
||||
return SUS_9_STRING;
|
||||
case 0x44120042:
|
||||
return SUS_11_STRING;
|
||||
return SUS_10_STRING;
|
||||
case 0x44120043:
|
||||
return SUS_12_STRING;
|
||||
case 0x44120044:
|
||||
return SUS_13_STRING;
|
||||
return SUS_11_STRING;
|
||||
case 0x44120047:
|
||||
return RW1_STRING;
|
||||
case 0x44120107:
|
||||
@ -195,6 +194,8 @@ const char *translateObject(object_id_t object) {
|
||||
return ACU_HANDLER_STRING;
|
||||
case 0x44260000:
|
||||
return BPX_BATT_HANDLER_STRING;
|
||||
case 0x44300000:
|
||||
return PLPCDU_HANDLER_STRING;
|
||||
case 0x443200A5:
|
||||
return RAD_SENSOR_STRING;
|
||||
case 0x44330000:
|
||||
@ -325,6 +326,8 @@ const char *translateObject(object_id_t object) {
|
||||
return SPI_TEST_STRING;
|
||||
case 0x54000020:
|
||||
return UART_TEST_STRING;
|
||||
case 0x54000030:
|
||||
return I2C_TEST_STRING;
|
||||
case 0x5400AFFE:
|
||||
return DUMMY_HANDLER_STRING;
|
||||
case 0x5400CAFE:
|
||||
|
@ -360,8 +360,8 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
|
||||
#endif
|
||||
|
||||
#if OBSW_ADD_ACS_BOARD == 1 && OBSW_ADD_ACS_HANDLERS == 1
|
||||
bool enableAside = true;
|
||||
bool enableBside = false;
|
||||
bool enableAside = false;
|
||||
bool enableBside = true;
|
||||
if (enableAside) {
|
||||
// A side
|
||||
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0,
|
||||
|
@ -79,7 +79,7 @@ void ObjectFactory::produceGenericObjects() {
|
||||
new Service3Housekeeping(objects::PUS_SERVICE_3_HOUSEKEEPING, apid::EIVE_OBSW,
|
||||
pus::PUS_SERVICE_3);
|
||||
new Service5EventReporting(objects::PUS_SERVICE_5_EVENT_REPORTING, apid::EIVE_OBSW,
|
||||
pus::PUS_SERVICE_5, 120);
|
||||
pus::PUS_SERVICE_5, 50);
|
||||
new Service8FunctionManagement(objects::PUS_SERVICE_8_FUNCTION_MGMT, apid::EIVE_OBSW,
|
||||
pus::PUS_SERVICE_8, 3, 60);
|
||||
new Service9TimeManagement(objects::PUS_SERVICE_9_TIME_MGMT, apid::EIVE_OBSW, pus::PUS_SERVICE_9);
|
||||
|
@ -9,6 +9,7 @@ target_sources(${LIB_EIVE_MISSION} PRIVATE
|
||||
ACUHandler.cpp
|
||||
SyrlinksHkHandler.cpp
|
||||
Max31865PT1000Handler.cpp
|
||||
PayloadPcduHandler.cpp
|
||||
IMTQHandler.cpp
|
||||
HeaterHandler.cpp
|
||||
PlocMPSoCHandler.cpp
|
||||
|
@ -2,14 +2,6 @@
|
||||
|
||||
#include <cstring>
|
||||
|
||||
uint8_t max1227::buildConvByte(ScanModes scanMode, uint8_t channel, bool readTemp) {
|
||||
return (1 << 7) | (channel << 3) | (scanMode << 1) | readTemp;
|
||||
}
|
||||
|
||||
uint8_t max1227::buildSetupByte(ClkSel clkSel, RefSel refSel, DiffSel diffSel) {
|
||||
return (1 << 6) | (clkSel << 4) | (refSel << 2) | diffSel;
|
||||
}
|
||||
|
||||
void max1227::prepareExternallyClockedSingleChannelRead(uint8_t *spiBuf, uint8_t channel,
|
||||
size_t &sz) {
|
||||
spiBuf[0] = buildConvByte(ScanModes::N_ONCE, channel, false);
|
||||
@ -18,21 +10,19 @@ void max1227::prepareExternallyClockedSingleChannelRead(uint8_t *spiBuf, uint8_t
|
||||
sz = 3;
|
||||
}
|
||||
|
||||
uint8_t max1227::buildResetByte(bool fifoOnly) { return (1 << 4) | (fifoOnly << 3); }
|
||||
|
||||
void max1227::prepareExternallyClockedRead0ToN(uint8_t *spiBuf, uint8_t n, size_t &sz) {
|
||||
for (uint8_t idx = 0; idx <= n; idx++) {
|
||||
spiBuf[idx * 2] = buildConvByte(ScanModes::N_ONCE, idx, false);
|
||||
spiBuf[idx * 2 + 1] = 0x00;
|
||||
}
|
||||
spiBuf[(n + 1) * 2] = 0x00;
|
||||
sz = (n + 1) * 2 + 1;
|
||||
sz += (n + 1) * 2 + 1;
|
||||
}
|
||||
|
||||
void max1227::prepareExternallyClockedTemperatureRead(uint8_t *spiBuf, size_t &sz) {
|
||||
spiBuf[0] = buildConvByte(ScanModes::N_ONCE, 0, true);
|
||||
std::memset(spiBuf + 1, 0, 24);
|
||||
sz = 25;
|
||||
sz += 25;
|
||||
}
|
||||
|
||||
float max1227::getTemperature(int16_t temp) { return static_cast<float>(temp) * 0.125; }
|
||||
|
@ -40,9 +40,15 @@ enum DiffSel : uint8_t {
|
||||
BIPOLAR_CFG = 0b11
|
||||
};
|
||||
|
||||
uint8_t buildResetByte(bool fifoOnly);
|
||||
uint8_t buildConvByte(ScanModes scanMode, uint8_t channel, bool readTemp);
|
||||
uint8_t buildSetupByte(ClkSel clkSel, RefSel refSel, DiffSel diffSel);
|
||||
constexpr uint8_t buildResetByte(bool fifoOnly) { return (1 << 4) | (fifoOnly << 3); }
|
||||
|
||||
constexpr uint8_t buildConvByte(ScanModes scanMode, uint8_t channel, bool readTemp) {
|
||||
return (1 << 7) | (channel << 3) | (scanMode << 1) | readTemp;
|
||||
}
|
||||
|
||||
constexpr uint8_t buildSetupByte(ClkSel clkSel, RefSel refSel, DiffSel diffSel) {
|
||||
return (1 << 6) | (clkSel << 4) | (refSel << 2) | diffSel;
|
||||
}
|
||||
|
||||
/**
|
||||
* If there is a wakeup delay, there needs to be a 65 us delay between sending
|
||||
|
Loading…
Reference in New Issue
Block a user