Release v1.2.0 #47

Merged
meierj merged 229 commits from develop into master 2021-06-21 17:58:40 +02:00
9 changed files with 142 additions and 120 deletions
Showing only changes of commit 1eb9909377 - Show all commits

View File

@ -156,16 +156,12 @@ void ObjectFactory::produce(){
gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, chipSelectRadSensor); gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, chipSelectRadSensor);
gpioComIF->addGpios(gpioCookieRadSensor); gpioComIF->addGpios(gpioCookieRadSensor);
// SpiCookie* spiCookieRadSensor = new SpiCookie(addresses::RAD_SENSOR, gpioIds::CS_RAD_SENSOR,
// std::string("/dev/spidev2.0"), RAD_SENSOR::READ_SIZE, spi::DEFAULT_MAX_1227_MODE,
// spi::DEFAULT_MAX_1227_SPEED);
SpiCookie* spiCookieRadSensor = new SpiCookie(addresses::RAD_SENSOR, gpioIds::CS_RAD_SENSOR, SpiCookie* spiCookieRadSensor = new SpiCookie(addresses::RAD_SENSOR, gpioIds::CS_RAD_SENSOR,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, std::string("/dev/spidev2.0"), RAD_SENSOR::READ_SIZE, spi::DEFAULT_MAX_1227_MODE,
spi::DEFAULT_MAX_1227_SPEED); spi::DEFAULT_MAX_1227_SPEED);
// RadiationSensorHandler* radSensor = new RadiationSensorHandler(objects::RAD_SENSOR, RadiationSensorHandler* radSensor = new RadiationSensorHandler(objects::RAD_SENSOR,
// objects::SPI_COM_IF, spiCookieRadSensor); objects::SPI_COM_IF, spiCookieRadSensor);
// (void) radSensor; (void) radSensor;
// radSensor->setStartUpImmediately();
GpioCookie* gpioCookieSus = new GpioCookie(); GpioCookie* gpioCookieSus = new GpioCookie();
@ -251,33 +247,45 @@ void ObjectFactory::produce(){
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
spi::DEFAULT_MAX_1227_SPEED); spi::DEFAULT_MAX_1227_SPEED);
SusHandler* sus1 = new SusHandler(objects::SUS_1, objects::SPI_COM_IF, spiCookieSus1); SusHandler* sus1 = new SusHandler(objects::SUS_1, objects::SPI_COM_IF, spiCookieSus1, gpioComIF,
gpioIds::CS_SUS_1);
// sus1->setStartUpImmediately(); // sus1->setStartUpImmediately();
(void) sus1; (void) sus1;
SusHandler* sus2 = new SusHandler(objects::SUS_2, objects::SPI_COM_IF, spiCookieSus2); SusHandler* sus2 = new SusHandler(objects::SUS_2, objects::SPI_COM_IF, spiCookieSus2, gpioComIF,
// sus2->setStartUpImmediately(); gpioIds::CS_SUS_2);
sus2->setStartUpImmediately();
(void) sus2; (void) sus2;
SusHandler* sus3 = new SusHandler(objects::SUS_3, objects::SPI_COM_IF, spiCookieSus3); SusHandler* sus3 = new SusHandler(objects::SUS_3, objects::SPI_COM_IF, spiCookieSus3, gpioComIF,
gpioIds::CS_SUS_3);
sus3->setStartUpImmediately(); sus3->setStartUpImmediately();
(void) sus3; (void) sus3;
new SusHandler(objects::SUS_4, objects::SPI_COM_IF, spiCookieSus4); new SusHandler(objects::SUS_4, objects::SPI_COM_IF, spiCookieSus4, gpioComIF,
new SusHandler(objects::SUS_5, objects::SPI_COM_IF, spiCookieSus5); gpioIds::CS_SUS_4);
new SusHandler(objects::SUS_6, objects::SPI_COM_IF, spiCookieSus6); new SusHandler(objects::SUS_5, objects::SPI_COM_IF, spiCookieSus5, gpioComIF,
new SusHandler(objects::SUS_7, objects::SPI_COM_IF, spiCookieSus7); gpioIds::CS_SUS_5);
SusHandler* sus8 = new SusHandler(objects::SUS_8, objects::SPI_COM_IF, spiCookieSus8); new SusHandler(objects::SUS_6, objects::SPI_COM_IF, spiCookieSus6, gpioComIF,
// sus8->setStartUpImmediately(); gpioIds::CS_SUS_6);
(void) sus8; new SusHandler(objects::SUS_7, objects::SPI_COM_IF, spiCookieSus7, gpioComIF,
gpioIds::CS_SUS_7);
SusHandler* sus8 = new SusHandler(objects::SUS_8, objects::SPI_COM_IF, spiCookieSus8, gpioComIF,
gpioIds::CS_SUS_8);
sus8->setStartUpImmediately();
new SusHandler(objects::SUS_9, objects::SPI_COM_IF, spiCookieSus9); new SusHandler(objects::SUS_9, objects::SPI_COM_IF, spiCookieSus9, gpioComIF,
new SusHandler(objects::SUS_10, objects::SPI_COM_IF, spiCookieSus10); gpioIds::CS_SUS_9);
SusHandler* sus11 = new SusHandler(objects::SUS_11, objects::SPI_COM_IF, spiCookieRadSensor); new SusHandler(objects::SUS_10, objects::SPI_COM_IF, spiCookieSus10, gpioComIF,
gpioIds::CS_SUS_10);
SusHandler* sus11 = new SusHandler(objects::SUS_11, objects::SPI_COM_IF, spiCookieSus11,
gpioComIF, gpioIds::CS_SUS_11);
sus11->setStartUpImmediately(); sus11->setStartUpImmediately();
new SusHandler(objects::SUS_12, objects::SPI_COM_IF, spiCookieSus12); new SusHandler(objects::SUS_12, objects::SPI_COM_IF, spiCookieSus12, gpioComIF,
new SusHandler(objects::SUS_13, objects::SPI_COM_IF, spiCookieSus13); gpioIds::CS_SUS_12);
new SusHandler(objects::SUS_13, objects::SPI_COM_IF, spiCookieSus13, gpioComIF,
gpioIds::CS_SUS_13);
#if OBSW_ADD_ACS_BOARD == 1 #if OBSW_ADD_ACS_BOARD == 1
GpioCookie* gpioCookieAcsBoard = new GpioCookie(); GpioCookie* gpioCookieAcsBoard = new GpioCookie();
@ -592,7 +600,8 @@ void ObjectFactory::produce(){
std::string("/dev/spidev1.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, std::string("/dev/spidev1.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
spi::DEFAULT_MAX_1227_SPEED); spi::DEFAULT_MAX_1227_SPEED);
SusHandler* sus1 = new SusHandler(objects::SUS_1, objects::SPI_COM_IF, spiCookieSus); SusHandler* sus1 = new SusHandler(objects::SUS_1, objects::SPI_COM_IF, spiCookieSus, gpioComIF,
gpioIds::CS_SUS_1);
sus1->setStartUpImmediately(); sus1->setStartUpImmediately();
#endif #endif

View File

@ -58,19 +58,18 @@ void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, int value
void* args) { void* args) {
if (gpioComInterface == nullptr) { if (gpioComInterface == nullptr) {
sif::debug << "tcsBoardDecoderCallback: No gpioComIF specified. Call initTcsBoardDecoder " sif::debug << "spiCsDecoderCallback: No gpioComIF specified. Call initSpiCsDecoder "
<< "to specify gpioComIF" << std::endl; << "to specify gpioComIF" << std::endl;
return; return;
} }
/* Read is not supported by the callback function */ /* Reading is not supported by the callback function */
if (gpioOp == gpio::GpioOperation::READ) { if (gpioOp == gpio::GpioOperation::READ) {
return; return;
} }
if (value == 1) { if (value == 1) {
/* This will pull all 16 decoder outputs to high */ disableAllDecoder();
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
} }
else if (value == 0) { else if (value == 0) {
switch (gpioId) { switch (gpioId) {
@ -155,70 +154,70 @@ void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, int value
break; break;
} }
case(gpioIds::CS_SUS_1): { case(gpioIds::CS_SUS_1): {
enableDecoderInterfaceBoardIc21(); enableDecoderInterfaceBoardIc1();
selectY0(); selectY0();
break; break;
} }
case(gpioIds::CS_SUS_2): { case(gpioIds::CS_SUS_2): {
enableDecoderInterfaceBoardIc21(); enableDecoderInterfaceBoardIc1();
selectY1(); selectY1();
break; break;
} }
case(gpioIds::CS_SUS_3): { case(gpioIds::CS_SUS_3): {
enableDecoderInterfaceBoardIc21(); enableDecoderInterfaceBoardIc2();
selectY2();
break;
}
case(gpioIds::CS_SUS_4): {
enableDecoderInterfaceBoardIc21();
selectY3();
break;
}
case(gpioIds::CS_SUS_5): {
enableDecoderInterfaceBoardIc21();
selectY4();
break;
}
case(gpioIds::CS_SUS_6): {
enableDecoderInterfaceBoardIc21();
selectY5();
break;
}
case(gpioIds::CS_SUS_7): {
enableDecoderInterfaceBoardIc21();
selectY6();
break;
}
case(gpioIds::CS_SUS_8): {
enableDecoderInterfaceBoardIc22();
selectY0(); selectY0();
break; break;
} }
case(gpioIds::CS_SUS_9): { case(gpioIds::CS_SUS_4): {
enableDecoderInterfaceBoardIc22(); enableDecoderInterfaceBoardIc2();
selectY1(); selectY1();
break; break;
} }
case(gpioIds::CS_SUS_10): { case(gpioIds::CS_SUS_5): {
enableDecoderInterfaceBoardIc22(); enableDecoderInterfaceBoardIc2();
selectY2(); selectY2();
break; break;
} }
case(gpioIds::CS_SUS_11): { case(gpioIds::CS_SUS_6): {
enableDecoderInterfaceBoardIc22(); enableDecoderInterfaceBoardIc1();
selectY2();
break;
}
case(gpioIds::CS_SUS_7): {
enableDecoderInterfaceBoardIc1();
selectY3(); selectY3();
break; break;
} }
case(gpioIds::CS_SUS_12): { case(gpioIds::CS_SUS_8): {
enableDecoderInterfaceBoardIc22(); enableDecoderInterfaceBoardIc2();
selectY3();
break;
}
case(gpioIds::CS_SUS_9): {
enableDecoderInterfaceBoardIc1();
selectY4(); selectY4();
break; break;
} }
case(gpioIds::CS_SUS_13): { case(gpioIds::CS_SUS_10): {
enableDecoderInterfaceBoardIc22(); enableDecoderInterfaceBoardIc1();
selectY5(); selectY5();
break; break;
} }
case(gpioIds::CS_SUS_11): {
enableDecoderInterfaceBoardIc2();
selectY4();
break;
}
case(gpioIds::CS_SUS_12): {
enableDecoderInterfaceBoardIc2();
selectY5();
break;
}
case(gpioIds::CS_SUS_13): {
enableDecoderInterfaceBoardIc1();
selectY6();
break;
}
default: default:
sif::debug << "spiCsDecoderCallback: Invalid gpio id " << gpioId << std::endl; sif::debug << "spiCsDecoderCallback: Invalid gpio id " << gpioId << std::endl;
} }
@ -240,13 +239,13 @@ void enableDecoderTcsIc2() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
} }
void enableDecoderInterfaceBoardIc21() { void enableDecoderInterfaceBoardIc1() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2); gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3); gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
} }
void enableDecoderInterfaceBoardIc22() { void enableDecoderInterfaceBoardIc2() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2); gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
@ -300,4 +299,10 @@ void selectY7() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6);
} }
void disableAllDecoder() {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
}
} }

