Merge branch 'mueller/master' of https://egit.irs.uni-stuttgart.de/eive/eive-obsw into mueller/master
This commit is contained in:
commit
d9ee7e9025
@ -57,12 +57,12 @@ static constexpr char HEATER_6[] = "heater6";
|
|||||||
static constexpr char HEATER_7[] = "heater7";
|
static constexpr char HEATER_7[] = "heater7";
|
||||||
static constexpr char SA_DPL_PIN_0[] = "sa_dpl_0";
|
static constexpr char SA_DPL_PIN_0[] = "sa_dpl_0";
|
||||||
static constexpr char SA_DPL_PIN_1[] = "sa_dpl_1";
|
static constexpr char SA_DPL_PIN_1[] = "sa_dpl_1";
|
||||||
static constexpr char SPI_MUX_BIT_0_PIN[] = "spi_mux_bit_1";
|
static constexpr char SPI_MUX_BIT_0_PIN[] = "spi_mux_bit_0";
|
||||||
static constexpr char SPI_MUX_BIT_1_PIN[] = "spi_mux_bit_2";
|
static constexpr char SPI_MUX_BIT_1_PIN[] = "spi_mux_bit_1";
|
||||||
static constexpr char SPI_MUX_BIT_2_PIN[] = "spi_mux_bit_3";
|
static constexpr char SPI_MUX_BIT_2_PIN[] = "spi_mux_bit_2";
|
||||||
static constexpr char SPI_MUX_BIT_3_PIN[] = "spi_mux_bit_4";
|
static constexpr char SPI_MUX_BIT_3_PIN[] = "spi_mux_bit_3";
|
||||||
static constexpr char SPI_MUX_BIT_4_PIN[] = "spi_mux_bit_5";
|
static constexpr char SPI_MUX_BIT_4_PIN[] = "spi_mux_bit_4";
|
||||||
static constexpr char SPI_MUX_BIT_5_PIN[] = "spi_mux_bit_6";
|
static constexpr char SPI_MUX_BIT_5_PIN[] = "spi_mux_bit_5";
|
||||||
static constexpr char EN_RW_CS[] = "en_rw_cs";
|
static constexpr char EN_RW_CS[] = "en_rw_cs";
|
||||||
static constexpr char EN_RW_1[] = "enable_rw_1";
|
static constexpr char EN_RW_1[] = "enable_rw_1";
|
||||||
static constexpr char EN_RW_2[] = "enable_rw_2";
|
static constexpr char EN_RW_2[] = "enable_rw_2";
|
||||||
@ -70,6 +70,7 @@ static constexpr char EN_RW_3[] = "enable_rw_3";
|
|||||||
static constexpr char EN_RW_4[] = "enable_rw_4";
|
static constexpr char EN_RW_4[] = "enable_rw_4";
|
||||||
|
|
||||||
static constexpr char RAD_SENSOR_CHIP_SELECT[] = "rad_sensor_chip_select";
|
static constexpr char RAD_SENSOR_CHIP_SELECT[] = "rad_sensor_chip_select";
|
||||||
|
static constexpr char ENABLE_RADFET[] = "enable_radfet";
|
||||||
static constexpr char PAPB_BUSY_SIGNAL_VC0[] = "papb_busy_signal_vc0";
|
static constexpr char PAPB_BUSY_SIGNAL_VC0[] = "papb_busy_signal_vc0";
|
||||||
static constexpr char PAPB_EMPTY_SIGNAL_VC0[] = "papb_empty_signal_vc0";
|
static constexpr char PAPB_EMPTY_SIGNAL_VC0[] = "papb_empty_signal_vc0";
|
||||||
static constexpr char PAPB_BUSY_SIGNAL_VC1[] = "papb_busy_signal_vc1";
|
static constexpr char PAPB_BUSY_SIGNAL_VC1[] = "papb_busy_signal_vc1";
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#include <fsfw/events/EventManager.h>
|
||||||
#include "CoreController.h"
|
#include "CoreController.h"
|
||||||
|
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
@ -99,6 +100,10 @@ ReturnValue_t CoreController::initializeAfterTaskCreation() {
|
|||||||
setenv("PATH", updatedEnvPath.c_str(), true);
|
setenv("PATH", updatedEnvPath.c_str(), true);
|
||||||
updateProtInfo();
|
updateProtInfo();
|
||||||
initPrint();
|
initPrint();
|
||||||
|
auto eventManager = ObjectManager::instance()->get<EventManager>(objects::EVENT_MANAGER);
|
||||||
|
if(eventManager != nullptr) {
|
||||||
|
eventManager->printListeners();
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,13 +140,11 @@ void ObjectFactory::produce(void* args) {
|
|||||||
|
|
||||||
createHeaterComponents();
|
createHeaterComponents();
|
||||||
createSolarArrayDeploymentComponents();
|
createSolarArrayDeploymentComponents();
|
||||||
|
createPlPcduComponents(gpioComIF, spiComIF);
|
||||||
#if OBSW_ADD_SYRLINKS == 1
|
#if OBSW_ADD_SYRLINKS == 1
|
||||||
createSyrlinksComponents();
|
createSyrlinksComponents();
|
||||||
#endif /* OBSW_ADD_SYRLINKS == 1 */
|
#endif /* OBSW_ADD_SYRLINKS == 1 */
|
||||||
|
|
||||||
#if OBSW_ADD_RTD_DEVICES == 1
|
|
||||||
createRtdComponents(gpioComIF);
|
createRtdComponents(gpioComIF);
|
||||||
#endif /* OBSW_ADD_RTD_DEVICES == 1 */
|
|
||||||
|
|
||||||
#if OBSW_ADD_MGT == 1
|
#if OBSW_ADD_MGT == 1
|
||||||
I2cCookie* imtqI2cCookie =
|
I2cCookie* imtqI2cCookie =
|
||||||
@ -254,9 +252,7 @@ void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, Ua
|
|||||||
new CspComIF(objects::CSP_COM_IF);
|
new CspComIF(objects::CSP_COM_IF);
|
||||||
*i2cComIF = new I2cComIF(objects::I2C_COM_IF);
|
*i2cComIF = new I2cComIF(objects::I2C_COM_IF);
|
||||||
*uartComIF = new UartComIF(objects::UART_COM_IF);
|
*uartComIF = new UartComIF(objects::UART_COM_IF);
|
||||||
#if OBSW_ADD_SPI_TEST_CODE == 0
|
|
||||||
*spiComIF = new SpiComIF(objects::SPI_COM_IF, *gpioComIF);
|
*spiComIF = new SpiComIF(objects::SPI_COM_IF, *gpioComIF);
|
||||||
#endif /* Q7S_ADD_SPI_TEST_CODE == 0 */
|
|
||||||
|
|
||||||
#if BOARD_TE0720 == 0
|
#if BOARD_TE0720 == 0
|
||||||
/* Adding gpios for chip select decoding to the gpioComIf */
|
/* Adding gpios for chip select decoding to the gpioComIf */
|
||||||
@ -298,12 +294,21 @@ void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) {
|
|||||||
GpiodRegularByLineName* gpio = new GpiodRegularByLineName(
|
GpiodRegularByLineName* gpio = new GpiodRegularByLineName(
|
||||||
q7s::gpioNames::RAD_SENSOR_CHIP_SELECT, consumer.str(), gpio::DIR_OUT, gpio::HIGH);
|
q7s::gpioNames::RAD_SENSOR_CHIP_SELECT, consumer.str(), gpio::DIR_OUT, gpio::HIGH);
|
||||||
gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, gpio);
|
gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, gpio);
|
||||||
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::ENABLE_RADFET, consumer.str(), gpio::DIR_OUT,
|
||||||
|
gpio::LOW);
|
||||||
|
gpioCookieRadSensor->addGpio(gpioIds::ENABLE_RADFET, gpio);
|
||||||
gpioComIF->addGpios(gpioCookieRadSensor);
|
gpioComIF->addGpios(gpioCookieRadSensor);
|
||||||
|
|
||||||
SpiCookie* spiCookieRadSensor = new SpiCookie(
|
SpiCookie* spiCookieRadSensor = new SpiCookie(
|
||||||
addresses::RAD_SENSOR, gpioIds::CS_RAD_SENSOR, std::string(q7s::SPI_DEFAULT_DEV),
|
addresses::RAD_SENSOR, gpioIds::CS_RAD_SENSOR, std::string(q7s::SPI_DEFAULT_DEV),
|
||||||
RAD_SENSOR::READ_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
|
RAD_SENSOR::READ_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
|
||||||
|
auto radSensor =
|
||||||
new RadiationSensorHandler(objects::RAD_SENSOR, objects::SPI_COM_IF, spiCookieRadSensor);
|
new RadiationSensorHandler(objects::RAD_SENSOR, objects::SPI_COM_IF, spiCookieRadSensor);
|
||||||
|
static_cast<void>(radSensor);
|
||||||
|
#if OBSW_TEST_RADIATION_SENSOR_HANDLER == 1
|
||||||
|
radSensor->setStartUpImmediately();
|
||||||
|
radSensor->setToGoToNormalModeImmediately();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF) {
|
void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF) {
|
||||||
@ -349,76 +354,77 @@ void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComI
|
|||||||
|
|
||||||
gpioComIF->addGpios(gpioCookieSus);
|
gpioComIF->addGpios(gpioCookieSus);
|
||||||
|
|
||||||
|
#if OBSW_ADD_SUN_SENSORS == 1
|
||||||
SpiCookie* spiCookie =
|
SpiCookie* spiCookie =
|
||||||
new SpiCookie(addresses::SUS_0, gpioIds::CS_SUS_0, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
|
new SpiCookie(addresses::SUS_0, gpioIds::CS_SUS_0, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
|
||||||
spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
||||||
SusHandler* susHandler0 =
|
SusHandler* susHandler0 = new SusHandler(objects::SUS_0, 0, objects::SPI_COM_IF, spiCookie,
|
||||||
new SusHandler(objects::SUS_0, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_0);
|
gpioComIF, gpioIds::CS_SUS_0);
|
||||||
|
|
||||||
spiCookie =
|
spiCookie =
|
||||||
new SpiCookie(addresses::SUS_1, gpioIds::CS_SUS_1, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
|
new SpiCookie(addresses::SUS_1, gpioIds::CS_SUS_1, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
|
||||||
spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
||||||
SusHandler* susHandler1 =
|
SusHandler* susHandler1 = new SusHandler(objects::SUS_1, 1, objects::SPI_COM_IF, spiCookie,
|
||||||
new SusHandler(objects::SUS_1, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_1);
|
gpioComIF, gpioIds::CS_SUS_1);
|
||||||
|
|
||||||
spiCookie =
|
spiCookie =
|
||||||
new SpiCookie(addresses::SUS_2, gpioIds::CS_SUS_2, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
|
new SpiCookie(addresses::SUS_2, gpioIds::CS_SUS_2, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
|
||||||
spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
||||||
SusHandler* susHandler2 =
|
SusHandler* susHandler2 = new SusHandler(objects::SUS_2, 2, objects::SPI_COM_IF, spiCookie,
|
||||||
new SusHandler(objects::SUS_2, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_2);
|
gpioComIF, gpioIds::CS_SUS_2);
|
||||||
|
|
||||||
spiCookie =
|
spiCookie =
|
||||||
new SpiCookie(addresses::SUS_3, gpioIds::CS_SUS_3, std::string(q7s::SPI_DEFAULT_DEV),
|
new SpiCookie(addresses::SUS_3, gpioIds::CS_SUS_3, std::string(q7s::SPI_DEFAULT_DEV),
|
||||||
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
||||||
SusHandler* susHandler3 =
|
SusHandler* susHandler3 = new SusHandler(objects::SUS_3, 3, objects::SPI_COM_IF, spiCookie,
|
||||||
new SusHandler(objects::SUS_3, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_3);
|
gpioComIF, gpioIds::CS_SUS_3);
|
||||||
|
|
||||||
spiCookie =
|
spiCookie =
|
||||||
new SpiCookie(addresses::SUS_4, gpioIds::CS_SUS_4, std::string(q7s::SPI_DEFAULT_DEV),
|
new SpiCookie(addresses::SUS_4, gpioIds::CS_SUS_4, std::string(q7s::SPI_DEFAULT_DEV),
|
||||||
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
||||||
SusHandler* susHandler4 =
|
SusHandler* susHandler4 = new SusHandler(objects::SUS_4, 4, objects::SPI_COM_IF, spiCookie,
|
||||||
new SusHandler(objects::SUS_4, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_4);
|
gpioComIF, gpioIds::CS_SUS_4);
|
||||||
|
|
||||||
spiCookie =
|
spiCookie =
|
||||||
new SpiCookie(addresses::SUS_5, gpioIds::CS_SUS_5, std::string(q7s::SPI_DEFAULT_DEV),
|
new SpiCookie(addresses::SUS_5, gpioIds::CS_SUS_5, std::string(q7s::SPI_DEFAULT_DEV),
|
||||||
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
||||||
SusHandler* susHandler5 =
|
SusHandler* susHandler5 = new SusHandler(objects::SUS_5, 5, objects::SPI_COM_IF, spiCookie,
|
||||||
new SusHandler(objects::SUS_5, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_5);
|
gpioComIF, gpioIds::CS_SUS_5);
|
||||||
|
|
||||||
spiCookie =
|
spiCookie =
|
||||||
new SpiCookie(addresses::SUS_6, gpioIds::CS_SUS_6, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
|
new SpiCookie(addresses::SUS_6, gpioIds::CS_SUS_6, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
|
||||||
spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
||||||
SusHandler* susHandler6 =
|
SusHandler* susHandler6 = new SusHandler(objects::SUS_6, 6, objects::SPI_COM_IF, spiCookie,
|
||||||
new SusHandler(objects::SUS_6, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_6);
|
gpioComIF, gpioIds::CS_SUS_6);
|
||||||
|
|
||||||
spiCookie =
|
spiCookie =
|
||||||
new SpiCookie(addresses::SUS_7, gpioIds::CS_SUS_7, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
|
new SpiCookie(addresses::SUS_7, gpioIds::CS_SUS_7, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
|
||||||
spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
||||||
SusHandler* susHandler7 =
|
SusHandler* susHandler7 = new SusHandler(objects::SUS_7, 7, objects::SPI_COM_IF, spiCookie,
|
||||||
new SusHandler(objects::SUS_7, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_7);
|
gpioComIF, gpioIds::CS_SUS_7);
|
||||||
|
|
||||||
spiCookie =
|
spiCookie =
|
||||||
new SpiCookie(addresses::SUS_8, gpioIds::CS_SUS_8, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
|
new SpiCookie(addresses::SUS_8, gpioIds::CS_SUS_8, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
|
||||||
spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
||||||
SusHandler* susHandler8 =
|
SusHandler* susHandler8 = new SusHandler(objects::SUS_8, 8, objects::SPI_COM_IF, spiCookie,
|
||||||
new SusHandler(objects::SUS_8, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_8);
|
gpioComIF, gpioIds::CS_SUS_8);
|
||||||
|
|
||||||
spiCookie =
|
spiCookie =
|
||||||
new SpiCookie(addresses::SUS_9, gpioIds::CS_SUS_9, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
|
new SpiCookie(addresses::SUS_9, gpioIds::CS_SUS_9, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
|
||||||
spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
||||||
SusHandler* susHandler9 =
|
SusHandler* susHandler9 = new SusHandler(objects::SUS_9, 9, objects::SPI_COM_IF, spiCookie,
|
||||||
new SusHandler(objects::SUS_9, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_9);
|
gpioComIF, gpioIds::CS_SUS_9);
|
||||||
|
|
||||||
spiCookie =
|
spiCookie =
|
||||||
new SpiCookie(addresses::SUS_10, gpioIds::CS_SUS_10, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
|
new SpiCookie(addresses::SUS_10, gpioIds::CS_SUS_10, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
|
||||||
spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
||||||
SusHandler* susHandler10 = new SusHandler(objects::SUS_10, objects::SPI_COM_IF, spiCookie,
|
SusHandler* susHandler10 = new SusHandler(objects::SUS_10, 10, objects::SPI_COM_IF, spiCookie,
|
||||||
gpioComIF, gpioIds::CS_SUS_10);
|
gpioComIF, gpioIds::CS_SUS_10);
|
||||||
|
|
||||||
spiCookie =
|
spiCookie =
|
||||||
new SpiCookie(addresses::SUS_11, gpioIds::CS_SUS_11, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
|
new SpiCookie(addresses::SUS_11, gpioIds::CS_SUS_11, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
|
||||||
spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
spi::DEFAULT_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
||||||
SusHandler* susHandler11 = new SusHandler(objects::SUS_11, objects::SPI_COM_IF, spiCookie,
|
SusHandler* susHandler11 = new SusHandler(objects::SUS_11, 11, objects::SPI_COM_IF, spiCookie,
|
||||||
gpioComIF, gpioIds::CS_SUS_11);
|
gpioComIF, gpioIds::CS_SUS_11);
|
||||||
static_cast<void>(susHandler0);
|
static_cast<void>(susHandler0);
|
||||||
static_cast<void>(susHandler1);
|
static_cast<void>(susHandler1);
|
||||||
@ -458,6 +464,8 @@ void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComI
|
|||||||
susHandler10->setToGoToNormalMode(true);
|
susHandler10->setToGoToNormalMode(true);
|
||||||
susHandler11->setToGoToNormalMode(true);
|
susHandler11->setToGoToNormalMode(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif /* OBSW_ADD_SUN_SENSORS == 1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF) {
|
void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF) {
|
||||||
@ -787,6 +795,7 @@ void ObjectFactory::createRtdComponents(LinuxLibgpioIF* gpioComIF) {
|
|||||||
|
|
||||||
gpioComIF->addGpios(rtdGpioCookie);
|
gpioComIF->addGpios(rtdGpioCookie);
|
||||||
|
|
||||||
|
#if OBSW_ADD_RTD_DEVICES == 1
|
||||||
SpiCookie* spiRtdIc0 =
|
SpiCookie* spiRtdIc0 =
|
||||||
new SpiCookie(addresses::RTD_IC_3, gpioIds::RTD_IC_3, q7s::SPI_DEFAULT_DEV,
|
new SpiCookie(addresses::RTD_IC_3, gpioIds::RTD_IC_3, q7s::SPI_DEFAULT_DEV,
|
||||||
Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
|
Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
|
||||||
@ -894,6 +903,7 @@ void ObjectFactory::createRtdComponents(LinuxLibgpioIF* gpioComIF) {
|
|||||||
static_cast<void>(rtdIc13);
|
static_cast<void>(rtdIc13);
|
||||||
static_cast<void>(rtdIc14);
|
static_cast<void>(rtdIc14);
|
||||||
static_cast<void>(rtdIc15);
|
static_cast<void>(rtdIc15);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) {
|
void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) {
|
||||||
@ -935,6 +945,7 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) {
|
|||||||
|
|
||||||
gpioComIF->addGpios(gpioCookieRw);
|
gpioComIF->addGpios(gpioCookieRw);
|
||||||
|
|
||||||
|
#if OBSW_ADD_RW == 1
|
||||||
auto rw1SpiCookie =
|
auto rw1SpiCookie =
|
||||||
new SpiCookie(addresses::RW1, gpioIds::CS_RW1, q7s::SPI_RW_DEV, RwDefinitions::MAX_REPLY_SIZE,
|
new SpiCookie(addresses::RW1, gpioIds::CS_RW1, q7s::SPI_RW_DEV, RwDefinitions::MAX_REPLY_SIZE,
|
||||||
spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback, nullptr);
|
spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback, nullptr);
|
||||||
@ -976,6 +987,8 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) {
|
|||||||
rwHandler4->setStartUpImmediately();
|
rwHandler4->setStartUpImmediately();
|
||||||
#endif
|
#endif
|
||||||
rw4SpiCookie->setCallbackArgs(rwHandler4);
|
rw4SpiCookie->setCallbackArgs(rwHandler4);
|
||||||
|
|
||||||
|
#endif /* OBSW_ADD_RW == 1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) {
|
void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) {
|
||||||
@ -1097,7 +1110,7 @@ void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF*
|
|||||||
gpio::Levels::LOW);
|
gpio::Levels::LOW);
|
||||||
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_VBAT0, gpio);
|
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_VBAT0, gpio);
|
||||||
consumer = "PLPCDU_ENB_VBAT_1";
|
consumer = "PLPCDU_ENB_VBAT_1";
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_VBAT0, consumer, gpio::DIR_OUT,
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_VBAT1, consumer, gpio::DIR_OUT,
|
||||||
gpio::Levels::LOW);
|
gpio::Levels::LOW);
|
||||||
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_VBAT1, gpio);
|
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_VBAT1, gpio);
|
||||||
consumer = "PLPCDU_ENB_DRO";
|
consumer = "PLPCDU_ENB_DRO";
|
||||||
|
@ -44,7 +44,9 @@ StarTrackerHandler::StarTrackerHandler(object_id_t objectId, object_id_t comIF,
|
|||||||
if (strHelper == nullptr) {
|
if (strHelper == nullptr) {
|
||||||
sif::error << "StarTrackerHandler: Invalid str image loader" << std::endl;
|
sif::error << "StarTrackerHandler: Invalid str image loader" << std::endl;
|
||||||
}
|
}
|
||||||
eventQueue = QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5);
|
auto mqArgs = MqArgs(this->getObjectId());
|
||||||
|
eventQueue = QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5,
|
||||||
|
MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
StarTrackerHandler::~StarTrackerHandler() {}
|
StarTrackerHandler::~StarTrackerHandler() {}
|
||||||
|
@ -27,7 +27,7 @@ static constexpr spi::SpiModes DEFAULT_L3G_MODE = spi::SpiModes::MODE_3;
|
|||||||
* Some MAX1227 could not be reached with frequencies around 4 MHz. Maybe this is caused by
|
* Some MAX1227 could not be reached with frequencies around 4 MHz. Maybe this is caused by
|
||||||
* the decoder and buffer circuits. Thus frequency is here defined to 1 MHz.
|
* the decoder and buffer circuits. Thus frequency is here defined to 1 MHz.
|
||||||
*/
|
*/
|
||||||
static const uint32_t SUS_MAX1227_SPI_FREQ = 1'000'000;
|
static const uint32_t SUS_MAX1227_SPI_FREQ = 976'000;
|
||||||
|
|
||||||
static constexpr uint32_t DEFAULT_MAX_1227_SPEED = 976'000;
|
static constexpr uint32_t DEFAULT_MAX_1227_SPEED = 976'000;
|
||||||
static constexpr spi::SpiModes DEFAULT_MAX_1227_MODE = spi::SpiModes::MODE_3;
|
static constexpr spi::SpiModes DEFAULT_MAX_1227_MODE = spi::SpiModes::MODE_3;
|
||||||
|
@ -26,9 +26,9 @@ SpiTestClass::SpiTestClass(object_id_t objectId, GpioIF *gpioIF)
|
|||||||
if (gpioIF == nullptr) {
|
if (gpioIF == nullptr) {
|
||||||
sif::error << "SpiTestClass::SpiTestClass: Invalid GPIO ComIF!" << std::endl;
|
sif::error << "SpiTestClass::SpiTestClass: Invalid GPIO ComIF!" << std::endl;
|
||||||
}
|
}
|
||||||
testMode = TestModes::MGM_LIS3MDL;
|
testMode = TestModes::MAX1227;
|
||||||
spiTransferStruct[0].rx_buf = reinterpret_cast<__u64>(recvBuffer.data());
|
spiTransferStruct[0].rx_buf = reinterpret_cast<__u64>(recvBuffer.data());
|
||||||
spiTransferStruct[0].tx_buf = reinterpret_cast<__u64>(sendBuffer.data());
|
setSendBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t SpiTestClass::performOneShotAction() {
|
ReturnValue_t SpiTestClass::performOneShotAction() {
|
||||||
@ -48,15 +48,25 @@ ReturnValue_t SpiTestClass::performOneShotAction() {
|
|||||||
performL3gTest(gyro1L3gd20ChipSelect);
|
performL3gTest(gyro1L3gd20ChipSelect);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (TestModes::SUS_0): {
|
case (TestModes::MAX1227): {
|
||||||
performSusTest();
|
performOneShotMax1227Test();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t SpiTestClass::performPeriodicAction() { return HasReturnvaluesIF::RETURN_OK; }
|
ReturnValue_t SpiTestClass::performPeriodicAction() {
|
||||||
|
switch (testMode) {
|
||||||
|
case (TestModes::MAX1227): {
|
||||||
|
performPeriodicMax1227Test();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
void SpiTestClass::performRm3100Test(uint8_t mgmId) {
|
void SpiTestClass::performRm3100Test(uint8_t mgmId) {
|
||||||
/* Configure all SPI chip selects and pull them high */
|
/* Configure all SPI chip selects and pull them high */
|
||||||
@ -281,14 +291,64 @@ void SpiTestClass::performL3gTest(uint8_t l3gId) {
|
|||||||
sif::info << "Z: " << angVelocZ << std::endl;
|
sif::info << "Z: " << angVelocZ << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpiTestClass::performSusTest() {
|
void SpiTestClass::performOneShotMax1227Test() {
|
||||||
|
using namespace max1227;
|
||||||
|
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;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
adcCfg.plPcduAdcExtConv = false;
|
||||||
|
adcCfg.plPcduAdcIntConv = true;
|
||||||
|
performMax1227Test();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpiTestClass::performPeriodicMax1227Test() {
|
||||||
|
using namespace max1227;
|
||||||
|
adcCfg.testRadSensorExtConvWithDelay = false;
|
||||||
|
adcCfg.testRadSensorIntConv = false;
|
||||||
|
|
||||||
|
adcCfg.plPcduAdcExtConv = false;
|
||||||
|
adcCfg.plPcduAdcIntConv = false;
|
||||||
|
performMax1227Test();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpiTestClass::performMax1227Test() {
|
||||||
#ifdef XIPHOS_Q7S
|
#ifdef XIPHOS_Q7S
|
||||||
std::string deviceName = q7s::SPI_DEFAULT_DEV;
|
std::string deviceName = q7s::SPI_DEFAULT_DEV;
|
||||||
#elif defined(RASPBERRY_PI)
|
#elif defined(RASPBERRY_PI)
|
||||||
std::string deviceName = "";
|
std::string deviceName = "";
|
||||||
#endif
|
#endif
|
||||||
int fileDescriptor = 0;
|
int fd = 0;
|
||||||
UnixFileGuard fileHelper(deviceName, &fileDescriptor, O_RDWR, "SpiComIF::initializeInterface");
|
UnixFileGuard fileHelper(deviceName, &fd, O_RDWR, "SpiComIF::initializeInterface");
|
||||||
if (fileHelper.getOpenResult()) {
|
if (fileHelper.getOpenResult()) {
|
||||||
sif::error << "SpiTestClass::performLis3Mdl3100Test: File descriptor could not be opened!"
|
sif::error << "SpiTestClass::performLis3Mdl3100Test: File descriptor could not be opened!"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -296,7 +356,253 @@ void SpiTestClass::performSusTest() {
|
|||||||
}
|
}
|
||||||
uint32_t spiSpeed = 1'000'000;
|
uint32_t spiSpeed = 1'000'000;
|
||||||
spi::SpiModes spiMode = spi::SpiModes::MODE_3;
|
spi::SpiModes spiMode = spi::SpiModes::MODE_3;
|
||||||
setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed);
|
setSpiSpeedAndMode(fd, spiMode, spiSpeed);
|
||||||
|
|
||||||
|
max1227RadSensorTest(fd);
|
||||||
|
int idx = 0;
|
||||||
|
bool firstTest = true;
|
||||||
|
for (auto &susCfg : adcCfg.testSus) {
|
||||||
|
if (susCfg.doTest) {
|
||||||
|
if (firstTest) {
|
||||||
|
firstTest = false;
|
||||||
|
sif::info << "---------- SUS ADC Values -----------" << std::endl;
|
||||||
|
}
|
||||||
|
sif::info << "SUS " << std::setw(2) << idx << ": ";
|
||||||
|
max1227SusTest(fd, susCfg);
|
||||||
|
}
|
||||||
|
idx++;
|
||||||
|
}
|
||||||
|
max1227PlPcduTest(fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpiTestClass::max1227RadSensorTest(int fd) {
|
||||||
|
using namespace max1227;
|
||||||
|
if (adcCfg.testRadSensorExtConvWithDelay) {
|
||||||
|
sendBuffer[0] = max1227::buildResetByte(true);
|
||||||
|
spiTransferStruct[0].len = 1;
|
||||||
|
transfer(fd, gpioIds::CS_RAD_SENSOR);
|
||||||
|
usleep(200);
|
||||||
|
sendBuffer[0] = max1227::buildSetupByte(ClkSel::EXT_CONV_EXT_TIMED, RefSel::INT_REF_WITH_WAKEUP,
|
||||||
|
DiffSel::NONE_0);
|
||||||
|
spiTransferStruct[0].len = 1;
|
||||||
|
transfer(fd, gpioIds::CS_RAD_SENSOR);
|
||||||
|
max1227::prepareExternallyClockedRead0ToN(sendBuffer.data(), 7, spiTransferStruct[0].len);
|
||||||
|
size_t tmpLen = spiTransferStruct[0].len;
|
||||||
|
spiTransferStruct[0].len = 1;
|
||||||
|
transfer(fd, gpioIds::CS_RAD_SENSOR);
|
||||||
|
std::memcpy(sendBuffer.data(), sendBuffer.data() + 1, tmpLen - 1);
|
||||||
|
spiTransferStruct[0].len = tmpLen - 1;
|
||||||
|
usleep(65);
|
||||||
|
transfer(fd, gpioIds::CS_RAD_SENSOR);
|
||||||
|
arrayprinter::print(recvBuffer.data(), 13, OutputType::HEX);
|
||||||
|
uint16_t adcRaw[8] = {};
|
||||||
|
adcRaw[0] = (recvBuffer[0] << 8) | recvBuffer[1];
|
||||||
|
adcRaw[1] = (recvBuffer[2] << 8) | recvBuffer[3];
|
||||||
|
adcRaw[2] = (recvBuffer[4] << 8) | recvBuffer[5];
|
||||||
|
adcRaw[3] = (recvBuffer[6] << 8) | recvBuffer[7];
|
||||||
|
adcRaw[4] = (recvBuffer[8] << 8) | recvBuffer[9];
|
||||||
|
adcRaw[5] = (recvBuffer[10] << 8) | recvBuffer[11];
|
||||||
|
adcRaw[6] = (recvBuffer[12] << 8) | recvBuffer[13];
|
||||||
|
adcRaw[7] = (recvBuffer[14] << 8) | recvBuffer[15];
|
||||||
|
arrayprinter::print(recvBuffer.data(), 17, OutputType::HEX);
|
||||||
|
for (int idx = 0; idx < 8; idx++) {
|
||||||
|
sif::info << "ADC raw " << idx << ": " << adcRaw[idx] << std::endl;
|
||||||
|
}
|
||||||
|
max1227::prepareExternallyClockedTemperatureRead(sendBuffer.data(), spiTransferStruct[0].len);
|
||||||
|
spiTransferStruct[0].len = 1;
|
||||||
|
transfer(fd, gpioIds::CS_RAD_SENSOR);
|
||||||
|
usleep(65);
|
||||||
|
spiTransferStruct[0].len = 24;
|
||||||
|
std::memcpy(sendBuffer.data(), sendBuffer.data() + 1, 24);
|
||||||
|
transfer(fd, gpioIds::CS_RAD_SENSOR);
|
||||||
|
int16_t tempRaw = ((recvBuffer[22] & 0x0f) << 8) | recvBuffer[23];
|
||||||
|
float temp = max1227::getTemperature(tempRaw);
|
||||||
|
sif::info << "Temperature: " << temp << std::endl;
|
||||||
|
}
|
||||||
|
if (adcCfg.testRadSensorIntConv) {
|
||||||
|
sendBuffer[0] = max1227::buildResetByte(false);
|
||||||
|
spiTransferStruct[0].len = 1;
|
||||||
|
transfer(fd, gpioIds::CS_RAD_SENSOR);
|
||||||
|
usleep(5);
|
||||||
|
// Now use internal conversion
|
||||||
|
sendBuffer[0] = max1227::buildSetupByte(ClkSel::INT_CONV_INT_TIMED_CNVST_AS_AIN,
|
||||||
|
RefSel::INT_REF_NO_WAKEUP, DiffSel::NONE_0);
|
||||||
|
spiTransferStruct[0].len = 1;
|
||||||
|
transfer(fd, gpioIds::CS_RAD_SENSOR);
|
||||||
|
usleep(10);
|
||||||
|
sendBuffer[0] = buildConvByte(ScanModes::CHANNELS_0_TO_N, 7, true);
|
||||||
|
spiTransferStruct[0].len = 1;
|
||||||
|
transfer(fd, gpioIds::CS_RAD_SENSOR);
|
||||||
|
|
||||||
|
usleep(65);
|
||||||
|
spiTransferStruct[0].len = 18;
|
||||||
|
// Shift out zeros
|
||||||
|
shiftOutZeros();
|
||||||
|
transfer(fd, gpioIds::CS_RAD_SENSOR);
|
||||||
|
setSendBuffer();
|
||||||
|
|
||||||
|
arrayprinter::print(recvBuffer.data(), 14);
|
||||||
|
uint16_t adcRaw[8] = {};
|
||||||
|
int16_t tempRaw = ((recvBuffer[0] & 0x0f) << 8) | recvBuffer[1];
|
||||||
|
sif::info << "Temperature: " << tempRaw * 0.125 << " C" << std::endl;
|
||||||
|
adcRaw[0] = (recvBuffer[2] << 8) | recvBuffer[3];
|
||||||
|
adcRaw[1] = (recvBuffer[4] << 8) | recvBuffer[5];
|
||||||
|
adcRaw[2] = (recvBuffer[6] << 8) | recvBuffer[7];
|
||||||
|
adcRaw[3] = (recvBuffer[8] << 8) | recvBuffer[9];
|
||||||
|
adcRaw[4] = (recvBuffer[10] << 8) | recvBuffer[11];
|
||||||
|
adcRaw[5] = (recvBuffer[12] << 8) | recvBuffer[13];
|
||||||
|
adcRaw[6] = (recvBuffer[14] << 8) | recvBuffer[15];
|
||||||
|
adcRaw[7] = (recvBuffer[16] << 8) | recvBuffer[17];
|
||||||
|
for (int idx = 0; idx < 8; idx++) {
|
||||||
|
sif::info << "ADC raw " << idx << ": " << adcRaw[idx] << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpiTestClass::max1227SusTest(int fd, SusTestCfg &cfg) {
|
||||||
|
using namespace max1227;
|
||||||
|
if (cfg.extConv) {
|
||||||
|
sendBuffer[0] = max1227::buildResetByte(false);
|
||||||
|
spiTransferStruct[0].len = 1;
|
||||||
|
transfer(fd, cfg.gpioId);
|
||||||
|
|
||||||
|
usleep(65);
|
||||||
|
sendBuffer[0] = max1227::buildSetupByte(ClkSel::EXT_CONV_EXT_TIMED, RefSel::INT_REF_NO_WAKEUP,
|
||||||
|
DiffSel::NONE_0);
|
||||||
|
spiTransferStruct[0].len = 1;
|
||||||
|
transfer(fd, cfg.gpioId);
|
||||||
|
|
||||||
|
max1227::prepareExternallyClockedRead0ToN(sendBuffer.data(), 5, spiTransferStruct[0].len);
|
||||||
|
transfer(fd, cfg.gpioId);
|
||||||
|
uint16_t adcRaw[6] = {};
|
||||||
|
adcRaw[0] = (recvBuffer[1] << 8) | recvBuffer[2];
|
||||||
|
adcRaw[1] = (recvBuffer[3] << 8) | recvBuffer[4];
|
||||||
|
adcRaw[2] = (recvBuffer[5] << 8) | recvBuffer[6];
|
||||||
|
adcRaw[3] = (recvBuffer[7] << 8) | recvBuffer[8];
|
||||||
|
adcRaw[4] = (recvBuffer[9] << 8) | recvBuffer[10];
|
||||||
|
adcRaw[5] = (recvBuffer[11] << 8) | recvBuffer[12];
|
||||||
|
sif::info << "Ext Conv [" << std::hex << std::setw(3);
|
||||||
|
for (int idx = 0; idx < 5; idx++) {
|
||||||
|
sif::info << adcRaw[idx];
|
||||||
|
if (idx < 6) {
|
||||||
|
sif::info << ",";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sif::info << std::dec << "]" << std::endl; // | Temperature: " << temp << " C" << std::endl;
|
||||||
|
}
|
||||||
|
if (cfg.intConv) {
|
||||||
|
sendBuffer[0] = max1227::buildResetByte(false);
|
||||||
|
spiTransferStruct[0].len = 1;
|
||||||
|
transfer(fd, cfg.gpioId);
|
||||||
|
usleep(65);
|
||||||
|
// Now use internal conversion
|
||||||
|
sendBuffer[0] = max1227::buildSetupByte(ClkSel::INT_CONV_INT_TIMED_CNVST_AS_AIN,
|
||||||
|
RefSel::INT_REF_NO_WAKEUP, DiffSel::NONE_0);
|
||||||
|
spiTransferStruct[0].len = 1;
|
||||||
|
transfer(fd, cfg.gpioId);
|
||||||
|
usleep(10);
|
||||||
|
sendBuffer[0] = buildConvByte(ScanModes::CHANNELS_0_TO_N, 5, true);
|
||||||
|
spiTransferStruct[0].len = 1;
|
||||||
|
transfer(fd, cfg.gpioId);
|
||||||
|
|
||||||
|
usleep(65);
|
||||||
|
spiTransferStruct[0].len = 14;
|
||||||
|
// Shift out zeros
|
||||||
|
shiftOutZeros();
|
||||||
|
transfer(fd, cfg.gpioId);
|
||||||
|
setSendBuffer();
|
||||||
|
// arrayprinter::print(recvBuffer.data(), 14);
|
||||||
|
float temp = static_cast<int16_t>(((recvBuffer[0] & 0x0f) << 8) | recvBuffer[1]) * 0.125;
|
||||||
|
uint16_t adcRaw[6] = {};
|
||||||
|
adcRaw[0] = (recvBuffer[2] << 8) | recvBuffer[3];
|
||||||
|
adcRaw[1] = (recvBuffer[4] << 8) | recvBuffer[5];
|
||||||
|
adcRaw[2] = (recvBuffer[6] << 8) | recvBuffer[7];
|
||||||
|
adcRaw[3] = (recvBuffer[8] << 8) | recvBuffer[9];
|
||||||
|
adcRaw[4] = (recvBuffer[10] << 8) | recvBuffer[11];
|
||||||
|
adcRaw[5] = (recvBuffer[12] << 8) | recvBuffer[13];
|
||||||
|
sif::info << "Int Conv [" << std::hex << std::setw(3);
|
||||||
|
for (int idx = 0; idx < 6; idx++) {
|
||||||
|
sif::info << adcRaw[idx];
|
||||||
|
if (idx < 5) {
|
||||||
|
sif::info << ",";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sif::info << std::dec << "] | T[C] " << temp << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpiTestClass::max1227PlPcduTest(int fd) {
|
||||||
|
using namespace max1227;
|
||||||
|
if ((adcCfg.plPcduAdcExtConv or adcCfg.plPcduAdcIntConv) and adcCfg.vbatSwitch) {
|
||||||
|
// This enables the ADC
|
||||||
|
ReturnValue_t result = gpioIF->pullHigh(gpioIds::PLPCDU_ENB_VBAT0);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
result = gpioIF->pullHigh(gpioIds::PLPCDU_ENB_VBAT1);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
adcCfg.vbatSwitch = false;
|
||||||
|
// Takes a bit of time until the ADC is usable
|
||||||
|
TaskFactory::delayTask(50);
|
||||||
|
}
|
||||||
|
if (adcCfg.plPcduAdcExtConv) {
|
||||||
|
sendBuffer[0] = max1227::buildResetByte(false);
|
||||||
|
spiTransferStruct[0].len = 1;
|
||||||
|
transfer(fd, gpioIds::PLPCDU_ADC_CS);
|
||||||
|
sendBuffer[0] = max1227::buildSetupByte(ClkSel::EXT_CONV_EXT_TIMED, RefSel::INT_REF_NO_WAKEUP,
|
||||||
|
DiffSel::NONE_0);
|
||||||
|
spiTransferStruct[0].len = 1;
|
||||||
|
transfer(fd, gpioIds::PLPCDU_ADC_CS);
|
||||||
|
uint8_t n = 11;
|
||||||
|
max1227::prepareExternallyClockedRead0ToN(sendBuffer.data(), n, spiTransferStruct[0].len);
|
||||||
|
transfer(fd, gpioIds::PLPCDU_ADC_CS);
|
||||||
|
uint16_t adcRaw[n + 1] = {};
|
||||||
|
for (uint8_t idx = 0; idx < n + 1; idx++) {
|
||||||
|
adcRaw[idx] = (recvBuffer[idx * 2 + 1] << 8) | recvBuffer[idx * 2 + 2];
|
||||||
|
}
|
||||||
|
arrayprinter::print(recvBuffer.data(), spiTransferStruct[0].len, OutputType::HEX);
|
||||||
|
sif::info << "PL PCDU ADC values:" << std::endl;
|
||||||
|
for (int idx = 0; idx < n + 1; idx++) {
|
||||||
|
sif::info << "Raw Value " << idx << ": " << adcRaw[idx] << std::endl;
|
||||||
|
}
|
||||||
|
max1227::prepareExternallyClockedTemperatureRead(sendBuffer.data(), spiTransferStruct[0].len);
|
||||||
|
transfer(fd, gpioIds::PLPCDU_ADC_CS);
|
||||||
|
int16_t tempRaw = ((recvBuffer[23] & 0x0f) << 8) | recvBuffer[24];
|
||||||
|
float temp = max1227::getTemperature(tempRaw);
|
||||||
|
sif::info << "Temperature: " << temp << std::endl;
|
||||||
|
}
|
||||||
|
if (adcCfg.plPcduAdcIntConv) {
|
||||||
|
sendBuffer[0] = max1227::buildResetByte(true);
|
||||||
|
spiTransferStruct[0].len = 1;
|
||||||
|
transfer(fd, gpioIds::PLPCDU_ADC_CS);
|
||||||
|
// Now use internal conversion
|
||||||
|
sendBuffer[0] = max1227::buildSetupByte(ClkSel::INT_CONV_INT_TIMED_CNVST_AS_AIN,
|
||||||
|
RefSel::INT_REF_NO_WAKEUP, DiffSel::NONE_0);
|
||||||
|
spiTransferStruct[0].len = 1;
|
||||||
|
transfer(fd, gpioIds::PLPCDU_ADC_CS);
|
||||||
|
usleep(10);
|
||||||
|
uint8_t n = 11;
|
||||||
|
sendBuffer[0] = buildConvByte(ScanModes::CHANNELS_0_TO_N, n, true);
|
||||||
|
spiTransferStruct[0].len = 1;
|
||||||
|
transfer(fd, gpioIds::PLPCDU_ADC_CS);
|
||||||
|
|
||||||
|
usleep(65);
|
||||||
|
spiTransferStruct[0].len = 26;
|
||||||
|
// Shift out zeros
|
||||||
|
shiftOutZeros();
|
||||||
|
transfer(fd, gpioIds::PLPCDU_ADC_CS);
|
||||||
|
setSendBuffer();
|
||||||
|
arrayprinter::print(recvBuffer.data(), 26, OutputType::HEX);
|
||||||
|
uint16_t adcRaw[n + 1] = {};
|
||||||
|
int16_t tempRaw = ((recvBuffer[0] & 0x0f) << 8) | recvBuffer[1];
|
||||||
|
sif::info << "Temperature: " << tempRaw * 0.125 << " C" << std::endl;
|
||||||
|
for (int idx = 0; idx < n + 1; idx++) {
|
||||||
|
adcRaw[idx] = (recvBuffer[idx * 2 + 2] << 8) | recvBuffer[idx * 2 + 3];
|
||||||
|
sif::info << "ADC raw " << idx << ": " << adcRaw[idx] << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpiTestClass::acsInit() {
|
void SpiTestClass::acsInit() {
|
||||||
@ -374,8 +680,27 @@ void SpiTestClass::acsInit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SpiTestClass::setSpiSpeedAndMode(int spiFd, spi::SpiModes mode, uint32_t speed) {
|
void SpiTestClass::setSpiSpeedAndMode(int spiFd, spi::SpiModes mode, uint32_t speed) {
|
||||||
int mode_test = SPI_MODE_3;
|
int modeUnix = 0;
|
||||||
int retval = ioctl(spiFd, SPI_IOC_WR_MODE, &mode_test); // reinterpret_cast<uint8_t*>(&mode));
|
switch (mode) {
|
||||||
|
case (spi::SpiModes::MODE_0): {
|
||||||
|
modeUnix = SPI_MODE_0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (spi::SpiModes::MODE_1): {
|
||||||
|
modeUnix = SPI_MODE_1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (spi::SpiModes::MODE_2): {
|
||||||
|
modeUnix = SPI_MODE_2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (spi::SpiModes::MODE_3): {
|
||||||
|
modeUnix = SPI_MODE_3;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int retval = ioctl(spiFd, SPI_IOC_WR_MODE, &modeUnix); // reinterpret_cast<uint8_t*>(&mode));
|
||||||
if (retval != 0) {
|
if (retval != 0) {
|
||||||
utility::handleIoctlError("SpiTestClass::performRm3100Test: Setting SPI mode failed!");
|
utility::handleIoctlError("SpiTestClass::performRm3100Test: Setting SPI mode failed!");
|
||||||
}
|
}
|
||||||
@ -455,6 +780,12 @@ void SpiTestClass::readMultipleStmRegisters(int fd, gpioId_t chipSelect, uint8_t
|
|||||||
readMultipleRegisters(fd, chipSelect, reg, reply, len);
|
readMultipleRegisters(fd, chipSelect, reg, reply, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SpiTestClass::shiftOutZeros() { spiTransferStruct[0].tx_buf = 0; }
|
||||||
|
|
||||||
|
void SpiTestClass::setSendBuffer() {
|
||||||
|
spiTransferStruct[0].tx_buf = reinterpret_cast<__u64>(sendBuffer.data());
|
||||||
|
}
|
||||||
|
|
||||||
void SpiTestClass::readMultipleRegisters(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t *reply,
|
void SpiTestClass::readMultipleRegisters(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t *reply,
|
||||||
size_t len) {
|
size_t len) {
|
||||||
if (reply == nullptr) {
|
if (reply == nullptr) {
|
||||||
@ -507,3 +838,28 @@ uint8_t SpiTestClass::readRegister(int fd, gpioId_t chipSelect, uint8_t reg) {
|
|||||||
}
|
}
|
||||||
return recvBuffer[1];
|
return recvBuffer[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReturnValue_t SpiTestClass::transfer(int fd, gpioId_t chipSelect = gpio::NO_GPIO) {
|
||||||
|
int retval = 0;
|
||||||
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
|
if (chipSelect != gpio::NO_GPIO) {
|
||||||
|
result = gpioIF->pullLow(chipSelect);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
retval = ioctl(fd, SPI_IOC_MESSAGE(1), &spiTransferStruct);
|
||||||
|
if (retval < 0) {
|
||||||
|
utility::handleIoctlError("SpiTestClass::transfer: ioctl failed");
|
||||||
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (chipSelect != gpio::NO_GPIO) {
|
||||||
|
result = gpioIF->pullHigh(chipSelect);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
@ -6,16 +6,39 @@
|
|||||||
#if defined(XIPHOS_Q7S)
|
#if defined(XIPHOS_Q7S)
|
||||||
#include "busConf.h"
|
#include "busConf.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <fsfw_hal/common/gpio/GpioIF.h>
|
#include <fsfw_hal/common/gpio/GpioIF.h>
|
||||||
#include <fsfw_hal/linux/spi/SpiCookie.h>
|
#include <fsfw_hal/linux/spi/SpiCookie.h>
|
||||||
#include <test/testtasks/TestTask.h>
|
#include <test/testtasks/TestTask.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "devices/gpioIds.h"
|
||||||
|
|
||||||
|
struct SusTestCfg {
|
||||||
|
SusTestCfg(bool doTest, gpioId_t gpioId) : gpioId(gpioId) {}
|
||||||
|
bool doTest = false;
|
||||||
|
const gpioId_t gpioId;
|
||||||
|
bool intConv = true;
|
||||||
|
bool extConv = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Max1227TestCfg {
|
||||||
|
bool testRadSensorExtConvWithDelay = false;
|
||||||
|
bool testRadSensorIntConv = false;
|
||||||
|
bool plPcduAdcExtConv = false;
|
||||||
|
bool plPcduAdcIntConv = false;
|
||||||
|
bool vbatSwitch = true;
|
||||||
|
|
||||||
|
SusTestCfg testSus[12] = {
|
||||||
|
{false, gpioIds::CS_SUS_0}, {false, gpioIds::CS_SUS_1}, {false, gpioIds::CS_SUS_2},
|
||||||
|
{false, gpioIds::CS_SUS_3}, {false, gpioIds::CS_SUS_4}, {false, gpioIds::CS_SUS_5},
|
||||||
|
{false, gpioIds::CS_SUS_6}, {false, gpioIds::CS_SUS_7}, {false, gpioIds::CS_SUS_8},
|
||||||
|
{false, gpioIds::CS_SUS_9}, {false, gpioIds::CS_SUS_10}, {false, gpioIds::CS_SUS_11},
|
||||||
|
};
|
||||||
|
};
|
||||||
class SpiTestClass : public TestTask {
|
class SpiTestClass : public TestTask {
|
||||||
public:
|
public:
|
||||||
enum TestModes { NONE, MGM_LIS3MDL, MGM_RM3100, GYRO_L3GD20H, SUS_0 };
|
enum TestModes { NONE, MGM_LIS3MDL, MGM_RM3100, GYRO_L3GD20H, MAX1227 };
|
||||||
|
|
||||||
TestModes testMode;
|
TestModes testMode;
|
||||||
|
|
||||||
@ -26,6 +49,7 @@ class SpiTestClass : public TestTask {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
GpioIF* gpioIF;
|
GpioIF* gpioIF;
|
||||||
|
Max1227TestCfg adcCfg = {};
|
||||||
|
|
||||||
std::array<uint8_t, 128> recvBuffer;
|
std::array<uint8_t, 128> recvBuffer;
|
||||||
std::array<uint8_t, 128> sendBuffer;
|
std::array<uint8_t, 128> sendBuffer;
|
||||||
@ -34,7 +58,9 @@ class SpiTestClass : public TestTask {
|
|||||||
void performRm3100Test(uint8_t mgmId);
|
void performRm3100Test(uint8_t mgmId);
|
||||||
void performLis3MdlTest(uint8_t lis3Id);
|
void performLis3MdlTest(uint8_t lis3Id);
|
||||||
void performL3gTest(uint8_t l3gId);
|
void performL3gTest(uint8_t l3gId);
|
||||||
void performSusTest();
|
void performOneShotMax1227Test();
|
||||||
|
void performPeriodicMax1227Test();
|
||||||
|
void performMax1227Test();
|
||||||
|
|
||||||
/* ACS board specific code which pulls all GPIOs high */
|
/* ACS board specific code which pulls all GPIOs high */
|
||||||
void acsInit();
|
void acsInit();
|
||||||
@ -51,6 +77,7 @@ class SpiTestClass : public TestTask {
|
|||||||
uint8_t gyro2AdisChipSelect = gpio::GYRO_2_BCM_PIN;
|
uint8_t gyro2AdisChipSelect = gpio::GYRO_2_BCM_PIN;
|
||||||
uint8_t gyro3L3gd20ChipSelect = gpio::GYRO_3_BCM_PIN;
|
uint8_t gyro3L3gd20ChipSelect = gpio::GYRO_3_BCM_PIN;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
uint8_t mgm0Lis3mdlChipSelect = 0;
|
uint8_t mgm0Lis3mdlChipSelect = 0;
|
||||||
uint8_t mgm1Rm3100ChipSelect = 0;
|
uint8_t mgm1Rm3100ChipSelect = 0;
|
||||||
uint8_t gyro0AdisResetLine = 0;
|
uint8_t gyro0AdisResetLine = 0;
|
||||||
@ -65,6 +92,13 @@ class SpiTestClass : public TestTask {
|
|||||||
static constexpr uint8_t RM3100_READ_MASK = STM_READ_MASK;
|
static constexpr uint8_t RM3100_READ_MASK = STM_READ_MASK;
|
||||||
static constexpr uint8_t STM_AUTO_INCR_MASK = 0b0100'0000;
|
static constexpr uint8_t STM_AUTO_INCR_MASK = 0b0100'0000;
|
||||||
|
|
||||||
|
void shiftOutZeros();
|
||||||
|
void setSendBuffer();
|
||||||
|
|
||||||
|
void max1227RadSensorTest(int fd);
|
||||||
|
void max1227SusTest(int fd, SusTestCfg& cfg);
|
||||||
|
void max1227PlPcduTest(int fd);
|
||||||
|
|
||||||
void setSpiSpeedAndMode(int spiFd, spi::SpiModes mode, uint32_t speed);
|
void setSpiSpeedAndMode(int spiFd, spi::SpiModes mode, uint32_t speed);
|
||||||
|
|
||||||
void writeStmRegister(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t value,
|
void writeStmRegister(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t value,
|
||||||
@ -74,6 +108,7 @@ class SpiTestClass : public TestTask {
|
|||||||
void writeMultipleRegisters(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t* values,
|
void writeMultipleRegisters(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t* values,
|
||||||
size_t len);
|
size_t len);
|
||||||
void writeRegister(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t value);
|
void writeRegister(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t value);
|
||||||
|
ReturnValue_t transfer(int fd, gpioId_t chipSelect);
|
||||||
|
|
||||||
uint8_t readRm3100Register(int fd, gpioId_t chipSelect, uint8_t reg);
|
uint8_t readRm3100Register(int fd, gpioId_t chipSelect, uint8_t reg);
|
||||||
uint8_t readStmRegister(int fd, gpioId_t chipSelect, uint8_t reg, bool autoIncrement);
|
uint8_t readStmRegister(int fd, gpioId_t chipSelect, uint8_t reg, bool autoIncrement);
|
||||||
|
@ -6,9 +6,9 @@
|
|||||||
|
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
|
|
||||||
SusHandler::SusHandler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie,
|
SusHandler::SusHandler(object_id_t objectId, uint8_t susIdx, object_id_t comIF, CookieIF *comCookie,
|
||||||
LinuxLibgpioIF *gpioComIF, gpioId_t chipSelectId)
|
LinuxLibgpioIF *gpioComIF, gpioId_t chipSelectId)
|
||||||
: DeviceHandlerBase(objectId, comIF, comCookie), divider(5), dataset(this) {}
|
: DeviceHandlerBase(objectId, comIF, comCookie), divider(5), dataset(this), susIdx(susIdx) {}
|
||||||
|
|
||||||
SusHandler::~SusHandler() {}
|
SusHandler::~SusHandler() {}
|
||||||
|
|
||||||
@ -102,7 +102,8 @@ ReturnValue_t SusHandler::buildCommandFromCommand(DeviceCommandId_t deviceComman
|
|||||||
}
|
}
|
||||||
case (SUS::START_INT_TIMED_CONVERSIONS): {
|
case (SUS::START_INT_TIMED_CONVERSIONS): {
|
||||||
std::memset(cmdBuffer, 0, sizeof(cmdBuffer));
|
std::memset(cmdBuffer, 0, sizeof(cmdBuffer));
|
||||||
cmdBuffer[0] = SUS::CONVERSION;
|
cmdBuffer[0] = max1227::buildResetByte(true);
|
||||||
|
cmdBuffer[1] = SUS::CONVERSION;
|
||||||
rawPacket = cmdBuffer;
|
rawPacket = cmdBuffer;
|
||||||
rawPacketLen = 2;
|
rawPacketLen = 2;
|
||||||
break;
|
break;
|
||||||
@ -116,13 +117,12 @@ ReturnValue_t SusHandler::buildCommandFromCommand(DeviceCommandId_t deviceComman
|
|||||||
case (SUS::READ_EXT_TIMED_CONVERSIONS): {
|
case (SUS::READ_EXT_TIMED_CONVERSIONS): {
|
||||||
std::memset(cmdBuffer, 0, sizeof(cmdBuffer));
|
std::memset(cmdBuffer, 0, sizeof(cmdBuffer));
|
||||||
rawPacket = cmdBuffer;
|
rawPacket = cmdBuffer;
|
||||||
for (uint8_t idx = 0; idx < 1; idx++) {
|
for (uint8_t idx = 0; idx < 6; idx++) {
|
||||||
cmdBuffer[idx * 2] = buildConvByte(ScanModes::N_ONCE, idx, false);
|
cmdBuffer[idx * 2] = buildConvByte(ScanModes::N_ONCE, idx, false);
|
||||||
cmdBuffer[idx * 2 + 1] = 0;
|
cmdBuffer[idx * 2 + 1] = 0;
|
||||||
}
|
}
|
||||||
cmdBuffer[2] = 0x00;
|
cmdBuffer[12] = 0x00;
|
||||||
// cmdBuffer[12] = 0x00;
|
rawPacketLen = SUS::SIZE_READ_EXT_CONVERSIONS;
|
||||||
rawPacketLen = 3; // SUS::SIZE_READ_EXT_CONVERSIONS;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (SUS::READ_EXT_TIMED_TEMPS): {
|
case (SUS::READ_EXT_TIMED_TEMPS): {
|
||||||
@ -168,7 +168,8 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8
|
|||||||
}
|
}
|
||||||
case SUS::READ_INT_TIMED_CONVERSIONS: {
|
case SUS::READ_INT_TIMED_CONVERSIONS: {
|
||||||
PoolReadGuard readSet(&dataset);
|
PoolReadGuard readSet(&dataset);
|
||||||
dataset.temperatureCelcius = (*(packet) << 8 | *(packet + 1)) * 0.125;
|
|
||||||
|
dataset.temperatureCelcius = static_cast<int16_t>((packet[0] << 8) | packet[1]) * 0.125;
|
||||||
dataset.ain0 = (*(packet + 2) << 8 | *(packet + 3));
|
dataset.ain0 = (*(packet + 2) << 8 | *(packet + 3));
|
||||||
dataset.ain1 = (*(packet + 4) << 8 | *(packet + 5));
|
dataset.ain1 = (*(packet + 4) << 8 | *(packet + 5));
|
||||||
dataset.ain2 = (*(packet + 6) << 8 | *(packet + 7));
|
dataset.ain2 = (*(packet + 6) << 8 | *(packet + 7));
|
||||||
@ -195,7 +196,8 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8
|
|||||||
}
|
}
|
||||||
case (SUS::READ_EXT_TIMED_TEMPS): {
|
case (SUS::READ_EXT_TIMED_TEMPS): {
|
||||||
PoolReadGuard readSet(&dataset);
|
PoolReadGuard readSet(&dataset);
|
||||||
dataset.temperatureCelcius = (packet[23] << 8) | packet[24];
|
dataset.temperatureCelcius =
|
||||||
|
static_cast<int16_t>(((packet[23] & 0x0f) << 8) | packet[24]) * 0.125;
|
||||||
comState = ComStates::EXT_CLOCKED_CONVERSIONS;
|
comState = ComStates::EXT_CLOCKED_CONVERSIONS;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -226,14 +228,15 @@ void SusHandler::setToGoToNormalMode(bool enable) { this->goToNormalModeImmediat
|
|||||||
void SusHandler::printDataset() {
|
void SusHandler::printDataset() {
|
||||||
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_SUS == 1
|
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_SUS == 1
|
||||||
if (divider.checkAndIncrement()) {
|
if (divider.checkAndIncrement()) {
|
||||||
sif::info << "SUS Object ID 0x" << std::hex << this->getObjectId() << ":" << std::endl;
|
sif::info << "SUS " << std::setw(2) << std::dec << static_cast<int>(susIdx) << " ID " << std::hex
|
||||||
sif::info << "Temperature: " << dataset.temperatureCelcius << " C" << std::endl;
|
<< "0x" << this->getObjectId() << " [" << std::hex << std::setw(3);
|
||||||
sif::info << "AIN0: " << std::dec << dataset.ain0 << std::endl;
|
sif::info << dataset.ain0 << ",";
|
||||||
sif::info << "AIN1: " << std::dec << dataset.ain1 << std::endl;
|
sif::info << dataset.ain1 << ",";
|
||||||
sif::info << "AIN2: " << std::dec << dataset.ain2 << std::endl;
|
sif::info << dataset.ain2 << ",";
|
||||||
sif::info << "AIN3: " << std::dec << dataset.ain3 << std::endl;
|
sif::info << dataset.ain3 << ",";
|
||||||
sif::info << "AIN4: " << std::dec << dataset.ain4 << std::endl;
|
sif::info << dataset.ain4 << ",";
|
||||||
sif::info << "AIN5: " << std::dec << dataset.ain5 << std::endl;
|
sif::info << dataset.ain5 << "] ";
|
||||||
|
sif::info << "T[C] " << dataset.temperatureCelcius << " C" << std::endl;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ class SusHandler : public DeviceHandlerBase {
|
|||||||
|
|
||||||
static const uint8_t FIRST_WRITE = 7;
|
static const uint8_t FIRST_WRITE = 7;
|
||||||
|
|
||||||
SusHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
|
SusHandler(object_id_t objectId, uint8_t susIdx, object_id_t comIF, CookieIF* comCookie,
|
||||||
LinuxLibgpioIF* gpioComIF, gpioId_t chipSelectId);
|
LinuxLibgpioIF* gpioComIF, gpioId_t chipSelectId);
|
||||||
virtual ~SusHandler();
|
virtual ~SusHandler();
|
||||||
|
|
||||||
@ -77,8 +77,9 @@ class SusHandler : public DeviceHandlerBase {
|
|||||||
SUS::SusDataset dataset;
|
SUS::SusDataset dataset;
|
||||||
// Read temperature in each alternating communication step when using
|
// Read temperature in each alternating communication step when using
|
||||||
// externally clocked mode
|
// externally clocked mode
|
||||||
ClkModes clkMode = ClkModes::EXT_CLOCKED;
|
ClkModes clkMode = ClkModes::INT_CLOCKED;
|
||||||
|
|
||||||
|
uint8_t susIdx = 0;
|
||||||
uint8_t cmdBuffer[SUS::MAX_CMD_SIZE];
|
uint8_t cmdBuffer[SUS::MAX_CMD_SIZE];
|
||||||
ComStates comState = ComStates::IDLE;
|
ComStates comState = ComStates::IDLE;
|
||||||
|
|
||||||
|
@ -75,6 +75,7 @@ enum gpioId_t {
|
|||||||
SPI_MUX_BIT_5,
|
SPI_MUX_BIT_5,
|
||||||
|
|
||||||
CS_RAD_SENSOR,
|
CS_RAD_SENSOR,
|
||||||
|
ENABLE_RADFET,
|
||||||
|
|
||||||
PAPB_BUSY_N,
|
PAPB_BUSY_N,
|
||||||
PAPB_EMPTY,
|
PAPB_EMPTY,
|
||||||
|
@ -162,17 +162,17 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
|
|||||||
#if OBSW_ADD_SUN_SENSORS == 1
|
#if OBSW_ADD_SUN_SENSORS == 1
|
||||||
|
|
||||||
bool addSus0 = true;
|
bool addSus0 = true;
|
||||||
bool addSus1 = false;
|
bool addSus1 = true;
|
||||||
bool addSus2 = false;
|
bool addSus2 = true;
|
||||||
bool addSus3 = false;
|
bool addSus3 = true;
|
||||||
bool addSus4 = false;
|
bool addSus4 = true;
|
||||||
bool addSus5 = false;
|
bool addSus5 = true;
|
||||||
bool addSus6 = false;
|
bool addSus6 = true;
|
||||||
bool addSus7 = false;
|
bool addSus7 = true;
|
||||||
bool addSus8 = false;
|
bool addSus8 = true;
|
||||||
bool addSus9 = false;
|
bool addSus9 = true;
|
||||||
bool addSus10 = false;
|
bool addSus10 = true;
|
||||||
bool addSus11 = false;
|
bool addSus11 = true;
|
||||||
/**
|
/**
|
||||||
* The sun sensor will be shutdown as soon as the chip select is pulled high. Thus all
|
* The sun sensor will be shutdown as soon as the chip select is pulled high. Thus all
|
||||||
* requests to a sun sensor must be performed consecutively. Another reason for calling multiple
|
* requests to a sun sensor must be performed consecutively. Another reason for calling multiple
|
||||||
@ -184,260 +184,152 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
|
|||||||
if (addSus0) {
|
if (addSus0) {
|
||||||
/* Write setup */
|
/* Write setup */
|
||||||
thisSequence->addSlot(objects::SUS_0, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
thisSequence->addSlot(objects::SUS_0, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
// thisSequence->addSlot(objects::SUS_0, length * 0.933, SusHandler::FIRST_WRITE);
|
thisSequence->addSlot(objects::SUS_0, length * 0, DeviceHandlerIF::SEND_WRITE);
|
||||||
thisSequence->addSlot(objects::SUS_0, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
thisSequence->addSlot(objects::SUS_0, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
|
thisSequence->addSlot(objects::SUS_0, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
|
thisSequence->addSlot(objects::SUS_0, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
|
|
||||||
|
thisSequence->addSlot(objects::SUS_0, length * 0.4, DeviceHandlerIF::SEND_WRITE);
|
||||||
thisSequence->addSlot(objects::SUS_0, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
thisSequence->addSlot(objects::SUS_0, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||||
thisSequence->addSlot(objects::SUS_0, length * 0.6, DeviceHandlerIF::SEND_READ);
|
thisSequence->addSlot(objects::SUS_0, length * 0.4, DeviceHandlerIF::SEND_READ);
|
||||||
thisSequence->addSlot(objects::SUS_0, length * 0.8, DeviceHandlerIF::GET_READ);
|
thisSequence->addSlot(objects::SUS_0, length * 0.4, DeviceHandlerIF::GET_READ);
|
||||||
/* Start ADC conversions */
|
|
||||||
// thisSequence->addSlot(objects::SUS_0, length * 0.934, DeviceHandlerIF::PERFORM_OPERATION);
|
|
||||||
// thisSequence->addSlot(objects::SUS_0, length * 0.94, DeviceHandlerIF::SEND_WRITE);
|
|
||||||
// thisSequence->addSlot(objects::SUS_0, length * 0.94, DeviceHandlerIF::GET_WRITE);
|
|
||||||
// thisSequence->addSlot(objects::SUS_0, length * 0.94, DeviceHandlerIF::SEND_READ);
|
|
||||||
// thisSequence->addSlot(objects::SUS_0, length * 0.94, DeviceHandlerIF::GET_READ);
|
|
||||||
// /* Read ADC conversions */
|
|
||||||
// // thisSequence->addSlot(objects::SUS_0, length * 0.935,
|
|
||||||
// DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_0, length * 0.935,
|
|
||||||
// DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_0, length * 0.935,
|
|
||||||
// DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_0, length * 0.935,
|
|
||||||
// DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_0, length * 0.935,
|
|
||||||
// DeviceHandlerIF::GET_READ);
|
|
||||||
}
|
}
|
||||||
if (addSus1) {
|
if (addSus1) {
|
||||||
/* Write setup */
|
thisSequence->addSlot(objects::SUS_1, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::PERFORM_OPERATION);
|
thisSequence->addSlot(objects::SUS_1, length * 0, DeviceHandlerIF::SEND_WRITE);
|
||||||
thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::SEND_WRITE);
|
thisSequence->addSlot(objects::SUS_1, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::GET_WRITE);
|
thisSequence->addSlot(objects::SUS_1, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::SEND_READ);
|
thisSequence->addSlot(objects::SUS_1, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::GET_READ);
|
|
||||||
// /* Write setup */
|
thisSequence->addSlot(objects::SUS_1, length * 0.4, DeviceHandlerIF::SEND_WRITE);
|
||||||
// thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::PERFORM_OPERATION);
|
thisSequence->addSlot(objects::SUS_1, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||||
// thisSequence->addSlot(objects::SUS_1, length * 0.901, SusHandler::FIRST_WRITE);
|
thisSequence->addSlot(objects::SUS_1, length * 0.4, DeviceHandlerIF::SEND_READ);
|
||||||
// thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::GET_WRITE);
|
thisSequence->addSlot(objects::SUS_1, length * 0.4, DeviceHandlerIF::GET_READ);
|
||||||
// thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::SEND_READ);
|
|
||||||
// thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::GET_READ);
|
|
||||||
// /* Write setup */
|
|
||||||
// thisSequence->addSlot(objects::SUS_1, length * 0.902, DeviceHandlerIF::PERFORM_OPERATION);
|
|
||||||
// thisSequence->addSlot(objects::SUS_1, length * 0.902, SusHandler::FIRST_WRITE);
|
|
||||||
// thisSequence->addSlot(objects::SUS_1, length * 0.902, DeviceHandlerIF::GET_WRITE);
|
|
||||||
// thisSequence->addSlot(objects::SUS_1, length * 0.902, DeviceHandlerIF::SEND_READ);
|
|
||||||
// thisSequence->addSlot(objects::SUS_1, length * 0.902, DeviceHandlerIF::GET_READ);
|
|
||||||
}
|
}
|
||||||
if (addSus2) {
|
if (addSus2) {
|
||||||
/* Write setup */
|
thisSequence->addSlot(objects::SUS_2, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::PERFORM_OPERATION);
|
thisSequence->addSlot(objects::SUS_2, length * 0, DeviceHandlerIF::SEND_WRITE);
|
||||||
thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::SEND_WRITE);
|
thisSequence->addSlot(objects::SUS_2, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::GET_WRITE);
|
thisSequence->addSlot(objects::SUS_2, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::SEND_READ);
|
thisSequence->addSlot(objects::SUS_2, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::GET_READ);
|
|
||||||
// /* Write setup */
|
thisSequence->addSlot(objects::SUS_2, length * 0.4, DeviceHandlerIF::SEND_WRITE);
|
||||||
// thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::PERFORM_OPERATION);
|
thisSequence->addSlot(objects::SUS_2, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||||
// thisSequence->addSlot(objects::SUS_2, length * 0.904, SusHandler::SEND_WRITE);
|
thisSequence->addSlot(objects::SUS_2, length * 0.4, DeviceHandlerIF::SEND_READ);
|
||||||
// thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::GET_WRITE);
|
thisSequence->addSlot(objects::SUS_2, length * 0.4, DeviceHandlerIF::GET_READ);
|
||||||
// thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::SEND_READ);
|
|
||||||
// thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::GET_READ);
|
|
||||||
// /* Write setup */
|
|
||||||
// thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::PERFORM_OPERATION);
|
|
||||||
// thisSequence->addSlot(objects::SUS_2, length * 0.905, SusHandler::SEND_WRITE);
|
|
||||||
// thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::GET_WRITE);
|
|
||||||
// thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::SEND_READ);
|
|
||||||
// thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::GET_READ);
|
|
||||||
}
|
}
|
||||||
if (addSus3) {
|
if (addSus3) {
|
||||||
/* Write setup */
|
thisSequence->addSlot(objects::SUS_3, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::PERFORM_OPERATION);
|
thisSequence->addSlot(objects::SUS_3, length * 0, DeviceHandlerIF::SEND_WRITE);
|
||||||
thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::SEND_WRITE);
|
thisSequence->addSlot(objects::SUS_3, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::GET_WRITE);
|
thisSequence->addSlot(objects::SUS_3, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::SEND_READ);
|
thisSequence->addSlot(objects::SUS_3, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::GET_READ);
|
|
||||||
// /* Write setup */
|
thisSequence->addSlot(objects::SUS_3, length * 0.4, DeviceHandlerIF::SEND_WRITE);
|
||||||
// thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::PERFORM_OPERATION);
|
thisSequence->addSlot(objects::SUS_3, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||||
// thisSequence->addSlot(objects::SUS_3, length * 0.91, SusHandler::SEND_WRITE);
|
thisSequence->addSlot(objects::SUS_3, length * 0.4, DeviceHandlerIF::SEND_READ);
|
||||||
// thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::GET_WRITE);
|
thisSequence->addSlot(objects::SUS_3, length * 0.4, DeviceHandlerIF::GET_READ);
|
||||||
// thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::SEND_READ);
|
|
||||||
// thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::GET_READ);
|
|
||||||
// /* Write setup */
|
|
||||||
// thisSequence->addSlot(objects::SUS_3, length * 0.93, DeviceHandlerIF::PERFORM_OPERATION);
|
|
||||||
// thisSequence->addSlot(objects::SUS_3, length * 0.93, SusHandler::SEND_WRITE);
|
|
||||||
// thisSequence->addSlot(objects::SUS_3, length * 0.93, DeviceHandlerIF::GET_WRITE);
|
|
||||||
// thisSequence->addSlot(objects::SUS_3, length * 0.93, DeviceHandlerIF::SEND_READ);
|
|
||||||
// thisSequence->addSlot(objects::SUS_3, length * 0.93, DeviceHandlerIF::GET_READ);
|
|
||||||
}
|
}
|
||||||
if (addSus4) {
|
if (addSus4) {
|
||||||
/* Write setup */
|
thisSequence->addSlot(objects::SUS_4, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::PERFORM_OPERATION);
|
thisSequence->addSlot(objects::SUS_4, length * 0, DeviceHandlerIF::SEND_WRITE);
|
||||||
// thisSequence->addSlot(objects::SUS_4, length * 0.909, SusHandler::FIRST_WRITE);
|
thisSequence->addSlot(objects::SUS_4, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::SEND_WRITE);
|
thisSequence->addSlot(objects::SUS_4, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::GET_WRITE);
|
thisSequence->addSlot(objects::SUS_4, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::SEND_READ);
|
|
||||||
thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::GET_READ);
|
thisSequence->addSlot(objects::SUS_4, length * 0.4, DeviceHandlerIF::SEND_WRITE);
|
||||||
/* Write setup */
|
thisSequence->addSlot(objects::SUS_4, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||||
// thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::PERFORM_OPERATION);
|
thisSequence->addSlot(objects::SUS_4, length * 0.4, DeviceHandlerIF::SEND_READ);
|
||||||
// thisSequence->addSlot(objects::SUS_4, length * 0.91, SusHandler::FIRST_WRITE);
|
thisSequence->addSlot(objects::SUS_4, length * 0.4, DeviceHandlerIF::GET_READ);
|
||||||
// thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::GET_WRITE);
|
|
||||||
// thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::SEND_READ);
|
|
||||||
// thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::GET_READ);
|
|
||||||
// /* Write setup */
|
|
||||||
// thisSequence->addSlot(objects::SUS_4, length * 0.911, DeviceHandlerIF::PERFORM_OPERATION);
|
|
||||||
// thisSequence->addSlot(objects::SUS_4, length * 0.911, SusHandler::FIRST_WRITE);
|
|
||||||
// thisSequence->addSlot(objects::SUS_4, length * 0.911, DeviceHandlerIF::GET_WRITE);
|
|
||||||
// thisSequence->addSlot(objects::SUS_4, length * 0.911, DeviceHandlerIF::SEND_READ);
|
|
||||||
// thisSequence->addSlot(objects::SUS_4, length * 0.911, DeviceHandlerIF::GET_READ);
|
|
||||||
}
|
}
|
||||||
if (addSus5) {
|
if (addSus5) {
|
||||||
/* Write setup */
|
thisSequence->addSlot(objects::SUS_5, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::PERFORM_OPERATION);
|
thisSequence->addSlot(objects::SUS_5, length * 0, DeviceHandlerIF::SEND_WRITE);
|
||||||
thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::SEND_WRITE);
|
thisSequence->addSlot(objects::SUS_5, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::GET_WRITE);
|
thisSequence->addSlot(objects::SUS_5, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::SEND_READ);
|
thisSequence->addSlot(objects::SUS_5, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::GET_READ);
|
|
||||||
// /* Write setup */
|
thisSequence->addSlot(objects::SUS_5, length * 0.4, DeviceHandlerIF::SEND_WRITE);
|
||||||
// thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::PERFORM_OPERATION);
|
thisSequence->addSlot(objects::SUS_5, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||||
// thisSequence->addSlot(objects::SUS_5, length * 0.913, SusHandler::FIRST_WRITE);
|
thisSequence->addSlot(objects::SUS_5, length * 0.4, DeviceHandlerIF::SEND_READ);
|
||||||
// thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::GET_WRITE);
|
thisSequence->addSlot(objects::SUS_5, length * 0.4, DeviceHandlerIF::GET_READ);
|
||||||
// thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::SEND_READ);
|
|
||||||
// thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::GET_READ);
|
|
||||||
// /* Write setup */
|
|
||||||
// thisSequence->addSlot(objects::SUS_5, length * 0.914, DeviceHandlerIF::PERFORM_OPERATION);
|
|
||||||
// thisSequence->addSlot(objects::SUS_5, length * 0.914, SusHandler::FIRST_WRITE);
|
|
||||||
// thisSequence->addSlot(objects::SUS_5, length * 0.914, DeviceHandlerIF::GET_WRITE);
|
|
||||||
// thisSequence->addSlot(objects::SUS_5, length * 0.914, DeviceHandlerIF::SEND_READ);
|
|
||||||
// thisSequence->addSlot(objects::SUS_5, length * 0.914, DeviceHandlerIF::GET_READ);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addSus6) {
|
if (addSus6) {
|
||||||
/* Write setup */
|
thisSequence->addSlot(objects::SUS_6, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::PERFORM_OPERATION);
|
thisSequence->addSlot(objects::SUS_6, length * 0, DeviceHandlerIF::SEND_WRITE);
|
||||||
thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::SEND_WRITE);
|
thisSequence->addSlot(objects::SUS_6, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::GET_WRITE);
|
thisSequence->addSlot(objects::SUS_6, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::SEND_READ);
|
thisSequence->addSlot(objects::SUS_6, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::GET_READ);
|
|
||||||
// /* Start ADC conversions */
|
thisSequence->addSlot(objects::SUS_6, length * 0.4, DeviceHandlerIF::SEND_WRITE);
|
||||||
// thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::PERFORM_OPERATION);
|
thisSequence->addSlot(objects::SUS_6, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||||
// thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::SEND_WRITE);
|
thisSequence->addSlot(objects::SUS_6, length * 0.4, DeviceHandlerIF::SEND_READ);
|
||||||
// thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::GET_WRITE);
|
thisSequence->addSlot(objects::SUS_6, length * 0.4, DeviceHandlerIF::GET_READ);
|
||||||
// thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::SEND_READ);
|
|
||||||
// thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::GET_READ);
|
|
||||||
// /* Read ADC conversions from inernal FIFO */
|
|
||||||
// thisSequence->addSlot(objects::SUS_6, length * 0.917, DeviceHandlerIF::PERFORM_OPERATION);
|
|
||||||
// thisSequence->addSlot(objects::SUS_6, length * 0.917, DeviceHandlerIF::SEND_WRITE);
|
|
||||||
// thisSequence->addSlot(objects::SUS_6, length * 0.917, DeviceHandlerIF::GET_WRITE);
|
|
||||||
// thisSequence->addSlot(objects::SUS_6, length * 0.917, DeviceHandlerIF::SEND_READ);
|
|
||||||
// thisSequence->addSlot(objects::SUS_6, length * 0.917, DeviceHandlerIF::GET_READ);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addSus7) {
|
if (addSus7) {
|
||||||
/* Write setup */
|
thisSequence->addSlot(objects::SUS_7, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::PERFORM_OPERATION);
|
thisSequence->addSlot(objects::SUS_7, length * 0, DeviceHandlerIF::SEND_WRITE);
|
||||||
thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::SEND_WRITE);
|
thisSequence->addSlot(objects::SUS_7, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::GET_WRITE);
|
thisSequence->addSlot(objects::SUS_7, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::SEND_READ);
|
thisSequence->addSlot(objects::SUS_7, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::GET_READ);
|
|
||||||
// /* Start ADC conversions */
|
thisSequence->addSlot(objects::SUS_7, length * 0.4, DeviceHandlerIF::SEND_WRITE);
|
||||||
// thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::PERFORM_OPERATION);
|
thisSequence->addSlot(objects::SUS_7, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||||
// thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::SEND_WRITE);
|
thisSequence->addSlot(objects::SUS_7, length * 0.4, DeviceHandlerIF::SEND_READ);
|
||||||
// thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::GET_WRITE);
|
thisSequence->addSlot(objects::SUS_7, length * 0.4, DeviceHandlerIF::GET_READ);
|
||||||
// thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::SEND_READ);
|
|
||||||
// thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::GET_READ);
|
|
||||||
// /* Read ADC conversions from inernal FIFO */
|
|
||||||
// thisSequence->addSlot(objects::SUS_7, length * 0.92, DeviceHandlerIF::PERFORM_OPERATION);
|
|
||||||
// thisSequence->addSlot(objects::SUS_7, length * 0.92, DeviceHandlerIF::SEND_WRITE);
|
|
||||||
// thisSequence->addSlot(objects::SUS_7, length * 0.92, DeviceHandlerIF::GET_WRITE);
|
|
||||||
// thisSequence->addSlot(objects::SUS_7, length * 0.92, DeviceHandlerIF::SEND_READ);
|
|
||||||
// thisSequence->addSlot(objects::SUS_7, length * 0.92, DeviceHandlerIF::GET_READ);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addSus8) {
|
if (addSus8) {
|
||||||
/* Write setup */
|
thisSequence->addSlot(objects::SUS_8, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
thisSequence->addSlot(objects::SUS_8, length * 0.9, DeviceHandlerIF::PERFORM_OPERATION);
|
thisSequence->addSlot(objects::SUS_8, length * 0, DeviceHandlerIF::SEND_WRITE);
|
||||||
// thisSequence->addSlot(objects::SUS_8, length * 0.921, SusHandler::FIRST_WRITE);
|
thisSequence->addSlot(objects::SUS_8, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
thisSequence->addSlot(objects::SUS_8, length * 0.925, DeviceHandlerIF::SEND_WRITE);
|
thisSequence->addSlot(objects::SUS_8, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
thisSequence->addSlot(objects::SUS_8, length * 0.93, DeviceHandlerIF::GET_WRITE);
|
thisSequence->addSlot(objects::SUS_8, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
thisSequence->addSlot(objects::SUS_8, length * 0.95, DeviceHandlerIF::SEND_READ);
|
|
||||||
thisSequence->addSlot(objects::SUS_8, length * 0.96, DeviceHandlerIF::GET_READ);
|
thisSequence->addSlot(objects::SUS_8, length * 0.4, DeviceHandlerIF::SEND_WRITE);
|
||||||
/* Start ADC conversions */
|
thisSequence->addSlot(objects::SUS_8, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||||
// thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::PERFORM_OPERATION);
|
thisSequence->addSlot(objects::SUS_8, length * 0.4, DeviceHandlerIF::SEND_READ);
|
||||||
// thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::SEND_WRITE);
|
thisSequence->addSlot(objects::SUS_8, length * 0.4, DeviceHandlerIF::GET_READ);
|
||||||
// thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::GET_WRITE);
|
|
||||||
// thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::SEND_READ);
|
|
||||||
// thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::GET_READ);
|
|
||||||
// /* Read ADC conversions from internal FIFO */
|
|
||||||
// // thisSequence->addSlot(objects::SUS_8, length * 0.925,
|
|
||||||
// DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_8, length * 0.925,
|
|
||||||
// DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_8, length * 0.925,
|
|
||||||
// DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_8, length * 0.925,
|
|
||||||
// DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_8, length * 0.925,
|
|
||||||
// DeviceHandlerIF::GET_READ);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addSus9) {
|
if (addSus9) {
|
||||||
/* Write setup */
|
thisSequence->addSlot(objects::SUS_9, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::PERFORM_OPERATION);
|
thisSequence->addSlot(objects::SUS_9, length * 0, DeviceHandlerIF::SEND_WRITE);
|
||||||
// thisSequence->addSlot(objects::SUS_9, length * 0.924, SusHandler::FIRST_WRITE);
|
thisSequence->addSlot(objects::SUS_9, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::SEND_WRITE);
|
thisSequence->addSlot(objects::SUS_9, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::GET_WRITE);
|
thisSequence->addSlot(objects::SUS_9, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::SEND_READ);
|
thisSequence->addSlot(objects::SUS_9, length * 0.4, DeviceHandlerIF::SEND_WRITE);
|
||||||
thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::GET_READ);
|
thisSequence->addSlot(objects::SUS_9, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||||
// /* Start ADC conversions */
|
thisSequence->addSlot(objects::SUS_9, length * 0.4, DeviceHandlerIF::SEND_READ);
|
||||||
// // thisSequence->addSlot(objects::SUS_9, length * 0.925,
|
thisSequence->addSlot(objects::SUS_9, length * 0.4, DeviceHandlerIF::GET_READ);
|
||||||
// DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_9, length * 0.925,
|
|
||||||
// DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_9, length * 0.925,
|
|
||||||
// DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_9, length * 0.925,
|
|
||||||
// DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_9, length * 0.925,
|
|
||||||
// DeviceHandlerIF::GET_READ);
|
|
||||||
// /* Read ADC conversions */
|
|
||||||
// // thisSequence->addSlot(objects::SUS_9, length * 0.926,
|
|
||||||
// DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_9, length * 0.926,
|
|
||||||
// DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_9, length * 0.926,
|
|
||||||
// DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_9, length * 0.926,
|
|
||||||
// DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_9, length * 0.926,
|
|
||||||
// DeviceHandlerIF::GET_READ);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addSus10) {
|
if (addSus10) {
|
||||||
/* Write setup */
|
thisSequence->addSlot(objects::SUS_10, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::PERFORM_OPERATION);
|
thisSequence->addSlot(objects::SUS_10, length * 0, DeviceHandlerIF::SEND_WRITE);
|
||||||
thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::SEND_WRITE);
|
thisSequence->addSlot(objects::SUS_10, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::GET_WRITE);
|
thisSequence->addSlot(objects::SUS_10, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::SEND_READ);
|
thisSequence->addSlot(objects::SUS_10, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::GET_READ);
|
|
||||||
// /* Start ADC conversions */
|
thisSequence->addSlot(objects::SUS_10, length * 0.4, DeviceHandlerIF::SEND_WRITE);
|
||||||
// thisSequence->addSlot(objects::SUS_10, length * 0.928,
|
thisSequence->addSlot(objects::SUS_10, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||||
// DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_10, length *
|
thisSequence->addSlot(objects::SUS_10, length * 0.4, DeviceHandlerIF::SEND_READ);
|
||||||
// 0.928, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_10, length *
|
thisSequence->addSlot(objects::SUS_10, length * 0.4, DeviceHandlerIF::GET_READ);
|
||||||
// 0.928, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_10, length * 0.928,
|
|
||||||
// DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_10, length * 0.928,
|
|
||||||
// DeviceHandlerIF::GET_READ);
|
|
||||||
// /* Read ADC conversions */
|
|
||||||
// thisSequence->addSlot(objects::SUS_10, length * 0.929,
|
|
||||||
// DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_10, length *
|
|
||||||
// 0.929, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_10, length *
|
|
||||||
// 0.929, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_10, length * 0.929,
|
|
||||||
// DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_10, length * 0.929,
|
|
||||||
// DeviceHandlerIF::GET_READ);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addSus11) {
|
if (addSus11) {
|
||||||
/* Write setup */
|
thisSequence->addSlot(objects::SUS_11, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::PERFORM_OPERATION);
|
thisSequence->addSlot(objects::SUS_11, length * 0, DeviceHandlerIF::SEND_WRITE);
|
||||||
thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::SEND_WRITE);
|
thisSequence->addSlot(objects::SUS_11, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::GET_WRITE);
|
thisSequence->addSlot(objects::SUS_11, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::SEND_READ);
|
thisSequence->addSlot(objects::SUS_11, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::GET_READ);
|
|
||||||
// /* Start ADC conversions */
|
thisSequence->addSlot(objects::SUS_11, length * 0.4, DeviceHandlerIF::SEND_WRITE);
|
||||||
// thisSequence->addSlot(objects::SUS_11, length * 0.931,
|
thisSequence->addSlot(objects::SUS_11, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||||
// DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_11, length *
|
thisSequence->addSlot(objects::SUS_11, length * 0.4, DeviceHandlerIF::SEND_READ);
|
||||||
// 0.931, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_11, length *
|
thisSequence->addSlot(objects::SUS_11, length * 0.4, DeviceHandlerIF::GET_READ);
|
||||||
// 0.931, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_11, length * 0.931,
|
|
||||||
// DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_11, length * 0.931,
|
|
||||||
// DeviceHandlerIF::GET_READ);
|
|
||||||
// /* Read ADC conversions */
|
|
||||||
// thisSequence->addSlot(objects::SUS_11, length * 0.932,
|
|
||||||
// DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_11, length *
|
|
||||||
// 0.932, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_11, length *
|
|
||||||
// 0.932, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_11, length * 0.932,
|
|
||||||
// DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_11, length * 0.932,
|
|
||||||
// DeviceHandlerIF::GET_READ);
|
|
||||||
}
|
}
|
||||||
#endif /* OBSW_ADD_SUN_SENSORS == 1 */
|
#endif /* OBSW_ADD_SUN_SENSORS == 1 */
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ void ObjectFactory::produceGenericObjects() {
|
|||||||
objects::CCSDS_PACKET_DISTRIBUTOR);
|
objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||||
|
|
||||||
// Every TM packet goes through this funnel
|
// Every TM packet goes through this funnel
|
||||||
new TmFunnel(objects::TM_FUNNEL);
|
new TmFunnel(objects::TM_FUNNEL, 50);
|
||||||
|
|
||||||
// PUS service stack
|
// PUS service stack
|
||||||
new Service1TelecommandVerification(objects::PUS_SERVICE_1_VERIFICATION, apid::EIVE_OBSW,
|
new Service1TelecommandVerification(objects::PUS_SERVICE_1_VERIFICATION, apid::EIVE_OBSW,
|
||||||
@ -79,7 +79,7 @@ void ObjectFactory::produceGenericObjects() {
|
|||||||
new Service3Housekeeping(objects::PUS_SERVICE_3_HOUSEKEEPING, apid::EIVE_OBSW,
|
new Service3Housekeeping(objects::PUS_SERVICE_3_HOUSEKEEPING, apid::EIVE_OBSW,
|
||||||
pus::PUS_SERVICE_3);
|
pus::PUS_SERVICE_3);
|
||||||
new Service5EventReporting(objects::PUS_SERVICE_5_EVENT_REPORTING, apid::EIVE_OBSW,
|
new Service5EventReporting(objects::PUS_SERVICE_5_EVENT_REPORTING, apid::EIVE_OBSW,
|
||||||
pus::PUS_SERVICE_5, 50);
|
pus::PUS_SERVICE_5, 120);
|
||||||
new Service8FunctionManagement(objects::PUS_SERVICE_8_FUNCTION_MGMT, apid::EIVE_OBSW,
|
new Service8FunctionManagement(objects::PUS_SERVICE_8_FUNCTION_MGMT, apid::EIVE_OBSW,
|
||||||
pus::PUS_SERVICE_8, 3, 60);
|
pus::PUS_SERVICE_8, 3, 60);
|
||||||
new Service9TimeManagement(objects::PUS_SERVICE_9_TIME_MGMT, apid::EIVE_OBSW, pus::PUS_SERVICE_9);
|
new Service9TimeManagement(objects::PUS_SERVICE_9_TIME_MGMT, apid::EIVE_OBSW, pus::PUS_SERVICE_9);
|
||||||
|
@ -14,11 +14,13 @@ RadiationSensorHandler::~RadiationSensorHandler() {}
|
|||||||
|
|
||||||
void RadiationSensorHandler::doStartUp() {
|
void RadiationSensorHandler::doStartUp() {
|
||||||
if (internalState == InternalState::CONFIGURED) {
|
if (internalState == InternalState::CONFIGURED) {
|
||||||
#if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1
|
if (goToNormalMode) {
|
||||||
setMode(MODE_NORMAL);
|
setMode(MODE_NORMAL);
|
||||||
#else
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
setMode(_MODE_TO_ON);
|
setMode(_MODE_TO_ON);
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,7 +126,8 @@ ReturnValue_t RadiationSensorHandler::interpretDeviceReply(DeviceCommandId_t id,
|
|||||||
case RAD_SENSOR::READ_CONVERSIONS: {
|
case RAD_SENSOR::READ_CONVERSIONS: {
|
||||||
uint8_t offset = 0;
|
uint8_t offset = 0;
|
||||||
PoolReadGuard readSet(&dataset);
|
PoolReadGuard readSet(&dataset);
|
||||||
dataset.temperatureCelcius = (*(packet + offset) << 8 | *(packet + offset + 1)) * 0.125;
|
int16_t tempRaw = ((packet[offset] & 0x0f) << 8) | packet[offset + 1];
|
||||||
|
dataset.temperatureCelcius = tempRaw * 0.125;
|
||||||
offset += 2;
|
offset += 2;
|
||||||
dataset.ain0 = (*(packet + offset) << 8 | *(packet + offset + 1));
|
dataset.ain0 = (*(packet + offset) << 8 | *(packet + offset + 1));
|
||||||
offset += 2;
|
offset += 2;
|
||||||
@ -175,3 +178,5 @@ ReturnValue_t RadiationSensorHandler::initializeLocalDataPool(localpool::DataPoo
|
|||||||
localDataPoolMap.emplace(RAD_SENSOR::AIN7, new PoolEntry<uint16_t>({0}));
|
localDataPoolMap.emplace(RAD_SENSOR::AIN7, new PoolEntry<uint16_t>({0}));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RadiationSensorHandler::setToGoToNormalModeImmediately() { this->goToNormalMode = true; }
|
||||||
|
@ -16,6 +16,7 @@ class RadiationSensorHandler : public DeviceHandlerBase {
|
|||||||
public:
|
public:
|
||||||
RadiationSensorHandler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie);
|
RadiationSensorHandler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie);
|
||||||
virtual ~RadiationSensorHandler();
|
virtual ~RadiationSensorHandler();
|
||||||
|
void setToGoToNormalModeImmediately();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void doStartUp() override;
|
void doStartUp() override;
|
||||||
@ -42,6 +43,7 @@ class RadiationSensorHandler : public DeviceHandlerBase {
|
|||||||
|
|
||||||
static const uint8_t MAX_CMD_LEN = RAD_SENSOR::READ_SIZE;
|
static const uint8_t MAX_CMD_LEN = RAD_SENSOR::READ_SIZE;
|
||||||
|
|
||||||
|
bool goToNormalMode = false;
|
||||||
uint8_t cmdBuffer[MAX_CMD_LEN];
|
uint8_t cmdBuffer[MAX_CMD_LEN];
|
||||||
InternalState internalState = InternalState::SETUP;
|
InternalState internalState = InternalState::SETUP;
|
||||||
CommunicationStep communicationStep = CommunicationStep::START_CONVERSION;
|
CommunicationStep communicationStep = CommunicationStep::START_CONVERSION;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include "max1227.h"
|
#include "max1227.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
uint8_t max1227::buildConvByte(ScanModes scanMode, uint8_t channel, bool readTemp) {
|
uint8_t max1227::buildConvByte(ScanModes scanMode, uint8_t channel, bool readTemp) {
|
||||||
return (1 << 7) | (channel << 3) | (scanMode << 1) | readTemp;
|
return (1 << 7) | (channel << 3) | (scanMode << 1) | readTemp;
|
||||||
}
|
}
|
||||||
@ -7,3 +9,30 @@ uint8_t max1227::buildConvByte(ScanModes scanMode, uint8_t channel, bool readTem
|
|||||||
uint8_t max1227::buildSetupByte(ClkSel clkSel, RefSel refSel, DiffSel diffSel) {
|
uint8_t max1227::buildSetupByte(ClkSel clkSel, RefSel refSel, DiffSel diffSel) {
|
||||||
return (1 << 6) | (clkSel << 4) | (refSel << 2) | 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);
|
||||||
|
spiBuf[1] = 0x00;
|
||||||
|
spiBuf[2] = 0x00;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
float max1227::getTemperature(int16_t temp) { return static_cast<float>(temp) * 0.125; }
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef MISSION_DEVICES_MAX1227_H_
|
#ifndef MISSION_DEVICES_MAX1227_H_
|
||||||
#define MISSION_DEVICES_MAX1227_H_
|
#define MISSION_DEVICES_MAX1227_H_
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace max1227 {
|
namespace max1227 {
|
||||||
@ -38,9 +39,40 @@ enum DiffSel : uint8_t {
|
|||||||
// One bipolar config byte follows the setup byte
|
// One bipolar config byte follows the setup byte
|
||||||
BIPOLAR_CFG = 0b11
|
BIPOLAR_CFG = 0b11
|
||||||
};
|
};
|
||||||
|
|
||||||
|
uint8_t buildResetByte(bool fifoOnly);
|
||||||
uint8_t buildConvByte(ScanModes scanMode, uint8_t channel, bool readTemp);
|
uint8_t buildConvByte(ScanModes scanMode, uint8_t channel, bool readTemp);
|
||||||
uint8_t buildSetupByte(ClkSel clkSel, RefSel refSel, DiffSel diffSel);
|
uint8_t buildSetupByte(ClkSel clkSel, RefSel refSel, DiffSel diffSel);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If there is a wakeup delay, there needs to be a 65 us delay between sending
|
||||||
|
* the first byte (conversion byte) and the the rest of the SPI buffer.
|
||||||
|
* The raw ADC value will be located in the first and second reply byte.
|
||||||
|
* @param spiBuf
|
||||||
|
* @param n
|
||||||
|
* @param sz
|
||||||
|
*/
|
||||||
|
void prepareExternallyClockedSingleChannelRead(uint8_t* spiBuf, uint8_t channel, size_t& sz);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If there is a wakeup delay, there needs to be a 65 us delay between sending
|
||||||
|
* the first byte (first conversion byte) the the rest of the SPI buffer.
|
||||||
|
* @param spiBuf
|
||||||
|
* @param n Channel number. Example: If the ADC has 6 channels, n will be 5
|
||||||
|
* @param sz
|
||||||
|
*/
|
||||||
|
void prepareExternallyClockedRead0ToN(uint8_t* spiBuf, uint8_t n, size_t& sz);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare an externally clocked temperature read. 25 bytes have to be sent
|
||||||
|
* and the raw temperature value will appear on the last 2 bytes of the reply.
|
||||||
|
* @param spiBuf
|
||||||
|
* @param sz
|
||||||
|
*/
|
||||||
|
void prepareExternallyClockedTemperatureRead(uint8_t* spiBuf, size_t& sz);
|
||||||
|
|
||||||
|
float getTemperature(int16_t temp);
|
||||||
|
|
||||||
} // namespace max1227
|
} // namespace max1227
|
||||||
|
|
||||||
#endif /* MISSION_DEVICES_MAX1227_H_ */
|
#endif /* MISSION_DEVICES_MAX1227_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user