meier/master #33
@ -26,13 +26,11 @@
|
|||||||
#include <mission/devices/GyroL3GD20Handler.h>
|
#include <mission/devices/GyroL3GD20Handler.h>
|
||||||
#include <mission/devices/PlocHandler.h>
|
#include <mission/devices/PlocHandler.h>
|
||||||
#include <mission/devices/RadiationSensorHandler.h>
|
#include <mission/devices/RadiationSensorHandler.h>
|
||||||
#include <mission/devices/SusHandler.h>
|
|
||||||
|
|
||||||
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
|
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
|
||||||
#include <mission/devices/devicedefinitions/SyrlinksDefinitions.h>
|
#include <mission/devices/devicedefinitions/SyrlinksDefinitions.h>
|
||||||
#include <mission/devices/devicedefinitions/PlocDefinitions.h>
|
#include <mission/devices/devicedefinitions/PlocDefinitions.h>
|
||||||
#include <mission/devices/devicedefinitions/RadSensorDefinitions.h>
|
#include <mission/devices/devicedefinitions/RadSensorDefinitions.h>
|
||||||
#include <mission/devices/devicedefinitions/SusDefinitions.h>
|
|
||||||
#include <mission/devices/devicedefinitions/Max31865Definitions.h>
|
#include <mission/devices/devicedefinitions/Max31865Definitions.h>
|
||||||
#include <mission/utility/TmFunnel.h>
|
#include <mission/utility/TmFunnel.h>
|
||||||
|
|
||||||
@ -108,8 +106,14 @@ void ObjectFactory::produce(){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Temperature sensors */
|
/* Temperature sensors */
|
||||||
new Tmp1075Handler(objects::TMP1075_HANDLER_1, objects::I2C_COM_IF, i2cCookieTmp1075tcs1);
|
Tmp1075Handler* tmp1075Handler_1 = new Tmp1075Handler(
|
||||||
new Tmp1075Handler(objects::TMP1075_HANDLER_2, objects::I2C_COM_IF, i2cCookieTmp1075tcs2);
|
objects::TMP1075_HANDLER_1, objects::I2C_COM_IF,
|
||||||
|
i2cCookieTmp1075tcs1);
|
||||||
|
// tmp1075Handler_1->setStartUpImmediately();
|
||||||
|
Tmp1075Handler* tmp1075Handler_2 = new Tmp1075Handler(
|
||||||
|
objects::TMP1075_HANDLER_2, objects::I2C_COM_IF,
|
||||||
|
i2cCookieTmp1075tcs2);
|
||||||
|
// tmp1075Handler_2->setStartUpImmediately();
|
||||||
|
|
||||||
GpioCookie* heaterGpiosCookie = new GpioCookie;
|
GpioCookie* heaterGpiosCookie = new GpioCookie;
|
||||||
|
|
||||||
@ -147,98 +151,6 @@ void ObjectFactory::produce(){
|
|||||||
(void) pdu2handler;
|
(void) pdu2handler;
|
||||||
(void) acuhandler;
|
(void) acuhandler;
|
||||||
|
|
||||||
/* Adding gpios for chip select decoding to the gpioComIf */
|
|
||||||
gpioCallbacks::initSpiCsDecoder(gpioComIF);
|
|
||||||
|
|
||||||
GpioCookie* gpioCookieSus = new GpioCookie();
|
|
||||||
|
|
||||||
GpioCallback* susgpio = new GpioCallback(std::string("Chip select SUS 1"), gpio::OUT, 1,
|
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
||||||
gpioCookieSus->addGpio(gpioIds::CS_SUS_1, susgpio);
|
|
||||||
susgpio = new GpioCallback(std::string("Chip select SUS 2"), gpio::OUT, 1,
|
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
||||||
gpioCookieSus->addGpio(gpioIds::CS_SUS_2, susgpio);
|
|
||||||
susgpio = new GpioCallback(std::string("Chip select SUS 3"), gpio::OUT, 1,
|
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
||||||
gpioCookieSus->addGpio(gpioIds::CS_SUS_3, susgpio);
|
|
||||||
susgpio = new GpioCallback(std::string("Chip select SUS 4"), gpio::OUT, 1,
|
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
||||||
gpioCookieSus->addGpio(gpioIds::CS_SUS_4, susgpio);
|
|
||||||
susgpio = new GpioCallback(std::string("Chip select SUS 5"), gpio::OUT, 1,
|
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
||||||
gpioCookieSus->addGpio(gpioIds::CS_SUS_5, susgpio);
|
|
||||||
susgpio = new GpioCallback(std::string("Chip select SUS 6"), gpio::OUT, 1,
|
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
||||||
gpioCookieSus->addGpio(gpioIds::CS_SUS_6, susgpio);
|
|
||||||
susgpio = new GpioCallback(std::string("Chip select SUS 7"), gpio::OUT, 1,
|
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
||||||
gpioCookieSus->addGpio(gpioIds::CS_SUS_7, susgpio);
|
|
||||||
susgpio = new GpioCallback(std::string("Chip select SUS 8"), gpio::OUT, 1,
|
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
||||||
gpioCookieSus->addGpio(gpioIds::CS_SUS_8, susgpio);
|
|
||||||
susgpio = new GpioCallback(std::string("Chip select SUS 9"), gpio::OUT, 1,
|
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
||||||
gpioCookieSus->addGpio(gpioIds::CS_SUS_9, susgpio);
|
|
||||||
susgpio = new GpioCallback(std::string("Chip select SUS 10"), gpio::OUT, 1,
|
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
||||||
gpioCookieSus->addGpio(gpioIds::CS_SUS_10, susgpio);
|
|
||||||
susgpio = new GpioCallback(std::string("Chip select SUS 11"), gpio::OUT, 1,
|
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
||||||
gpioCookieSus->addGpio(gpioIds::CS_SUS_11, susgpio);
|
|
||||||
susgpio = new GpioCallback(std::string("Chip select SUS 12"), gpio::OUT, 1,
|
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
||||||
gpioCookieSus->addGpio(gpioIds::CS_SUS_12, susgpio);
|
|
||||||
susgpio = new GpioCallback(std::string("Chip select SUS 13"), gpio::OUT, 1,
|
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
||||||
gpioCookieSus->addGpio(gpioIds::CS_SUS_13, susgpio);
|
|
||||||
|
|
||||||
gpioComIF->addGpios(gpioCookieSus);
|
|
||||||
|
|
||||||
SpiCookie* spiCookieSus1 = new SpiCookie(addresses::SUS_1, gpioIds::CS_SUS_1,
|
|
||||||
std::string("/dev/spidev2.0"), SUS::READ_SIZE, spi::DEFAULT_MAX_1227_MODE,
|
|
||||||
spi::DEFAULT_MAX_1227_SPEED);
|
|
||||||
SpiCookie* spiCookieSus2 = new SpiCookie(addresses::SUS_2, gpioIds::CS_SUS_2, std::string("/dev/spidev2.0"),
|
|
||||||
SUS::READ_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
|
|
||||||
SpiCookie* spiCookieSus3 = new SpiCookie(addresses::SUS_3, gpioIds::CS_SUS_3, std::string("/dev/spidev2.0"),
|
|
||||||
SUS::READ_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
|
|
||||||
SpiCookie* spiCookieSus4 = new SpiCookie(addresses::SUS_4, gpioIds::CS_SUS_4, std::string("/dev/spidev2.0"),
|
|
||||||
SUS::READ_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
|
|
||||||
SpiCookie* spiCookieSus5 = new SpiCookie(addresses::SUS_5, gpioIds::CS_SUS_5, std::string("/dev/spidev2.0"),
|
|
||||||
SUS::READ_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
|
|
||||||
SpiCookie* spiCookieSus6 = new SpiCookie(addresses::SUS_6, gpioIds::CS_SUS_6, std::string("/dev/spidev2.0"),
|
|
||||||
SUS::READ_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
|
|
||||||
SpiCookie* spiCookieSus7 = new SpiCookie(addresses::SUS_7, gpioIds::CS_SUS_7, std::string("/dev/spidev2.0"),
|
|
||||||
SUS::READ_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
|
|
||||||
SpiCookie* spiCookieSus8 = new SpiCookie(addresses::SUS_8, gpioIds::CS_SUS_8, std::string("/dev/spidev2.0"),
|
|
||||||
SUS::READ_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
|
|
||||||
SpiCookie* spiCookieSus9 = new SpiCookie(addresses::SUS_9, gpioIds::CS_SUS_9, std::string("/dev/spidev2.0"),
|
|
||||||
SUS::READ_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
|
|
||||||
SpiCookie* spiCookieSus10 = new SpiCookie(addresses::SUS_10, gpioIds::CS_SUS_10, std::string("/dev/spidev2.0"),
|
|
||||||
SUS::READ_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
|
|
||||||
SpiCookie* spiCookieSus11 = new SpiCookie(addresses::SUS_11, gpioIds::CS_SUS_11, std::string("/dev/spidev2.0"),
|
|
||||||
SUS::READ_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
|
|
||||||
SpiCookie* spiCookieSus12 = new SpiCookie(addresses::SUS_12, gpioIds::CS_SUS_12, std::string("/dev/spidev2.0"),
|
|
||||||
SUS::READ_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
|
|
||||||
SpiCookie* spiCookieSus13 = new SpiCookie(addresses::SUS_13, gpioIds::CS_SUS_13, std::string("/dev/spidev2.0"),
|
|
||||||
SUS::READ_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
|
|
||||||
|
|
||||||
SusHandler* sus1 = new SusHandler(objects::SUS_1, objects::SPI_COM_IF, spiCookieSus1);
|
|
||||||
(void) sus1;
|
|
||||||
// sus1->setStartUpImmediately();
|
|
||||||
|
|
||||||
new SusHandler(objects::SUS_2, objects::SPI_COM_IF, spiCookieSus2);
|
|
||||||
new SusHandler(objects::SUS_3, objects::SPI_COM_IF, spiCookieSus3);
|
|
||||||
new SusHandler(objects::SUS_4, objects::SPI_COM_IF, spiCookieSus4);
|
|
||||||
new SusHandler(objects::SUS_5, objects::SPI_COM_IF, spiCookieSus5);
|
|
||||||
new SusHandler(objects::SUS_6, objects::SPI_COM_IF, spiCookieSus6);
|
|
||||||
new SusHandler(objects::SUS_7, objects::SPI_COM_IF, spiCookieSus7);
|
|
||||||
new SusHandler(objects::SUS_8, objects::SPI_COM_IF, spiCookieSus8);
|
|
||||||
new SusHandler(objects::SUS_9, objects::SPI_COM_IF, spiCookieSus9);
|
|
||||||
new SusHandler(objects::SUS_10, objects::SPI_COM_IF, spiCookieSus10);
|
|
||||||
new SusHandler(objects::SUS_11, objects::SPI_COM_IF, spiCookieSus11);
|
|
||||||
new SusHandler(objects::SUS_12, objects::SPI_COM_IF, spiCookieSus12);
|
|
||||||
new SusHandler(objects::SUS_13, objects::SPI_COM_IF, spiCookieSus13);
|
|
||||||
|
|
||||||
#if OBSW_ADD_ACS_BOARD == 1
|
#if OBSW_ADD_ACS_BOARD == 1
|
||||||
GpioCookie* gpioCookieAcsBoard = new GpioCookie();
|
GpioCookie* gpioCookieAcsBoard = new GpioCookie();
|
||||||
GpiodRegular* gpio = nullptr;
|
GpiodRegular* gpio = nullptr;
|
||||||
@ -375,53 +287,54 @@ void ObjectFactory::produce(){
|
|||||||
#if Q7S_ADD_RTD_DEVICES == 1
|
#if Q7S_ADD_RTD_DEVICES == 1
|
||||||
GpioCookie* rtdGpioCookie = new GpioCookie;
|
GpioCookie* rtdGpioCookie = new GpioCookie;
|
||||||
|
|
||||||
|
gpioCallbacks::initTcsBoardDecoder(gpioComIF);
|
||||||
GpioCallback* gpioRtdIc3 = new GpioCallback(std::string("Chip select RTD IC3"), gpio::OUT, 1,
|
GpioCallback* gpioRtdIc3 = new GpioCallback(std::string("Chip select RTD IC3"), gpio::OUT, 1,
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
|
||||||
rtdGpioCookie->addGpio(gpioIds::RTD_IC3, gpioRtdIc3);
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC3, gpioRtdIc3);
|
||||||
GpioCallback* gpioRtdIc4 = new GpioCallback(std::string("Chip select RTD IC4"), gpio::OUT, 1,
|
GpioCallback* gpioRtdIc4 = new GpioCallback(std::string("Chip select RTD IC4"), gpio::OUT, 1,
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
|
||||||
rtdGpioCookie->addGpio(gpioIds::RTD_IC4, gpioRtdIc4);
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC4, gpioRtdIc4);
|
||||||
GpioCallback* gpioRtdIc5 = new GpioCallback(std::string("Chip select RTD IC5"), gpio::OUT, 1,
|
GpioCallback* gpioRtdIc5 = new GpioCallback(std::string("Chip select RTD IC5"), gpio::OUT, 1,
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
|
||||||
rtdGpioCookie->addGpio(gpioIds::RTD_IC5, gpioRtdIc5);
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC5, gpioRtdIc5);
|
||||||
GpioCallback* gpioRtdIc6 = new GpioCallback(std::string("Chip select RTD IC6"), gpio::OUT, 1,
|
GpioCallback* gpioRtdIc6 = new GpioCallback(std::string("Chip select RTD IC6"), gpio::OUT, 1,
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
|
||||||
rtdGpioCookie->addGpio(gpioIds::RTD_IC6, gpioRtdIc6);
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC6, gpioRtdIc6);
|
||||||
GpioCallback* gpioRtdIc7 = new GpioCallback(std::string("Chip select RTD IC7"), gpio::OUT, 1,
|
GpioCallback* gpioRtdIc7 = new GpioCallback(std::string("Chip select RTD IC7"), gpio::OUT, 1,
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
|
||||||
rtdGpioCookie->addGpio(gpioIds::RTD_IC7, gpioRtdIc7);
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC7, gpioRtdIc7);
|
||||||
GpioCallback* gpioRtdIc8 = new GpioCallback(std::string("Chip select RTD IC8"), gpio::OUT, 1,
|
GpioCallback* gpioRtdIc8 = new GpioCallback(std::string("Chip select RTD IC8"), gpio::OUT, 1,
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
|
||||||
rtdGpioCookie->addGpio(gpioIds::RTD_IC8, gpioRtdIc8);
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC8, gpioRtdIc8);
|
||||||
GpioCallback* gpioRtdIc9 = new GpioCallback(std::string("Chip select RTD IC9"), gpio::OUT, 1,
|
GpioCallback* gpioRtdIc9 = new GpioCallback(std::string("Chip select RTD IC9"), gpio::OUT, 1,
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
|
||||||
rtdGpioCookie->addGpio(gpioIds::RTD_IC9, gpioRtdIc9);
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC9, gpioRtdIc9);
|
||||||
GpioCallback* gpioRtdIc10 = new GpioCallback(std::string("Chip select RTD IC10"), gpio::OUT, 1,
|
GpioCallback* gpioRtdIc10 = new GpioCallback(std::string("Chip select RTD IC10"), gpio::OUT, 1,
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
|
||||||
rtdGpioCookie->addGpio(gpioIds::RTD_IC10, gpioRtdIc10);
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC10, gpioRtdIc10);
|
||||||
GpioCallback* gpioRtdIc11 = new GpioCallback(std::string("Chip select RTD IC11"), gpio::OUT, 1,
|
GpioCallback* gpioRtdIc11 = new GpioCallback(std::string("Chip select RTD IC11"), gpio::OUT, 1,
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
|
||||||
rtdGpioCookie->addGpio(gpioIds::RTD_IC11, gpioRtdIc11);
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC11, gpioRtdIc11);
|
||||||
GpioCallback* gpioRtdIc12 = new GpioCallback(std::string("Chip select RTD IC12"), gpio::OUT, 1,
|
GpioCallback* gpioRtdIc12 = new GpioCallback(std::string("Chip select RTD IC12"), gpio::OUT, 1,
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
|
||||||
rtdGpioCookie->addGpio(gpioIds::RTD_IC12, gpioRtdIc12);
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC12, gpioRtdIc12);
|
||||||
GpioCallback* gpioRtdIc13 = new GpioCallback(std::string("Chip select RTD IC13"), gpio::OUT, 1,
|
GpioCallback* gpioRtdIc13 = new GpioCallback(std::string("Chip select RTD IC13"), gpio::OUT, 1,
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
|
||||||
rtdGpioCookie->addGpio(gpioIds::RTD_IC13, gpioRtdIc13);
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC13, gpioRtdIc13);
|
||||||
GpioCallback* gpioRtdIc14 = new GpioCallback(std::string("Chip select RTD IC14"), gpio::OUT, 1,
|
GpioCallback* gpioRtdIc14 = new GpioCallback(std::string("Chip select RTD IC14"), gpio::OUT, 1,
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
|
||||||
rtdGpioCookie->addGpio(gpioIds::RTD_IC14, gpioRtdIc14);
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC14, gpioRtdIc14);
|
||||||
GpioCallback* gpioRtdIc15 = new GpioCallback(std::string("Chip select RTD IC15"), gpio::OUT, 1,
|
GpioCallback* gpioRtdIc15 = new GpioCallback(std::string("Chip select RTD IC15"), gpio::OUT, 1,
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
|
||||||
rtdGpioCookie->addGpio(gpioIds::RTD_IC15, gpioRtdIc15);
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC15, gpioRtdIc15);
|
||||||
GpioCallback* gpioRtdIc16 = new GpioCallback(std::string("Chip select RTD IC16"), gpio::OUT, 1,
|
GpioCallback* gpioRtdIc16 = new GpioCallback(std::string("Chip select RTD IC16"), gpio::OUT, 1,
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
|
||||||
rtdGpioCookie->addGpio(gpioIds::RTD_IC16, gpioRtdIc16);
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC16, gpioRtdIc16);
|
||||||
GpioCallback* gpioRtdIc17 = new GpioCallback(std::string("Chip select RTD IC17"), gpio::OUT, 1,
|
GpioCallback* gpioRtdIc17 = new GpioCallback(std::string("Chip select RTD IC17"), gpio::OUT, 1,
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
|
||||||
rtdGpioCookie->addGpio(gpioIds::RTD_IC17, gpioRtdIc17);
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC17, gpioRtdIc17);
|
||||||
GpioCallback* gpioRtdIc18 = new GpioCallback(std::string("Chip select RTD IC18"), gpio::OUT, 1,
|
GpioCallback* gpioRtdIc18 = new GpioCallback(std::string("Chip select RTD IC18"), gpio::OUT, 1,
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
|
||||||
rtdGpioCookie->addGpio(gpioIds::RTD_IC18, gpioRtdIc18);
|
rtdGpioCookie->addGpio(gpioIds::RTD_IC18, gpioRtdIc18);
|
||||||
|
|
||||||
gpioComIF->addGpios(rtdGpioCookie);
|
gpioComIF->addGpios(rtdGpioCookie);
|
||||||
|
@ -3,12 +3,12 @@
|
|||||||
#include <OBSWConfig.h>
|
#include <OBSWConfig.h>
|
||||||
|
|
||||||
RadiationSensorHandler::RadiationSensorHandler(object_id_t objectId, object_id_t comIF,
|
RadiationSensorHandler::RadiationSensorHandler(object_id_t objectId, object_id_t comIF,
|
||||||
CookieIF * comCookie) :
|
CookieIF * comCookie) :
|
||||||
DeviceHandlerBase(objectId, comIF, comCookie), dataset(
|
DeviceHandlerBase(objectId, comIF, comCookie), dataset(
|
||||||
this) {
|
this) {
|
||||||
if (comCookie == NULL) {
|
if (comCookie == NULL) {
|
||||||
sif::error << "RadiationSensorHandler: Invalid com cookie" << std::endl;
|
sif::error << "RadiationSensorHandler: Invalid com cookie" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RadiationSensorHandler::~RadiationSensorHandler() {
|
RadiationSensorHandler::~RadiationSensorHandler() {
|
||||||
@ -30,21 +30,17 @@ void RadiationSensorHandler::doShutDown(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t RadiationSensorHandler::buildNormalDeviceCommand(
|
ReturnValue_t RadiationSensorHandler::buildNormalDeviceCommand(
|
||||||
DeviceCommandId_t * id) {
|
DeviceCommandId_t * id) {
|
||||||
|
|
||||||
switch (communicationStep) {
|
switch (communicationStep) {
|
||||||
case CommunicationStep::FIRST_CONVERSION: {
|
case CommunicationStep::START_CONVERSION: {
|
||||||
*id = RAD_SENSOR::FIRST_CONVERSION;
|
*id = RAD_SENSOR::START_CONVERSION;
|
||||||
communicationStep = CommunicationStep::READ_CONVERSIONS;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case CommunicationStep::PERFORM_CONVERSION: {
|
|
||||||
*id = RAD_SENSOR::PERFORM_CONVERSION;
|
|
||||||
communicationStep = CommunicationStep::READ_CONVERSIONS;
|
communicationStep = CommunicationStep::READ_CONVERSIONS;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CommunicationStep::READ_CONVERSIONS: {
|
case CommunicationStep::READ_CONVERSIONS: {
|
||||||
*id = RAD_SENSOR::READ_CONVERSIONS;
|
*id = RAD_SENSOR::READ_CONVERSIONS;
|
||||||
communicationStep = CommunicationStep::PERFRORM_CONVERSION;
|
communicationStep = CommunicationStep::START_CONVERSION;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
@ -57,55 +53,56 @@ ReturnValue_t RadiationSensorHandler::buildNormalDeviceCommand(
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t RadiationSensorHandler::buildTransitionDeviceCommand(
|
ReturnValue_t RadiationSensorHandler::buildTransitionDeviceCommand(
|
||||||
DeviceCommandId_t * id){
|
DeviceCommandId_t * id){
|
||||||
if (internalState == InternalState::SETUP) {
|
if (internalState == InternalState::SETUP) {
|
||||||
*id = RAD_SENSOR::WRITE_SETUP;
|
*id = RAD_SENSOR::WRITE_SETUP;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
return buildCommandFromCommand(*id, nullptr, 0);
|
return buildCommandFromCommand(*id, nullptr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t RadiationSensorHandler::buildCommandFromCommand(
|
ReturnValue_t RadiationSensorHandler::buildCommandFromCommand(
|
||||||
DeviceCommandId_t deviceCommand, const uint8_t * commandData,
|
DeviceCommandId_t deviceCommand, const uint8_t * commandData,
|
||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
switch(deviceCommand) {
|
switch(deviceCommand) {
|
||||||
case(RAD_SENSOR::WRITE_SETUP): {
|
case(RAD_SENSOR::WRITE_SETUP): {
|
||||||
cmdBuffer[0] = RAD_SENSOR::SETUP_DEFINITION;
|
cmdBuffer[0] = RAD_SENSOR::SETUP_DEFINITION;
|
||||||
rawPacket = cmdBuffer;
|
rawPacket = cmdBuffer;
|
||||||
rawPacketLen = 1;
|
rawPacketLen = 1;
|
||||||
internalState = InternalState::CONFIGURED;
|
internalState = InternalState::CONFIGURED;
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
case(RAD_SENSOR::FIRST_CONVERSION): {
|
case(RAD_SENSOR::START_CONVERSION): {
|
||||||
/* Dummy bytes are written to remove old values from fifo */
|
/* First the fifo will be reset here */
|
||||||
cmdBuffer[0] = RAD_SENSOR::FIRST_CONVERSION_DEFINITION;
|
cmdBuffer[0] = RAD_SENSOR::RESET_DEFINITION;
|
||||||
rawPacket = cmdBuffer;
|
cmdBuffer[1] = RAD_SENSOR::CONVERSION_DEFINITION;
|
||||||
rawPacketLen = RAD_SENSOR::READ_SIZE;
|
rawPacket = cmdBuffer;
|
||||||
return RETURN_OK;
|
rawPacketLen = 2;
|
||||||
}
|
return RETURN_OK;
|
||||||
case(RAD_SENSOR::PERFORM_CONVERSION): {
|
}
|
||||||
/* Dummy bytes are written to remove old values from fifo */
|
case(RAD_SENSOR::READ_CONVERSIONS): {
|
||||||
cmdBuffer[0] = RAD_SENSOR::CONVERSION_DEFINITION;
|
cmdBuffer[0] = RAD_SENSOR::DUMMY_BYTE;
|
||||||
cmdBuffer[1] = RAD_SENSOR::DUMMY_BYTE;
|
cmdBuffer[1] = RAD_SENSOR::DUMMY_BYTE;
|
||||||
cmdBuffer[2] = RAD_SENSOR::DUMMY_BYTE;
|
cmdBuffer[2] = RAD_SENSOR::DUMMY_BYTE;
|
||||||
cmdBuffer[3] = RAD_SENSOR::DUMMY_BYTE;
|
cmdBuffer[3] = RAD_SENSOR::DUMMY_BYTE;
|
||||||
cmdBuffer[4] = RAD_SENSOR::DUMMY_BYTE;
|
cmdBuffer[4] = RAD_SENSOR::DUMMY_BYTE;
|
||||||
cmdBuffer[5] = RAD_SENSOR::DUMMY_BYTE;
|
cmdBuffer[5] = RAD_SENSOR::DUMMY_BYTE;
|
||||||
rawPacket = cmdBuffer;
|
rawPacket = cmdBuffer;
|
||||||
rawPacketLen = RAD_SENSOR::READ_SIZE;
|
rawPacketLen = RAD_SENSOR::READ_SIZE;
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadiationSensorHandler::fillCommandAndReplyMap() {
|
void RadiationSensorHandler::fillCommandAndReplyMap() {
|
||||||
this->insertInCommandMap(RAD_SENSOR::WRITE_SETUP);
|
this->insertInCommandMap(RAD_SENSOR::WRITE_SETUP);
|
||||||
this->insertInCommandAndReplyMap(RAD_SENSOR::PERFORM_CONVERSION, 1, &dataset,
|
this->insertInCommandMap(RAD_SENSOR::START_CONVERSION);
|
||||||
|
this->insertInCommandAndReplyMap(RAD_SENSOR::READ_CONVERSIONS, 1, &dataset,
|
||||||
RAD_SENSOR::READ_SIZE);
|
RAD_SENSOR::READ_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,12 +115,12 @@ ReturnValue_t RadiationSensorHandler::scanForReply(const uint8_t *start,
|
|||||||
|
|
||||||
ReturnValue_t RadiationSensorHandler::interpretDeviceReply(DeviceCommandId_t id,
|
ReturnValue_t RadiationSensorHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||||
const uint8_t *packet) {
|
const uint8_t *packet) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case RAD_SENSOR::PERFORM_CONVERSION: {
|
case RAD_SENSOR::READ_CONVERSIONS: {
|
||||||
PoolReadGuard readSet(&dataset);
|
PoolReadGuard readSet(&dataset);
|
||||||
dataset.temperatureCelcius = (*(packet) << 8 | *(packet + 1)) * 0.125;
|
dataset.temperatureCelcius = (*(packet) << 8 | *(packet + 1)) * 0.125;
|
||||||
dataset.channel0 = (*(packet + 2) << 8 | *(packet + 3));
|
dataset.channel0 = (*(packet + 2) << 8 | *(packet + 3));
|
||||||
dataset.channel1 = (*(packet + 4) << 8 | *(packet + 5));
|
dataset.channel1 = (*(packet + 4) << 8 | *(packet + 5));
|
||||||
#if OBSW_VERBOSE_LEVEL >= 1 && DEBUG_RAD_SENSOR
|
#if OBSW_VERBOSE_LEVEL >= 1 && DEBUG_RAD_SENSOR
|
||||||
sif::info << "Radiation sensor temperature: " << dataset.temperatureCelcius << " °C"
|
sif::info << "Radiation sensor temperature: " << dataset.temperatureCelcius << " °C"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -132,15 +129,15 @@ ReturnValue_t RadiationSensorHandler::interpretDeviceReply(DeviceCommandId_t id,
|
|||||||
sif::info << "Radiation sensor temperature ADC value channel 1: " << dataset.channel1
|
sif::info << "Radiation sensor temperature ADC value channel 1: " << dataset.channel1
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
sif::debug << "RadiationSensorHandler::interpretDeviceReply: Unknown reply id" << std::endl;
|
sif::debug << "RadiationSensorHandler::interpretDeviceReply: Unknown reply id" << std::endl;
|
||||||
return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY;
|
return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadiationSensorHandler::setNormalDatapoolEntriesInvalid(){
|
void RadiationSensorHandler::setNormalDatapoolEntriesInvalid(){
|
||||||
@ -148,7 +145,7 @@ void RadiationSensorHandler::setNormalDatapoolEntriesInvalid(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32_t RadiationSensorHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo){
|
uint32_t RadiationSensorHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo){
|
||||||
return 5000;
|
return 5000;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t RadiationSensorHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
ReturnValue_t RadiationSensorHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||||
|
@ -77,9 +77,11 @@ ReturnValue_t SusHandler::buildCommandFromCommand(
|
|||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
case(SUS::START_CONVERSION): {
|
case(SUS::START_CONVERSION): {
|
||||||
cmdBuffer[0] = SUS::CONVERSION_DEFINITION;
|
/* First the fifo will be reset before a new conversion is initiated */
|
||||||
|
cmdBuffer[0] = SUS::RESET_DEFINITION;
|
||||||
|
cmdBuffer[1] = SUS::CONVERSION_DEFINITION;
|
||||||
rawPacket = cmdBuffer;
|
rawPacket = cmdBuffer;
|
||||||
rawPacketLen = 1;
|
rawPacketLen = 2;
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
case(SUS::READ_CONVERSIONS): {
|
case(SUS::READ_CONVERSIONS): {
|
||||||
|
@ -10,8 +10,9 @@ namespace RAD_SENSOR {
|
|||||||
* temperature sensor.
|
* temperature sensor.
|
||||||
*/
|
*/
|
||||||
static const DeviceCommandId_t WRITE_SETUP = 0x1;
|
static const DeviceCommandId_t WRITE_SETUP = 0x1;
|
||||||
static const DeviceCommandId_t PERFORM_CONVERSION = 0x2;
|
static const DeviceCommandId_t START_CONVERSION = 0x2;
|
||||||
static const DeviceCommandId_t READ_CONVERSIONS = 0x3;
|
static const DeviceCommandId_t READ_CONVERSIONS = 0x3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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.
|
||||||
@ -34,6 +35,11 @@ namespace RAD_SENSOR {
|
|||||||
*/
|
*/
|
||||||
static const uint8_t CONVERSION_DEFINITION = 0b10001001;
|
static const uint8_t CONVERSION_DEFINITION = 0b10001001;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Writing this value resets the fifo of the MAX1227.
|
||||||
|
*/
|
||||||
|
static const uint8_t RESET_DEFINITION = 0b00011000;
|
||||||
|
|
||||||
static const uint8_t DUMMY_BYTE = 0xFF;
|
static const uint8_t DUMMY_BYTE = 0xFF;
|
||||||
|
|
||||||
static const uint8_t RAD_SENSOR_DATA_SET_ID = READ_CONVERSIONS;
|
static const uint8_t RAD_SENSOR_DATA_SET_ID = READ_CONVERSIONS;
|
||||||
|
@ -34,6 +34,11 @@ namespace SUS {
|
|||||||
*/
|
*/
|
||||||
static const uint8_t UNIPOLAR_CONFIG = 0b11100000;
|
static const uint8_t UNIPOLAR_CONFIG = 0b11100000;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Writing this value resets the fifo of the MAX1227.
|
||||||
|
*/
|
||||||
|
static const uint8_t RESET_DEFINITION = 0b00011000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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
|
||||||
* conversions to perform.
|
* conversions to perform.
|
||||||
|
Loading…
Reference in New Issue
Block a user