View File

@ -35,13 +35,18 @@ namespace gpioCallbacks {
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder * @brief This function sets mux bits 1-3 to a state which will only enable the decoder
* on the inteface board board which is named to IC21 in the schematic. * on the inteface board board which is named to IC21 in the schematic.
*/ */
void enableDecoderInterfaceBoardIc21(); void enableDecoderInterfaceBoardIc1();
/** /**
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder * @brief This function sets mux bits 1-3 to a state which will only enable the decoder
* on the inteface board board which is named to IC22 in the schematic. * on the inteface board board which is named to IC22 in the schematic.
*/ */
void enableDecoderInterfaceBoardIc22(); void enableDecoderInterfaceBoardIc2();
/**
* @brief This function disables all decoder.
*/
void disableAllDecoder();
/** The following functions enable the appropriate channel of the currently enabled decoder */ /** The following functions enable the appropriate channel of the currently enabled decoder */
void selectY0(); void selectY0();

View File

@ -24,7 +24,7 @@ debugging. */
#define TEST_SUS_HANDLER 1 #define TEST_SUS_HANDLER 1
#define TEST_PLOC_HANDLER 0 #define TEST_PLOC_HANDLER 0
#define TE0720 1 #define TE0720 0
#define TE0720_HEATER_TEST 0 #define TE0720_HEATER_TEST 0
#define P60DOCK_DEBUG 0 #define P60DOCK_DEBUG 0

View File

@ -21,8 +21,8 @@ static constexpr uint32_t DEFAULT_L3G_SPEED = 3'900'000;
static constexpr spi::SpiModes DEFAULT_L3G_MODE = spi::SpiModes::MODE_3; static constexpr spi::SpiModes DEFAULT_L3G_MODE = spi::SpiModes::MODE_3;
//static constexpr uint32_t DEFAULT_MAX_1227_SPEED = 3'900'000; //static constexpr uint32_t DEFAULT_MAX_1227_SPEED = 3'900'000;
static constexpr uint32_t DEFAULT_MAX_1227_SPEED = 2'900'000; static constexpr uint32_t DEFAULT_MAX_1227_SPEED = 1'000'000;
static constexpr spi::SpiModes DEFAULT_MAX_1227_MODE = spi::SpiModes::MODE_3; static constexpr spi::SpiModes DEFAULT_MAX_1227_MODE = spi::SpiModes::MODE_0;
} }

View File

@ -151,17 +151,17 @@ ReturnValue_t pst::pollingSequenceInitDefault(FixedTimeslotTaskIF *thisSequence)
// thisSequence->addSlot(objects::RAD_SENSOR, length * 0.8, DeviceHandlerIF::GET_READ); // thisSequence->addSlot(objects::RAD_SENSOR, length * 0.8, DeviceHandlerIF::GET_READ);
/* Sun sensor 1 */ /* Sun sensor 1 */
thisSequence->addSlot(objects::SUS_1, length * 0, DeviceHandlerIF::PERFORM_OPERATION); // thisSequence->addSlot(objects::SUS_1, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_1, length * 0.2, DeviceHandlerIF::SEND_WRITE); // thisSequence->addSlot(objects::SUS_1, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.4, DeviceHandlerIF::GET_WRITE); // thisSequence->addSlot(objects::SUS_1, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.6, DeviceHandlerIF::SEND_READ); // thisSequence->addSlot(objects::SUS_1, length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_1, length * 0.8, DeviceHandlerIF::GET_READ); // thisSequence->addSlot(objects::SUS_1, length * 0.8, DeviceHandlerIF::GET_READ);
// thisSequence->addSlot(objects::SUS_2, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_8, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_2, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_8, length * 0.2, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_2, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_8, length * 0.4, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_2, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_8, length * 0.6, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_2, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::SUS_8, length * 0.8, DeviceHandlerIF::GET_READ);
// thisSequence->addSlot(objects::SUS_11, length * 0, DeviceHandlerIF::PERFORM_OPERATION); // thisSequence->addSlot(objects::SUS_11, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_11, length * 0.2, DeviceHandlerIF::SEND_WRITE); // thisSequence->addSlot(objects::SUS_11, length * 0.2, DeviceHandlerIF::SEND_WRITE);

View File

@ -1,12 +1,11 @@
#include <fsfw/datapool/PoolReadGuard.h> #include <fsfw/datapool/PoolReadGuard.h>
#include <mission/devices/SusHandler.h> #include <mission/devices/SusHandler.h>
#include <OBSWConfig.h> #include <OBSWConfig.h>
#include <sys/time.h>
SusHandler::SusHandler(object_id_t objectId, object_id_t comIF, SusHandler::SusHandler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie,
CookieIF * comCookie) : LinuxLibgpioIF* gpioComIF, gpioId_t chipSelectId) :
DeviceHandlerBase(objectId, comIF, comCookie), dataset( DeviceHandlerBase(objectId, comIF, comCookie), gpioComIF(gpioComIF), chipSelectId(
this) { chipSelectId), dataset(this) {
if (comCookie == NULL) { if (comCookie == NULL) {
sif::error << "SusHandler: Invalid com cookie" << std::endl; sif::error << "SusHandler: Invalid com cookie" << std::endl;
} }
@ -34,8 +33,8 @@ ReturnValue_t SusHandler::buildNormalDeviceCommand(
DeviceCommandId_t * id) { DeviceCommandId_t * id) {
if (communicationStep == CommunicationStep::PERFORM_CONVERSIONS) { if (communicationStep == CommunicationStep::PERFORM_CONVERSIONS) {
*id = SUS::PERFORM_CONVERSIONS; *id = SUS::PERFORM_CONVERSIONS;
// communicationStep = CommunicationStep::READ_TEMP; communicationStep = CommunicationStep::READ_TEMP;
communicationStep = CommunicationStep::PERFORM_CONVERSIONS; // communicationStep = CommunicationStep::PERFORM_CONVERSIONS;
} }
else if (communicationStep == CommunicationStep::READ_TEMP) { else if (communicationStep == CommunicationStep::READ_TEMP) {
*id = SUS::READ_TEMP; *id = SUS::READ_TEMP;
@ -61,23 +60,23 @@ ReturnValue_t SusHandler::buildCommandFromCommand(
switch(deviceCommand) { switch(deviceCommand) {
case(SUS::WRITE_SETUP): { case(SUS::WRITE_SETUP): {
cmdBuffer[0] = SUS::SETUP_DEFINITION; cmdBuffer[0] = SUS::SETUP_DEFINITION;
cmdBuffer[1] = SUS::UNIPOLAR_CONFIG;
rawPacket = cmdBuffer; rawPacket = cmdBuffer;
rawPacketLen = 2; rawPacketLen = 0;
internalState = InternalState::CONFIGURED; internalState = InternalState::CONFIGURED;
return RETURN_OK; return RETURN_OK;
} }
case(SUS::PERFORM_CONVERSIONS): { case(SUS::PERFORM_CONVERSIONS): {
gpioComIF->pullLow(chipSelectId);
std::memset(cmdBuffer, 0, sizeof(cmdBuffer)); std::memset(cmdBuffer, 0, sizeof(cmdBuffer));
/** /**
* The sun sensor ADC is shutdown when CS is pulled high so each time requesting a * The sun sensor ADC is shutdown when CS is pulled high so each time requesting a
* measurement the setup has to be rewritten * measurement the setup has to be rewritten
*/ */
cmdBuffer[0] = SUS::SETUP_DEFINITION; cmdBuffer[0] = SUS::RESET_FIFO;
cmdBuffer[1] = SUS::UNIPOLAR_CONFIG; cmdBuffer[1] = SUS::SETUP_DEFINITION;
// wirte one dummy byte here // wirte one dummy byte here
// cmdBuffer[2] = SUS::CONVERT_TEMPERATURE; // cmdBuffer[2] = SUS::CONVERT_TEMPERATURE;
cmdBuffer[2] = SUS::CONVERT_TEMPERATURE; cmdBuffer[2] = SUS::CONVERT_DIFF_CHANNEL_0_1;
// struct timeval startOfDelay; // struct timeval startOfDelay;
// gettimeofday(&startOfDelay, NULL); // gettimeofday(&startOfDelay, NULL);
// struct timeval currentTime; // struct timeval currentTime;
@ -98,13 +97,16 @@ ReturnValue_t SusHandler::buildCommandFromCommand(
// cmdBuffer[30] = SUS::CONVERT_DIFF_CHANNEL_4_5; // cmdBuffer[30] = SUS::CONVERT_DIFF_CHANNEL_4_5;
rawPacket = cmdBuffer; rawPacket = cmdBuffer;
// rawPacketLen = SUS::SIZE_PERFORM_CONVERSIONS; // rawPacketLen = SUS::SIZE_PERFORM_CONVERSIONS;
rawPacketLen = 7; rawPacketLen = 5;
return RETURN_OK; return RETURN_OK;
} }
case(SUS::READ_TEMP): { case(SUS::READ_TEMP): {
std::memset(cmdBuffer, 0, sizeof(cmdBuffer)); std::memset(cmdBuffer, 0, sizeof(cmdBuffer));
cmdBuffer[0] = SUS::RESET_FIFO;
cmdBuffer[1] = SUS::SETUP_DEFINITION;
cmdBuffer[2] = SUS::CONVERT_TEMPERATURE;
rawPacket = cmdBuffer; rawPacket = cmdBuffer;
rawPacketLen = 26; rawPacketLen = 27;
return RETURN_OK; return RETURN_OK;
} }
default: default:
@ -115,7 +117,9 @@ ReturnValue_t SusHandler::buildCommandFromCommand(
void SusHandler::fillCommandAndReplyMap() { void SusHandler::fillCommandAndReplyMap() {
this->insertInCommandMap(SUS::WRITE_SETUP); this->insertInCommandMap(SUS::WRITE_SETUP);
this->insertInCommandAndReplyMap(SUS::READ_TEMP, 1, &dataset, SUS::SIZE_PERFORM_CONVERSIONS); // this->insertInCommandAndReplyMap(SUS::READ_TEMP, 1, &dataset, SUS::SIZE_PERFORM_CONVERSIONS);
this->insertInCommandAndReplyMap(SUS::PERFORM_CONVERSIONS, 1, &dataset, SUS::SIZE_PERFORM_CONVERSIONS);
this->insertInCommandAndReplyMap(SUS::READ_TEMP, 1, nullptr, SUS::SIZE_PERFORM_CONVERSIONS);
// this->insertInCommandAndReplyMap(SUS::PERFORM_CONVERSIONS, 1, &dataset, // this->insertInCommandAndReplyMap(SUS::PERFORM_CONVERSIONS, 1, &dataset,
// SUS::SIZE_PERFORM_CONVERSIONS); // SUS::SIZE_PERFORM_CONVERSIONS);
this->insertInCommandMap(SUS::PERFORM_CONVERSIONS); this->insertInCommandMap(SUS::PERFORM_CONVERSIONS);
@ -149,6 +153,10 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id,
#endif #endif
break; break;
} }
case SUS::READ_TEMP: {
gpioComIF->pullHigh(chipSelectId);
break;
}
default: { default: {
sif::debug << "SusHandler::interpretDeviceReply: Unknown reply id" << std::endl; sif::debug << "SusHandler::interpretDeviceReply: Unknown reply id" << std::endl;
return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY; return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY;

View File

@ -3,6 +3,7 @@
#include <fsfw/devicehandlers/DeviceHandlerBase.h> #include <fsfw/devicehandlers/DeviceHandlerBase.h>
#include <mission/devices/devicedefinitions/SusDefinitions.h> #include <mission/devices/devicedefinitions/SusDefinitions.h>
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
/** /**
* @brief This is the device handler class for the SUS sensor. The sensor is * @brief This is the device handler class for the SUS sensor. The sensor is
@ -17,7 +18,7 @@ class SusHandler: public DeviceHandlerBase {
public: public:
SusHandler(object_id_t objectId, object_id_t comIF, SusHandler(object_id_t objectId, object_id_t comIF,
CookieIF * comCookie); CookieIF * comCookie, LinuxLibgpioIF* gpioComIF, gpioId_t chipSelectId);
virtual ~SusHandler(); virtual ~SusHandler();
protected: protected:
@ -49,6 +50,10 @@ private:
CONFIGURED CONFIGURED
}; };
LinuxLibgpioIF* gpioComIF = nullptr;
gpioId_t chipSelectId = gpio::NO_GPIO;
SUS::SusDataset dataset; SUS::SusDataset dataset;
uint8_t cmdBuffer[SUS::MAX_CMD_SIZE]; uint8_t cmdBuffer[SUS::MAX_CMD_SIZE];

View File

@ -17,25 +17,13 @@ namespace SUS {
* @brief This is the configuration byte which will be written to the setup register after * @brief This is the configuration byte which will be written to the setup register after
* power on. * power on.
* *
* @note Bit1 (DIFFSEL1) - Bit0 (DIFFSEL0): 0b10, following byte will be written to the * @note Bit1 (DIFFSEL1) - Bit0 (DIFFSEL0): 0b00, No byte is following the setup byte
* unipolar register to perform differential conversion * Bit3 (REFSEL1) - Bit2 (REFSEL0): 0b00, internal reference, needs wake-up delay
* Bit3 (REFSEL1) - Bit2 (REFSEL0): 0b10, internal reference differential (AIN6 is REF-)
* Bit5 (CLKSEL1) - Bit4 (CLKSEL0): 0b11, MAX1227 clocked through SPI SCLK * Bit5 (CLKSEL1) - Bit4 (CLKSEL0): 0b11, MAX1227 clocked through SPI SCLK
* Bit7 - Bit6: 0b01, tells MAX1227 that this is the setup register * Bit7 - Bit6: 0b01, tells MAX1227 that this is the setup register
* *
*/ */
// static const uint8_t SETUP_DEFINITION = 0b0111110; static const uint8_t SETUP_DEFINITION = 0b01110000;
// Internal reference 0b10
static const uint8_t SETUP_DEFINITION = 0b0111010;
/**
* @brief This byte will be written to the unipolar register
*
* @details Setting bits 7 - 5 to will configure channels 0/1, 2/3 and 4/5 as differential
* pairs.
*/
static const uint8_t UNIPOLAR_CONFIG = 0b11100000;
/** /**
* @brief This value will always be written to the ADC conversion register to specify the * @brief This value will always be written to the ADC conversion register to specify the
@ -46,12 +34,13 @@ namespace SUS {
* Bit6 - Bit3 defines N: 0b0001 (N = 4) * Bit6 - Bit3 defines N: 0b0001 (N = 4)
* Bit7: Always 1. Tells the ADC that this is the conversion register. * Bit7: Always 1. Tells the ADC that this is the conversion register.
*/ */
// static const uint8_t CONVERT_TEMPERATURE = 0b10000111; static const uint8_t CONVERT_TEMPERATURE = 0b10000001;
static const uint8_t CONVERT_TEMPERATURE = 0b10000110;
static const uint8_t CONVERT_DIFF_CHANNEL_0_1 = 0b10000110; static const uint8_t CONVERT_DIFF_CHANNEL_0_1 = 0b10000110;
static const uint8_t CONVERT_DIFF_CHANNEL_2_3 = 0b10010110; static const uint8_t CONVERT_DIFF_CHANNEL_2_3 = 0b10010110;
static const uint8_t CONVERT_DIFF_CHANNEL_4_5 = 0b10100110; static const uint8_t CONVERT_DIFF_CHANNEL_4_5 = 0b10100110;
static const uint8_t RESET_FIFO = 0b00011000;
static const uint8_t DUMMY_BYTE = 0x0; static const uint8_t DUMMY_BYTE = 0x0;
static const uint8_t SUS_DATA_SET_ID = PERFORM_CONVERSIONS; static const uint8_t SUS_DATA_SET_ID = PERFORM_CONVERSIONS;
@ -60,6 +49,7 @@ namespace SUS {
static const uint8_t MAX_CMD_SIZE = SIZE_PERFORM_CONVERSIONS; static const uint8_t MAX_CMD_SIZE = SIZE_PERFORM_CONVERSIONS;
enum Max1227PoolIds: lp_id_t { enum Max1227PoolIds: lp_id_t {
TEMPERATURE_C, TEMPERATURE_C,
DIFF_SCAN_CHANNEL_0_1, DIFF_SCAN_CHANNEL_0_1,