Update to v1.8.0 #100

Merged
muellerr merged 125 commits from develop into main 2021-09-24 10:17:43 +02:00
67 changed files with 2829 additions and 3539 deletions

2
.gitmodules vendored
View File

@ -15,7 +15,7 @@
url = https://github.com/rmspacefish/lwgps.git url = https://github.com/rmspacefish/lwgps.git
[submodule "generators/fsfwgen"] [submodule "generators/fsfwgen"]
path = generators/fsfwgen path = generators/fsfwgen
url = https://egit.irs.uni-stuttgart.de/fsfw/fsfw-generators.git url = https://egit.irs.uni-stuttgart.de/fsfw/fsfw-gen.git
[submodule "thirdparty/arcsec_star_tracker"] [submodule "thirdparty/arcsec_star_tracker"]
path = thirdparty/arcsec_star_tracker path = thirdparty/arcsec_star_tracker
url = https://egit.irs.uni-stuttgart.de/eive/arcsec_star_tracker.git url = https://egit.irs.uni-stuttgart.de/eive/arcsec_star_tracker.git

View File

@ -97,18 +97,18 @@ if(TGT_BSP)
endif() endif()
endif() endif()
if(${TGT_BSP} MATCHES "arm/raspberrypi") if(TGT_BSP MATCHES "arm/raspberrypi")
# Used by configure file # Used by configure file
set(RASPBERRY_PI ON) set(RASPBERRY_PI ON)
set(FSFW_HAL_ADD_RASPBERRY_PI ON) set(FSFW_HAL_ADD_RASPBERRY_PI ON)
endif() endif()
if(${TGT_BSP} MATCHES "arm/beagleboneblack") if(TGT_BSP MATCHES "arm/beagleboneblack")
# Used by configure file # Used by configure file
set(BEAGLEBONEBLACK ON) set(BEAGLEBONEBLACK ON)
endif() endif()
if(${TGT_BSP} MATCHES "arm/q7s") if(TGT_BSP MATCHES "arm/q7s")
# Used by configure file # Used by configure file
set(XIPHOS_Q7S ON) set(XIPHOS_Q7S ON)
endif() endif()
@ -122,9 +122,9 @@ if(NOT EIVE_BUILD_WATCHDOG)
configure_file(${COMMON_CONFIG_PATH}/commonConfig.h.in commonConfig.h) configure_file(${COMMON_CONFIG_PATH}/commonConfig.h.in commonConfig.h)
configure_file(${FSFW_CONFIG_PATH}/FSFWConfig.h.in FSFWConfig.h) configure_file(${FSFW_CONFIG_PATH}/FSFWConfig.h.in FSFWConfig.h)
configure_file(${FSFW_CONFIG_PATH}/OBSWConfig.h.in OBSWConfig.h) configure_file(${FSFW_CONFIG_PATH}/OBSWConfig.h.in OBSWConfig.h)
if(${TGT_BSP} MATCHES "arm/q7s") if(TGT_BSP MATCHES "arm/q7s")
configure_file(${BSP_PATH}/boardconfig/q7sConfig.h.in q7sConfig.h) configure_file(${BSP_PATH}/boardconfig/q7sConfig.h.in q7sConfig.h)
elseif(${TGT_BSP} MATCHES "arm/raspberrypi") elseif(TGT_BSP MATCHES "arm/raspberrypi")
configure_file(${BSP_PATH}/boardconfig/rpiConfig.h.in rpiConfig.h) configure_file(${BSP_PATH}/boardconfig/rpiConfig.h.in rpiConfig.h)
endif() endif()
endif() endif()
@ -135,8 +135,6 @@ set(FSFW_ADDITIONAL_INC_PATHS
"${COMMON_PATH}/config" "${COMMON_PATH}/config"
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
) )
# Set for lwgps library
set(LWGPS_CONFIG_PATH "${COMMON_PATH}/config")
################################################################################ ################################################################################
# Executable and Sources # Executable and Sources

View File

@ -65,7 +65,7 @@ prerequisites.
as a [separate download](#arm-toolchain) as a [separate download](#arm-toolchain)
2. [Q7S sysroot](#q7s-sysroot) on local development machine 2. [Q7S sysroot](#q7s-sysroot) on local development machine
3. Recommended: Eclipse or [Vivado 2018.2 SDK](#vivado) for OBSW development 3. Recommended: Eclipse or [Vivado 2018.2 SDK](#vivado) for OBSW development
3. [TCF agent] running on Q7S 3. [TCF agent](https://wiki.eclipse.org/TCF) running on Q7S
## Hardware Design ## Hardware Design
@ -324,6 +324,33 @@ For Linux, you can also download a more recent version of the
[Linaro 8.3.0 cross-compiler](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads) [Linaro 8.3.0 cross-compiler](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads)
from [here](https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.xz?revision=e09a1c45-0ed3-4a8e-b06b-db3978fd8d56&la=en&hash=93ED4444B8B3A812B893373B490B90BBB28FD2E3) from [here](https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.xz?revision=e09a1c45-0ed3-4a8e-b06b-db3978fd8d56&la=en&hash=93ED4444B8B3A812B893373B490B90BBB28FD2E3)
### Compatibility issues with wayland on more recent Linux distributions
If Vivado crashes and you find following lines in the `hs_err_pid*` files:
```sh
#
# An unexpected error has occurred (11)
#
Stack:
/opt/Xilinx/Vivado/2017.4/tps/lnx64/jre/lib/amd64/server/libjvm.so(+0x923da9) [0x7f666cf5eda9]
/opt/Xilinx/Vivado/2017.4/tps/lnx64/jre/lib/amd64/server/libjvm.so(JVM_handle_linux_signal+0xb6) [0x7f666cf653f6]
/opt/Xilinx/Vivado/2017.4/tps/lnx64/jre/lib/amd64/server/libjvm.so(+0x9209d3) [0x7f666cf5b9d3]
/lib/x86_64-linux-gnu/libc.so.6(+0x35fc0) [0x7f66a993efc0]
/opt/Xilinx/Vivado/2017.4/tps/lnx64/jre/lib/amd64/libawt_xawt.so(+0x42028) [0x7f664e24d028]
...
```
You can [solve this](https://forums.xilinx.com/t5/Design-Entry/Bug-Vivado-2017-4-crashing-on-rightclick-in-console-log/td-p/881811)
by logging in with `xorg` like specified [here](https://www.maketecheasier.com/switch-xorg-wayland-ubuntu1710/).
### Using `docnav` on more recent Linux versions
If you want to use `docnav` for navigating Xilinx documentation, it is recommended to install
it as a standalone version from [here](https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/documentation-nav.html).
This is because the `docnav` installed as part of version 2018.2 requires `libpng12`, which is not part of
more recent disitributions anymore.
## <a id="arm-toolchain"></a> Installing toolchain without Vivado ## <a id="arm-toolchain"></a> Installing toolchain without Vivado
You can download the toolchains for Windows and Linux You can download the toolchains for Windows and Linux

View File

@ -5,7 +5,7 @@
namespace pcduSwitches { namespace pcduSwitches {
/* Switches are uint8_t datatype and go from 0 to 255 */ /* Switches are uint8_t datatype and go from 0 to 255 */
enum switcherList { enum SwitcherList {
Q7S, Q7S,
PAYLOAD_PCDU_CH1, PAYLOAD_PCDU_CH1,
RW, RW,
@ -22,7 +22,7 @@ namespace pcduSwitches {
SUS_NOMINAL, SUS_NOMINAL,
SOLAR_CELL_EXP, SOLAR_CELL_EXP,
PLOC, PLOC,
ACS_BORAD_SIDE_A, ACS_BOARD_SIDE_A,
NUMBER_OF_SWITCHES NUMBER_OF_SWITCHES
}; };

View File

@ -36,6 +36,7 @@ void initmission::initMission() {
void initmission::initTasks() { void initmission::initTasks() {
TaskFactory* factory = TaskFactory::instance(); TaskFactory* factory = TaskFactory::instance();
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
if(factory == nullptr) { if(factory == nullptr) {
/* Should never happen ! */ /* Should never happen ! */
return; return;
@ -46,11 +47,11 @@ void initmission::initTasks() {
void (*missedDeadlineFunc) (void) = nullptr; void (*missedDeadlineFunc) (void) = nullptr;
#endif #endif
/* TMTC Distribution */ /* TMTC Distribution */
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask( PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); "DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
ReturnValue_t result = tmTcDistributor->addComponent( result = tmTcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
objects::CCSDS_PACKET_DISTRIBUTOR);
if(result != HasReturnvaluesIF::RETURN_OK){ if(result != HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl; sif::error << "Object add component failed" << std::endl;
} }
@ -78,21 +79,70 @@ void initmission::initTasks() {
} }
/* PUS Services */ /* PUS Services */
PeriodicTaskIF* pusVerification = factory->createPeriodicTask( std::vector<PeriodicTaskIF*> pusTasks;
createPusTasks(*factory, missedDeadlineFunc, pusTasks);
std::vector<PeriodicTaskIF*> pstTasks;
createPstTasks(*factory, missedDeadlineFunc, pstTasks);
#if OBSW_ADD_TEST_CODE == 1
std::vector<PeriodicTaskIF*> testTasks;
createTestTasks(*factory, missedDeadlineFunc, pstTasks);
#endif /* OBSW_ADD_TEST_CODE == 1 */
auto taskStarter = [](std::vector<PeriodicTaskIF*>& taskVector, std::string name) {
for(const auto& task: taskVector) {
if(task != nullptr) {
task->startTask();
}
else {
sif::error << "Task in vector " << name << " is invalid!" << std::endl;
}
}
};
sif::info << "Starting tasks.." << std::endl;
tmTcDistributor->startTask();
udpBridgeTask->startTask();
udpPollingTask->startTask();
taskStarter(pusTasks, "PUS Tasks");
#if OBSW_ADD_TEST_CODE == 1
taskStarter(testTasks, "Test Tasks");
#endif /* OBSW_ADD_TEST_CODE == 1 */
taskStarter(pstTasks, "PST Tasks");
#if OBSW_ADD_TEST_PST == 1
if(startTestPst) {
pstTestTask->startTask();
}
#endif /* RPI_TEST_ACS_BOARD == 1 */
sif::info << "Tasks started.." << std::endl;
}
void initmission::createPusTasks(TaskFactory& factory,
TaskDeadlineMissedFunction missedDeadlineFunc, std::vector<PeriodicTaskIF*>& taskVec) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc); "PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION); result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
if(result != HasReturnvaluesIF::RETURN_OK){ if(result != HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl; sif::error << "Object add component failed" << std::endl;
} }
taskVec.push_back(pusVerification);
PeriodicTaskIF* pusEvents = factory->createPeriodicTask( PeriodicTaskIF* pusEvents = factory.createPeriodicTask(
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc); "PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusVerification->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING); result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
if(result != HasReturnvaluesIF::RETURN_OK){ if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS5", objects::PUS_SERVICE_5_EVENT_REPORTING); initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING);
} }
result = pusEvents->addComponent(objects::EVENT_MANAGER);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER);
}
taskVec.push_back(pusEvents);
PeriodicTaskIF* pusHighPrio = factory->createPeriodicTask( PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask(
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc); "PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS); result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
if(result != HasReturnvaluesIF::RETURN_OK) { if(result != HasReturnvaluesIF::RETURN_OK) {
@ -102,8 +152,9 @@ void initmission::initTasks() {
if(result != HasReturnvaluesIF::RETURN_OK) { if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT); initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
} }
taskVec.push_back(pusHighPrio);
PeriodicTaskIF* pusMedPrio = factory->createPeriodicTask( PeriodicTaskIF* pusMedPrio = factory.createPeriodicTask(
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc); "PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT); result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
if(result != HasReturnvaluesIF::RETURN_OK) { if(result != HasReturnvaluesIF::RETURN_OK) {
@ -121,8 +172,9 @@ void initmission::initTasks() {
if(result != HasReturnvaluesIF::RETURN_OK) { if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING); initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING);
} }
taskVec.push_back(pusMedPrio);
PeriodicTaskIF* pusLowPrio = factory->createPeriodicTask( PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask(
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc); "PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST); result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
if(result != HasReturnvaluesIF::RETURN_OK) { if(result != HasReturnvaluesIF::RETURN_OK) {
@ -133,26 +185,34 @@ void initmission::initTasks() {
initmission::printAddObjectError("INT_ERR_RPRT", initmission::printAddObjectError("INT_ERR_RPRT",
objects::INTERNAL_ERROR_REPORTER); objects::INTERNAL_ERROR_REPORTER);
} }
taskVec.push_back(pusLowPrio);
}
bool startTestPst = true; void initmission::createPstTasks(TaskFactory& factory,
#if OBSW_ADD_TEST_PST == 1 TaskDeadlineMissedFunction missedDeadlineFunc, std::vector<PeriodicTaskIF*> &taskVec) {
FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask("ACS_PST", 50, ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc); #if OBSW_ADD_SPI_TEST_CODE == 0
result = pst::pstTest(pstTestTask); FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
if(result != HasReturnvaluesIF::RETURN_OK) { "SPI_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0,
sif::info << "initmission::initTasks: ACS PST empty or invalid" << std::endl; missedDeadlineFunc);
startTestPst = false; result = pst::pstSpi(spiPst);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
} }
#endif /* RPI_TEST_ACS_BOARD == 1 */ taskVec.push_back(spiPst);
#endif
}
PeriodicTaskIF* testTask = factory->createPeriodicTask( void initmission::createTestTasks(TaskFactory& factory,
TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*> &taskVec) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
PeriodicTaskIF* testTask = factory.createPeriodicTask(
"TEST_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); "TEST_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
#if OBSW_ADD_TEST_CODE == 1
result = testTask->addComponent(objects::TEST_TASK); result = testTask->addComponent(objects::TEST_TASK);
if(result != HasReturnvaluesIF::RETURN_OK) { if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK); initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
} }
#endif /* OBSW_ADD_TEST_CODE == 1 */
#if RPI_ADD_SPI_TEST == 1 #if RPI_ADD_SPI_TEST == 1
result = testTask->addComponent(objects::SPI_TEST); result = testTask->addComponent(objects::SPI_TEST);
if(result != HasReturnvaluesIF::RETURN_OK) { if(result != HasReturnvaluesIF::RETURN_OK) {
@ -172,25 +232,16 @@ void initmission::initTasks() {
} }
#endif /* RPI_ADD_GPIO_TEST == 1 */ #endif /* RPI_ADD_GPIO_TEST == 1 */
sif::info << "Starting tasks.." << std::endl; bool startTestPst = true;
tmTcDistributor->startTask(); static_cast<void>(startTestPst);
udpBridgeTask->startTask();
udpPollingTask->startTask();
pusVerification->startTask();
pusEvents->startTask();
pusHighPrio->startTask();
pusMedPrio->startTask();
pusLowPrio->startTask();
#if OBSW_ADD_TEST_CODE == 1
testTask->startTask();
#endif /* OBSW_ADD_TEST_CODE == 1 */
#if OBSW_ADD_TEST_PST == 1 #if OBSW_ADD_TEST_PST == 1
if(startTestPst) { FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask("TEST_PST", 50,
pstTestTask->startTask(); PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc);
result = pst::pstTest(pstTestTask);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::info << "initmission::initTasks: ACS PST empty or invalid" << std::endl;
startTestPst = false;
} }
#endif /* RPI_TEST_ACS_BOARD == 1 */ #endif /* RPI_TEST_ACS_BOARD == 1 */
sif::info << "Tasks started.." << std::endl;
} }

View File

@ -1,9 +1,24 @@
#ifndef BSP_LINUX_INITMISSION_H_ #ifndef BSP_LINUX_INITMISSION_H_
#define BSP_LINUX_INITMISSION_H_ #define BSP_LINUX_INITMISSION_H_
#include "fsfw/tasks/Typedef.h"
#include <vector>
class PeriodicTaskIF;
class TaskFactory;
namespace initmission { namespace initmission {
void initMission(); void initMission();
void initTasks(); void initTasks();
void createPstTasks(TaskFactory& factory,
TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*> &taskVec);
void createTestTasks(TaskFactory& factory,
TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*> &taskVec);
void createPusTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*>& taskVec);
}; };
#endif /* BSP_LINUX_INITMISSION_H_ */ #endif /* BSP_LINUX_INITMISSION_H_ */

View File

@ -14,8 +14,6 @@
#include "mission/core/GenericFactory.h" #include "mission/core/GenericFactory.h"
#include "mission/utility/TmFunnel.h" #include "mission/utility/TmFunnel.h"
#include <mission/devices/GPSHyperionHandler.h> #include <mission/devices/GPSHyperionHandler.h>
#include "mission/devices/MGMHandlerLIS3MDL.h"
#include "mission/devices/MGMHandlerRM3100.h"
#include "mission/devices/GyroADIS16507Handler.h" #include "mission/devices/GyroADIS16507Handler.h"
#include "fsfw/datapoollocal/LocalDataPoolManager.h" #include "fsfw/datapoollocal/LocalDataPoolManager.h"
@ -33,6 +31,8 @@
#include "fsfw/osal/common/UdpTcPollingTask.h" #include "fsfw/osal/common/UdpTcPollingTask.h"
#endif #endif
#include "fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h"
#include "fsfw_hal/devicehandlers/MgmRM3100Handler.h"
#include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h" #include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h"
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h" #include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
#include "fsfw_hal/linux/rpi/GpioRPi.h" #include "fsfw_hal/linux/rpi/GpioRPi.h"
@ -64,10 +64,12 @@ void ObjectFactory::produce(void* args){
ObjectFactory::produceGenericObjects(); ObjectFactory::produceGenericObjects();
#if OBSW_USE_TMTC_TCP_BRIDGE == 1 #if OBSW_USE_TMTC_TCP_BRIDGE == 1
new TcpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR); auto tmtcBridge = new TcpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
tmtcBridge->setMaxNumberOfPacketsStored(50);
new TcpTmTcServer(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE); new TcpTmTcServer(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
#else #else
new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR); auto tmtcBridge = new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
tmtcBridge->setMaxNumberOfPacketsStored(50);
new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE); new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
#endif #endif
@ -81,7 +83,104 @@ void ObjectFactory::produce(void* args){
SpiCookie* spiCookie = nullptr; SpiCookie* spiCookie = nullptr;
static_cast<void>(spiCookie); static_cast<void>(spiCookie);
#if OBSW_ADD_ACS_BOARD == 1
if(gpioCookie == nullptr) {
gpioCookie = new GpioCookie();
}
// TODO: Missing pin for Gyro 2
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_0_LIS3_CS, gpio::MGM_0_BCM_PIN,
"MGM_0_LIS3", gpio::Direction::OUT, 1);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_1_RM3100_CS, gpio::MGM_1_BCM_PIN,
"MGM_1_RM3100", gpio::Direction::OUT, 1);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_2_LIS3_CS, gpio::MGM_2_BCM_PIN,
"MGM_2_LIS3", gpio::Direction::OUT, 1);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_3_RM3100_CS, gpio::MGM_3_BCM_PIN,
"MGM_3_RM3100", gpio::Direction::OUT, 1);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_0_ADIS_CS, gpio::GYRO_0_BCM_PIN,
"GYRO_0_ADIS", gpio::Direction::OUT, 1);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_1_L3G_CS, gpio::GYRO_1_BCM_PIN,
"GYRO_1_L3G", gpio::Direction::OUT, 1);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_2_ADIS_CS, gpio::GYRO_2_BCM_PIN,
"GYRO_2_ADIS", gpio::Direction::OUT, 1);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_3_L3G_CS, gpio::GYRO_3_BCM_PIN,
"GYRO_3_L3G", gpio::Direction::OUT, 1);
gpioIF->addGpios(gpioCookie);
spiDev = "/dev/spidev0.1";
spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev,
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
auto mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER,
objects::SPI_COM_IF, spiCookie, 0);
mgmLis3Handler->setStartUpImmediately();
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
mgmLis3Handler->setToGoToNormalMode(true);
#endif
spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev,
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER,
objects::SPI_COM_IF, spiCookie, 0);
mgmRm3100Handler->setStartUpImmediately();
#if FSFW_HAL_RM3100_MGM_DEBUG == 1
mgmRm3100Handler->setToGoToNormalMode(true);
#endif
spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev,
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER,
objects::SPI_COM_IF, spiCookie, 0);
mgmLis3Handler->setStartUpImmediately();
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
mgmLis3Handler->setToGoToNormalMode(true);
#endif
spiCookie = new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev,
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER,
objects::SPI_COM_IF, spiCookie, 0);
mgmRm3100Handler->setStartUpImmediately();
#if FSFW_HAL_RM3100_MGM_DEBUG == 1
mgmRm3100Handler->setToGoToNormalMode(true);
#endif
spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev,
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
auto adisHandler = new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF,
spiCookie);
adisHandler->setStartUpImmediately();
spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev,
L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF,
spiCookie, 0);
gyroL3gHandler->setStartUpImmediately();
#if FSFW_HAL_L3GD20_GYRO_DEBUG== 1
gyroL3gHandler->setToGoToNormalMode(true);
#endif
spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev,
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
adisHandler = new GyroADIS16507Handler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF,
spiCookie);
adisHandler->setStartUpImmediately();
spiCookie = new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, spiDev,
L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, objects::SPI_COM_IF,
spiCookie, 0);
gyroL3gHandler->setStartUpImmediately();
#if FSFW_HAL_L3GD20_GYRO_DEBUG== 1
gyroL3gHandler->setToGoToNormalMode(true);
#endif
#endif /* RPI_TEST_ACS_BOARD == 1 */
#if OBSW_ADD_TEST_CODE == 1 #if OBSW_ADD_TEST_CODE == 1
createTestTasks();
#endif /* OBSW_ADD_TEST_CODE == 1 */
}
void ObjectFactory::createTestTasks() {
new TestTask(objects::TEST_TASK); new TestTask(objects::TEST_TASK);
#if RPI_ADD_SPI_TEST == 1 #if RPI_ADD_SPI_TEST == 1
@ -108,47 +207,6 @@ void ObjectFactory::produce(void* args){
new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookieLoopback); new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookieLoopback);
#endif /* RPI_LOOPBACK_TEST_GPIO == 1 */ #endif /* RPI_LOOPBACK_TEST_GPIO == 1 */
#if RPI_TEST_ACS_BOARD == 1
if(gpioCookie == nullptr) {
gpioCookie = new GpioCookie();
}
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_0_LIS3_CS, gpio::MGM_0_BCM_PIN,
"MGM_0_LIS3", gpio::Direction::OUT, 1);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_1_RM3100_CS, gpio::MGM_1_BCM_PIN,
"MGM_1_RM3100", gpio::Direction::OUT, 1);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_2_LIS3_CS, gpio::MGM_2_BCM_PIN,
"MGM_2_LIS3", gpio::Direction::OUT, 1);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_3_RM3100_CS, gpio::MGM_3_BCM_PIN,
"MGM_3_RM3100", gpio::Direction::OUT, 1);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_0_ADIS_CS, gpio::GYRO_0_BCM_PIN,
"GYRO_0_ADIS", gpio::Direction::OUT, 1);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_1_L3G_CS, gpio::GYRO_1_BCM_PIN,
"GYRO_1_L3G", gpio::Direction::OUT, 1);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_2_L3G_CS, gpio::GYRO_2_BCM_PIN,
"GYRO_2_L3G", gpio::Direction::OUT, 1);
gpioIF->addGpios(gpioCookie);
spiDev = "/dev/spidev0.0";
spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev,
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
auto mgmLis3Handler = new MGMHandlerLIS3MDL(objects::MGM_0_LIS3_HANDLER,
objects::SPI_COM_IF, spiCookie);
mgmLis3Handler->setStartUpImmediately();
spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev,
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
auto mgmRm3100Handler = new MGMHandlerRM3100(objects::MGM_1_RM3100_HANDLER,
objects::SPI_COM_IF, spiCookie);
mgmRm3100Handler->setStartUpImmediately();
spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev,
L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF,
spiCookie);
gyroL3gHandler->setStartUpImmediately();
#endif /* RPI_TEST_ACS_BOARD == 1 */
#if RPI_TEST_ADIS16507 == 1 #if RPI_TEST_ADIS16507 == 1
if(gpioCookie == nullptr) { if(gpioCookie == nullptr) {
gpioCookie = new GpioCookie(); gpioCookie = new GpioCookie();
@ -157,7 +215,7 @@ void ObjectFactory::produce(void* args){
"GYRO_0_ADIS", gpio::Direction::OUT, 1); "GYRO_0_ADIS", gpio::Direction::OUT, 1);
gpioIF->addGpios(gpioCookie); gpioIF->addGpios(gpioCookie);
spiDev = "/dev/spidev0.0"; spiDev = "/dev/spidev0.1";
spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev, spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev,
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE, spi::DEFAULT_ADIS16507_SPEED, ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE, spi::DEFAULT_ADIS16507_SPEED,
nullptr, nullptr); nullptr, nullptr);
@ -175,5 +233,4 @@ void ObjectFactory::produce(void* args){
gpsHandler->setStartUpImmediately(); gpsHandler->setStartUpImmediately();
#endif #endif
#endif /* OBSW_ADD_TEST_CODE == 1 */
} }

View File

@ -5,6 +5,8 @@
namespace ObjectFactory { namespace ObjectFactory {
void setStatics(); void setStatics();
void produce(void* args); void produce(void* args);
void createTestTasks();
}; };
#endif /* BSP_LINUX_OBJECTFACTORY_H_ */ #endif /* BSP_LINUX_OBJECTFACTORY_H_ */

View File

@ -19,13 +19,14 @@
/* Adapt these values accordingly */ /* Adapt these values accordingly */
namespace gpio { namespace gpio {
static constexpr uint8_t MGM_0_BCM_PIN = 0; static constexpr uint8_t MGM_0_BCM_PIN = 17;
static constexpr uint8_t MGM_1_BCM_PIN = 1; static constexpr uint8_t MGM_1_BCM_PIN = 27;
static constexpr uint8_t MGM_2_BCM_PIN = 17; static constexpr uint8_t MGM_2_BCM_PIN = 22;
static constexpr uint8_t MGM_3_BCM_PIN = 27; static constexpr uint8_t MGM_3_BCM_PIN = 23;
static constexpr uint8_t GYRO_0_BCM_PIN = 5; static constexpr uint8_t GYRO_0_BCM_PIN = 5;
static constexpr uint8_t GYRO_1_BCM_PIN = 6; static constexpr uint8_t GYRO_1_BCM_PIN = 6;
static constexpr uint8_t GYRO_2_BCM_PIN = 4; static constexpr uint8_t GYRO_2_BCM_PIN = 13;
static constexpr uint8_t GYRO_3_BCM_PIN = 19;
} }
#endif /* BSP_RPI_BOARDCONFIG_RPI_CONFIG_H_ */ #endif /* BSP_RPI_BOARDCONFIG_RPI_CONFIG_H_ */

View File

@ -12,6 +12,6 @@ else()
add_subdirectory(gpio) add_subdirectory(gpio)
add_subdirectory(core) add_subdirectory(core)
add_subdirectory(memory) add_subdirectory(memory)
add_subdirectory(spiCallbacks) add_subdirectory(callbacks)
add_subdirectory(devices) add_subdirectory(devices)
endif() endif()

View File

@ -10,32 +10,66 @@ static constexpr char I2C_DEFAULT_DEV[] = "/dev/i2c-1";
static constexpr char UART_PLOC_MPSOC_DEV[] = "/dev/ttyUL3"; static constexpr char UART_PLOC_MPSOC_DEV[] = "/dev/ttyUL3";
static constexpr char UART_PLOC_SUPERVSIOR_DEV[] = "/dev/ttyUL4"; static constexpr char UART_PLOC_SUPERVSIOR_DEV[] = "/dev/ttyUL4";
static constexpr char UART_SYRLINKS_DEV[] = "/dev/ttyUL5";
static constexpr char UART_STAR_TRACKER_DEV[] = "/dev/ttyUL8"; static constexpr char UART_STAR_TRACKER_DEV[] = "/dev/ttyUL8";
static constexpr char GPIO_ACS_BOARD_DEFAULT_CHIP[] = "gpiochip5"; static constexpr char UART_GNSS_0_DEV[] = "/dev/ttyUL0";
static constexpr char GPIO_MGM2_LIS3_CHIP[] = "gpiochip6"; static constexpr char UART_GNSS_1_DEV[] = "/dev/ttyUL2";
// TODO: Determine new pins, additional ADIS gyro device /**************************************************************/
static constexpr uint32_t GPIO_GYRO_0_ADIS_CS = 1; /** OBC1E */
static constexpr uint32_t GPIO_GYRO_1_L3G_CS = 7; /**************************************************************/
static constexpr uint32_t GPIO_GYRO_2_ADIS_CS = 3; static constexpr char GPIO_MULTIPURPOSE_1V8_OBC1D[] = "/amba_pl/gpio@42020000";
static constexpr uint32_t GPIO_GYRO_3_L3G_CS = 3; static const char* const GPIO_GYRO_ADIS_LABEL = GPIO_MULTIPURPOSE_1V8_OBC1D;
static constexpr uint32_t GPIO_GYRO_0_ADIS_CS = 0; // Package Pin: W20
static constexpr uint32_t GPIO_GYRO_2_ADIS_CS = 2; // AA22
static constexpr uint32_t GPIO_MGM_0_LIS3_CS = 5; /**************************************************************/
static constexpr uint32_t GPIO_MGM_1_RM3100_CS = 16; /** OBC1F B0 */
static constexpr uint32_t GPIO_MGM_2_LIS3_CS = 0; /**************************************************************/
static constexpr uint32_t GPIO_MGM_3_RM3100_CS = 10; static constexpr char GPIO_FLEX_OBC1F_B0[] = "/amba_pl/gpio@42030000";
static constexpr uint32_t GPIO_FLEX_OBC1F_B0_WIDTH = 20;
static const char* const GPIO_ACS_BOARD_DEFAULT_LABEL = GPIO_FLEX_OBC1F_B0;
static const char* const GPIO_RW_DEFAULT_LABEL = GPIO_FLEX_OBC1F_B0;
static const char* const GPIO_RAD_SENSOR_LABEL = GPIO_FLEX_OBC1F_B0;
static constexpr char GPIO_RW_DEFAULT_CHIP[] = "gpiochip5";
static constexpr uint32_t GPIO_RW_0_CS = 7;
static constexpr uint32_t GPIO_RW_1_CS = 3;
static constexpr uint32_t GPIO_RW_2_CS = 11;
static constexpr uint32_t GPIO_RW_3_CS = 6;
static constexpr char GPIO_RW_SPI_MUX_CHIP[] = "gpiochip11"; static constexpr uint32_t GPIO_RW_0_CS = 7; // B20
static constexpr uint32_t GPIO_RW_SPI_MUX_CS = 57; static constexpr uint32_t GPIO_RW_1_CS = 3; // G22
static constexpr uint32_t GPIO_RW_2_CS = 11; // E18
static constexpr uint32_t GPIO_RW_3_CS = 6; // B19
static constexpr char GPIO_HEATER_CHIP[] = "gpiochip7"; static constexpr uint32_t GPIO_GYRO_1_L3G_CS = 18; // N22
static constexpr uint32_t GPIO_GYRO_3_L3G_CS = 1; // M21
static constexpr uint32_t GPIO_MGM_0_LIS3_CS = 5; // C18
static constexpr uint32_t GPIO_MGM_1_RM3100_CS = 16; // A16
static constexpr uint32_t GPIO_MGM_3_RM3100_CS = 10; // C17
// Active low enable pin (needs to be driven low for regular operations)
static constexpr uint32_t GPIO_GYRO_0_ENABLE = 2; // H22
// Active low reset pin (needs to be driven high for regular operations)
static constexpr uint32_t GPIO_RESET_GNSS_0 = 9; // C22
static constexpr uint32_t GPIO_RESET_GNSS_1 = 12; // B21
static constexpr uint32_t GPIO_RAD_SENSOR_CS = 19; // R18
/**************************************************************/
/** OBC1F B1 */
/**************************************************************/
static constexpr char GPIO_FLEX_OBC1F_B1[] = "/amba_pl/gpio@42030000";
// Need to use chip name here for now because the label name is the name for
// gpiochip 5 and gpiochip6
static constexpr char GPIO_FLEX_OBC1F_B1_CHIP[] = "gpiochip6";
static const char* const GPIO_MGM2_LIS3_LABEL = GPIO_FLEX_OBC1F_B1_CHIP;
static constexpr uint32_t GPIO_MGM_2_LIS3_CS = 0; // D18
/**************************************************************/
/** OBC1C */
/**************************************************************/
static constexpr char GPIO_3V3_OBC1C[] = "/amba_pl/gpio@42040000";
static const char* const GPIO_HEATER_LABEL = GPIO_3V3_OBC1C;
static const char* const GPIO_SOLAR_ARR_DEPL_LABEL = GPIO_3V3_OBC1C;
static constexpr uint32_t GPIO_HEATER_0_PIN = 6; static constexpr uint32_t GPIO_HEATER_0_PIN = 6;
static constexpr uint32_t GPIO_HEATER_1_PIN = 12; static constexpr uint32_t GPIO_HEATER_1_PIN = 12;
static constexpr uint32_t GPIO_HEATER_2_PIN = 7; static constexpr uint32_t GPIO_HEATER_2_PIN = 7;
@ -44,13 +78,23 @@ static constexpr uint32_t GPIO_HEATER_4_PIN = 3;
static constexpr uint32_t GPIO_HEATER_5_PIN = 0; static constexpr uint32_t GPIO_HEATER_5_PIN = 0;
static constexpr uint32_t GPIO_HEATER_6_PIN = 1; static constexpr uint32_t GPIO_HEATER_6_PIN = 1;
static constexpr uint32_t GPIO_HEATER_7_PIN = 11; static constexpr uint32_t GPIO_HEATER_7_PIN = 11;
static constexpr uint32_t GPIO_GYRO_2_ENABLE = 18; // F22
static constexpr char GPIO_SOLAR_ARR_DEPL_CHIP[] = "gpiochip7";
static constexpr uint32_t GPIO_SOL_DEPL_SA_0_PIN = 4; static constexpr uint32_t GPIO_SOL_DEPL_SA_0_PIN = 4;
static constexpr uint32_t GPIO_SOL_DEPL_SA_1_PIN = 2; static constexpr uint32_t GPIO_SOL_DEPL_SA_1_PIN = 2;
static constexpr char GPIO_RAD_SENSOR_CHIP[] = "gpiochip5"; static constexpr char GPIO_RW_SPI_MUX_LABEL[] = "zynq_gpio";
static constexpr uint32_t GPIO_RAD_SENSOR_CS = 19; // Uses EMIO interface to PL, starts at 54
static constexpr uint32_t GPIO_RW_SPI_MUX_CS = 54;
static constexpr uint32_t SPI_MUX_BIT_1 = 13;
static constexpr uint32_t SPI_MUX_BIT_2 = 14;
static constexpr uint32_t SPI_MUX_BIT_3 = 15;
static constexpr uint32_t SPI_MUX_BIT_4 = 16;
static constexpr uint32_t SPI_MUX_BIT_5 = 17;
static constexpr uint32_t SPI_MUX_BIT_6 = 9;
static constexpr uint32_t EN_RW_CS = 17;
} }
#endif /* BSP_Q7S_BOARDCONFIG_BUSCONF_H_ */ #endif /* BSP_Q7S_BOARDCONFIG_BUSCONF_H_ */

View File

@ -5,30 +5,31 @@
#cmakedefine01 Q7S_SIMPLE_MODE #cmakedefine01 Q7S_SIMPLE_MODE
#define Q7S_SD_NONE 0 /*******************************************************************/
#define Q7S_SD_COLD_REDUNDANT 1 /** All of the following flags should be enabled for mission code */
#define Q7S_SD_HOT_REDUNDANT 2 /*******************************************************************/
//! Timers can mess up the code when debugging
//! All of this should be enabled for mission code!
/*******************************************************************/
/** Other flags */
/*******************************************************************/
#define Q7S_SD_NONE 0
#define Q7S_SD_COLD_REDUNDANT 1
#define Q7S_SD_HOT_REDUNDANT 2
// The OBSW will perform different actions to set up the SD cards depending on the flag set here // The OBSW will perform different actions to set up the SD cards depending on the flag set here
// Set to Q7S_SD_NONE: Don't do anything // Set to Q7S_SD_NONE: Don't do anything
// Set to Q7S_COLD_REDUNDANT: On startup, get the prefered SD card, turn it on and mount it, and // Set to Q7S_COLD_REDUNDANT: On startup, get the prefered SD card, turn it on and mount it, and
// turn off the second SD card if it is on // turn off the second SD card if it is on
// Set to Q7S_HOT_REDUNDANT: On startup, turn on both SD cards and mount them // Set to Q7S_HOT_REDUNDANT: On startup, turn on both SD cards and mount them
#define Q7S_SD_CARD_CONFIG Q7S_SD_COLD_REDUNDANT #define Q7S_SD_CARD_CONFIG Q7S_SD_COLD_REDUNDANT
// Probably better if this is disabled for mission code. Convenient for development // Probably better if this is disabled for mission code. Convenient for development
#define Q7S_CHECK_FOR_ALREADY_RUNNING_IMG 1 #define Q7S_CHECK_FOR_ALREADY_RUNNING_IMG 1
#define Q7S_ADD_RTD_DEVICES 0
/* Only one of those 2 should be enabled! */ #define Q7S_SIMPLE_ADD_FILE_SYSTEM_TEST 0
/* Add code for ACS board */
#define OBSW_ADD_ACS_BOARD 0
#if OBSW_ADD_ACS_BOARD == 0
#define Q7S_ADD_SPI_TEST 0
#endif
#define Q7S_ADD_SYRLINKS_HANDLER 1
#define Q7S_SIMPLE_ADD_FILE_SYSTEM_TEST 0
namespace config { namespace config {

View File

@ -1,3 +1,4 @@
target_sources(${TARGET_NAME} PRIVATE target_sources(${TARGET_NAME} PRIVATE
rwSpiCallback.cpp rwSpiCallback.cpp
gnssCallback.cpp
) )

View File

@ -0,0 +1,26 @@
#include "gnssCallback.h"
#include "devices/gpioIds.h"
#include "fsfw/tasks/TaskFactory.h"
ReturnValue_t gps::triggerGpioResetPin(void *args) {
ResetArgs* resetArgs = reinterpret_cast<ResetArgs*>(args);
if(args == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED;
}
if (resetArgs->gpioComIF == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED;
}
gpioId_t gpioId;
if(resetArgs->gnss1) {
gpioId = gpioIds::GNSS_1_NRESET;
}
else {
gpioId = gpioIds::GNSS_0_NRESET;
}
resetArgs->gpioComIF->pullLow(gpioId);
TaskFactory::delayTask(resetArgs->waitPeriodMs);
resetArgs->gpioComIF->pullHigh(gpioId);
return HasReturnvaluesIF::RETURN_OK;
}

View File

@ -0,0 +1,19 @@
#ifndef BSP_Q7S_CALLBACKS_GNSSCALLBACK_H_
#define BSP_Q7S_CALLBACKS_GNSSCALLBACK_H_
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
struct ResetArgs {
bool gnss1 = false;
LinuxLibgpioIF* gpioComIF = nullptr;
uint32_t waitPeriodMs = 100;
};
namespace gps {
ReturnValue_t triggerGpioResetPin(void* args);
}
#endif /* BSP_Q7S_CALLBACKS_GNSSCALLBACK_H_ */

View File

@ -1,9 +1,10 @@
#include <bsp_q7s/spiCallbacks/rwSpiCallback.h> #include "rwSpiCallback.h"
#include <fsfw/serviceinterface/ServiceInterface.h>
#include <mission/devices/RwHandler.h>
#include <fsfw_hal/linux/spi/SpiCookie.h>
#include <fsfw_hal/linux/UnixFileGuard.h>
#include "devices/gpioIds.h" #include "devices/gpioIds.h"
#include "mission/devices/RwHandler.h"
#include "fsfw_hal/linux/spi/SpiCookie.h"
#include "fsfw_hal/linux/UnixFileGuard.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
namespace rwSpiCallback { namespace rwSpiCallback {
@ -211,7 +212,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen
result = HasReturnvaluesIF::RETURN_OK; result = HasReturnvaluesIF::RETURN_OK;
} }
cookie->assignTransferSize(decodedFrameLen); cookie->setTransferSize(decodedFrameLen);
closeSpi(gpioId, gpioIF, mutex); closeSpi(gpioId, gpioIF, mutex);

View File

@ -1,9 +1,9 @@
#ifndef BSP_Q7S_RW_SPI_CALLBACK_H_ #ifndef BSP_Q7S_RW_SPI_CALLBACK_H_
#define BSP_Q7S_RW_SPI_CALLBACK_H_ #define BSP_Q7S_RW_SPI_CALLBACK_H_
#include <fsfw/returnvalues/HasReturnvaluesIF.h> #include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include <fsfw_hal/linux/spi/SpiComIF.h> #include "fsfw_hal/linux/spi/SpiComIF.h"
#include <fsfw_hal/common/gpio/GpioCookie.h> #include "fsfw_hal/common/gpio/GpioCookie.h"
namespace rwSpiCallback { namespace rwSpiCallback {

View File

@ -121,7 +121,7 @@ void initmission::initTasks() {
std::vector<PeriodicTaskIF*> pstTasks; std::vector<PeriodicTaskIF*> pstTasks;
createPstTasks(*factory, missedDeadlineFunc, pstTasks); createPstTasks(*factory, missedDeadlineFunc, pstTasks);
#if OBSW_ADD_TEST_TASK == 1 #if OBSW_ADD_TEST_CODE == 1
std::vector<PeriodicTaskIF*> testTasks; std::vector<PeriodicTaskIF*> testTasks;
createTestTasks(*factory, missedDeadlineFunc, testTasks); createTestTasks(*factory, missedDeadlineFunc, testTasks);
#endif #endif
@ -147,7 +147,7 @@ void initmission::initTasks() {
taskStarter(pstTasks, "PST task vector"); taskStarter(pstTasks, "PST task vector");
taskStarter(pusTasks, "PUS task vector"); taskStarter(pusTasks, "PUS task vector");
#if OBSW_ADD_TEST_TASK == 1 #if OBSW_ADD_TEST_CODE == 1
taskStarter(testTasks, "Test task vector"); taskStarter(testTasks, "Test task vector");
#endif #endif
@ -167,7 +167,7 @@ void initmission::createPstTasks(TaskFactory& factory,
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
#if BOARD_TE0720 == 0 #if BOARD_TE0720 == 0
/* Polling Sequence Table Default */ /* Polling Sequence Table Default */
#if Q7S_ADD_SPI_TEST == 0 #if OBSW_ADD_SPI_TEST_CODE == 0
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask( FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
"PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, "PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0,
missedDeadlineFunc); missedDeadlineFunc);
@ -289,15 +289,19 @@ void initmission::createPusTasks(TaskFactory &factory,
void initmission::createTestTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc, void initmission::createTestTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*>& taskVec) { std::vector<PeriodicTaskIF*>& taskVec) {
#if OBSW_ADD_TEST_TASK == 1 || OBSW_ADD_SPI_TEST_CODE == 1 || (BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1)
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
#endif
PeriodicTaskIF* testTask = factory.createPeriodicTask( PeriodicTaskIF* testTask = factory.createPeriodicTask(
"TEST_TASK", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1, missedDeadlineFunc); "TEST_TASK", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1, missedDeadlineFunc);
#if OBSW_ADD_TEST_TASK == 1
result = testTask->addComponent(objects::TEST_TASK); result = testTask->addComponent(objects::TEST_TASK);
if(result != HasReturnvaluesIF::RETURN_OK) { if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK); initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
} }
#endif /* OBSW_ADD_TEST_TASK == 1 */
#if Q7S_ADD_SPI_TEST == 1 #if OBSW_ADD_SPI_TEST_CODE == 1
result = testTask->addComponent(objects::SPI_TEST); result = testTask->addComponent(objects::SPI_TEST);
if(result != HasReturnvaluesIF::RETURN_OK) { if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST); initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST);

View File

@ -9,12 +9,13 @@
#include "devices/powerSwitcherList.h" #include "devices/powerSwitcherList.h"
#include "bsp_q7s/gpio/gpioCallbacks.h" #include "bsp_q7s/gpio/gpioCallbacks.h"
#include "bsp_q7s/core/CoreController.h" #include "bsp_q7s/core/CoreController.h"
#include "bsp_q7s/spiCallbacks/rwSpiCallback.h"
#include "bsp_q7s/boardtest/Q7STestTask.h" #include "bsp_q7s/boardtest/Q7STestTask.h"
#include "bsp_q7s/memory/FileSystemHandler.h" #include "bsp_q7s/memory/FileSystemHandler.h"
#include "bsp_q7s/devices/PlocSupervisorHandler.h" #include "bsp_q7s/devices/PlocSupervisorHandler.h"
#include "bsp_q7s/devices/PlocUpdater.h" #include "bsp_q7s/devices/PlocUpdater.h"
#include "bsp_q7s/devices/PlocMemoryDumper.h" #include "bsp_q7s/devices/PlocMemoryDumper.h"
#include "bsp_q7s/callbacks/rwSpiCallback.h"
#include "bsp_q7s/callbacks/gnssCallback.h"
#include "linux/devices/HeaterHandler.h" #include "linux/devices/HeaterHandler.h"
#include "linux/devices/SolarArrayDeploymentHandler.h" #include "linux/devices/SolarArrayDeploymentHandler.h"
@ -32,10 +33,9 @@
#include "mission/devices/P60DockHandler.h" #include "mission/devices/P60DockHandler.h"
#include "mission/devices/Tmp1075Handler.h" #include "mission/devices/Tmp1075Handler.h"
#include "mission/devices/Max31865PT1000Handler.h" #include "mission/devices/Max31865PT1000Handler.h"
#include "mission/devices/GyroADIS16507Handler.h"
#include "mission/devices/IMTQHandler.h" #include "mission/devices/IMTQHandler.h"
#include "mission/devices/SyrlinksHkHandler.h" #include "mission/devices/SyrlinksHkHandler.h"
#include "mission/devices/MGMHandlerLIS3MDL.h"
#include "mission/devices/MGMHandlerRM3100.h"
#include "mission/devices/PlocMPSoCHandler.h" #include "mission/devices/PlocMPSoCHandler.h"
#include "mission/devices/RadiationSensorHandler.h" #include "mission/devices/RadiationSensorHandler.h"
#include "mission/devices/RwHandler.h" #include "mission/devices/RwHandler.h"
@ -52,7 +52,9 @@
#include "fsfw_hal/linux/uart/UartComIF.h" #include "fsfw_hal/linux/uart/UartComIF.h"
#include "fsfw_hal/linux/uart/UartCookie.h" #include "fsfw_hal/linux/uart/UartCookie.h"
#include "fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h"
#include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h" #include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h"
#include "fsfw_hal/devicehandlers/MgmRM3100Handler.h"
#include "fsfw_hal/linux/i2c/I2cCookie.h" #include "fsfw_hal/linux/i2c/I2cCookie.h"
#include "fsfw_hal/linux/i2c/I2cComIF.h" #include "fsfw_hal/linux/i2c/I2cComIF.h"
#include "fsfw_hal/linux/spi/SpiCookie.h" #include "fsfw_hal/linux/spi/SpiCookie.h"
@ -81,6 +83,9 @@
#include "linux/boardtest/LibgpiodTest.h" #include "linux/boardtest/LibgpiodTest.h"
#endif #endif
ResetArgs resetArgsGnss0;
ResetArgs resetArgsGnss1;
void ObjectFactory::setStatics() { void ObjectFactory::setStatics() {
Factory::setStaticFrameworkObjectIds(); Factory::setStaticFrameworkObjectIds();
} }
@ -92,6 +97,8 @@ void Factory::setStaticFrameworkObjectIds() {
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR; CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL; CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
//DeviceHandlerBase::powerSwitcherId = objects::PCDU_HANDLER;
DeviceHandlerBase::powerSwitcherId = objects::NO_OBJECT;
TmFunnel::downlinkDestination = objects::TMTC_BRIDGE; TmFunnel::downlinkDestination = objects::TMTC_BRIDGE;
// No storage object for now. // No storage object for now.
TmFunnel::storageDestination = objects::NO_OBJECT; TmFunnel::storageDestination = objects::NO_OBJECT;
@ -102,7 +109,7 @@ void Factory::setStaticFrameworkObjectIds() {
TmPacketBase::timeStamperId = objects::TIME_STAMPER; TmPacketBase::timeStamperId = objects::TIME_STAMPER;
} }
void ObjectFactory::produce(void* args){ void ObjectFactory::produce(void* args) {
ObjectFactory::setStatics(); ObjectFactory::setStatics();
ObjectFactory::produceGenericObjects(); ObjectFactory::produceGenericObjects();
LinuxLibgpioIF* gpioComIF = nullptr; LinuxLibgpioIF* gpioComIF = nullptr;
@ -116,21 +123,22 @@ void ObjectFactory::produce(void* args){
createPcduComponents(); createPcduComponents();
createRadSensorComponent(gpioComIF); createRadSensorComponent(gpioComIF);
createSunSensorComponents(gpioComIF, spiComIF); createSunSensorComponents(gpioComIF, spiComIF);
#if OBSW_ADD_ACS_BOARD == 1 #if OBSW_ADD_ACS_BOARD == 1
createAcsBoardComponents(gpioComIF, uartComIF); createAcsBoardComponents(gpioComIF, uartComIF);
#endif /* OBSW_ADD_ACS_BOARD == 1 */ #endif /* OBSW_ADD_ACS_BOARD == 1 */
createHeaterComponents(); createHeaterComponents();
createSolarArrayDeploymentComponents(); createSolarArrayDeploymentComponents();
#if Q7S_ADD_SYRLINKS_HANDLER == 1 #if OBSW_ADD_SYRLINKS == 1
createSyrlinksComponents(); createSyrlinksComponents();
#endif /* Q7S_ADD_SYRLINKS_HANDLER == 1 */ #endif /* OBSW_ADD_SYRLINKS == 1 */
#if Q7S_ADD_RTD_DEVICES == 1 #if OBSW_ADD_RTD_DEVICES == 1
createRtdComponents(); createRtdComponents();
#endif /* Q7S_ADD_RTD_DEVICES == 1 */ #endif /* OBSW_ADD_RTD_DEVICES == 1 */
I2cCookie* imtqI2cCookie = new I2cCookie(addresses::IMTQ, I2cCookie* imtqI2cCookie = new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE,
IMTQ::MAX_REPLY_SIZE, q7s::I2C_DEFAULT_DEV); q7s::I2C_DEFAULT_DEV);
new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie); new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie);
createReactionWheelComponents(gpioComIF); createReactionWheelComponents(gpioComIF);
@ -167,17 +175,18 @@ void ObjectFactory::produce(void* args){
auto udpBridge = new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR); auto udpBridge = new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE); new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
sif::info << "Created UDP server for TMTC commanding with listener port " << sif::info << "Created UDP server for TMTC commanding with listener port " <<
udpBridge->getUdpPort() << std::endl; udpBridge->getUdpPort() << std::endl;
#else #else
new TcpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR); auto tmtcBridge = new TcpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
tmtcBridge->setMaxNumberOfPacketsStored(50);
auto tcpServer = new TcpTmTcServer(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE); auto tcpServer = new TcpTmTcServer(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
sif::info << "Created TCP server for TMTC commanding with listener port " << sif::info << "Created TCP server for TMTC commanding with listener port "
tcpServer->getTcpPort() << std::endl; << tcpServer->getTcpPort() << std::endl;
#endif /* OBSW_USE_TMTC_TCP_BRIDGE == 0 */ #endif /* OBSW_USE_TMTC_TCP_BRIDGE == 0 */
/* Test Task */ /* Test Task */
#if OBSW_ADD_TEST_CODE == 1 #if OBSW_ADD_TEST_CODE == 1
createTestComponents(); createTestComponents(gpioComIF);
#endif /* OBSW_ADD_TEST_CODE == 1 */ #endif /* OBSW_ADD_TEST_CODE == 1 */
new PlocUpdater(objects::PLOC_UPDATER); new PlocUpdater(objects::PLOC_UPDATER);
@ -198,19 +207,17 @@ void ObjectFactory::createTmpComponents() {
#endif #endif
/* Temperature sensors */ /* Temperature sensors */
Tmp1075Handler* tmp1075Handler_1 = new Tmp1075Handler( Tmp1075Handler* tmp1075Handler_1 = new Tmp1075Handler(objects::TMP1075_HANDLER_1,
objects::TMP1075_HANDLER_1, objects::I2C_COM_IF, objects::I2C_COM_IF, i2cCookieTmp1075tcs1);
i2cCookieTmp1075tcs1);
(void) tmp1075Handler_1; (void) tmp1075Handler_1;
Tmp1075Handler* tmp1075Handler_2 = new Tmp1075Handler( Tmp1075Handler* tmp1075Handler_2 = new Tmp1075Handler(objects::TMP1075_HANDLER_2,
objects::TMP1075_HANDLER_2, objects::I2C_COM_IF, objects::I2C_COM_IF, i2cCookieTmp1075tcs2);
i2cCookieTmp1075tcs2);
(void) tmp1075Handler_2; (void) tmp1075Handler_2;
} }
void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF **gpioComIF, void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF **gpioComIF, UartComIF** uartComIF,
UartComIF** uartComIF, SpiComIF** spiComIF) { SpiComIF** spiComIF) {
if(gpioComIF == nullptr or uartComIF == nullptr or spiComIF == nullptr) { if (gpioComIF == nullptr or uartComIF == nullptr or spiComIF == nullptr) {
sif::error << "ObjectFactory::createCommunicationInterfaces: Invalid passed ComIF pointer" sif::error << "ObjectFactory::createCommunicationInterfaces: Invalid passed ComIF pointer"
<< std::endl; << std::endl;
} }
@ -220,9 +227,9 @@ void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF **gpioComIF,
new CspComIF(objects::CSP_COM_IF); new CspComIF(objects::CSP_COM_IF);
new I2cComIF(objects::I2C_COM_IF); new I2cComIF(objects::I2C_COM_IF);
*uartComIF = new UartComIF(objects::UART_COM_IF); *uartComIF = new UartComIF(objects::UART_COM_IF);
#if Q7S_ADD_SPI_TEST == 0 #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 == 0 */ #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 */
@ -231,23 +238,19 @@ void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF **gpioComIF,
} }
void ObjectFactory::createPcduComponents() { void ObjectFactory::createPcduComponents() {
CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_LENGTH, CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_LENGTH, addresses::P60DOCK);
addresses::P60DOCK); CspCookie* pdu1CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, addresses::PDU1);
CspCookie* pdu1CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, CspCookie* pdu2CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, addresses::PDU2);
addresses::PDU1); CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_LENGTH, addresses::ACU);
CspCookie* pdu2CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH,
addresses::PDU2);
CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_LENGTH,
addresses::ACU);
/* Device Handler */ /* Device Handler */
P60DockHandler* p60dockhandler = new P60DockHandler(objects::P60DOCK_HANDLER, P60DockHandler* p60dockhandler = new P60DockHandler(objects::P60DOCK_HANDLER,
objects::CSP_COM_IF, p60DockCspCookie); objects::CSP_COM_IF, p60DockCspCookie);
PDU1Handler* pdu1handler = new PDU1Handler(objects::PDU1_HANDLER, PDU1Handler* pdu1handler = new PDU1Handler(objects::PDU1_HANDLER, objects::CSP_COM_IF,
objects::CSP_COM_IF, pdu1CspCookie); pdu1CspCookie);
PDU2Handler* pdu2handler = new PDU2Handler(objects::PDU2_HANDLER, PDU2Handler* pdu2handler = new PDU2Handler(objects::PDU2_HANDLER, objects::CSP_COM_IF,
objects::CSP_COM_IF, pdu2CspCookie); pdu2CspCookie);
ACUHandler* acuhandler = new ACUHandler(objects::ACU_HANDLER, ACUHandler* acuhandler = new ACUHandler(objects::ACU_HANDLER, objects::CSP_COM_IF,
objects::CSP_COM_IF, acuCspCookie); acuCspCookie);
new PCDUHandler(objects::PCDU_HANDLER, 50); new PCDUHandler(objects::PCDU_HANDLER, 50);
/** /**
@ -262,8 +265,8 @@ void ObjectFactory::createPcduComponents() {
void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) { void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) {
GpioCookie* gpioCookieRadSensor = new GpioCookie; GpioCookie* gpioCookieRadSensor = new GpioCookie;
GpiodRegular* chipSelectRadSensor = new GpiodRegular(q7s::GPIO_RAD_SENSOR_CHIP, auto chipSelectRadSensor = new GpiodRegularByLabel(q7s::GPIO_RAD_SENSOR_LABEL,
q7s::GPIO_RAD_SENSOR_CS, "Chip Select Radiation Sensor", gpio::OUT, 1); q7s::GPIO_RAD_SENSOR_CS, "Chip Select Radiation Sensor", gpio::OUT, gpio::HIGH);
gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, chipSelectRadSensor); gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, chipSelectRadSensor);
gpioComIF->addGpios(gpioCookieRadSensor); gpioComIF->addGpios(gpioCookieRadSensor);
@ -273,49 +276,48 @@ void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) {
new RadiationSensorHandler(objects::RAD_SENSOR, objects::SPI_COM_IF, spiCookieRadSensor); new RadiationSensorHandler(objects::RAD_SENSOR, objects::SPI_COM_IF, spiCookieRadSensor);
} }
void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF *gpioComIF, void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF *gpioComIF, SpiComIF* spiComIF) {
SpiComIF* spiComIF) {
GpioCookie* gpioCookieSus = new GpioCookie(); GpioCookie* gpioCookieSus = new GpioCookie();
GpioCallback* susgpio = nullptr; GpioCallback* susgpio = nullptr;
susgpio = new GpioCallback("Chip select SUS 1", gpio::OUT, 1, susgpio = new GpioCallback("Chip select SUS 1", gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF); &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_1, susgpio); gpioCookieSus->addGpio(gpioIds::CS_SUS_1, susgpio);
susgpio = new GpioCallback("Chip select SUS 2", gpio::OUT, 1, susgpio = new GpioCallback("Chip select SUS 2", gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF); &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_2, susgpio); gpioCookieSus->addGpio(gpioIds::CS_SUS_2, susgpio);
susgpio = new GpioCallback("Chip select SUS 3", gpio::OUT, 1, susgpio = new GpioCallback("Chip select SUS 3", gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF); &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_3, susgpio); gpioCookieSus->addGpio(gpioIds::CS_SUS_3, susgpio);
susgpio = new GpioCallback("Chip select SUS 4", gpio::OUT, 1, susgpio = new GpioCallback("Chip select SUS 4", gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF); &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_4, susgpio); gpioCookieSus->addGpio(gpioIds::CS_SUS_4, susgpio);
susgpio = new GpioCallback("Chip select SUS 5", gpio::OUT, 1, susgpio = new GpioCallback("Chip select SUS 5", gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF); &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_5, susgpio); gpioCookieSus->addGpio(gpioIds::CS_SUS_5, susgpio);
susgpio = new GpioCallback("Chip select SUS 6", gpio::OUT, 1, susgpio = new GpioCallback("Chip select SUS 6", gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF); &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_6, susgpio); gpioCookieSus->addGpio(gpioIds::CS_SUS_6, susgpio);
susgpio = new GpioCallback("Chip select SUS 7", gpio::OUT, 1, susgpio = new GpioCallback("Chip select SUS 7", gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF); &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_7, susgpio); gpioCookieSus->addGpio(gpioIds::CS_SUS_7, susgpio);
susgpio = new GpioCallback("Chip select SUS 8", gpio::OUT, 1, susgpio = new GpioCallback("Chip select SUS 8", gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF); &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_8, susgpio); gpioCookieSus->addGpio(gpioIds::CS_SUS_8, susgpio);
susgpio = new GpioCallback("Chip select SUS 9", gpio::OUT, 1, susgpio = new GpioCallback("Chip select SUS 9", gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF); &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_9, susgpio); gpioCookieSus->addGpio(gpioIds::CS_SUS_9, susgpio);
susgpio = new GpioCallback("Chip select SUS 10", gpio::OUT, 1, susgpio = new GpioCallback("Chip select SUS 10", gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF); &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_10, susgpio); gpioCookieSus->addGpio(gpioIds::CS_SUS_10, susgpio);
susgpio = new GpioCallback("Chip select SUS 11", gpio::OUT, 1, susgpio = new GpioCallback("Chip select SUS 11", gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF); &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_11, susgpio); gpioCookieSus->addGpio(gpioIds::CS_SUS_11, susgpio);
susgpio = new GpioCallback("Chip select SUS 12", gpio::OUT, 1, susgpio = new GpioCallback("Chip select SUS 12", gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF); &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_12, susgpio); gpioCookieSus->addGpio(gpioIds::CS_SUS_12, susgpio);
susgpio = new GpioCallback("Chip select SUS 13", gpio::OUT, 1, susgpio = new GpioCallback("Chip select SUS 13", gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF); &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_13, susgpio); gpioCookieSus->addGpio(gpioIds::CS_SUS_13, susgpio);
gpioComIF->addGpios(gpioCookieSus); gpioComIF->addGpios(gpioCookieSus);
@ -390,85 +392,149 @@ void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF *gpioComIF,
void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComIF* uartComIF) { void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComIF* uartComIF) {
GpioCookie* gpioCookieAcsBoard = new GpioCookie(); GpioCookie* gpioCookieAcsBoard = new GpioCookie();
GpiodRegular* gpio = nullptr; GpiodRegularByLabel* gpio = nullptr;
// TODO: Determine new Gyro GPIO pins gpio = new GpiodRegularByLabel(q7s::GPIO_GYRO_ADIS_LABEL, q7s::GPIO_GYRO_0_ADIS_CS,
gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, q7s::GPIO_GYRO_0_ADIS_CS,
"CS_GYRO_0_ADIS", gpio::OUT, gpio::HIGH); "CS_GYRO_0_ADIS", gpio::OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio);
gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, q7s::GPIO_GYRO_1_L3G_CS, gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_GYRO_1_L3G_CS,
"CS_GYRO_1_L3G", gpio::OUT, gpio::HIGH); "CS_GYRO_1_L3G", gpio::OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_1_L3G_CS, gpio); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_1_L3G_CS, gpio);
gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, q7s::GPIO_GYRO_2_ADIS_CS, gpio = new GpiodRegularByLabel(q7s::GPIO_GYRO_ADIS_LABEL, q7s::GPIO_GYRO_2_ADIS_CS,
"CS_GYRO_2_ADIS", gpio::OUT, gpio::HIGH); "CS_GYRO_2_ADIS", gpio::OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_2_ADIS_CS, gpio); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_2_ADIS_CS, gpio);
gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, q7s::GPIO_GYRO_3_L3G_CS, gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_GYRO_3_L3G_CS,
"CS_GYRO_3_L3G", gpio::OUT, gpio::HIGH); "CS_GYRO_3_L3G", gpio::OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_3_L3G_CS, gpio); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_3_L3G_CS, gpio);
gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, q7s::GPIO_MGM_0_LIS3_CS, gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_0_LIS3_CS,
"CS_MGM_0_LIS3_A", gpio::OUT, gpio::HIGH); "CS_MGM_0_LIS3_A", gpio::OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::MGM_0_LIS3_CS, gpio); gpioCookieAcsBoard->addGpio(gpioIds::MGM_0_LIS3_CS, gpio);
gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, q7s::GPIO_MGM_1_RM3100_CS, gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_1_RM3100_CS,
"CS_MGM_1_RM3100_A", gpio::OUT, gpio::HIGH); "CS_MGM_1_RM3100_A", gpio::OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::MGM_1_RM3100_CS, gpio); gpioCookieAcsBoard->addGpio(gpioIds::MGM_1_RM3100_CS, gpio);
gpio = new GpiodRegular(q7s::GPIO_MGM2_LIS3_CHIP, q7s::GPIO_MGM_2_LIS3_CS, auto gpioChip = new GpiodRegularByChip(q7s::GPIO_MGM2_LIS3_LABEL, q7s::GPIO_MGM_2_LIS3_CS,
"CS_MGM_2_LIS3_B", gpio::OUT, gpio::HIGH); "CS_MGM_2_LIS3_B", gpio::OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::MGM_2_LIS3_CS, gpio); gpioCookieAcsBoard->addGpio(gpioIds::MGM_2_LIS3_CS, gpioChip);
gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, q7s::GPIO_MGM_3_RM3100_CS, gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_3_RM3100_CS,
"CS_MGM_3_RM3100_B", gpio::OUT, gpio::HIGH); "CS_MGM_3_RM3100_B", gpio::OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); gpioCookieAcsBoard->addGpio(gpioIds::MGM_3_RM3100_CS, gpio);
// GNSS reset pins are active low
gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_RESET_GNSS_0,
"GNSS_0_NRESET", gpio::OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GNSS_0_NRESET, gpio);
gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_RESET_GNSS_1,
"GNSS_1_NRESET", gpio::OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GNSS_1_NRESET, gpio);
// Enable pins must be pulled low for regular operations
gpio = new GpiodRegularByLabel(q7s::GPIO_FLEX_OBC1F_B0, q7s::GPIO_GYRO_0_ENABLE,
"GYRO_0_ENABLE", gpio::OUT, gpio::LOW);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ENABLE, gpio);
gpio = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::GPIO_GYRO_2_ENABLE,
"GYRO_2_ENABLE", gpio::OUT, gpio::LOW);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_2_ENABLE, gpio);
// TODO: Add enable pins for GPS as soon as new interface board design is finished
gpioComIF->addGpios(gpioCookieAcsBoard); gpioComIF->addGpios(gpioCookieAcsBoard);
std::string spiDev = q7s::SPI_DEFAULT_DEV; std::string spiDev = q7s::SPI_DEFAULT_DEV;
SpiCookie* spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev, SpiCookie* spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev,
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
auto mgmLis3Handler = new MGMHandlerLIS3MDL(objects::MGM_0_LIS3_HANDLER, auto mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER, objects::SPI_COM_IF,
objects::SPI_COM_IF, spiCookie); spiCookie, spi::LIS3_TRANSITION_DELAY);
mgmLis3Handler->setStartUpImmediately(); mgmLis3Handler->setStartUpImmediately();
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev, mgmLis3Handler->setToGoToNormalMode(true);
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); #endif
auto mgmLis3Handler2 = new MGMHandlerLIS3MDL(objects::MGM_2_LIS3_HANDLER,
objects::SPI_COM_IF, spiCookie);
mgmLis3Handler2->setStartUpImmediately();
spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev, spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev,
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
auto mgmRm3100Handler = new MGMHandlerRM3100(objects::MGM_1_RM3100_HANDLER, auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, objects::SPI_COM_IF,
objects::SPI_COM_IF, spiCookie); spiCookie, spi::RM3100_TRANSITION_DELAY);
mgmRm3100Handler->setStartUpImmediately(); mgmRm3100Handler->setStartUpImmediately();
#if FSFW_HAL_RM3100_MGM_DEBUG == 1
mgmRm3100Handler->setToGoToNormalMode(true);
#endif
spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev,
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
auto mgmLis3Handler2 = new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER, objects::SPI_COM_IF,
spiCookie, spi::LIS3_TRANSITION_DELAY);
mgmLis3Handler2->setStartUpImmediately();
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
mgmLis3Handler2->setToGoToNormalMode(true);
#endif
spiCookie = new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev, spiCookie = new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev,
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
mgmRm3100Handler = new MGMHandlerRM3100(objects::MGM_3_RM3100_HANDLER, mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, objects::SPI_COM_IF,
objects::SPI_COM_IF, spiCookie); spiCookie, spi::RM3100_TRANSITION_DELAY);
mgmRm3100Handler->setStartUpImmediately(); mgmRm3100Handler->setStartUpImmediately();
#if FSFW_HAL_RM3100_MGM_DEBUG == 1
//TODO: Adis Gyro (Gyro 0 Side A) mgmRm3100Handler->setToGoToNormalMode(true);
#endif
// Commented until ACS board V2 in in clean room again // Commented until ACS board V2 in in clean room again
/* Gyro 1 Side A */ // Gyro 0 Side A
// spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev,
// L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE,
// auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF, spi::DEFAULT_ADIS16507_SPEED);
// spiCookie); auto adisHandler = new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF,
// gyroL3gHandler->setStartUpImmediately(); spiCookie);
// adisHandler->setStartUpImmediately();
// /* Gyro 2 Side B */ // Gyro 1 Side A
// spiCookie = new SpiCookie(addresses::GYRO_2_L3G, gpioIds::GYRO_2_L3G_CS, spiDev, spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev,
// L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
// gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_2_L3G_HANDLER, objects::SPI_COM_IF, auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF,
// spiCookie); spiCookie, spi::L3G_TRANSITION_DELAY);
// gyroL3gHandler->setStartUpImmediately(); gyroL3gHandler->setStartUpImmediately();
#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1
gyroL3gHandler->setToGoToNormalMode(true);
#endif
// Gyro 2 Side B
spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev,
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE,
spi::DEFAULT_ADIS16507_SPEED);
adisHandler = new GyroADIS16507Handler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF,
spiCookie);
adisHandler->setStartUpImmediately();
// Gyro 3 Side B
spiCookie = new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, spiDev,
L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, objects::SPI_COM_IF,
spiCookie, spi::L3G_TRANSITION_DELAY);
gyroL3gHandler->setStartUpImmediately();
#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1
gyroL3gHandler->setToGoToNormalMode(true);
#endif
// TODO: Add GPS device handlers bool debugGps = false;
// auto uartCookieGps0 = new UartCookie(objects::GPS0_HANDLER, deviceFile, uartMode, baudrate, #if OBSW_DEBUG_GPS == 1
// maxReplyLen); debugGps = true;
// auto uartCookieGps1 = new UartCookie(objects::GPS0_HANDLER, deviceFile, uartMode, baudrate, #endif
// maxReplyLen); resetArgsGnss1.gnss1 = true;
// new GPSHyperionHandler(objects::GPS0_HANDLER, uartComIF); resetArgsGnss1.gpioComIF = gpioComIF;
// new GPSHyperionHandler(objects::GPS1_HANDLER, uartComIF); resetArgsGnss1.waitPeriodMs = 100;
resetArgsGnss0.gnss1 = false;
resetArgsGnss0.gpioComIF = gpioComIF;
resetArgsGnss0.waitPeriodMs = 100;
auto uartCookieGps0 = new UartCookie(objects::GPS0_HANDLER, q7s::UART_GNSS_0_DEV,
UartModes::CANONICAL, uart::GNSS_BAUD, uart::HYPERION_GPS_REPLY_MAX_BUFFER);
uartCookieGps0->setToFlushInput(true);
uartCookieGps0->setReadCycles(6);
auto uartCookieGps1 = new UartCookie(objects::GPS1_HANDLER, q7s::UART_GNSS_1_DEV,
UartModes::CANONICAL, uart::GNSS_BAUD, uart::HYPERION_GPS_REPLY_MAX_BUFFER);
uartCookieGps1->setToFlushInput(true);
uartCookieGps1->setReadCycles(6);
auto gpsHandler0 = new GPSHyperionHandler(objects::GPS0_HANDLER, objects::UART_COM_IF,
uartCookieGps0, debugGps);
gpsHandler0->setResetPinTriggerFunction(gps::triggerGpioResetPin, &resetArgsGnss0);
gpsHandler0->setStartUpImmediately();
auto gpsHandler1 = new GPSHyperionHandler(objects::GPS1_HANDLER, objects::UART_COM_IF,
uartCookieGps1, debugGps);
gpsHandler1->setResetPinTriggerFunction(gps::triggerGpioResetPin, &resetArgsGnss1);
gpsHandler1->setStartUpImmediately();
} }
void ObjectFactory::createHeaterComponents() { void ObjectFactory::createHeaterComponents() {
@ -476,38 +542,37 @@ void ObjectFactory::createHeaterComponents() {
GpioCookie* heaterGpiosCookie = new GpioCookie; GpioCookie* heaterGpiosCookie = new GpioCookie;
/* Pin H2-11 on stack connector */ /* Pin H2-11 on stack connector */
GpiodRegular* gpioConfigHeater0 = new GpiodRegular(q7s::GPIO_HEATER_CHIP, auto gpioConfigHeater0 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_0_PIN,
q7s::GPIO_HEATER_0_PIN, "Heater0", gpio::OUT, 0); "Heater0", gpio::OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_0, gpioConfigHeater0); heaterGpiosCookie->addGpio(gpioIds::HEATER_0, gpioConfigHeater0);
/* Pin H2-12 on stack connector */ /* Pin H2-12 on stack connector */
GpiodRegular* gpioConfigHeater1 = new GpiodRegular(q7s::GPIO_HEATER_CHIP, auto gpioConfigHeater1 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_1_PIN,
q7s::GPIO_HEATER_1_PIN, "Heater1", gpio::OUT, 0); "Heater1", gpio::OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_1, gpioConfigHeater1); heaterGpiosCookie->addGpio(gpioIds::HEATER_1, gpioConfigHeater1);
/* Pin H2-13 on stack connector */ /* Pin H2-13 on stack connector */
GpiodRegular* gpioConfigHeater2 = new GpiodRegular(q7s::GPIO_HEATER_CHIP, auto gpioConfigHeater2 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_2_PIN,
q7s::GPIO_HEATER_2_PIN, "Heater2", gpio::OUT, 0); "Heater2", gpio::OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_2, gpioConfigHeater2); heaterGpiosCookie->addGpio(gpioIds::HEATER_2, gpioConfigHeater2);
GpiodRegular* gpioConfigHeater3 = new GpiodRegular(q7s::GPIO_HEATER_CHIP, auto gpioConfigHeater3 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_3_PIN,
q7s::GPIO_HEATER_3_PIN, "Heater3", gpio::OUT, 0); "Heater3", gpio::OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_3, gpioConfigHeater3); heaterGpiosCookie->addGpio(gpioIds::HEATER_3, gpioConfigHeater3);
GpiodRegular* gpioConfigHeater4 = new GpiodRegular(q7s::GPIO_HEATER_CHIP, auto gpioConfigHeater4 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_4_PIN,
q7s::GPIO_HEATER_4_PIN, "Heater4", gpio::OUT, 0); "Heater4", gpio::OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_4, gpioConfigHeater4); heaterGpiosCookie->addGpio(gpioIds::HEATER_4, gpioConfigHeater4);
GpiodRegular* gpioConfigHeater5 = new GpiodRegular(q7s::GPIO_HEATER_CHIP, auto gpioConfigHeater5 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_5_PIN,
q7s::GPIO_HEATER_5_PIN, "Heater5", gpio::OUT, 0); "Heater5", gpio::OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_5, gpioConfigHeater5); heaterGpiosCookie->addGpio(gpioIds::HEATER_5, gpioConfigHeater5);
GpiodRegular* gpioConfigHeater6 = new GpiodRegular(q7s::GPIO_HEATER_CHIP, auto gpioConfigHeater6 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_6_PIN,
q7s::GPIO_HEATER_6_PIN, "Heater6", gpio::OUT, 0); "Heater6", gpio::OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_6, gpioConfigHeater6); heaterGpiosCookie->addGpio(gpioIds::HEATER_6, gpioConfigHeater6);
GpiodRegular* gpioConfigHeater7 = new GpiodRegular(q7s::GPIO_HEATER_CHIP, auto gpioConfigHeater7 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_7_PIN,
q7s::GPIO_HEATER_7_PIN, "Heater7", gpio::OUT, 0); "Heater7", gpio::OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_7, gpioConfigHeater7); heaterGpiosCookie->addGpio(gpioIds::HEATER_7, gpioConfigHeater7);
new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, heaterGpiosCookie, new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, heaterGpiosCookie,
@ -517,11 +582,11 @@ void ObjectFactory::createHeaterComponents() {
void ObjectFactory::createSolarArrayDeploymentComponents() { void ObjectFactory::createSolarArrayDeploymentComponents() {
GpioCookie* solarArrayDeplCookie = new GpioCookie; GpioCookie* solarArrayDeplCookie = new GpioCookie;
GpiodRegular* gpioConfigDeplSA0 = new GpiodRegular(q7s::GPIO_SOLAR_ARR_DEPL_CHIP, auto gpioConfigDeplSA0 = new GpiodRegularByLabel(q7s::GPIO_SOLAR_ARR_DEPL_LABEL,
q7s::GPIO_SOL_DEPL_SA_0_PIN, "DeplSA0", gpio::OUT, 0); q7s::GPIO_SOL_DEPL_SA_0_PIN, "DeplSA0", gpio::OUT, gpio::LOW);
solarArrayDeplCookie->addGpio(gpioIds::DEPLSA1, gpioConfigDeplSA0); solarArrayDeplCookie->addGpio(gpioIds::DEPLSA1, gpioConfigDeplSA0);
GpiodRegular* gpioConfigDeplSA1 = new GpiodRegular(q7s::GPIO_SOLAR_ARR_DEPL_CHIP, auto gpioConfigDeplSA1 = new GpiodRegularByLabel(q7s::GPIO_SOLAR_ARR_DEPL_LABEL,
q7s::GPIO_SOL_DEPL_SA_1_PIN, "DeplSA1", gpio::OUT, 0); q7s::GPIO_SOL_DEPL_SA_1_PIN, "DeplSA1", gpio::OUT, gpio::LOW);
solarArrayDeplCookie->addGpio(gpioIds::DEPLSA2, gpioConfigDeplSA1); solarArrayDeplCookie->addGpio(gpioIds::DEPLSA2, gpioConfigDeplSA1);
//TODO: Find out burn time. For now set to 1000 ms. //TODO: Find out burn time. For now set to 1000 ms.
@ -532,7 +597,8 @@ void ObjectFactory::createSolarArrayDeploymentComponents() {
void ObjectFactory::createSyrlinksComponents() { void ObjectFactory::createSyrlinksComponents() {
UartCookie* syrlinksUartCookie = new UartCookie(objects::SYRLINKS_HK_HANDLER, UartCookie* syrlinksUartCookie = new UartCookie(objects::SYRLINKS_HK_HANDLER,
std::string("/dev/ttyUL5"), UartModes::NON_CANONICAL, 38400, SYRLINKS::MAX_REPLY_SIZE); q7s::UART_SYRLINKS_DEV, UartModes::NON_CANONICAL, uart::SYRLINKS_BAUD,
SYRLINKS::MAX_REPLY_SIZE);
syrlinksUartCookie->setParityEven(); syrlinksUartCookie->setParityEven();
new SyrlinksHkHandler(objects::SYRLINKS_HK_HANDLER, objects::UART_COM_IF, syrlinksUartCookie); new SyrlinksHkHandler(objects::SYRLINKS_HK_HANDLER, objects::UART_COM_IF, syrlinksUartCookie);
@ -592,69 +658,62 @@ void ObjectFactory::createRtdComponents(LinuxLibgpioIF *gpioComIF) {
gpioComIF->addGpios(rtdGpioCookie); gpioComIF->addGpios(rtdGpioCookie);
SpiCookie* spiRtdIc3 = new SpiCookie(addresses::RTD_IC3, gpioIds::RTD_IC3, SpiCookie* spiRtdIc3 = new SpiCookie(addresses::RTD_IC3, gpioIds::RTD_IC3, q7s::SPI_DEFAULT_DEV,
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED);
spi::SpiModes::MODE_1, spi::RTD_SPEED); SpiCookie* spiRtdIc4 = new SpiCookie(addresses::RTD_IC4, gpioIds::RTD_IC4, q7s::SPI_DEFAULT_DEV,
SpiCookie* spiRtdIc4 = new SpiCookie(addresses::RTD_IC4, gpioIds::RTD_IC4, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED);
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, SpiCookie* spiRtdIc5 = new SpiCookie(addresses::RTD_IC5, gpioIds::RTD_IC5, q7s::SPI_DEFAULT_DEV,
spi::SpiModes::MODE_1, spi::RTD_SPEED); Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED);
SpiCookie* spiRtdIc5 = new SpiCookie(addresses::RTD_IC5, gpioIds::RTD_IC5, SpiCookie* spiRtdIc6 = new SpiCookie(addresses::RTD_IC6, gpioIds::RTD_IC6, q7s::SPI_DEFAULT_DEV,
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED);
spi::SpiModes::MODE_1, spi::RTD_SPEED); SpiCookie* spiRtdIc7 = new SpiCookie(addresses::RTD_IC7, gpioIds::RTD_IC7, q7s::SPI_DEFAULT_DEV,
SpiCookie* spiRtdIc6 = new SpiCookie(addresses::RTD_IC6, gpioIds::RTD_IC6, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED);
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, SpiCookie* spiRtdIc8 = new SpiCookie(addresses::RTD_IC8, gpioIds::RTD_IC8, q7s::SPI_DEFAULT_DEV,
spi::SpiModes::MODE_1, spi::RTD_SPEED); Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED);
SpiCookie* spiRtdIc7 = new SpiCookie(addresses::RTD_IC7, gpioIds::RTD_IC7, SpiCookie* spiRtdIc9 = new SpiCookie(addresses::RTD_IC9, gpioIds::RTD_IC9, q7s::SPI_DEFAULT_DEV,
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED);
spi::SpiModes::MODE_1, spi::RTD_SPEED);
SpiCookie* spiRtdIc8 = new SpiCookie(addresses::RTD_IC8, gpioIds::RTD_IC8,
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, spi::RTD_SPEED);
SpiCookie* spiRtdIc9 = new SpiCookie(addresses::RTD_IC9, gpioIds::RTD_IC9,
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, spi::RTD_SPEED);
SpiCookie* spiRtdIc10 = new SpiCookie(addresses::RTD_IC10, gpioIds::RTD_IC10, SpiCookie* spiRtdIc10 = new SpiCookie(addresses::RTD_IC10, gpioIds::RTD_IC10,
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1,
spi::SpiModes::MODE_1, spi::RTD_SPEED); spi::RTD_SPEED);
SpiCookie* spiRtdIc11 = new SpiCookie(addresses::RTD_IC11, gpioIds::RTD_IC11, SpiCookie* spiRtdIc11 = new SpiCookie(addresses::RTD_IC11, gpioIds::RTD_IC11,
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1,
spi::SpiModes::MODE_1, spi::RTD_SPEED); spi::RTD_SPEED);
SpiCookie* spiRtdIc12 = new SpiCookie(addresses::RTD_IC12, gpioIds::RTD_IC12, SpiCookie* spiRtdIc12 = new SpiCookie(addresses::RTD_IC12, gpioIds::RTD_IC12,
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1,
spi::SpiModes::MODE_1, spi::RTD_SPEED); spi::RTD_SPEED);
SpiCookie* spiRtdIc13 = new SpiCookie(addresses::RTD_IC13, gpioIds::RTD_IC13, SpiCookie* spiRtdIc13 = new SpiCookie(addresses::RTD_IC13, gpioIds::RTD_IC13,
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1,
spi::SpiModes::MODE_1, spi::RTD_SPEED); spi::RTD_SPEED);
SpiCookie* spiRtdIc14 = new SpiCookie(addresses::RTD_IC14, gpioIds::RTD_IC14, SpiCookie* spiRtdIc14 = new SpiCookie(addresses::RTD_IC14, gpioIds::RTD_IC14,
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1,
spi::SpiModes::MODE_1, spi::RTD_SPEED); spi::RTD_SPEED);
SpiCookie* spiRtdIc15 = new SpiCookie(addresses::RTD_IC15, gpioIds::RTD_IC15, SpiCookie* spiRtdIc15 = new SpiCookie(addresses::RTD_IC15, gpioIds::RTD_IC15,
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1,
spi::SpiModes::MODE_1, spi::RTD_SPEED); spi::RTD_SPEED);
SpiCookie* spiRtdIc16 = new SpiCookie(addresses::RTD_IC16, gpioIds::RTD_IC16, SpiCookie* spiRtdIc16 = new SpiCookie(addresses::RTD_IC16, gpioIds::RTD_IC16,
std::string(q7s::SPI_DEFAULT_DEV), Max31865Definitions::MAX_REPLY_SIZE, std::string(q7s::SPI_DEFAULT_DEV), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, spi::RTD_SPEED); spi::SpiModes::MODE_1, spi::RTD_SPEED);
SpiCookie* spiRtdIc17 = new SpiCookie(addresses::RTD_IC17, gpioIds::RTD_IC17, SpiCookie* spiRtdIc17 = new SpiCookie(addresses::RTD_IC17, gpioIds::RTD_IC17,
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1,
spi::SpiModes::MODE_1, spi::RTD_SPEED); spi::RTD_SPEED);
SpiCookie* spiRtdIc18 = new SpiCookie(addresses::RTD_IC18, gpioIds::RTD_IC18, SpiCookie* spiRtdIc18 = new SpiCookie(addresses::RTD_IC18, gpioIds::RTD_IC18,
q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1,
spi::SpiModes::MODE_1, spi::RTD_SPEED); spi::RTD_SPEED);
Max31865PT1000Handler* rtdIc3 = new Max31865PT1000Handler(objects::RTD_IC3, Max31865PT1000Handler* rtdIc3 = new Max31865PT1000Handler(objects::RTD_IC3, objects::SPI_COM_IF,
objects::SPI_COM_IF, spiRtdIc3, 0); // 0 is switchId spiRtdIc3, 0); // 0 is switchId
Max31865PT1000Handler* rtdIc4 = new Max31865PT1000Handler(objects::RTD_IC4, Max31865PT1000Handler* rtdIc4 = new Max31865PT1000Handler(objects::RTD_IC4, objects::SPI_COM_IF,
objects::SPI_COM_IF, spiRtdIc4, 0); spiRtdIc4, 0);
Max31865PT1000Handler* rtdIc5 = new Max31865PT1000Handler(objects::RTD_IC5, Max31865PT1000Handler* rtdIc5 = new Max31865PT1000Handler(objects::RTD_IC5, objects::SPI_COM_IF,
objects::SPI_COM_IF, spiRtdIc5, 0); spiRtdIc5, 0);
Max31865PT1000Handler* rtdIc6 = new Max31865PT1000Handler(objects::RTD_IC6, Max31865PT1000Handler* rtdIc6 = new Max31865PT1000Handler(objects::RTD_IC6, objects::SPI_COM_IF,
objects::SPI_COM_IF, spiRtdIc6, 0); spiRtdIc6, 0);
Max31865PT1000Handler* rtdIc7 = new Max31865PT1000Handler(objects::RTD_IC7, Max31865PT1000Handler* rtdIc7 = new Max31865PT1000Handler(objects::RTD_IC7, objects::SPI_COM_IF,
objects::SPI_COM_IF, spiRtdIc7, 0); spiRtdIc7, 0);
Max31865PT1000Handler* rtdIc8 = new Max31865PT1000Handler(objects::RTD_IC8, Max31865PT1000Handler* rtdIc8 = new Max31865PT1000Handler(objects::RTD_IC8, objects::SPI_COM_IF,
objects::SPI_COM_IF, spiRtdIc8, 0); spiRtdIc8, 0);
Max31865PT1000Handler* rtdIc9 = new Max31865PT1000Handler(objects::RTD_IC9, Max31865PT1000Handler* rtdIc9 = new Max31865PT1000Handler(objects::RTD_IC9, objects::SPI_COM_IF,
objects::SPI_COM_IF, spiRtdIc9, 0); spiRtdIc9, 0);
Max31865PT1000Handler* rtdIc10 = new Max31865PT1000Handler(objects::RTD_IC10, Max31865PT1000Handler* rtdIc10 = new Max31865PT1000Handler(objects::RTD_IC10,
objects::SPI_COM_IF, spiRtdIc10, 0); objects::SPI_COM_IF, spiRtdIc10, 0);
Max31865PT1000Handler* rtdIc11 = new Max31865PT1000Handler(objects::RTD_IC11, Max31865PT1000Handler* rtdIc11 = new Max31865PT1000Handler(objects::RTD_IC11,
@ -694,30 +753,30 @@ void ObjectFactory::createRtdComponents(LinuxLibgpioIF *gpioComIF) {
void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) {
GpioCookie* gpioCookieRw = new GpioCookie; GpioCookie* gpioCookieRw = new GpioCookie;
GpioCallback* csRw1 = new GpioCallback("Chip select reaction wheel 1", gpio::OUT, GpioCallback* csRw1 = new GpioCallback("Chip select reaction wheel 1", gpio::OUT, gpio::HIGH,
gpio::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieRw->addGpio(gpioIds::CS_RW1, csRw1); gpioCookieRw->addGpio(gpioIds::CS_RW1, csRw1);
GpioCallback* csRw2 = new GpioCallback("Chip select reaction wheel 2", gpio::OUT, GpioCallback* csRw2 = new GpioCallback("Chip select reaction wheel 2", gpio::OUT, gpio::HIGH,
gpio::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieRw->addGpio(gpioIds::CS_RW2, csRw2); gpioCookieRw->addGpio(gpioIds::CS_RW2, csRw2);
GpioCallback* csRw3 = new GpioCallback("Chip select reaction wheel 3", gpio::OUT, GpioCallback* csRw3 = new GpioCallback("Chip select reaction wheel 3", gpio::OUT, gpio::HIGH,
gpio::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieRw->addGpio(gpioIds::CS_RW3, csRw3); gpioCookieRw->addGpio(gpioIds::CS_RW3, csRw3);
GpioCallback* csRw4 = new GpioCallback("Chip select reaction wheel 4", gpio::OUT, GpioCallback* csRw4 = new GpioCallback("Chip select reaction wheel 4", gpio::OUT, gpio::HIGH,
gpio::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieRw->addGpio(gpioIds::CS_RW4, csRw4); gpioCookieRw->addGpio(gpioIds::CS_RW4, csRw4);
GpiodRegular* enRw1 = new GpiodRegular(q7s::GPIO_RW_DEFAULT_CHIP, q7s::GPIO_RW_0_CS, auto enRw1 = new GpiodRegularByLabel(q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_0_CS,
"Enable reaction wheel 1", gpio::OUT, 0); "Enable reaction wheel 1", gpio::OUT, gpio::LOW);
gpioCookieRw->addGpio(gpioIds::EN_RW1, enRw1); gpioCookieRw->addGpio(gpioIds::EN_RW1, enRw1);
GpiodRegular* enRw2 = new GpiodRegular(q7s::GPIO_RW_DEFAULT_CHIP, q7s::GPIO_RW_1_CS, auto enRw2 = new GpiodRegularByLabel(q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_1_CS,
"Enable reaction wheel 2", gpio::OUT, 0); "Enable reaction wheel 2", gpio::OUT, gpio::LOW);
gpioCookieRw->addGpio(gpioIds::EN_RW2, enRw2); gpioCookieRw->addGpio(gpioIds::EN_RW2, enRw2);
GpiodRegular* enRw3 = new GpiodRegular(q7s::GPIO_RW_DEFAULT_CHIP, q7s::GPIO_RW_2_CS, auto enRw3 = new GpiodRegularByLabel(q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_2_CS,
"Enable reaction wheel 3", gpio::OUT, 0); "Enable reaction wheel 3", gpio::OUT, gpio::LOW);
gpioCookieRw->addGpio(gpioIds::EN_RW3, enRw3); gpioCookieRw->addGpio(gpioIds::EN_RW3, enRw3);
GpiodRegular* enRw4 = new GpiodRegular(q7s::GPIO_RW_DEFAULT_CHIP, q7s::GPIO_RW_3_CS, auto enRw4 = new GpiodRegularByLabel(q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_3_CS,
"Enable reaction wheel 4", gpio::OUT, 0); "Enable reaction wheel 4", gpio::OUT, gpio::LOW);
gpioCookieRw->addGpio(gpioIds::EN_RW4, enRw4); gpioCookieRw->addGpio(gpioIds::EN_RW4, enRw4);
/** /**
@ -725,8 +784,8 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) {
* the PS SPI peripheral from the SPI interface and route out the SPI lines of the AXI SPI core. * the PS SPI peripheral from the SPI interface and route out the SPI lines of the AXI SPI core.
* Per default the PS SPI is selected (EMIO = 0). * Per default the PS SPI is selected (EMIO = 0).
*/ */
GpiodRegular* spiMux = new GpiodRegular(q7s::GPIO_RW_SPI_MUX_CHIP, q7s::GPIO_RW_SPI_MUX_CS, auto spiMux = new GpiodRegularByLabel(q7s::GPIO_RW_SPI_MUX_LABEL,
"EMIO 0 SPI Mux", gpio::OUT, 0); q7s::GPIO_RW_SPI_MUX_CS, "EMIO 0 SPI Mux", gpio::OUT, gpio::LOW);
gpioCookieRw->addGpio(gpioIds::SPI_MUX, spiMux); gpioCookieRw->addGpio(gpioIds::SPI_MUX, spiMux);
gpioComIF->addGpios(gpioCookieRw); gpioComIF->addGpios(gpioCookieRw);
@ -746,33 +805,49 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) {
auto rwHandler1 = new RwHandler(objects::RW1, objects::SPI_COM_IF, rw1SpiCookie, gpioComIF, auto rwHandler1 = new RwHandler(objects::RW1, objects::SPI_COM_IF, rw1SpiCookie, gpioComIF,
gpioIds::EN_RW1); gpioIds::EN_RW1);
#if OBSW_DEBUG_RW == 1
rwHandler1->setStartUpImmediately();
#endif
rw1SpiCookie->setCallbackArgs(rwHandler1); rw1SpiCookie->setCallbackArgs(rwHandler1);
auto rwHandler2 = new RwHandler(objects::RW2, objects::SPI_COM_IF, rw2SpiCookie, gpioComIF, auto rwHandler2 = new RwHandler(objects::RW2, objects::SPI_COM_IF, rw2SpiCookie, gpioComIF,
gpioIds::EN_RW2); gpioIds::EN_RW2);
#if OBSW_DEBUG_RW == 1
rwHandler2->setStartUpImmediately();
#endif
rw2SpiCookie->setCallbackArgs(rwHandler2); rw2SpiCookie->setCallbackArgs(rwHandler2);
auto rwHandler3 = new RwHandler(objects::RW3, objects::SPI_COM_IF, rw3SpiCookie, gpioComIF, auto rwHandler3 = new RwHandler(objects::RW3, objects::SPI_COM_IF, rw3SpiCookie, gpioComIF,
gpioIds::EN_RW3); gpioIds::EN_RW3);
#if OBSW_DEBUG_RW == 1
rwHandler3->setStartUpImmediately();
#endif
rw3SpiCookie->setCallbackArgs(rwHandler3); rw3SpiCookie->setCallbackArgs(rwHandler3);
auto rwHandler4 = new RwHandler(objects::RW4, objects::SPI_COM_IF, rw4SpiCookie, gpioComIF, auto rwHandler4 = new RwHandler(objects::RW4, objects::SPI_COM_IF, rw4SpiCookie, gpioComIF,
gpioIds::EN_RW4); gpioIds::EN_RW4);
#if OBSW_DEBUG_RW == 1
rwHandler4->setStartUpImmediately();
#endif
rw4SpiCookie->setCallbackArgs(rwHandler4); rw4SpiCookie->setCallbackArgs(rwHandler4);
} }
void ObjectFactory::createTestComponents() { void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
#if BOARD_TE0720 == 0 #if BOARD_TE0720 == 0
new Q7STestTask(objects::TEST_TASK); new Q7STestTask(objects::TEST_TASK);
#endif #endif
#if BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1 #if BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1
#if OBSW_TEST_GPIO_LABEL == 1
/* Configure MIO0 as input */ /* Configure MIO0 as input */
GpiodRegular gpioConfigMio0(std::string("gpiochip0"), 0, GpiodRegular* testGpio = new GpiodRegular("MIO0", gpio::OUT, 0, "/amba_pl/gpio@41200000", 0);
std::string("MIO0"), gpio::IN, 0); #else
/* Configure MIO0 as input */
GpiodRegular* testGpio = new GpiodRegular("gpiochip0", 0, "MIO0", gpio::IN, 0);
#endif /* OBSW_TEST_GPIO_LABEL == 1 */
GpioCookie* gpioCookie = new GpioCookie; GpioCookie* gpioCookie = new GpioCookie;
gpioCookie->addGpio(gpioIds::TEST_ID_0, gpioConfigMio0); gpioCookie->addGpio(gpioIds::TEST_ID_0, testGpio);
new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookie); new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookie);
#endif #endif
@ -849,7 +924,7 @@ void ObjectFactory::createTestComponents() {
plocSupervisor->setStartUpImmediately(); plocSupervisor->setStartUpImmediately();
#endif #endif
#if Q7S_ADD_SPI_TEST == 1 #if OBSW_ADD_SPI_TEST_CODE == 1
new SpiTestClass(objects::SPI_TEST, gpioComIF); new SpiTestClass(objects::SPI_TEST, gpioComIF);
#endif #endif

View File

@ -22,7 +22,7 @@ void createSolarArrayDeploymentComponents();
void createSyrlinksComponents(); void createSyrlinksComponents();
void createRtdComponents(LinuxLibgpioIF* gpioComIF); void createRtdComponents(LinuxLibgpioIF* gpioComIF);
void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF); void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF);
void createTestComponents(); void createTestComponents(LinuxLibgpioIF* gpioComIF);
}; };

View File

@ -1,4 +1,5 @@
#include "gpioCallbacks.h" #include "gpioCallbacks.h"
#include "busConf.h"
#include <devices/gpioIds.h> #include <devices/gpioIds.h>
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h> #include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
@ -23,30 +24,31 @@ void initSpiCsDecoder(GpioIF* gpioComIF) {
GpioCookie* spiMuxGpios = new GpioCookie; GpioCookie* spiMuxGpios = new GpioCookie;
GpiodRegularByLabel* spiMuxBit = nullptr;
/** Setting mux bit 1 to low will disable IC21 on the interface board */ /** Setting mux bit 1 to low will disable IC21 on the interface board */
GpiodRegular* spiMuxBit1 = new GpiodRegular(std::string("gpiochip7"), 13, spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_1,
std::string("SPI Mux Bit 1"), gpio::OUT, 0); "SPI Mux Bit 1", gpio::OUT, gpio::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit1); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit);
/** Setting mux bit 2 to low disables IC1 on the TCS board */ /** Setting mux bit 2 to low disables IC1 on the TCS board */
GpiodRegular* spiMuxBit2 = new GpiodRegular(std::string("gpiochip7"), 14, spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_2,
std::string("SPI Mux Bit 2"), gpio::OUT, 0); "SPI Mux Bit 2", gpio::OUT, gpio::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit2); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit);
/** Setting mux bit 3 to low disables IC2 on the TCS board and IC22 on the interface board */ /** Setting mux bit 3 to low disables IC2 on the TCS board and IC22 on the interface board */
GpiodRegular* spiMuxBit3 = new GpiodRegular(std::string("gpiochip7"), 15, spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_3,
std::string("SPI Mux Bit 3"), gpio::OUT, 0); "SPI Mux Bit 3", gpio::OUT, gpio::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit3); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit);
/** The following gpios can take arbitrary initial values */ /** The following gpios can take arbitrary initial values */
GpiodRegular* spiMuxBit4 = new GpiodRegular(std::string("gpiochip7"), 16, spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_4,
std::string("SPI Mux Bit 4"), gpio::OUT, 0); "SPI Mux Bit 4", gpio::OUT, gpio::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_4, spiMuxBit4); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_4, spiMuxBit);
GpiodRegular* spiMuxBit5 = new GpiodRegular(std::string("gpiochip7"), 17, spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_5,
std::string("SPI Mux Bit 5"), gpio::OUT, 0); "SPI Mux Bit 5", gpio::OUT, gpio::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_5, spiMuxBit5); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_5, spiMuxBit);
GpiodRegular* spiMuxBit6 = new GpiodRegular(std::string("gpiochip7"), 9, spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_6,
std::string("SPI Mux Bit 6"), gpio::OUT, 0); "SPI Mux Bit 6", gpio::OUT, gpio::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_6, spiMuxBit6); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_6, spiMuxBit);
GpiodRegular* enRwDecoder = new GpiodRegular(std::string("gpiochip5"), 17, GpiodRegularByLabel* enRwDecoder = new GpiodRegularByLabel(q7s::GPIO_FLEX_OBC1F_B1,
std::string("EN_RW_CS"), gpio::OUT, 1); q7s::EN_RW_CS, "EN_RW_CS", gpio::OUT, gpio::HIGH);
spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder); spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder);
result = gpioComInterface->addGpios(spiMuxGpios); result = gpioComInterface->addGpios(spiMuxGpios);

View File

@ -11,6 +11,10 @@ int simple::simple() {
{ {
FileSystemTest fileSystemTest; FileSystemTest fileSystemTest;
} }
#endif
#if TE0720_GPIO_TEST
#endif #endif
return 0; return 0;
} }

View File

@ -53,9 +53,9 @@ endif()
if(TGT_BSP) if(TGT_BSP)
if (${TGT_BSP} MATCHES "arm/raspberrypi" OR ${TGT_BSP} MATCHES "arm/beagleboneblack") if (TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/beagleboneblack")
set(BSP_PATH "bsp_linux_board") set(BSP_PATH "bsp_linux_board")
elseif(${TGT_BSP} MATCHES "arm/q7s") elseif(TGT_BSP MATCHES "arm/q7s")
set(BSP_PATH "bsp_q7s") set(BSP_PATH "bsp_q7s")
else() else()
message(WARNING "CMake not configured for this target!") message(WARNING "CMake not configured for this target!")

View File

@ -1,5 +1,8 @@
if(DEFINED ENV{Q7S_SYSROOT})
set(ENV{Q7S_ROOTFS} $ENV{Q7S_SYSROOT})
endif()
# CROSS_COMPILE also needs to be set accordingly or passed to the CMake command # CROSS_COMPILE also needs to be set accordingly or passed to the CMake command
if(NOT DEFINED ENV{Q7S_SYSROOT}) if(NOT DEFINED ENV{Q7S_ROOTFS})
# Sysroot has not been cached yet and was not set in environment either # Sysroot has not been cached yet and was not set in environment either
if(NOT DEFINED SYSROOT_PATH) if(NOT DEFINED SYSROOT_PATH)
message(FATAL_ERROR message(FATAL_ERROR
@ -7,7 +10,7 @@ if(NOT DEFINED ENV{Q7S_SYSROOT})
) )
endif() endif()
else() else()
set(SYSROOT_PATH "$ENV{Q7S_SYSROOT}" CACHE PATH "Q7S root filesystem path") set(SYSROOT_PATH "$ENV{Q7S_ROOTFS}" CACHE PATH "Q7S root filesystem path")
endif() endif()
if(NOT DEFINED ENV{CROSS_COMPILE}) if(NOT DEFINED ENV{CROSS_COMPILE})

View File

@ -4,7 +4,7 @@
const char* const SW_NAME = "eive"; const char* const SW_NAME = "eive";
#define SW_VERSION 1 #define SW_VERSION 1
#define SW_SUBVERSION 6 #define SW_SUBVERSION 7
#define SW_REVISION 1 #define SW_REVISION 0
#endif /* COMMON_CONFIG_OBSWVERSION_H_ */ #endif /* COMMON_CONFIG_OBSWVERSION_H_ */

View File

@ -10,14 +10,17 @@
*/ */
namespace spi { namespace spi {
/* Default values, changing them is not supported for now */ // Default values, changing them is not supported for now
static constexpr uint32_t DEFAULT_LIS3_SPEED = 3'900'000; static constexpr uint32_t DEFAULT_LIS3_SPEED = 976'000;
static constexpr uint32_t LIS3_TRANSITION_DELAY = 10000;
static constexpr spi::SpiModes DEFAULT_LIS3_MODE = spi::SpiModes::MODE_3; static constexpr spi::SpiModes DEFAULT_LIS3_MODE = spi::SpiModes::MODE_3;
static constexpr uint32_t DEFAULT_RM3100_SPEED = 976'000; static constexpr uint32_t DEFAULT_RM3100_SPEED = 976'000;
static constexpr uint32_t RM3100_TRANSITION_DELAY = 10000;
static constexpr spi::SpiModes DEFAULT_RM3100_MODE = spi::SpiModes::MODE_3; static constexpr spi::SpiModes DEFAULT_RM3100_MODE = spi::SpiModes::MODE_3;
static constexpr uint32_t DEFAULT_L3G_SPEED = 3'900'000; static constexpr uint32_t DEFAULT_L3G_SPEED = 976'000;
static constexpr uint32_t L3G_TRANSITION_DELAY = 10000;
static constexpr spi::SpiModes DEFAULT_L3G_MODE = spi::SpiModes::MODE_3; static constexpr spi::SpiModes DEFAULT_L3G_MODE = spi::SpiModes::MODE_3;
static constexpr uint32_t DEFAULT_MAX_1227_SPEED = 3'900'000; static constexpr uint32_t DEFAULT_MAX_1227_SPEED = 3'900'000;
@ -26,15 +29,18 @@ static constexpr spi::SpiModes DEFAULT_MAX_1227_MODE = spi::SpiModes::MODE_3;
static constexpr uint32_t DEFAULT_ADIS16507_SPEED = 976'000; static constexpr uint32_t DEFAULT_ADIS16507_SPEED = 976'000;
static constexpr spi::SpiModes DEFAULT_ADIS16507_MODE = spi::SpiModes::MODE_3; static constexpr spi::SpiModes DEFAULT_ADIS16507_MODE = spi::SpiModes::MODE_3;
static constexpr uint32_t RW_SPEED = 300000; static constexpr uint32_t RW_SPEED = 300'000;
static constexpr spi::SpiModes RW_MODE = spi::SpiModes::MODE_0; static constexpr spi::SpiModes RW_MODE = spi::SpiModes::MODE_0;
static constexpr uint32_t RTD_SPEED = 2000000; static constexpr uint32_t RTD_SPEED = 2'000'000;
} }
namespace uart { namespace uart {
static constexpr size_t HYPERION_GPS_REPLY_MAX_BUFFER = 1024;
static constexpr uint32_t SYRLINKS_BAUD = 38400;
static constexpr uint32_t GNSS_BAUD = 9600;
static constexpr uint32_t PLOC_MPSOC_BAUD = 115200; static constexpr uint32_t PLOC_MPSOC_BAUD = 115200;
static constexpr uint32_t PLOC_SUPERVISOR_BAUD = 115200; static constexpr uint32_t PLOC_SUPERVISOR_BAUD = 115200;
static constexpr uint32_t STAR_TRACKER_BAUD = 115200; static constexpr uint32_t STAR_TRACKER_BAUD = 115200;

2
fsfw

@ -1 +1 @@
Subproject commit 882da68a2f0c1301d433d517c449c9c31f3cb35e Subproject commit e1a85b47c5018590e58b9b1130b1754b0079450f

1
generators/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.~lock*

View File

@ -10,6 +10,9 @@
LinuxLibgpioIF::LinuxLibgpioIF(object_id_t objectId) : SystemObject(objectId) { LinuxLibgpioIF::LinuxLibgpioIF(object_id_t objectId) : SystemObject(objectId) {
struct gpiod_chip* chip = gpiod_chip_open_by_label("/amba_pl/gpio@42030000");
sif::debug << chip->name << std::endl;
} }
LinuxLibgpioIF::~LinuxLibgpioIF() { LinuxLibgpioIF::~LinuxLibgpioIF() {

View File

@ -47,9 +47,9 @@ private:
* @param gpioId The GPIO ID of the GPIO to drive. * @param gpioId The GPIO ID of the GPIO to drive.
* @param logiclevel The logic level to set. O or 1. * @param logiclevel The logic level to set. O or 1.
*/ */
ReturnValue_t driveGpio(gpioId_t gpioId, GpiodRegular* regularGpio, unsigned int logiclevel); ReturnValue_t driveGpio(gpioId_t gpioId, GpiodRegularBase& regularGpio, unsigned int logiclevel);
ReturnValue_t configureRegularGpio(gpioId_t gpioId, GpiodRegular* regularGpio); ReturnValue_t configureRegularGpio(gpioId_t gpioId, GpiodRegularBase& regularGpio);
/** /**
* @brief This function checks if GPIOs are already registered and whether * @brief This function checks if GPIOs are already registered and whether

View File

@ -15,7 +15,7 @@ LibgpiodTest::LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId,
sif::error << "LibgpiodTest::LibgpiodTest: Invalid Gpio interface." << std::endl; sif::error << "LibgpiodTest::LibgpiodTest: Invalid Gpio interface." << std::endl;
} }
gpioInterface->addGpios(gpioCookie); gpioInterface->addGpios(gpioCookie);
testCase = TestCases::LOOPBACK; testCase = TestCases::BLINK;
} }
LibgpiodTest::~LibgpiodTest() { LibgpiodTest::~LibgpiodTest() {
@ -29,7 +29,7 @@ ReturnValue_t LibgpiodTest::performPeriodicAction() {
case(TestCases::READ): { case(TestCases::READ): {
result = gpioInterface->readGpio(gpioIds::TEST_ID_0, &gpioState); result = gpioInterface->readGpio(gpioIds::TEST_ID_0, &gpioState);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::debug << "LibgpiodTest::performPeriodicAction: Failed to read gpio " sif::warning << "LibgpiodTest::performPeriodicAction: Failed to read gpio "
<< std::endl; << std::endl;
return RETURN_FAILED; return RETURN_FAILED;
} }
@ -42,6 +42,38 @@ ReturnValue_t LibgpiodTest::performPeriodicAction() {
case(TestCases::LOOPBACK): { case(TestCases::LOOPBACK): {
break; break;
} }
case(TestCases::BLINK): {
result = gpioInterface->readGpio(gpioIds::TEST_ID_0, &gpioState);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "LibgpiodTest::performPeriodicAction: Failed to read gpio "
<< std::endl;
return RETURN_FAILED;
}
if (gpioState == 1) {
result = gpioInterface->pullLow(gpioIds::TEST_ID_0);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "LibgpiodTest::performPeriodicAction: Could not pull GPIO low!"
<< std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
}
else if (gpioState == 0) {
result = gpioInterface->pullHigh(gpioIds::TEST_ID_0);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "LibgpiodTest::performPeriodicAction: Could not pull GPIO high!"
<< std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
}
else {
sif::warning << "LibgpiodTest::performPeriodicAction: Invalid GPIO state" << std::endl;
}
break;
}
default:
sif::debug << "LibgpiodTest::performPeriodicAction: Invalid test case" << std::endl;
break;
} }
@ -56,6 +88,9 @@ ReturnValue_t LibgpiodTest::performOneShotAction() {
case(TestCases::READ): { case(TestCases::READ): {
break; break;
} }
case(TestCases::BLINK): {
break;
}
case(TestCases::LOOPBACK): { case(TestCases::LOOPBACK): {
result = gpioInterface->pullHigh(gpioIds::TEST_ID_0); result = gpioInterface->pullHigh(gpioIds::TEST_ID_0);
if(result == HasReturnvaluesIF::RETURN_OK) { if(result == HasReturnvaluesIF::RETURN_OK) {

View File

@ -14,7 +14,8 @@ class LibgpiodTest: public TestTask {
public: public:
enum TestCases { enum TestCases {
READ = 0, READ = 0,
LOOPBACK = 1 LOOPBACK = 1,
BLINK
}; };
TestCases testCase; TestCases testCase;

View File

@ -1,5 +1,4 @@
#include "SpiTestClass.h" #include "SpiTestClass.h"
#include "OBSWConfig.h"
#include "devices/gpioIds.h" #include "devices/gpioIds.h"
@ -20,13 +19,12 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <bitset> #include <bitset>
SpiTestClass::SpiTestClass(object_id_t objectId, GpioIF* gpioIF): TestTask(objectId), SpiTestClass::SpiTestClass(object_id_t objectId, GpioIF* gpioIF): TestTask(objectId),
gpioIF(gpioIF) { 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::GYRO_L3GD20H; testMode = TestModes::MGM_LIS3MDL;
spiTransferStruct.rx_buf = reinterpret_cast<__u64>(recvBuffer.data()); spiTransferStruct.rx_buf = reinterpret_cast<__u64>(recvBuffer.data());
spiTransferStruct.tx_buf = reinterpret_cast<__u64>(sendBuffer.data()); spiTransferStruct.tx_buf = reinterpret_cast<__u64>(sendBuffer.data());
} }
@ -37,11 +35,11 @@ ReturnValue_t SpiTestClass::performOneShotAction() {
break; break;
} }
case(TestModes::MGM_LIS3MDL): { case(TestModes::MGM_LIS3MDL): {
performLis3MdlTest(mgm2Lis3mdlChipSelect); performLis3MdlTest(mgm0Lis3mdlChipSelect);
break; break;
} }
case(TestModes::MGM_RM3100): { case(TestModes::MGM_RM3100): {
performRm3100Test(mgm3Rm3100ChipSelect); performRm3100Test(mgm1Rm3100ChipSelect);
break; break;
} }
case(TestModes::GYRO_L3GD20H): { case(TestModes::GYRO_L3GD20H): {
@ -115,7 +113,7 @@ void SpiTestClass::performRm3100Test(uint8_t mgmId) {
sif::info << "Cycle count Y: " << cycleCountY << std::endl; sif::info << "Cycle count Y: " << cycleCountY << std::endl;
sif::info << "Cycle count z: " << cycleCountZ << std::endl; sif::info << "Cycle count z: " << cycleCountZ << std::endl;
writeRegister(fileDescriptor, currentGpioId, 0x0B, 0x95); writeRegister(fileDescriptor, currentGpioId, 0x0B, 0x96);
uint8_t tmrcReg = readRm3100Register(fileDescriptor, currentGpioId, 0x0B); uint8_t tmrcReg = readRm3100Register(fileDescriptor, currentGpioId, 0x0B);
sif::info << "SpiTestClass::performRm3100Test: TMRC register value: " << sif::info << "SpiTestClass::performRm3100Test: TMRC register value: " <<
std::hex << "0x" << static_cast<int>(tmrcReg) << std::dec << std::endl; std::hex << "0x" << static_cast<int>(tmrcReg) << std::dec << std::endl;
@ -150,10 +148,10 @@ void SpiTestClass::performRm3100Test(uint8_t mgmId) {
float fieldStrengthY = rawY * scaleFactor; float fieldStrengthY = rawY * scaleFactor;
float fieldStrengthZ = rawZ * scaleFactor; float fieldStrengthZ = rawZ * scaleFactor;
sif::info << "RM3100 measured field strenghts in microtesla:" << std::endl; sif::info << "RM3100 measured field strengths in microtesla:" << std::endl;
sif::info << "Field Strength X: " << fieldStrengthX << " \xC2\xB5T" << std::endl; sif::info << "Field Strength X: " << fieldStrengthX << " uT" << std::endl;
sif::info << "Field Strength Y: " << fieldStrengthY << " \xC2\xB5T" << std::endl; sif::info << "Field Strength Y: " << fieldStrengthY << " uT" << std::endl;
sif::info << "Field Strength Z: " << fieldStrengthZ << " \xC2\xB5T" << std::endl; sif::info << "Field Strength Z: " << fieldStrengthZ << " uT" << std::endl;
} }
void SpiTestClass::performLis3MdlTest(uint8_t lis3Id) { void SpiTestClass::performLis3MdlTest(uint8_t lis3Id) {
@ -174,8 +172,8 @@ void SpiTestClass::performLis3MdlTest(uint8_t lis3Id) {
else { else {
currentGpioId = gpioIds::MGM_2_LIS3_CS; currentGpioId = gpioIds::MGM_2_LIS3_CS;
} }
uint32_t spiSpeed = 3'900'000; uint32_t spiSpeed = 10'000'000;
spi::SpiModes spiMode = spi::SpiModes::MODE_3; spi::SpiModes spiMode = spi::SpiModes::MODE_0;
#ifdef RASPBERRY_PI #ifdef RASPBERRY_PI
std::string deviceName = "/dev/spidev0.0"; std::string deviceName = "/dev/spidev0.0";
#else #else
@ -208,10 +206,10 @@ void SpiTestClass::performL3gTest(uint8_t l3gId) {
/* Configure all SPI chip selects and pull them high */ /* Configure all SPI chip selects and pull them high */
acsInit(); acsInit();
l3gId = gyro2L3gd20ChipSelect; l3gId = gyro1L3gd20ChipSelect;
/* Adapt accordingly */ /* Adapt accordingly */
if(l3gId != gyro1L3gd20ChipSelect and l3gId != gyro2L3gd20ChipSelect) { if(l3gId != gyro1L3gd20ChipSelect and l3gId != gyro3L3gd20ChipSelect) {
sif::warning << "SpiTestClass::performLis3MdlTest: Invalid MGM ID!" << std::endl; sif::warning << "SpiTestClass::performLis3MdlTest: Invalid MGM ID!" << std::endl;
} }
gpioId_t currentGpioId = 0; gpioId_t currentGpioId = 0;
@ -300,69 +298,74 @@ void SpiTestClass::performL3gTest(uint8_t l3gId) {
void SpiTestClass::acsInit() { void SpiTestClass::acsInit() {
GpioCookie* gpioCookie = new GpioCookie(); GpioCookie* gpioCookie = new GpioCookie();
GpiodRegular* gpio = nullptr;
#ifdef RASPBERRY_PI #ifdef RASPBERRY_PI
GpiodRegularByChip* gpio = nullptr;
std::string rpiGpioName = "gpiochip0"; std::string rpiGpioName = "gpiochip0";
gpio = new GpiodRegular(rpiGpioName, mgm0Lis3mdlChipSelect, "MGM_0_LIS3", gpio = new GpiodRegularByChip(rpiGpioName, mgm0Lis3mdlChipSelect, "MGM_0_LIS3",
gpio::Direction::OUT, 1); gpio::Direction::OUT, 1);
gpioCookie->addGpio(gpioIds::MGM_0_LIS3_CS, gpio); gpioCookie->addGpio(gpioIds::MGM_0_LIS3_CS, gpio);
gpio = new GpiodRegular(rpiGpioName, mgm1Rm3100ChipSelect, "MGM_1_RM3100", gpio = new GpiodRegularByChip(rpiGpioName, mgm1Rm3100ChipSelect, "MGM_1_RM3100",
gpio::Direction::OUT, 1); gpio::Direction::OUT, 1);
gpioCookie->addGpio(gpioIds::MGM_1_RM3100_CS, gpio); gpioCookie->addGpio(gpioIds::MGM_1_RM3100_CS, gpio);
gpio = new GpiodRegular(rpiGpioName, gyro0AdisChipSelect, "GYRO_0_ADIS", gpio = new GpiodRegularByChip(rpiGpioName, gyro0AdisChipSelect, "GYRO_0_ADIS",
gpio::Direction::OUT, 1); gpio::Direction::OUT, 1);
gpioCookie->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio); gpioCookie->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio);
gpio = new GpiodRegular(rpiGpioName, gyro1L3gd20ChipSelect, "GYRO_1_L3G", gpio = new GpiodRegularByChip(rpiGpioName, gyro1L3gd20ChipSelect, "GYRO_1_L3G",
gpio::Direction::OUT, 1); gpio::Direction::OUT, 1);
gpioCookie->addGpio(gpioIds::GYRO_1_L3G_CS, gpio); gpioCookie->addGpio(gpioIds::GYRO_1_L3G_CS, gpio);
gpio = new GpiodRegular(rpiGpioName, gyro2L3gd20ChipSelect, "GYRO_2_L3G", gpio = new GpiodRegularByChip(rpiGpioName, gyro3L3gd20ChipSelect, "GYRO_2_L3G",
gpio::Direction::OUT, 1); gpio::Direction::OUT, 1);
gpioCookie->addGpio(gpioIds::GYRO_2_L3G_CS, gpio); gpioCookie->addGpio(gpioIds::GYRO_3_L3G_CS, gpio);
gpio = new GpiodRegular(rpiGpioName, mgm2Lis3mdlChipSelect, "MGM_2_LIS3", gpio = new GpiodRegularByChip(rpiGpioName, mgm2Lis3mdlChipSelect, "MGM_2_LIS3",
gpio::Direction::OUT, 1); gpio::Direction::OUT, 1);
gpioCookie->addGpio(gpioIds::MGM_2_LIS3_CS, gpio); gpioCookie->addGpio(gpioIds::MGM_2_LIS3_CS, gpio);
gpio = new GpiodRegular(rpiGpioName, mgm3Rm3100ChipSelect, "MGM_3_RM3100", gpio = new GpiodRegularByChip(rpiGpioName, mgm3Rm3100ChipSelect, "MGM_3_RM3100",
gpio::Direction::OUT, 1); gpio::Direction::OUT, 1);
gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, gpio);
#elif defined(XIPHOS_Q7S) #elif defined(XIPHOS_Q7S)
std::string q7sGpioName5 = "gpiochip5"; GpiodRegularByLabel* gpio = nullptr;
std::string q7sGpioName6 = "gpiochip6"; gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, mgm0Lis3mdlChipSelect,
"MGM_0_LIS3", gpio::Direction::OUT, gpio::HIGH);
gpio = new GpiodRegular(q7sGpioName5, mgm0Lis3mdlChipSelect, "MGM_0_LIS3",
gpio::Direction::OUT, gpio::HIGH);
gpioCookie->addGpio(gpioIds::MGM_0_LIS3_CS, gpio); gpioCookie->addGpio(gpioIds::MGM_0_LIS3_CS, gpio);
gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, mgm1Rm3100ChipSelect,
gpio = new GpiodRegular(q7sGpioName5, mgm1Rm3100ChipSelect, "MGM_1_RM3100", "MGM_1_RM3100", gpio::Direction::OUT, gpio::HIGH);
gpio::Direction::OUT, gpio::HIGH);
gpioCookie->addGpio(gpioIds::MGM_1_RM3100_CS, gpio); gpioCookie->addGpio(gpioIds::MGM_1_RM3100_CS, gpio);
gpio = new GpiodRegularByLabel(q7s::GPIO_MGM2_LIS3_LABEL, mgm2Lis3mdlChipSelect,
"MGM_2_LIS3", gpio::Direction::OUT, gpio::HIGH);
gpioCookie->addGpio(gpioIds::MGM_2_LIS3_CS, gpio);
gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, mgm3Rm3100ChipSelect,
"MGM_3_RM3100", gpio::Direction::OUT, gpio::HIGH);
gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, gpio);
gpio = new GpiodRegular(q7sGpioName5, gyro0AdisChipSelect, "GYRO_0_ADIS", gpio = new GpiodRegularByLabel(q7s::GPIO_GYRO_ADIS_LABEL, gyro0AdisChipSelect,
gpio::Direction::OUT, gpio::HIGH); "GYRO_0_ADIS", gpio::Direction::OUT, gpio::HIGH);
gpioCookie->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio); gpioCookie->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio);
gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, gyro1L3gd20ChipSelect,
gpio = new GpiodRegular(q7sGpioName5, gyro1L3gd20ChipSelect, "GYRO_1_L3G", "GYRO_1_L3G", gpio::Direction::OUT, gpio::HIGH);
gpio::Direction::OUT, gpio::HIGH);
gpioCookie->addGpio(gpioIds::GYRO_1_L3G_CS, gpio); gpioCookie->addGpio(gpioIds::GYRO_1_L3G_CS, gpio);
gpio = new GpiodRegularByLabel(q7s::GPIO_GYRO_ADIS_LABEL, gyro2AdisChipSelect, "GYRO_2_ADIS",
gpio = new GpiodRegular(q7sGpioName5, gyro2L3gd20ChipSelect, "GYRO_2_L3G",
gpio::Direction::OUT, gpio::HIGH); gpio::Direction::OUT, gpio::HIGH);
gpioCookie->addGpio(gpioIds::GYRO_2_ADIS_CS, gpio);
gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, gyro3L3gd20ChipSelect,
"GYRO_3_L3G", gpio::Direction::OUT, gpio::HIGH);
gpioCookie->addGpio(gpioIds::GYRO_3_L3G_CS, gpio); gpioCookie->addGpio(gpioIds::GYRO_3_L3G_CS, gpio);
gpio = new GpiodRegular(q7sGpioName6, mgm2Lis3mdlChipSelect, "MGM_2_LIS3", // Enable pins must be pulled low for regular operations
gpio::Direction::OUT, gpio::HIGH); gpio = new GpiodRegularByLabel(q7s::GPIO_FLEX_OBC1F_B0, q7s::GPIO_GYRO_0_ENABLE,
gpioCookie->addGpio(gpioIds::MGM_2_LIS3_CS, gpio); "GYRO_0_ENABLE", gpio::OUT, gpio::LOW);
gpioCookie->addGpio(gpioIds::GYRO_0_ENABLE, gpio);
gpio = new GpiodRegular(q7sGpioName5, mgm3Rm3100ChipSelect, "MGM_3_RM3100", gpio = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::GPIO_GYRO_2_ENABLE,
gpio::Direction::OUT, gpio::HIGH); "GYRO_2_ENABLE", gpio::OUT, gpio::LOW);
gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); gpioCookie->addGpio(gpioIds::GYRO_2_ENABLE, gpio);
#endif #endif
if(gpioIF != nullptr) { if (gpioIF != nullptr) {
gpioIF->addGpios(gpioCookie); gpioIF->addGpios(gpioCookie);
} }
} }

View File

@ -1,6 +1,12 @@
#ifndef LINUX_BOARDTEST_SPITESTCLASS_H_ #ifndef LINUX_BOARDTEST_SPITESTCLASS_H_
#define LINUX_BOARDTEST_SPITESTCLASS_H_ #define LINUX_BOARDTEST_SPITESTCLASS_H_
#include "OBSWConfig.h"
#if defined(XIPHOS_Q7S)
#include "busConf.h"
#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>
@ -39,22 +45,24 @@ private:
/* ACS board specific variables */ /* ACS board specific variables */
#ifdef RASPBERRY_PI #ifdef RASPBERRY_PI
uint8_t mgm0Lis3mdlChipSelect = 0; uint8_t mgm0Lis3mdlChipSelect = gpio::MGM_0_BCM_PIN;
uint8_t mgm1Rm3100ChipSelect = 1; uint8_t mgm1Rm3100ChipSelect = gpio::MGM_1_BCM_PIN;
uint8_t gyro0AdisChipSelect = 5; uint8_t mgm2Lis3mdlChipSelect = gpio::MGM_2_BCM_PIN;
uint8_t gyro1L3gd20ChipSelect = 6; uint8_t mgm3Rm3100ChipSelect = gpio::MGM_3_BCM_PIN;
uint8_t gyro2L3gd20ChipSelect = 4;
uint8_t mgm2Lis3mdlChipSelect = 17; uint8_t gyro0AdisChipSelect = gpio::GYRO_0_BCM_PIN;
uint8_t mgm3Rm3100ChipSelect = 27; uint8_t gyro1L3gd20ChipSelect = gpio::GYRO_1_BCM_PIN;
uint8_t gyro2AdisChipSelect = gpio::GYRO_2_BCM_PIN;
uint8_t gyro3L3gd20ChipSelect = gpio::GYRO_3_BCM_PIN;
#elif defined(XIPHOS_Q7S) #elif defined(XIPHOS_Q7S)
uint8_t mgm0Lis3mdlChipSelect = 5; uint8_t mgm0Lis3mdlChipSelect = q7s::GPIO_MGM_0_LIS3_CS;
uint8_t mgm1Rm3100ChipSelect = 17; uint8_t mgm1Rm3100ChipSelect = q7s::GPIO_MGM_1_RM3100_CS;
uint8_t gyro0AdisResetLine = 20; uint8_t gyro0AdisChipSelect = q7s::GPIO_GYRO_0_ADIS_CS;
uint8_t gyro0AdisChipSelect = 21; uint8_t gyro2AdisChipSelect = q7s::GPIO_GYRO_2_ADIS_CS;
uint8_t gyro1L3gd20ChipSelect = 10; uint8_t gyro1L3gd20ChipSelect = q7s::GPIO_GYRO_1_L3G_CS;
uint8_t gyro2L3gd20ChipSelect = 3; uint8_t gyro3L3gd20ChipSelect = q7s::GPIO_GYRO_3_L3G_CS;
uint8_t mgm2Lis3mdlChipSelect = 0; uint8_t mgm2Lis3mdlChipSelect = q7s::GPIO_MGM_2_LIS3_CS;
uint8_t mgm3Rm3100ChipSelect = 23; uint8_t mgm3Rm3100ChipSelect = q7s::GPIO_MGM_3_RM3100_CS;
#else #else
uint8_t mgm0Lis3mdlChipSelect = 0; uint8_t mgm0Lis3mdlChipSelect = 0;
uint8_t mgm1Rm3100ChipSelect = 0; uint8_t mgm1Rm3100ChipSelect = 0;

View File

@ -72,6 +72,12 @@ static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 2048;
} }
#define FSFW_HAL_LINUX_SPI_WIRETAPPING 0 #define FSFW_HAL_LINUX_SPI_WIRETAPPING 0
#define FSFW_DEV_HYPERION_GPS_CREATE_NMEA_CSV 0
#define FSFW_HAL_L3GD20_GYRO_DEBUG 0
#define FSFW_HAL_RM3100_MGM_DEBUG 0
#define FSFW_HAL_LIS3MDL_MGM_DEBUG 0
#define FSFW_HAL_ADIS16507_GYRO_DEBUG 0
#endif /* CONFIG_FSFWCONFIG_H_ */ #endif /* CONFIG_FSFWCONFIG_H_ */

View File

@ -6,9 +6,9 @@
#ifndef FSFWCONFIG_OBSWCONFIG_H_ #ifndef FSFWCONFIG_OBSWCONFIG_H_
#define FSFWCONFIG_OBSWCONFIG_H_ #define FSFWCONFIG_OBSWCONFIG_H_
/* #undef RASPBERRY_PI */ #cmakedefine RASPBERRY_PI
#define XIPHOS_Q7S #cmakedefine XIPHOS_Q7S
/* #undef BEAGLEBONEBLACK */ #cmakedefine BEAGLEBONEBLACK
#ifdef RASPBERRY_PI #ifdef RASPBERRY_PI
#include "rpiConfig.h" #include "rpiConfig.h"
@ -31,11 +31,39 @@ debugging. */
//! Timers can mess up the code when debugging //! Timers can mess up the code when debugging
//! All of this should be enabled for mission code! //! All of this should be enabled for mission code!
#if defined XIPHOS_Q7S
#define OBSW_ENABLE_TIMERS 1 #define OBSW_ENABLE_TIMERS 1
#define OBSW_ADD_GPS 0
#define OBSW_ADD_STAR_TRACKER 0 #define OBSW_ADD_STAR_TRACKER 0
#define OBSW_ADD_PLOC_SUPERVISOR 0 #define OBSW_ADD_PLOC_SUPERVISOR 0
#define OBSW_ADD_PLOC_MPSOC 0 #define OBSW_ADD_PLOC_MPSOC 0
#define OBSW_ADD_SUN_SENSORS 0
#define OBSW_ADD_ACS_BOARD 0
#define OBSW_ADD_GPS_0 0
#define OBSW_ADD_GPS_1 0
#define OBSW_ADD_RW 0
#define OBSW_ADD_RTD_DEVICES 0
#define OBSW_ADD_TMP_DEVICES 0
#define OBSW_ADD_RAD_SENSORS 0
#define OBSW_ADD_SYRLINKS 0
#elif defined RASPBERRY_PI
#define OBSW_ENABLE_TIMERS 1
#define OBSW_ADD_STAR_TRACKER 0
#define OBSW_ADD_PLOC_SUPERVISOR 0
#define OBSW_ADD_PLOC_MPSOC 0
#define OBSW_ADD_SUN_SENSORS 0
#define OBSW_ADD_ACS_BOARD 0
#define OBSW_ADD_GPS_0 0
#define OBSW_ADD_GPS_1 0
#define OBSW_ADD_RW 0
#define OBSW_ADD_RTD_DEVICES 0
#define OBSW_ADD_TMP_DEVICES 0
#define OBSW_ADD_RAD_SENSORS 0
#define OBSW_ADD_SYRLINKS 0
#endif
/*******************************************************************/ /*******************************************************************/
/** All of the following flags should be disabled for mission code */ /** All of the following flags should be disabled for mission code */
@ -44,7 +72,9 @@ debugging. */
//! /* Can be used to switch device to NORMAL mode immediately */ //! /* Can be used to switch device to NORMAL mode immediately */
#define OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP 1 #define OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP 1
#define OBSW_PRINT_MISSED_DEADLINES 1 #define OBSW_PRINT_MISSED_DEADLINES 1
// If this is enabled, all other SPI code should be disabled
#define OBSW_ADD_TEST_CODE 0 #define OBSW_ADD_TEST_CODE 0
#define OBSW_ADD_SPI_TEST_CODE 0
#define OBSW_ADD_TEST_PST 0 #define OBSW_ADD_TEST_PST 0
#define OBSW_ADD_TEST_TASK 0 #define OBSW_ADD_TEST_TASK 0
#define OBSW_TEST_LIBGPIOD 0 #define OBSW_TEST_LIBGPIOD 0
@ -54,15 +84,16 @@ debugging. */
#define OBSW_TEST_CCSDS_BRIDGE 0 #define OBSW_TEST_CCSDS_BRIDGE 0
#define OBSW_TEST_CCSDS_PTME 0 #define OBSW_TEST_CCSDS_PTME 0
#define OBSW_TEST_TE7020_HEATER 0 #define OBSW_TEST_TE7020_HEATER 0
#define OBSW_TEST_GPIO_LABEL 0
#define OBSW_DEBUG_P60DOCK 0 #define OBSW_DEBUG_P60DOCK 0
#define OBSW_DEBUG_PDU1 0 #define OBSW_DEBUG_PDU1 0
#define OBSW_DEBUG_PDU2 0 #define OBSW_DEBUG_PDU2 0
#define OBSW_DEBUG_GPS 0
#define OBSW_DEBUG_ACU 0 #define OBSW_DEBUG_ACU 0
#define OBSW_DEBUG_SYRLINKS 0 #define OBSW_DEBUG_SYRLINKS 0
#define OBSW_DEBUG_IMQT 0 #define OBSW_DEBUG_IMQT 0
#define OBSW_DEBUG_ADIS16507 0 #define OBSW_DEBUG_ADIS16507 0
#define OBSW_DEBUG_L3GD20_GYRO 0
#define OBSW_DEBUG_RAD_SENSOR 0 #define OBSW_DEBUG_RAD_SENSOR 0
#define OBSW_DEBUG_SUS 0 #define OBSW_DEBUG_SUS 0
#define OBSW_DEBUG_RTD 0 #define OBSW_DEBUG_RTD 0

View File

@ -25,6 +25,12 @@ enum gpioId_t {
MGM_2_LIS3_CS, MGM_2_LIS3_CS,
MGM_3_RM3100_CS, MGM_3_RM3100_CS,
GNSS_0_NRESET,
GNSS_1_NRESET,
GYRO_0_ENABLE,
GYRO_2_ENABLE,
TEST_ID_0, TEST_ID_0,
TEST_ID_1, TEST_ID_1,

View File

@ -5,7 +5,7 @@
namespace pcduSwitches { namespace pcduSwitches {
/* Switches are uint8_t datatype and go from 0 to 255 */ /* Switches are uint8_t datatype and go from 0 to 255 */
enum switcherList { enum SwitcherList: uint8_t {
Q7S, Q7S,
PAYLOAD_PCDU_CH1, PAYLOAD_PCDU_CH1,
RW, RW,
@ -22,7 +22,7 @@ namespace pcduSwitches {
SUS_NOMINAL, SUS_NOMINAL,
SOLAR_CELL_EXP, SOLAR_CELL_EXP,
PLOC, PLOC,
ACS_BORAD_SIDE_A, ACS_BOARD_SIDE_A,
NUMBER_OF_SWITCHES NUMBER_OF_SWITCHES
}; };

View File

@ -28,12 +28,14 @@ ReturnValue_t pst::pstGpio(FixedTimeslotTaskIF *thisSequence)
ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
uint32_t length = thisSequence->getPeriodMs(); uint32_t length = thisSequence->getPeriodMs();
static_cast<void>(length);
#if OBSW_ADD_TMP_DEVICES == 1
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0, thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0,
DeviceHandlerIF::PERFORM_OPERATION); DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0, thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0,
DeviceHandlerIF::PERFORM_OPERATION); DeviceHandlerIF::PERFORM_OPERATION);
#if Q7S_ADD_RTD_DEVICES == 1 #endif
#if OBSW_ADD_RTD_DEVICES == 1
thisSequence->addSlot(objects::RTD_IC3, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RTD_IC3, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::RTD_IC4, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RTD_IC4, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::RTD_IC5, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RTD_IC5, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
@ -50,11 +52,13 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
thisSequence->addSlot(objects::RTD_IC16, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RTD_IC16, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::RTD_IC17, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RTD_IC17, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::RTD_IC18, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RTD_IC18, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
#endif /* Q7S_ADD_RTD_DEVICES */ #endif /* OBSW_ADD_RTD_DEVICES */
#if OBSW_ADD_TMP_DEVICES == 1
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.2, DeviceHandlerIF::SEND_WRITE);
#if Q7S_ADD_RTD_DEVICES == 1 #endif
#if OBSW_ADD_RTD_DEVICES == 1
thisSequence->addSlot(objects::RTD_IC3, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RTD_IC3, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::RTD_IC4, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RTD_IC4, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::RTD_IC5, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RTD_IC5, length * 0.2, DeviceHandlerIF::SEND_WRITE);
@ -71,11 +75,13 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
thisSequence->addSlot(objects::RTD_IC16, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RTD_IC16, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::RTD_IC17, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RTD_IC17, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::RTD_IC18, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RTD_IC18, length * 0.2, DeviceHandlerIF::SEND_WRITE);
#endif /* Q7S_ADD_RTD_DEVICES */ #endif /* OBSW_ADD_RTD_DEVICES */
#if OBSW_ADD_TMP_DEVICES == 1
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.4, DeviceHandlerIF::GET_WRITE);
#if Q7S_ADD_RTD_DEVICES == 1 #endif
#if OBSW_ADD_RTD_DEVICES == 1
thisSequence->addSlot(objects::RTD_IC3, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RTD_IC3, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::RTD_IC4, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RTD_IC4, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::RTD_IC5, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RTD_IC5, length * 0.4, DeviceHandlerIF::GET_WRITE);
@ -92,11 +98,13 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
thisSequence->addSlot(objects::RTD_IC16, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RTD_IC16, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::RTD_IC17, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RTD_IC17, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::RTD_IC18, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RTD_IC18, length * 0.4, DeviceHandlerIF::GET_WRITE);
#endif /* Q7S_ADD_RTD_DEVICES */ #endif /* OBSW_ADD_RTD_DEVICES */
#if OBSW_ADD_TMP_DEVICES == 1
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.6, DeviceHandlerIF::SEND_READ);
#if Q7S_ADD_RTD_DEVICES == 1 #endif
#if OBSW_ADD_RTD_DEVICES == 1
thisSequence->addSlot(objects::RTD_IC3, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RTD_IC3, length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::RTD_IC4, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RTD_IC4, length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::RTD_IC5, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RTD_IC5, length * 0.6, DeviceHandlerIF::SEND_READ);
@ -113,11 +121,13 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
thisSequence->addSlot(objects::RTD_IC16, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RTD_IC16, length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::RTD_IC17, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RTD_IC17, length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::RTD_IC18, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RTD_IC18, length * 0.6, DeviceHandlerIF::SEND_READ);
#endif /* Q7S_ADD_RTD_DEVICES */ #endif /* OBSW_ADD_RTD_DEVICES */
#if OBSW_ADD_TMP_DEVICES == 1
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.8, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.8, DeviceHandlerIF::GET_READ);
#if Q7S_ADD_RTD_DEVICES == 1 #endif
#if OBSW_ADD_RTD_DEVICES == 1
thisSequence->addSlot(objects::RTD_IC3, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RTD_IC3, length * 0.8, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::RTD_IC4, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RTD_IC4, length * 0.8, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::RTD_IC5, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RTD_IC5, length * 0.8, DeviceHandlerIF::GET_READ);
@ -134,15 +144,18 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
thisSequence->addSlot(objects::RTD_IC16, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RTD_IC16, length * 0.8, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::RTD_IC17, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RTD_IC17, length * 0.8, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::RTD_IC18, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RTD_IC18, length * 0.8, DeviceHandlerIF::GET_READ);
#endif /* Q7S_ADD_RTD_DEVICES */ #endif /* OBSW_ADD_RTD_DEVICES */
#if OBSW_ADD_RAD_SENSORS == 1
/* Radiation sensor */ /* Radiation sensor */
thisSequence->addSlot(objects::RAD_SENSOR, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RAD_SENSOR, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RAD_SENSOR, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RAD_SENSOR, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RAD_SENSOR, length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RAD_SENSOR, length * 0.8, DeviceHandlerIF::GET_READ);
#endif
#if OBSW_ADD_SUN_SENSORS == 1
/** /**
* 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
@ -151,254 +164,255 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
* One sun sensor communication sequence also blocks the SPI bus. So other devices can not be * One sun sensor communication sequence also blocks the SPI bus. So other devices can not be
* inserted between the device handler cycles of one SUS. * inserted between the device handler cycles of one SUS.
*/ */
/* Write setup */
thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_1, length * 0.9, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_1, length * 0.901, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::GET_WRITE);
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);
/* Write setup */ /* Write setup */
// thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_1, length * 0.9, SusHandler::FIRST_WRITE); thisSequence->addSlot(objects::SUS_2, length * 0.903, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::GET_READ);
// /* Write setup */ /* Write setup */
// thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_1, length * 0.901, SusHandler::FIRST_WRITE); thisSequence->addSlot(objects::SUS_2, length * 0.904, SusHandler::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::GET_READ);
// /* Write setup */ /* Write setup */
// thisSequence->addSlot(objects::SUS_1, length * 0.902, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_1, length * 0.902, SusHandler::FIRST_WRITE); thisSequence->addSlot(objects::SUS_2, length * 0.905, SusHandler::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_1, length * 0.902, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_1, length * 0.902, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_1, length * 0.902, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::GET_READ);
/* Write setup */ /* Write setup */
// thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_2, length * 0.903, SusHandler::FIRST_WRITE); thisSequence->addSlot(objects::SUS_3, length * 0.8, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::GET_READ);
// /* Write setup */ /* Write setup */
// thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_2, length * 0.904, SusHandler::SEND_WRITE); thisSequence->addSlot(objects::SUS_3, length * 0.91, SusHandler::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::GET_READ);
// /* Write setup */ /* Write setup */
// thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_3, length * 0.93, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_2, length * 0.905, SusHandler::SEND_WRITE); thisSequence->addSlot(objects::SUS_3, length * 0.93, SusHandler::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_3, length * 0.93, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_3, length * 0.93, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::SUS_3, length * 0.93, DeviceHandlerIF::GET_READ);
/* Write setup */ /* Write setup */
// thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_3, length * 0.8, SusHandler::FIRST_WRITE); thisSequence->addSlot(objects::SUS_4, length * 0.909, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::GET_READ);
// /* Write setup */ /* Write setup */
// thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_3, length * 0.91, SusHandler::SEND_WRITE); thisSequence->addSlot(objects::SUS_4, length * 0.91, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::GET_READ);
// /* Write setup */ /* Write setup */
// thisSequence->addSlot(objects::SUS_3, length * 0.93, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_4, length * 0.911, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_3, length * 0.93, SusHandler::SEND_WRITE); thisSequence->addSlot(objects::SUS_4, length * 0.911, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_3, length * 0.93, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_4, length * 0.911, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_3, length * 0.93, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_4, length * 0.911, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_3, length * 0.93, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::SUS_4, length * 0.911, DeviceHandlerIF::GET_READ);
//
// /* Write setup */
// thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_4, length * 0.909, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::GET_READ);
// /* Write setup */
// thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_4, length * 0.91, SusHandler::FIRST_WRITE);
// 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);
//
// /* Write setup */
// thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_5, length * 0.912, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::GET_READ);
// /* Write setup */
// thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_5, length * 0.913, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::GET_WRITE);
// 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);
//
// /* Write setup */
// thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_6, length * 0.915, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::GET_READ);
// /* Start ADC conversions */
// thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::GET_WRITE);
// 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);
//
// /* Write setup */
// thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_7, length * 0.918, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::GET_READ);
// /* Start ADC conversions */
// thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::GET_WRITE);
// 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);
//
// /* Write setup */
// thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_8, length * 0.921, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::GET_READ);
// /* Start ADC conversions */
// thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::GET_READ);
// /* Read ADC conversions from inernal FIFO */
// thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::SEND_WRITE);
// 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);
//
// /* Write setup */
// thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_9, length * 0.924, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::GET_READ);
// /* Start ADC conversions */
// thisSequence->addSlot(objects::SUS_9, length * 0.925, 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);
//
// /* Write setup */
// thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_10, length * 0.927, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::GET_READ);
// /* Start ADC conversions */
// thisSequence->addSlot(objects::SUS_10, length * 0.928, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_10, length * 0.928, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_10, length * 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);
//
// /* Write setup */
// thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_11, length * 0.93, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::GET_READ);
// /* Start ADC conversions */
// thisSequence->addSlot(objects::SUS_11, length * 0.931, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_11, length * 0.931, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_11, length * 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);
//
// /* Write setup */
// thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_12, length * 0.933, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::GET_READ);
// /* Start ADC conversions */
// thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::GET_READ);
// /* Read ADC conversions */
// thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::GET_READ);
//
// /* Write setup */
// thisSequence->addSlot(objects::SUS_13, length * 0.936, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_13, length * 0.936, SusHandler::FIRST_WRITE);
// thisSequence->addSlot(objects::SUS_13, length * 0.936, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_13, length * 0.936, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_13, length * 0.936, DeviceHandlerIF::GET_READ);
// /* Start ADC conversions */
// thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::GET_READ);
// /* Read ADC conversions */
// thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_5, length * 0.912, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_5, length * 0.913, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::GET_WRITE);
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);
/* Write setup */
thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_6, length * 0.915, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::GET_READ);
/* Start ADC conversions */
thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::GET_WRITE);
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);
/* Write setup */
thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_7, length * 0.918, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::GET_READ);
/* Start ADC conversions */
thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::GET_WRITE);
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);
/* Write setup */
thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_8, length * 0.921, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::GET_READ);
/* Start ADC conversions */
thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::GET_READ);
/* Read ADC conversions from inernal FIFO */
thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::SEND_WRITE);
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);
/* Write setup */
thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_9, length * 0.924, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::GET_READ);
/* Start ADC conversions */
thisSequence->addSlot(objects::SUS_9, length * 0.925, 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);
/* Write setup */
thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_10, length * 0.927, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::GET_READ);
/* Start ADC conversions */
thisSequence->addSlot(objects::SUS_10, length * 0.928, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_10, length * 0.928, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_10, length * 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);
/* Write setup */
thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_11, length * 0.93, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::GET_READ);
/* Start ADC conversions */
thisSequence->addSlot(objects::SUS_11, length * 0.931, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_11, length * 0.931, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_11, length * 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);
/* Write setup */
thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_12, length * 0.933, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::GET_READ);
/* Start ADC conversions */
thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::GET_READ);
/* Read ADC conversions */
thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::GET_READ);
/* Write setup */
thisSequence->addSlot(objects::SUS_13, length * 0.936, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_13, length * 0.936, SusHandler::FIRST_WRITE);
thisSequence->addSlot(objects::SUS_13, length * 0.936, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_13, length * 0.936, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_13, length * 0.936, DeviceHandlerIF::GET_READ);
/* Start ADC conversions */
thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::GET_READ);
/* Read ADC conversions */
thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::GET_READ);
#endif
#if OBSW_ADD_RW == 1
thisSequence->addSlot(objects::RW1, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RW1, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::RW1, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RW1, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::RW1, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RW1, length * 0.4, DeviceHandlerIF::GET_WRITE);
@ -407,92 +421,120 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
thisSequence->addSlot(objects::RW2, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RW2, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::RW2, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RW2, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::RW2, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RW2, length * 0.6, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::RW2, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RW2, length * 0.7, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::RW2, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RW2, length * 0.85, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::RW3, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RW3, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::RW3, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RW3, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::RW3, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RW3, length * 0.6, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::RW3, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RW3, length * 0.7, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::RW3, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RW3, length * 0.85, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::RW4, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RW4, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::RW4, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RW4, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::RW4, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RW4, length * 0.6, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::RW4, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RW4, length * 0.7, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::RW4, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RW4, length * 0.85, DeviceHandlerIF::GET_READ);
#endif
#if OBSW_ADD_ACS_BOARD == 1 #if OBSW_ADD_ACS_BOARD == 1
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, bool enableAside = true;
DeviceHandlerIF::PERFORM_OPERATION); bool enableBside = false;
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, if(enableAside) {
DeviceHandlerIF::SEND_WRITE); // A side
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4, thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0,
DeviceHandlerIF::GET_WRITE); DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_READ); DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6,
DeviceHandlerIF::GET_READ); DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.7,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.85,
DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION); DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.25,
DeviceHandlerIF::SEND_WRITE); DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6,
DeviceHandlerIF::GET_WRITE); DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.75,
DeviceHandlerIF::SEND_READ); DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.85,
DeviceHandlerIF::GET_READ); DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION); // DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.3,
DeviceHandlerIF::SEND_WRITE); // DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4, // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6,
DeviceHandlerIF::GET_WRITE); // DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.75,
DeviceHandlerIF::SEND_READ); // DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.85,
DeviceHandlerIF::GET_READ); // DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.35,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.75,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.85,
DeviceHandlerIF::GET_READ);
}
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, if(enableBside) {
DeviceHandlerIF::PERFORM_OPERATION); // B side
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0,
DeviceHandlerIF::SEND_WRITE); DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2,
DeviceHandlerIF::GET_WRITE); DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6,
DeviceHandlerIF::SEND_READ); DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.7,
DeviceHandlerIF::GET_READ); DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.85,
DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.25,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.75,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.85,
DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION); // DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2, // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.3,
DeviceHandlerIF::SEND_WRITE); // DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.4, // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.6,
DeviceHandlerIF::GET_WRITE); // DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.75,
DeviceHandlerIF::SEND_READ); // DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8, // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.85,
DeviceHandlerIF::GET_READ); // DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0,
thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.35,
thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE);
DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6,
thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE);
DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.75,
thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, DeviceHandlerIF::SEND_READ);
DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.85,
thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
DeviceHandlerIF::GET_READ); }
#endif #endif /* OBSW_ADD_ACS_BOARD == 1 */
if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) { if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) {
sif::error << "SPI PST initialization failed" << std::endl; sif::error << "SPI PST initialization failed" << std::endl;
@ -519,18 +561,21 @@ ReturnValue_t pst::pstI2c(FixedTimeslotTaskIF *thisSequence) {
ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) { ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) {
// Length of a communication cycle // Length of a communication cycle
uint32_t length = thisSequence->getPeriodMs(); uint32_t length = thisSequence->getPeriodMs();
static_cast<void>(length);
bool uartPstEmpty = true;
#if OBSW_ADD_PLOC_MPSOC == 1 #if OBSW_ADD_PLOC_MPSOC == 1
uartPstEmpty = false;
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0, thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION); DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.2, thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_WRITE); DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.4, thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.4,
DeviceHandlerIF::GET_WRITE); DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.6, thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.6,
DeviceHandlerIF::SEND_READ); DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.8, thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.8,
DeviceHandlerIF::GET_READ); DeviceHandlerIF::GET_READ);
#endif #endif
thisSequence->addSlot(objects::PLOC_UPDATER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::PLOC_UPDATER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
@ -540,70 +585,63 @@ ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) {
thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0, thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION); DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.2, thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_WRITE); DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.4, thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.4,
DeviceHandlerIF::GET_WRITE); DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.6, thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.6,
DeviceHandlerIF::SEND_READ); DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.8, thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.8,
DeviceHandlerIF::GET_READ); DeviceHandlerIF::GET_READ);
#endif #endif
#if Q7S_ADD_SYRLINKS_HANDLER == 1 #if OBSW_ADD_SYRLINKS == 1
uartPstEmpty = false;
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0, thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION); DeviceHandlerIF::PERFORM_OPERATION);
#endif
#if OBSW_ADD_ACS_BOARD == 1
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::GPS1_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
#endif
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.2, thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_WRITE); DeviceHandlerIF::SEND_WRITE);
#if OBSW_ADD_ACS_BOARD == 1
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::GPS1_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_WRITE);
#endif
#if Q7S_ADD_SYRLINKS_HANDLER == 1
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.4, thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.4,
DeviceHandlerIF::GET_WRITE); DeviceHandlerIF::GET_WRITE);
#endif
#if OBSW_ADD_ACS_BOARD == 1
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.4,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::GPS1_HANDLER, length * 0.4,
DeviceHandlerIF::GET_WRITE);
#endif
#if Q7S_ADD_SYRLINKS_HANDLER == 1
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.6, thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.6,
DeviceHandlerIF::SEND_READ); DeviceHandlerIF::SEND_READ);
#endif
#if OBSW_ADD_ACS_BOARD == 1
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.6,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::GPS1_HANDLER, length * 0.6,
DeviceHandlerIF::SEND_READ);
#endif
#if Q7S_ADD_SYRLINKS_HANDLER == 1
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.8, thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.8,
DeviceHandlerIF::GET_READ); DeviceHandlerIF::GET_READ);
#endif #endif
#if OBSW_ADD_ACS_BOARD == 1 #if OBSW_ADD_ACS_BOARD == 1
#if OBSW_ADD_GPS_0 == 1
uartPstEmpty = false;
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.4,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.6,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.8, thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.8,
DeviceHandlerIF::GET_READ); DeviceHandlerIF::GET_READ);
#endif /* OBSW_ADD_GPS_0 == 1 */
#if OBSW_ADD_GPS_1 == 1
uartPstEmpty = false;
thisSequence->addSlot(objects::GPS1_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::GPS1_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::GPS1_HANDLER, length * 0.4,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::GPS1_HANDLER, length * 0.6,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::GPS1_HANDLER, length * 0.8, thisSequence->addSlot(objects::GPS1_HANDLER, length * 0.8,
DeviceHandlerIF::GET_READ); DeviceHandlerIF::GET_READ);
#endif #endif /* OBSW_ADD_GPS_1 == 1 */
#endif /* OBSW_ADD_ACS_BOARD == 1 */
#if OBSW_ADD_STAR_TRACKER == 1 #if OBSW_ADD_STAR_TRACKER == 1
uartPstEmpty = false;
thisSequence->addSlot(objects::START_TRACKER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::START_TRACKER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::START_TRACKER, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::START_TRACKER, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::START_TRACKER, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::START_TRACKER, length * 0.4, DeviceHandlerIF::GET_WRITE);
@ -611,6 +649,9 @@ ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) {
thisSequence->addSlot(objects::START_TRACKER, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::START_TRACKER, length * 0.8, DeviceHandlerIF::GET_READ);
#endif #endif
if(uartPstEmpty) {
return HasReturnvaluesIF::RETURN_OK;
}
if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) { if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) {
sif::error << "UART PST initialization failed" << std::endl; sif::error << "UART PST initialization failed" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
@ -681,77 +722,6 @@ ReturnValue_t pst::pstTest(FixedTimeslotTaskIF* thisSequence) {
/* Length of a communication cycle */ /* Length of a communication cycle */
uint32_t length = thisSequence->getPeriodMs(); uint32_t length = thisSequence->getPeriodMs();
bool notEmpty = false; bool notEmpty = false;
#if OBSW_ADD_ACS_BOARD == 1
notEmpty = true;
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8,
DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8,
DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8,
DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8,
DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.4,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8,
DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8,
DeviceHandlerIF::GET_READ);
#endif
#if RPI_TEST_ADIS16507 == 1 #if RPI_TEST_ADIS16507 == 1
notEmpty = true; notEmpty = true;

View File

@ -36,22 +36,22 @@ void ObjectFactory::produceGenericObjects() {
{ {
PoolManager::LocalPoolConfig poolCfg = { PoolManager::LocalPoolConfig poolCfg = {
{100, 16}, {50, 32}, {25, 64}, {15, 128}, {10, 1024}, {5, 2048} {300, 16}, {300, 32}, {200, 64}, {200, 128}, {100, 1024}, {10, 2048}
}; };
new PoolManager(objects::TC_STORE, poolCfg); new PoolManager(objects::TC_STORE, poolCfg);
} }
{ {
PoolManager::LocalPoolConfig poolCfg = { PoolManager::LocalPoolConfig poolCfg = {
{100, 16}, {50, 32}, {25, 64}, {15, 128}, {10, 1024}, {5, 2048} {300, 16}, {300, 32}, {100, 64}, {100, 128}, {100, 1024}, {10, 2048}
}; };
new PoolManager(objects::TM_STORE, poolCfg); new PoolManager(objects::TM_STORE, poolCfg);
} }
{ {
PoolManager::LocalPoolConfig poolCfg = { PoolManager::LocalPoolConfig poolCfg = {
{ 100, 16 }, { 100, 32 }, { 100, 64 }, { 300, 16 }, { 200, 32 }, { 150, 64 },
{ 100, 128 }, { 50, 256 }, { 50, 512 }, { 50, 1024 }, { 10, 2048 } { 150, 128 }, { 100, 256 }, { 50, 512 }, { 50, 1024 }, { 10, 2048 }
}; };
new PoolManager(objects::IPC_STORE, poolCfg); new PoolManager(objects::IPC_STORE, poolCfg);
} }

View File

@ -1,7 +1,5 @@
target_sources(${TARGET_NAME} PUBLIC target_sources(${TARGET_NAME} PUBLIC
GPSHyperionHandler.cpp GPSHyperionHandler.cpp
MGMHandlerLIS3MDL.cpp
MGMHandlerRM3100.cpp
GomspaceDeviceHandler.cpp GomspaceDeviceHandler.cpp
Tmp1075Handler.cpp Tmp1075Handler.cpp
PCDUHandler.cpp PCDUHandler.cpp

View File

@ -6,6 +6,11 @@
#include "lwgps/lwgps.h" #include "lwgps/lwgps.h"
#if FSFW_DEV_HYPERION_GPS_CREATE_NMEA_CSV == 1
#include <filesystem>
#include <fstream>
#endif
GPSHyperionHandler::GPSHyperionHandler(object_id_t objectId, object_id_t deviceCommunication, GPSHyperionHandler::GPSHyperionHandler(object_id_t objectId, object_id_t deviceCommunication,
CookieIF *comCookie, bool debugHyperionGps): CookieIF *comCookie, bool debugHyperionGps):
DeviceHandlerBase(objectId, deviceCommunication, comCookie), gpsSet(this), DeviceHandlerBase(objectId, deviceCommunication, comCookie), gpsSet(this),
@ -37,16 +42,30 @@ void GPSHyperionHandler::doShutDown() {
} }
ReturnValue_t GPSHyperionHandler::buildTransitionDeviceCommand(DeviceCommandId_t *id) { ReturnValue_t GPSHyperionHandler::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
return HasReturnvaluesIF::RETURN_OK; return NOTHING_TO_SEND;
} }
ReturnValue_t GPSHyperionHandler::buildNormalDeviceCommand(DeviceCommandId_t *id) { ReturnValue_t GPSHyperionHandler::buildNormalDeviceCommand(DeviceCommandId_t *id) {
return HasReturnvaluesIF::RETURN_OK; return NOTHING_TO_SEND;
} }
ReturnValue_t GPSHyperionHandler::buildCommandFromCommand( ReturnValue_t GPSHyperionHandler::buildCommandFromCommand(
DeviceCommandId_t deviceCommand, const uint8_t *commandData, DeviceCommandId_t deviceCommand, const uint8_t *commandData,
size_t commandDataLen) { size_t commandDataLen) {
// By default, send nothing
rawPacketLen = 0;
switch(deviceCommand) {
case(GpsHyperion::TRIGGER_RESET_PIN): {
if(resetCallback != nullptr) {
PoolReadGuard pg(&gpsSet);
// Set HK entries invalid
gpsSet.setValidity(false, true);
resetCallback(resetCallbackArgs);
return HasActionsIF::EXECUTION_FINISHED;
}
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
}
}
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
@ -54,9 +73,9 @@ ReturnValue_t GPSHyperionHandler::scanForReply(const uint8_t *start, size_t len,
DeviceCommandId_t *foundId, size_t *foundLen) { DeviceCommandId_t *foundId, size_t *foundLen) {
// Pass data to GPS library // Pass data to GPS library
if(len > 0) { if(len > 0) {
sif::info << "GPSHandler::scanForReply: Received " << len << " bytes" << std::endl; // sif::debug << "GPSHandler::scanForReply: Received " << len << " bytes" << std::endl;
if (internalState == InternalStates::WAIT_FIRST_MESSAGE) { if (internalState == InternalStates::WAIT_FIRST_MESSAGE) {
// TODO: Check whether data is valid by chcking whether NMEA start string is valid // TODO: Check whether data is valid by checking whether NMEA start string is valid?
commandExecuted = true; commandExecuted = true;
} }
int result = lwgps_process(&gpsData, start, len); int result = lwgps_process(&gpsData, start, len);
@ -82,7 +101,14 @@ ReturnValue_t GPSHyperionHandler::scanForReply(const uint8_t *start, size_t len,
// Negative latitude -> South direction // Negative latitude -> South direction
gpsSet.latitude.value = gpsData.latitude; gpsSet.latitude.value = gpsData.latitude;
// Negative longitude -> West direction // Negative longitude -> West direction
gpsSet.longitude.value = gpsData.latitude; gpsSet.longitude.value = gpsData.longitude;
if(gpsData.altitude > 600000.0 or gpsData.altitude < 400000.0) {
gpsSet.altitude.setValid(false);
}
else {
gpsSet.altitude.setValid(true);
gpsSet.altitude.value = gpsData.altitude;
}
gpsSet.fixMode.value = gpsData.fix_mode; gpsSet.fixMode.value = gpsData.fix_mode;
gpsSet.satInUse.value = gpsData.sats_in_use; gpsSet.satInUse.value = gpsData.sats_in_use;
Clock::TimeOfDay_t timeStruct = {}; Clock::TimeOfDay_t timeStruct = {};
@ -101,6 +127,7 @@ ReturnValue_t GPSHyperionHandler::scanForReply(const uint8_t *start, size_t len,
gpsSet.hours = gpsData.hours; gpsSet.hours = gpsData.hours;
gpsSet.minutes = gpsData.minutes; gpsSet.minutes = gpsData.minutes;
gpsSet.seconds = gpsData.seconds; gpsSet.seconds = gpsData.seconds;
gpsSet.unixSeconds = timeval.tv_sec;
if(debugHyperionGps) { if(debugHyperionGps) {
sif::info << "GPS Data" << std::endl; sif::info << "GPS Data" << std::endl;
printf("Valid status: %d\n", gpsData.is_valid); printf("Valid status: %d\n", gpsData.is_valid);
@ -108,8 +135,19 @@ ReturnValue_t GPSHyperionHandler::scanForReply(const uint8_t *start, size_t len,
printf("Longitude: %f degrees\n", gpsData.longitude); printf("Longitude: %f degrees\n", gpsData.longitude);
printf("Altitude: %f meters\n", gpsData.altitude); printf("Altitude: %f meters\n", gpsData.altitude);
} }
#if FSFW_DEV_HYPERION_GPS_CREATE_NMEA_CSV == 1
std::string filename = "/mnt/sd0/gps_log.txt";
std::ofstream gpsFile;
if(not std::filesystem::exists(filename)) {
gpsFile.open(filename, std::ofstream::out);
}
gpsFile.open(filename, std::ofstream::out | std::ofstream::app);
gpsFile.write("\n", 1);
gpsFile.write(reinterpret_cast<const char*>(start), len);
#endif
} }
*foundLen = len; *foundLen = len;
*foundId = GpsHyperion::GPS_REPLY;
} }
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
@ -145,8 +183,32 @@ ReturnValue_t GPSHyperionHandler::initializeLocalDataPool(
void GPSHyperionHandler::fillCommandAndReplyMap() { void GPSHyperionHandler::fillCommandAndReplyMap() {
// Reply length does not matter, packets should always arrive periodically // Reply length does not matter, packets should always arrive periodically
insertInReplyMap(GpsHyperion::GPS_REPLY, 4, &gpsSet, 0, true); insertInReplyMap(GpsHyperion::GPS_REPLY, 4, &gpsSet, 0, true);
insertInCommandMap(GpsHyperion::TRIGGER_RESET_PIN);
} }
void GPSHyperionHandler::modeChanged() { void GPSHyperionHandler::modeChanged() {
internalState = InternalStates::NONE; internalState = InternalStates::NONE;
} }
void GPSHyperionHandler::setResetPinTriggerFunction(gpioResetFunction_t resetCallback,
void *args) {
this->resetCallback = resetCallback;
resetCallbackArgs = args;
}
void GPSHyperionHandler::debugInterface(uint8_t positionTracker, object_id_t objectId,
uint32_t parameter) {
}
ReturnValue_t GPSHyperionHandler::initialize() {
ReturnValue_t result = DeviceHandlerBase::initialize();
if(result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
// Enable reply immediately for now
return updatePeriodicReply(true, GpsHyperion::GPS_REPLY);
}
ReturnValue_t GPSHyperionHandler::acceptExternalDeviceCommands() {
return DeviceHandlerBase::acceptExternalDeviceCommands();
}

View File

@ -6,7 +6,6 @@
#include "devicedefinitions/GPSDefinitions.h" #include "devicedefinitions/GPSDefinitions.h"
#include "lwgps/lwgps.h" #include "lwgps/lwgps.h"
/** /**
* @brief Device handler for the Hyperion HT-GPS200 device * @brief Device handler for the Hyperion HT-GPS200 device
* @details * @details
@ -15,12 +14,22 @@
*/ */
class GPSHyperionHandler: public DeviceHandlerBase { class GPSHyperionHandler: public DeviceHandlerBase {
public: public:
GPSHyperionHandler(object_id_t objectId, object_id_t deviceCommunication, GPSHyperionHandler(object_id_t objectId, object_id_t deviceCommunication,
CookieIF* comCookie, bool debugHyperionGps = false); CookieIF* comCookie, bool debugHyperionGps = false);
virtual ~GPSHyperionHandler(); virtual ~GPSHyperionHandler();
using gpioResetFunction_t = ReturnValue_t (*) (void* args);
void setResetPinTriggerFunction(gpioResetFunction_t resetCallback, void*args);
ReturnValue_t acceptExternalDeviceCommands() override;
ReturnValue_t initialize() override;
protected: protected:
gpioResetFunction_t resetCallback = nullptr;
void* resetCallbackArgs = nullptr;
enum class InternalStates { enum class InternalStates {
NONE, NONE,
WAIT_FIRST_MESSAGE, WAIT_FIRST_MESSAGE,
@ -49,7 +58,8 @@ protected:
uint32_t getTransitionDelayMs(Mode_t from, Mode_t to) override; uint32_t getTransitionDelayMs(Mode_t from, Mode_t to) override;
ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap, ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) override; LocalDataPoolManager &poolManager) override;
virtual void debugInterface(uint8_t positionTracker = 0,
object_id_t objectId = 0, uint32_t parameter = 0) override;
private: private:
lwgps_t gpsData = {}; lwgps_t gpsData = {};
GpsPrimaryDataset gpsSet; GpsPrimaryDataset gpsSet;

View File

@ -7,11 +7,11 @@ GomspaceDeviceHandler::GomspaceDeviceHandler(object_id_t objectId, object_id_t c
DeviceHandlerBase(objectId, comIF, comCookie), maxConfigTableAddress(maxConfigTableAddress), DeviceHandlerBase(objectId, comIF, comCookie), maxConfigTableAddress(maxConfigTableAddress),
maxHkTableAddress(maxHkTableAddress), hkTableReplySize(hkTableReplySize), maxHkTableAddress(maxHkTableAddress), hkTableReplySize(hkTableReplySize),
hkTableDataset(hkTableDataset) { hkTableDataset(hkTableDataset) {
if (comCookie == NULL) { if (comCookie == nullptr) {
sif::error << "GomspaceDeviceHandler::GomspaceDeviceHandler: Invalid com cookie" sif::error << "GomspaceDeviceHandler::GomspaceDeviceHandler: Invalid com cookie"
<< std::endl; << std::endl;
} }
if (hkTableDataset == NULL) { if (hkTableDataset == nullptr) {
sif::error << "GomspaceDeviceHandler::GomspaceDeviceHandler: Invalid hk table data set" sif::error << "GomspaceDeviceHandler::GomspaceDeviceHandler: Invalid hk table data set"
<< std::endl; << std::endl;
} }
@ -75,6 +75,10 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(
} }
break; break;
} }
case(GOMSPACE::PRINT_SWITCH_V_I): {
result = printStatus(deviceCommand);
break;
}
case(GOMSPACE::REQUEST_HK_TABLE): { case(GOMSPACE::REQUEST_HK_TABLE): {
result = generateRequestFullHkTableCmd(hkTableReplySize); result = generateRequestFullHkTableCmd(hkTableReplySize);
if(result != HasReturnvaluesIF::RETURN_OK){ if(result != HasReturnvaluesIF::RETURN_OK){
@ -95,6 +99,7 @@ void GomspaceDeviceHandler::fillCommandAndReplyMap(){
this->insertInCommandAndReplyMap(GOMSPACE::PARAM_GET, 3); this->insertInCommandAndReplyMap(GOMSPACE::PARAM_GET, 3);
this->insertInCommandAndReplyMap(GOMSPACE::REQUEST_HK_TABLE, 3); this->insertInCommandAndReplyMap(GOMSPACE::REQUEST_HK_TABLE, 3);
this->insertInCommandMap(GOMSPACE::GNDWDT_RESET); this->insertInCommandMap(GOMSPACE::GNDWDT_RESET);
this->insertInCommandMap(GOMSPACE::PRINT_SWITCH_V_I);
} }
ReturnValue_t GomspaceDeviceHandler::scanForReply(const uint8_t *start, ReturnValue_t GomspaceDeviceHandler::scanForReply(const uint8_t *start,
@ -396,3 +401,8 @@ LocalPoolDataSetBase* GomspaceDeviceHandler::getDataSetHandle(sid_t sid) {
void GomspaceDeviceHandler::setModeNormal() { void GomspaceDeviceHandler::setModeNormal() {
mode = MODE_NORMAL; mode = MODE_NORMAL;
} }
ReturnValue_t GomspaceDeviceHandler::printStatus(DeviceCommandId_t cmd) {
sif::info << "No printHkTable implementation given.." << std::endl;
return HasReturnvaluesIF::RETURN_OK;
}

View File

@ -88,6 +88,13 @@ protected:
*/ */
virtual ReturnValue_t generateRequestFullHkTableCmd(uint16_t hkTableSize); virtual ReturnValue_t generateRequestFullHkTableCmd(uint16_t hkTableSize);
/**
* This command handles printing the HK table to the console. This is useful for debugging
* purposes
* @return
*/
virtual ReturnValue_t printStatus(DeviceCommandId_t cmd);
/** /**
* @brief Because housekeeping tables are device specific the handling of the reply is * @brief Because housekeeping tables are device specific the handling of the reply is
* given to the child class. * given to the child class.

View File

@ -1,8 +1,7 @@
#include "GyroADIS16507Handler.h"
#include <fsfw/action/HasActionsIF.h> #include <fsfw/action/HasActionsIF.h>
#include <fsfw/datapool/PoolReadGuard.h> #include <fsfw/datapool/PoolReadGuard.h>
#include "GyroADIS16507Handler.h"
#if OBSW_ADIS16507_LINUX_COM_IF == 1 #if OBSW_ADIS16507_LINUX_COM_IF == 1
#include "fsfw_hal/linux/utility.h" #include "fsfw_hal/linux/utility.h"
#include "fsfw_hal/linux/spi/SpiCookie.h" #include "fsfw_hal/linux/spi/SpiCookie.h"
@ -16,7 +15,7 @@ GyroADIS16507Handler::GyroADIS16507Handler(object_id_t objectId,
object_id_t deviceCommunication, CookieIF * comCookie): object_id_t deviceCommunication, CookieIF * comCookie):
DeviceHandlerBase(objectId, deviceCommunication, comCookie), primaryDataset(this), DeviceHandlerBase(objectId, deviceCommunication, comCookie), primaryDataset(this),
configDataset(this), breakCountdown() { configDataset(this), breakCountdown() {
#if OBSW_DEBUG_ADIS16507 == 1 #if FSFW_HAL_ADIS16507_GYRO_DEBUG == 1
debugDivider = new PeriodicOperationDivider(5); debugDivider = new PeriodicOperationDivider(5);
#endif #endif
@ -73,6 +72,7 @@ ReturnValue_t GyroADIS16507Handler::buildTransitionDeviceCommand(DeviceCommandId
break; break;
} }
case(InternalState::STARTUP): { case(InternalState::STARTUP): {
return NOTHING_TO_SEND;
break; break;
} }
default: { default: {
@ -200,7 +200,7 @@ ReturnValue_t GyroADIS16507Handler::interpretDeviceReply(DeviceCommandId_t id,
uint16_t readProdId = packet[10] << 8 | packet[11]; uint16_t readProdId = packet[10] << 8 | packet[11];
if (readProdId != ADIS16507::PROD_ID) { if (readProdId != ADIS16507::PROD_ID) {
#if OBSW_VERBOSE_LEVEL >= 1 #if OBSW_VERBOSE_LEVEL >= 1
sif::debug << "GyroADIS16507Handler::interpretDeviceReply: Invalid product ID!" sif::warning << "GyroADIS16507Handler::interpretDeviceReply: Invalid product ID!"
<< std::endl; << std::endl;
#endif #endif
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
@ -284,7 +284,7 @@ ReturnValue_t GyroADIS16507Handler::handleSensorData(const uint8_t *packet) {
primaryDataset.setValidity(true, true); primaryDataset.setValidity(true, true);
} }
#if OBSW_DEBUG_ADIS16507 == 1 #if FSFW_HAL_ADIS16507_GYRO_DEBUG == 1
if(debugDivider->checkAndIncrement()) { if(debugDivider->checkAndIncrement()) {
sif::info << "GyroADIS16507Handler: Angular velocities in deg / s" << std::endl; sif::info << "GyroADIS16507Handler: Angular velocities in deg / s" << std::endl;
sif::info << "X: " << primaryDataset.angVelocX.value << std::endl; sif::info << "X: " << primaryDataset.angVelocX.value << std::endl;
@ -402,7 +402,7 @@ ReturnValue_t GyroADIS16507Handler::spiSendCallback(SpiComIF *comIf, SpiCookie *
cookie->getSpiParameters(spiMode, spiSpeed, nullptr); cookie->getSpiParameters(spiMode, spiSpeed, nullptr);
comIf->setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed); comIf->setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed);
cookie->assignWriteBuffer(sendData); cookie->assignWriteBuffer(sendData);
cookie->assignTransferSize(2); cookie->setTransferSize(2);
gpioId_t gpioId = cookie->getChipSelectPin(); gpioId_t gpioId = cookie->getChipSelectPin();
GpioIF* gpioIF = comIf->getGpioInterface(); GpioIF* gpioIF = comIf->getGpioInterface();

View File

@ -1,11 +1,13 @@
#ifndef MISSION_DEVICES_GYROADIS16507HANDLER_H_ #ifndef MISSION_DEVICES_GYROADIS16507HANDLER_H_
#define MISSION_DEVICES_GYROADIS16507HANDLER_H_ #define MISSION_DEVICES_GYROADIS16507HANDLER_H_
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "fsfw/devicehandlers/DeviceHandlerBase.h" #include "FSFWConfig.h"
#include "devicedefinitions/GyroADIS16507Definitions.h" #include "devicedefinitions/GyroADIS16507Definitions.h"
#include "fsfw/globalfunctions/PeriodicOperationDivider.h"
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
#if OBSW_ADIS16507_LINUX_COM_IF == 1 #if OBSW_ADIS16507_LINUX_COM_IF == 1
class SpiComIF; class SpiComIF;
class SpiCookie; class SpiCookie;
@ -69,7 +71,7 @@ private:
const uint8_t *sendData, size_t sendLen, void* args); const uint8_t *sendData, size_t sendLen, void* args);
#endif #endif
#if OBSW_DEBUG_ADIS16507 == 1 #if FSFW_HAL_ADIS16507_GYRO_DEBUG == 1
PeriodicOperationDivider* debugDivider; PeriodicOperationDivider* debugDivider;
#endif #endif
Countdown breakCountdown; Countdown breakCountdown;

View File

@ -1,486 +0,0 @@
#include "MGMHandlerLIS3MDL.h"
#include "fsfw/datapool/PoolReadGuard.h"
#if OBSW_VERBOSE_LEVEL >= 1
#include "fsfw/globalfunctions/PeriodicOperationDivider.h"
#endif
MGMHandlerLIS3MDL::MGMHandlerLIS3MDL(object_id_t objectId,
object_id_t deviceCommunication, CookieIF* comCookie):
DeviceHandlerBase(objectId, deviceCommunication, comCookie),
dataset(this) {
#if OBSW_VERBOSE_LEVEL >= 1
debugDivider = new PeriodicOperationDivider(5);
#endif
/* Set to default values right away. */
registers[0] = MGMLIS3MDL::CTRL_REG1_DEFAULT;
registers[1] = MGMLIS3MDL::CTRL_REG2_DEFAULT;
registers[2] = MGMLIS3MDL::CTRL_REG3_DEFAULT;
registers[3] = MGMLIS3MDL::CTRL_REG4_DEFAULT;
registers[4] = MGMLIS3MDL::CTRL_REG5_DEFAULT;
}
MGMHandlerLIS3MDL::~MGMHandlerLIS3MDL() {
}
void MGMHandlerLIS3MDL::doStartUp() {
switch (internalState) {
case(InternalState::STATE_NONE): {
internalState = InternalState::STATE_FIRST_CONTACT;
break;
}
case(InternalState::STATE_FIRST_CONTACT): {
/* Will be set by checking device ID (WHO AM I register) */
if(commandExecuted) {
commandExecuted = false;
internalState = InternalState::STATE_SETUP;
}
break;
}
case(InternalState::STATE_SETUP): {
internalState = InternalState::STATE_CHECK_REGISTERS;
break;
}
case(InternalState::STATE_CHECK_REGISTERS): {
/* Set up cached registers which will be used to configure the MGM. */
if(commandExecuted) {
commandExecuted = false;
#if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1
setMode(MODE_NORMAL);
#else
setMode(_MODE_TO_ON);
#endif
}
break;
}
default:
break;
}
}
void MGMHandlerLIS3MDL::doShutDown() {
setMode(_MODE_POWER_DOWN);
}
ReturnValue_t MGMHandlerLIS3MDL::buildTransitionDeviceCommand(
DeviceCommandId_t *id) {
switch (internalState) {
case(InternalState::STATE_NONE):
case(InternalState::STATE_NORMAL): {
return HasReturnvaluesIF::RETURN_OK;
}
case(InternalState::STATE_FIRST_CONTACT): {
*id = MGMLIS3MDL::IDENTIFY_DEVICE;
break;
}
case(InternalState::STATE_SETUP): {
*id = MGMLIS3MDL::SETUP_MGM;
break;
}
case(InternalState::STATE_CHECK_REGISTERS): {
*id = MGMLIS3MDL::READ_CONFIG_AND_DATA;
break;
}
default: {
/* might be a configuration error. */
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "GyroHandler::buildTransitionDeviceCommand: Unknown internal state!" <<
std::endl;
#else
sif::printWarning("GyroHandler::buildTransitionDeviceCommand: Unknown internal state!\n");
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
return HasReturnvaluesIF::RETURN_OK;
}
}
return buildCommandFromCommand(*id, NULL, 0);
}
uint8_t MGMHandlerLIS3MDL::readCommand(uint8_t command, bool continuousCom) {
command |= (1 << MGMLIS3MDL::RW_BIT);
if (continuousCom == true) {
command |= (1 << MGMLIS3MDL::MS_BIT);
}
return command;
}
uint8_t MGMHandlerLIS3MDL::writeCommand(uint8_t command, bool continuousCom) {
command &= ~(1 << MGMLIS3MDL::RW_BIT);
if (continuousCom == true) {
command |= (1 << MGMLIS3MDL::MS_BIT);
}
return command;
}
void MGMHandlerLIS3MDL::setupMgm() {
registers[0] = MGMLIS3MDL::CTRL_REG1_DEFAULT;
registers[1] = MGMLIS3MDL::CTRL_REG2_DEFAULT;
registers[2] = MGMLIS3MDL::CTRL_REG3_DEFAULT;
registers[3] = MGMLIS3MDL::CTRL_REG4_DEFAULT;
registers[4] = MGMLIS3MDL::CTRL_REG5_DEFAULT;
prepareCtrlRegisterWrite();
}
ReturnValue_t MGMHandlerLIS3MDL::buildNormalDeviceCommand(
DeviceCommandId_t *id) {
// Data/config register will be read in an alternating manner.
if(communicationStep == CommunicationStep::DATA) {
*id = MGMLIS3MDL::READ_CONFIG_AND_DATA;
communicationStep = CommunicationStep::TEMPERATURE;
return buildCommandFromCommand(*id, NULL, 0);
}
else {
*id = MGMLIS3MDL::READ_TEMPERATURE;
communicationStep = CommunicationStep::DATA;
return buildCommandFromCommand(*id, NULL, 0);
}
}
ReturnValue_t MGMHandlerLIS3MDL::buildCommandFromCommand(
DeviceCommandId_t deviceCommand, const uint8_t *commandData,
size_t commandDataLen) {
switch(deviceCommand) {
case(MGMLIS3MDL::READ_CONFIG_AND_DATA): {
std::memset(commandBuffer, 0, sizeof(commandBuffer));
commandBuffer[0] = readCommand(MGMLIS3MDL::CTRL_REG1, true);
rawPacket = commandBuffer;
rawPacketLen = MGMLIS3MDL::NR_OF_DATA_AND_CFG_REGISTERS + 1;
return RETURN_OK;
}
case(MGMLIS3MDL::READ_TEMPERATURE): {
std::memset(commandBuffer, 0, 3);
commandBuffer[0] = readCommand(MGMLIS3MDL::TEMP_LOWBYTE, true);
rawPacket = commandBuffer;
rawPacketLen = 3;
return RETURN_OK;
}
case(MGMLIS3MDL::IDENTIFY_DEVICE): {
return identifyDevice();
}
case(MGMLIS3MDL::TEMP_SENSOR_ENABLE): {
return enableTemperatureSensor(commandData, commandDataLen);
}
case(MGMLIS3MDL::SETUP_MGM): {
setupMgm();
return HasReturnvaluesIF::RETURN_OK;
}
case(MGMLIS3MDL::ACCURACY_OP_MODE_SET): {
return setOperatingMode(commandData, commandDataLen);
}
default:
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
}
return HasReturnvaluesIF::RETURN_FAILED;
}
ReturnValue_t MGMHandlerLIS3MDL::identifyDevice() {
uint32_t size = 2;
commandBuffer[0] = readCommand(MGMLIS3MDL::IDENTIFY_DEVICE_REG_ADDR);
commandBuffer[1] = 0x00;
rawPacket = commandBuffer;
rawPacketLen = size;
return RETURN_OK;
}
ReturnValue_t MGMHandlerLIS3MDL::scanForReply(const uint8_t *start,
size_t len, DeviceCommandId_t *foundId, size_t *foundLen) {
*foundLen = len;
if (len == MGMLIS3MDL::NR_OF_DATA_AND_CFG_REGISTERS + 1) {
*foundLen = len;
*foundId = MGMLIS3MDL::READ_CONFIG_AND_DATA;
// Check validity by checking config registers
if (start[1] != registers[0] or start[2] != registers[1] or
start[3] != registers[2] or start[4] != registers[3] or
start[5] != registers[4]) {
#if OBSW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "MGMHandlerLIS3MDL::scanForReply: Invalid registers!" << std::endl;
#else
sif::printWarning("MGMHandlerLIS3MDL::scanForReply: Invalid registers!\n");
#endif
#endif
return DeviceHandlerIF::INVALID_DATA;
}
if(mode == _MODE_START_UP) {
commandExecuted = true;
}
}
else if(len == MGMLIS3MDL::TEMPERATURE_REPLY_LEN) {
*foundLen = len;
*foundId = MGMLIS3MDL::READ_TEMPERATURE;
}
else if (len == MGMLIS3MDL::SETUP_REPLY_LEN) {
*foundLen = len;
*foundId = MGMLIS3MDL::SETUP_MGM;
}
else if (len == SINGLE_COMMAND_ANSWER_LEN) {
*foundLen = len;
*foundId = getPendingCommand();
if(*foundId == MGMLIS3MDL::IDENTIFY_DEVICE) {
if(start[1] != MGMLIS3MDL::DEVICE_ID) {
#if OBSW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "MGMHandlerLIS3MDL::scanForReply: Invalid registers!" << std::endl;
#else
sif::printWarning("MGMHandlerLIS3MDL::scanForReply: Invalid registers!\n");
#endif
#endif
return DeviceHandlerIF::INVALID_DATA;
}
if(mode == _MODE_START_UP) {
commandExecuted = true;
}
}
}
else {
return DeviceHandlerIF::INVALID_DATA;
}
/* Data with SPI Interface always has this answer */
if (start[0] == 0b11111111) {
return RETURN_OK;
}
else {
return DeviceHandlerIF::INVALID_DATA;
}
}
ReturnValue_t MGMHandlerLIS3MDL::interpretDeviceReply(DeviceCommandId_t id,
const uint8_t *packet) {
switch (id) {
case MGMLIS3MDL::IDENTIFY_DEVICE: {
break;
}
case MGMLIS3MDL::SETUP_MGM: {
break;
}
case MGMLIS3MDL::READ_CONFIG_AND_DATA: {
// TODO: Store configuration in new local datasets.
uint8_t scale = getFullScale(registers[2]);
float sensitivityFactor = getSensitivityFactor(scale);
int16_t mgmMeasurementRawX = packet[MGMLIS3MDL::X_HIGHBYTE_IDX] << 8
| packet[MGMLIS3MDL::X_LOWBYTE_IDX] ;
int16_t mgmMeasurementRawY = packet[MGMLIS3MDL::Y_HIGHBYTE_IDX] << 8
| packet[MGMLIS3MDL::Y_LOWBYTE_IDX] ;
int16_t mgmMeasurementRawZ = packet[MGMLIS3MDL::Z_HIGHBYTE_IDX] << 8
| packet[MGMLIS3MDL::Z_LOWBYTE_IDX] ;
/* Target value in microtesla */
float mgmX = static_cast<float>(mgmMeasurementRawX) * sensitivityFactor
* MGMLIS3MDL::GAUSS_TO_MICROTESLA_FACTOR;
float mgmY = static_cast<float>(mgmMeasurementRawY) * sensitivityFactor
* MGMLIS3MDL::GAUSS_TO_MICROTESLA_FACTOR;
float mgmZ = static_cast<float>(mgmMeasurementRawZ) * sensitivityFactor
* MGMLIS3MDL::GAUSS_TO_MICROTESLA_FACTOR;
#if OBSW_VERBOSE_LEVEL >= 1
if(debugDivider->checkAndIncrement()) {
/* Set terminal to utf-8 if there is an issue with micro printout. */
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "MGMHandlerLIS3: Magnetic field strength in"
" microtesla:" << std::endl;
sif::info << "X: " << mgmX << " \xC2\xB5T" << std::endl;
sif::info << "Y: " << mgmY << " \xC2\xB5T" << std::endl;
sif::info << "Z: " << mgmZ << " \xC2\xB5T" << std::endl;
#else
sif::printInfo("MGMHandlerLIS3: Magnetic field strength in microtesla:\n");
sif::printInfo("X: %f " "\xC2\xB5" "T\n", mgmX);
sif::printInfo("Y: %f " "\xC2\xB5" "T\n", mgmY);
sif::printInfo("Z: %f " "\xC2\xB5" "T\n", mgmZ);
#endif /* FSFW_CPP_OSTREAM_ENABLED == 0 */
}
#endif /* OBSW_VERBOSE_LEVEL >= 1 */
PoolReadGuard readHelper(&dataset);
if(readHelper.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
dataset.fieldStrengthX = mgmX;
dataset.fieldStrengthY = mgmY;
dataset.fieldStrengthZ = mgmZ;
dataset.setValidity(true, true);
}
break;
}
case MGMLIS3MDL::READ_TEMPERATURE: {
int16_t tempValueRaw = packet[2] << 8 | packet[1];
float tempValue = 25.0 + ((static_cast<float>(tempValueRaw)) / 8.0);
#if OBSW_VERBOSE_LEVEL >= 1
if(debugDivider->check()) {
/* Set terminal to utf-8 if there is an issue with micro printout. */
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "MGMHandlerLIS3: Temperature: " << tempValue << " \xC2\xB0" << "C" <<
std::endl;
#else
sif::printInfo("MGMHandlerLIS3: Temperature: %f" "\xC2\xB0" "C\n");
#endif
}
#endif
ReturnValue_t result = dataset.read();
if(result == HasReturnvaluesIF::RETURN_OK) {
dataset.temperature = tempValue;
dataset.commit();
}
break;
}
default: {
return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY;
}
}
return RETURN_OK;
}
uint8_t MGMHandlerLIS3MDL::getFullScale(uint8_t ctrlRegister2) {
bool FS0 = false;
bool FS1 = false;
if ((ctrlRegister2 >> 5) == 1)
FS0 = true;
if ((ctrlRegister2 >> 6) == 1)
FS1 = true;
if ((FS0 == true) && (FS1 == true))
return 16;
else if ((FS0 == false) && (FS1 == true))
return 12;
else if ((FS0 == true) && (FS1 == false))
return 8;
else
return 4;
}
float MGMHandlerLIS3MDL::getSensitivityFactor(uint8_t scale) {
return (float) scale / (INT16_MAX);
}
ReturnValue_t MGMHandlerLIS3MDL::enableTemperatureSensor(
const uint8_t *commandData, size_t commandDataLen) {
triggerEvent(CHANGE_OF_SETUP_PARAMETER);
uint32_t size = 2;
commandBuffer[0] = writeCommand(MGMLIS3MDL::CTRL_REG1);
if (commandDataLen > 1) {
return INVALID_NUMBER_OR_LENGTH_OF_PARAMETERS;
}
switch (*commandData) {
case (MGMLIS3MDL::ON): {
commandBuffer[1] = registers[0] | (1 << 7);
break;
}
case (MGMLIS3MDL::OFF): {
commandBuffer[1] = registers[0] & ~(1 << 7);
break;
}
default:
return INVALID_COMMAND_PARAMETER;
}
registers[0] = commandBuffer[1];
rawPacket = commandBuffer;
rawPacketLen = size;
return RETURN_OK;
}
ReturnValue_t MGMHandlerLIS3MDL::setOperatingMode(const uint8_t *commandData,
size_t commandDataLen) {
triggerEvent(CHANGE_OF_SETUP_PARAMETER);
if (commandDataLen != 1) {
return INVALID_NUMBER_OR_LENGTH_OF_PARAMETERS;
}
switch (commandData[0]) {
case MGMLIS3MDL::LOW:
registers[0] = (registers[0] & (~(1 << MGMLIS3MDL::OM1))) & (~(1 << MGMLIS3MDL::OM0));
registers[3] = (registers[3] & (~(1 << MGMLIS3MDL::OMZ1))) & (~(1 << MGMLIS3MDL::OMZ0));
break;
case MGMLIS3MDL::MEDIUM:
registers[0] = (registers[0] & (~(1 << MGMLIS3MDL::OM1))) | (1 << MGMLIS3MDL::OM0);
registers[3] = (registers[3] & (~(1 << MGMLIS3MDL::OMZ1))) | (1 << MGMLIS3MDL::OMZ0);
break;
case MGMLIS3MDL::HIGH:
registers[0] = (registers[0] | (1 << MGMLIS3MDL::OM1)) & (~(1 << MGMLIS3MDL::OM0));
registers[3] = (registers[3] | (1 << MGMLIS3MDL::OMZ1)) & (~(1 << MGMLIS3MDL::OMZ0));
break;
case MGMLIS3MDL::ULTRA:
registers[0] = (registers[0] | (1 << MGMLIS3MDL::OM1)) | (1 << MGMLIS3MDL::OM0);
registers[3] = (registers[3] | (1 << MGMLIS3MDL::OMZ1)) | (1 << MGMLIS3MDL::OMZ0);
break;
default:
break;
}
return prepareCtrlRegisterWrite();
}
void MGMHandlerLIS3MDL::fillCommandAndReplyMap() {
/*
* Regarding ArduinoBoard:
* Actually SPI answers directly, but as commanding ArduinoBoard the
* communication could be delayed
* SPI always has to be triggered, so there could be no periodic answer of
* the device, the device has to asked with a command, so periodic is zero.
*
* We dont read single registers, we just expect special
* reply from he Readall_MGM
*/
insertInCommandAndReplyMap(MGMLIS3MDL::READ_CONFIG_AND_DATA, 1, &dataset);
insertInCommandAndReplyMap(MGMLIS3MDL::READ_TEMPERATURE, 1);
insertInCommandAndReplyMap(MGMLIS3MDL::SETUP_MGM, 1);
insertInCommandAndReplyMap(MGMLIS3MDL::IDENTIFY_DEVICE, 1);
insertInCommandAndReplyMap(MGMLIS3MDL::TEMP_SENSOR_ENABLE, 1);
insertInCommandAndReplyMap(MGMLIS3MDL::ACCURACY_OP_MODE_SET, 1);
}
ReturnValue_t MGMHandlerLIS3MDL::prepareCtrlRegisterWrite() {
commandBuffer[0] = writeCommand(MGMLIS3MDL::CTRL_REG1, true);
for (size_t i = 0; i < MGMLIS3MDL::NR_OF_CTRL_REGISTERS; i++) {
commandBuffer[i + 1] = registers[i];
}
rawPacket = commandBuffer;
rawPacketLen = MGMLIS3MDL::NR_OF_CTRL_REGISTERS + 1;
/* We dont have to check if this is working because we just did it */
return RETURN_OK;
}
void MGMHandlerLIS3MDL::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
}
uint32_t MGMHandlerLIS3MDL::getTransitionDelayMs(Mode_t from, Mode_t to) {
return 20000;
}
void MGMHandlerLIS3MDL::modeChanged(void) {
internalState = InternalState::STATE_NONE;
}
ReturnValue_t MGMHandlerLIS3MDL::initializeLocalDataPool(
localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) {
localDataPoolMap.emplace(MGMLIS3MDL::FIELD_STRENGTH_X,
new PoolEntry<float>({0.0}));
localDataPoolMap.emplace(MGMLIS3MDL::FIELD_STRENGTH_Y,
new PoolEntry<float>({0.0}));
localDataPoolMap.emplace(MGMLIS3MDL::FIELD_STRENGTH_Z,
new PoolEntry<float>({0.0}));
localDataPoolMap.emplace(MGMLIS3MDL::TEMPERATURE_CELCIUS,
new PoolEntry<float>({0.0}));
return HasReturnvaluesIF::RETURN_OK;
}

View File

@ -1,167 +0,0 @@
#ifndef MISSION_DEVICES_MGMLIS3MDLHANDLER_H_
#define MISSION_DEVICES_MGMLIS3MDLHANDLER_H_
#include "OBSWConfig.h"
#include "devicedefinitions/MGMHandlerLIS3Definitions.h"
#include "events/subsystemIdRanges.h"
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
class PeriodicOperationDivider;
/**
* @brief Device handler object for the LIS3MDL 3-axis magnetometer
* by STMicroeletronics
* @details
* Datasheet can be found online by googling LIS3MDL.
* Flight manual:
* https://egit.irs.uni-stuttgart.de/redmine/projects/eive-flight-manual/wiki/LIS3MDL_MGM
* @author L. Loidold, R. Mueller
*/
class MGMHandlerLIS3MDL: public DeviceHandlerBase {
public:
enum class CommunicationStep {
DATA,
TEMPERATURE
};
static const uint8_t INTERFACE_ID = CLASS_ID::MGM_LIS3MDL;
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::MGM_LIS3MDL;
//Notifies a command to change the setup parameters
static const Event CHANGE_OF_SETUP_PARAMETER = MAKE_EVENT(0, severity::LOW);
MGMHandlerLIS3MDL(uint32_t objectId, object_id_t deviceCommunication,
CookieIF* comCookie);
virtual ~MGMHandlerLIS3MDL();
protected:
/** DeviceHandlerBase overrides */
void doShutDown() override;
void doStartUp() override;
void doTransition(Mode_t modeFrom, Submode_t subModeFrom) override;
uint32_t getTransitionDelayMs(Mode_t from, Mode_t to) override;
ReturnValue_t buildCommandFromCommand(
DeviceCommandId_t deviceCommand, const uint8_t *commandData,
size_t commandDataLen) override;
ReturnValue_t buildTransitionDeviceCommand(
DeviceCommandId_t *id) override;
ReturnValue_t buildNormalDeviceCommand(
DeviceCommandId_t *id) override;
ReturnValue_t scanForReply(const uint8_t *start, size_t len,
DeviceCommandId_t *foundId, size_t *foundLen) override;
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id,
const uint8_t *packet) override;
void fillCommandAndReplyMap() override;
void modeChanged(void) override;
ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) override;
private:
MGMLIS3MDL::MgmPrimaryDataset dataset;
/*------------------------------------------------------------------------*/
/* Device specific commands and variables */
/*------------------------------------------------------------------------*/
/**
* Sets the read bit for the command
* @param single command to set the read-bit at
* @param boolean to select a continuous read bit, default = false
*/
uint8_t readCommand(uint8_t command, bool continuousCom = false);
/**
* Sets the write bit for the command
* @param single command to set the write-bit at
* @param boolean to select a continuous write bit, default = false
*/
uint8_t writeCommand(uint8_t command, bool continuousCom = false);
/**
* This Method gets the full scale for the measurement range
* e.g.: +- 4 gauss. See p.25 datasheet.
* @return The ReturnValue does not contain the sign of the value
*/
uint8_t getFullScale(uint8_t ctrlReg2);
/**
* The 16 bit value needs to be divided by the full range of a 16bit value
* and then multiplied with the current scale of the MGM.
* This factor returns the factor required to achieve this with
* one multiplication.
*
* @param scale is the return value of the getFulscale Method
* @return Multiplication factor to get the sensor value from raw data.
*/
float getSensitivityFactor(uint8_t scale);
/**
* This Command detects the device ID
*/
ReturnValue_t identifyDevice();
virtual void setupMgm();
/*------------------------------------------------------------------------*/
/* Non normal commands */
/*------------------------------------------------------------------------*/
/**
* Enables/Disables the integrated Temperaturesensor
* @param commandData On or Off
* @param length of the commandData: has to be 1
*/
virtual ReturnValue_t enableTemperatureSensor(const uint8_t *commandData,
size_t commandDataLen);
/**
* Sets the accuracy of the measurement of the axis. The noise is changing.
* @param commandData LOW, MEDIUM, HIGH, ULTRA
* @param length of the command, has to be 1
*/
virtual ReturnValue_t setOperatingMode(const uint8_t *commandData,
size_t commandDataLen);
//Length a sindgle command SPI answer
static const uint8_t SINGLE_COMMAND_ANSWER_LEN = 2;
//Single SPIcommand has 2 bytes, first for adress, second for content
size_t singleComandSize = 2;
//has the size for all adresses of the lis3mdl + the continous write bit
uint8_t commandBuffer[MGMLIS3MDL::NR_OF_DATA_AND_CFG_REGISTERS + 1];
/**
* We want to save the registers we set, so we dont have to read the
* registers when we want to change something.
* --> everytime we change set a register we have to save it
*/
uint8_t registers[MGMLIS3MDL::NR_OF_CTRL_REGISTERS];
uint8_t statusRegister = 0;
/**
* We always update all registers together, so this method updates
* the rawpacket and rawpacketLen, so we just manipulate the local
* saved register
*
*/
ReturnValue_t prepareCtrlRegisterWrite();
enum class InternalState {
STATE_NONE,
STATE_FIRST_CONTACT,
STATE_SETUP,
STATE_CHECK_REGISTERS,
STATE_NORMAL
};
InternalState internalState = InternalState::STATE_NONE;
CommunicationStep communicationStep = CommunicationStep::DATA;
bool commandExecuted = false;
#if OBSW_VERBOSE_LEVEL >= 1
PeriodicOperationDivider* debugDivider;
#endif
};
#endif /* MISSION_DEVICES_MGMLIS3MDLHANDLER_H_ */

View File

@ -1,363 +0,0 @@
#include "MGMHandlerRM3100.h"
#include "fsfw/datapool/PoolReadGuard.h"
#include "fsfw/globalfunctions/bitutility.h"
#include "fsfw/devicehandlers/DeviceHandlerMessage.h"
#include "fsfw/objectmanager/SystemObjectIF.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
MGMHandlerRM3100::MGMHandlerRM3100(object_id_t objectId,
object_id_t deviceCommunication, CookieIF* comCookie):
DeviceHandlerBase(objectId, deviceCommunication, comCookie),
primaryDataset(this) {
#if OBSW_VERBOSE_LEVEL >= 1
debugDivider = new PeriodicOperationDivider(5);
#endif
}
MGMHandlerRM3100::~MGMHandlerRM3100() {}
void MGMHandlerRM3100::doStartUp() {
switch(internalState) {
case(InternalState::NONE): {
internalState = InternalState::CONFIGURE_CMM;
break;
}
case(InternalState::CONFIGURE_CMM): {
internalState = InternalState::READ_CMM;
break;
}
case(InternalState::READ_CMM): {
if(commandExecuted) {
internalState = InternalState::STATE_CONFIGURE_TMRC;
}
break;
}
case(InternalState::STATE_CONFIGURE_TMRC): {
if(commandExecuted) {
internalState = InternalState::STATE_READ_TMRC;
}
break;
}
case(InternalState::STATE_READ_TMRC): {
if(commandExecuted) {
internalState = InternalState::NORMAL;
#if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1
setMode(MODE_NORMAL);
#else
setMode(_MODE_TO_ON);
#endif
}
break;
}
default: {
break;
}
}
}
void MGMHandlerRM3100::doShutDown() {
setMode(_MODE_POWER_DOWN);
}
ReturnValue_t MGMHandlerRM3100::buildTransitionDeviceCommand(
DeviceCommandId_t *id) {
switch(internalState) {
case(InternalState::NONE):
case(InternalState::NORMAL): {
return HasReturnvaluesIF::RETURN_OK;
}
case(InternalState::CONFIGURE_CMM): {
*id = RM3100::CONFIGURE_CMM;
break;
}
case(InternalState::READ_CMM): {
*id = RM3100::READ_CMM;
break;
}
case(InternalState::STATE_CONFIGURE_TMRC): {
*id = RM3100::CONFIGURE_TMRC;
break;
}
case(InternalState::STATE_READ_TMRC): {
*id = RM3100::READ_TMRC;
break;
}
default:
/* Might be a configuration error. */
sif::debug << "GyroHandler::buildTransitionDeviceCommand: Unknown internal state!" <<
std::endl;
return HasReturnvaluesIF::RETURN_OK;
}
return buildCommandFromCommand(*id, nullptr, 0);
}
ReturnValue_t MGMHandlerRM3100::buildCommandFromCommand(
DeviceCommandId_t deviceCommand, const uint8_t *commandData,
size_t commandDataLen) {
switch(deviceCommand) {
case(RM3100::CONFIGURE_CMM): {
commandBuffer[0] = RM3100::CMM_REGISTER;
commandBuffer[1] = RM3100::CMM_VALUE;
rawPacket = commandBuffer;
rawPacketLen = 2;
break;
}
case(RM3100::READ_CMM): {
commandBuffer[0] = RM3100::CMM_REGISTER | RM3100::READ_MASK;
commandBuffer[1] = 0;
rawPacket = commandBuffer;
rawPacketLen = 2;
break;
}
case(RM3100::CONFIGURE_TMRC): {
return handleTmrcConfigCommand(deviceCommand, commandData,
commandDataLen);
}
case(RM3100::READ_TMRC): {
commandBuffer[0] = RM3100::TMRC_REGISTER | RM3100::READ_MASK;
commandBuffer[1] = 0;
rawPacket = commandBuffer;
rawPacketLen = 2;
break;
}
case(RM3100::CONFIGURE_CYCLE_COUNT): {
return handleCycleCountConfigCommand(deviceCommand, commandData,
commandDataLen);
}
case(RM3100::READ_CYCLE_COUNT): {
commandBuffer[0] = RM3100::CYCLE_COUNT_START_REGISTER | RM3100::READ_MASK;
std::memset(commandBuffer + 1, 0, 6);
rawPacket = commandBuffer;
rawPacketLen = 7;
break;
}
case(RM3100::READ_DATA): {
commandBuffer[0] = RM3100::MEASUREMENT_REG_START | RM3100::READ_MASK;
std::memset(commandBuffer + 1, 0, 9);
rawPacketLen = 10;
break;
}
default:
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
}
return RETURN_OK;
}
ReturnValue_t MGMHandlerRM3100::buildNormalDeviceCommand(
DeviceCommandId_t *id) {
*id = RM3100::READ_DATA;
return buildCommandFromCommand(*id, nullptr, 0);
}
ReturnValue_t MGMHandlerRM3100::scanForReply(const uint8_t *start,
size_t len, DeviceCommandId_t *foundId,
size_t *foundLen) {
/* For SPI, ID will always be the one of the last sent command. */
*foundId = this->getPendingCommand();
*foundLen = len;
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t MGMHandlerRM3100::interpretDeviceReply(
DeviceCommandId_t id, const uint8_t *packet) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
switch(id) {
case(RM3100::CONFIGURE_CMM):
case(RM3100::CONFIGURE_CYCLE_COUNT):
case(RM3100::CONFIGURE_TMRC): {
/* We can only check whether write was successful with read operation. */
if(mode == _MODE_START_UP) {
commandExecuted = true;
}
break;
}
case(RM3100::READ_CMM): {
uint8_t cmmValue = packet[1];
/* We clear the seventh bit in any case
* because this one is zero sometimes for some reason */
bitutil::bitClear(&cmmValue, 6);
if(cmmValue == cmmRegValue and internalState == InternalState::READ_CMM) {
commandExecuted = true;
}
else {
/* Attempt reconfiguration. */
internalState = InternalState::CONFIGURE_CMM;
return DeviceHandlerIF::DEVICE_REPLY_INVALID;
}
break;
}
case(RM3100::READ_TMRC): {
if(packet[1] == tmrcRegValue) {
commandExecuted = true;
/* Reading TMRC was commanded. Trigger event to inform ground. */
if(mode != _MODE_START_UP) {
triggerEvent(tmrcSet, tmrcRegValue, 0);
}
}
else {
/* Attempt reconfiguration. */
internalState = InternalState::STATE_CONFIGURE_TMRC;
return DeviceHandlerIF::DEVICE_REPLY_INVALID;
}
break;
}
case(RM3100::READ_CYCLE_COUNT): {
uint16_t cycleCountX = packet[1] << 8 | packet[2];
uint16_t cycleCountY = packet[3] << 8 | packet[4];
uint16_t cycleCountZ = packet[5] << 8 | packet[6];
if(cycleCountX != cycleCountRegValueX or cycleCountY != cycleCountRegValueY or
cycleCountZ != cycleCountRegValueZ) {
return DeviceHandlerIF::DEVICE_REPLY_INVALID;
}
/* Reading TMRC was commanded. Trigger event to inform ground. */
if(mode != _MODE_START_UP) {
uint32_t eventParam1 = (cycleCountX << 16) | cycleCountY;
triggerEvent(cycleCountersSet, eventParam1, cycleCountZ);
}
break;
}
case(RM3100::READ_DATA): {
result = handleDataReadout(packet);
break;
}
default:
return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY;
}
return result;
}
ReturnValue_t MGMHandlerRM3100::handleCycleCountConfigCommand(DeviceCommandId_t deviceCommand,
const uint8_t *commandData, size_t commandDataLen) {
if(commandData == nullptr) {
return DeviceHandlerIF::INVALID_COMMAND_PARAMETER;
}
// Set cycle count
if(commandDataLen == 2) {
handleCycleCommand(true, commandData, commandDataLen);
}
else if(commandDataLen == 6) {
handleCycleCommand(false, commandData, commandDataLen);
}
else {
return DeviceHandlerIF::INVALID_COMMAND_PARAMETER;
}
commandBuffer[0] = RM3100::CYCLE_COUNT_VALUE;
std::memcpy(commandBuffer + 1, &cycleCountRegValueX, 2);
std::memcpy(commandBuffer + 3, &cycleCountRegValueY, 2);
std::memcpy(commandBuffer + 5, &cycleCountRegValueZ, 2);
rawPacketLen = 7;
rawPacket = commandBuffer;
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t MGMHandlerRM3100::handleCycleCommand(bool oneCycleValue,
const uint8_t *commandData, size_t commandDataLen) {
RM3100::CycleCountCommand command(oneCycleValue);
ReturnValue_t result = command.deSerialize(&commandData, &commandDataLen,
SerializeIF::Endianness::BIG);
if(result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
/* Data sheet p.30 "while noise limits the useful upper range to ~400 cycle counts." */
if(command.cycleCountX > 450 ) {
return DeviceHandlerIF::INVALID_COMMAND_PARAMETER;
}
if(not oneCycleValue and (command.cycleCountY > 450 or command.cycleCountZ > 450)) {
return DeviceHandlerIF::INVALID_COMMAND_PARAMETER;
}
cycleCountRegValueX = command.cycleCountX;
cycleCountRegValueY = command.cycleCountY;
cycleCountRegValueZ = command.cycleCountZ;
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t MGMHandlerRM3100::handleTmrcConfigCommand(
DeviceCommandId_t deviceCommand, const uint8_t *commandData,
size_t commandDataLen) {
if(commandData == nullptr) {
return DeviceHandlerIF::INVALID_COMMAND_PARAMETER;
}
if(commandDataLen != 1) {
return DeviceHandlerIF::INVALID_COMMAND_PARAMETER;
}
commandBuffer[0] = RM3100::TMRC_REGISTER;
commandBuffer[1] = commandData[1];
rawPacketLen = 2;
rawPacket = commandBuffer;
return HasReturnvaluesIF::RETURN_OK;
}
void MGMHandlerRM3100::fillCommandAndReplyMap() {
insertInCommandAndReplyMap(RM3100::CONFIGURE_CMM, 1);
insertInCommandAndReplyMap(RM3100::READ_CMM, 1);
insertInCommandAndReplyMap(RM3100::CONFIGURE_TMRC, 1);
insertInCommandAndReplyMap(RM3100::READ_TMRC, 1);
insertInCommandAndReplyMap(RM3100::CONFIGURE_CYCLE_COUNT, 1);
insertInCommandAndReplyMap(RM3100::READ_CYCLE_COUNT, 1);
insertInCommandAndReplyMap(RM3100::READ_DATA, 1, &primaryDataset);
}
void MGMHandlerRM3100::modeChanged(void) {
internalState = InternalState::NONE;
}
ReturnValue_t MGMHandlerRM3100::initializeLocalDataPool(
localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) {
localDataPoolMap.emplace(RM3100::FIELD_STRENGTH_X, new PoolEntry<float>({0.0}));
localDataPoolMap.emplace(RM3100::FIELD_STRENGTH_Y, new PoolEntry<float>({0.0}));
localDataPoolMap.emplace(RM3100::FIELD_STRENGTH_Z, new PoolEntry<float>({0.0}));
return HasReturnvaluesIF::RETURN_OK;
}
uint32_t MGMHandlerRM3100::getTransitionDelayMs(Mode_t from, Mode_t to) {
return 10000;
}
ReturnValue_t MGMHandlerRM3100::handleDataReadout(const uint8_t *packet) {
/* Analyze data here. The sensor generates 24 bit signed values so we need to do some bitshift
* trickery here to calculate the raw values first */
int32_t fieldStrengthRawX = ((packet[1] << 24) | (packet[2] << 16) | (packet[3] << 8)) >> 8;
int32_t fieldStrengthRawY = ((packet[4] << 24) | (packet[5] << 16) | (packet[6] << 8)) >> 8;
int32_t fieldStrengthRawZ = ((packet[7] << 24) | (packet[8] << 16) | (packet[3] << 8)) >> 8;
/* Now scale to physical value in microtesla */
float fieldStrengthX = fieldStrengthRawX * scaleFactorX;
float fieldStrengthY = fieldStrengthRawY * scaleFactorX;
float fieldStrengthZ = fieldStrengthRawZ * scaleFactorX;
#if OBSW_VERBOSE_LEVEL >= 1
if(debugDivider->checkAndIncrement()) {
sif::info << "MGMHandlerRM3100: Magnetic field strength in"
" microtesla:" << std::endl;
/* Set terminal to utf-8 if there is an issue with micro printout. */
sif::info << "X: " << fieldStrengthX << " \xC2\xB5T" << std::endl;
sif::info << "Y: " << fieldStrengthY << " \xC2\xB5T" << std::endl;
sif::info << "Z: " << fieldStrengthZ << " \xC2\xB5T" << std::endl;
}
#endif
/* TODO: Sanity check on values */
PoolReadGuard readGuard(&primaryDataset);
if(readGuard.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
primaryDataset.fieldStrengthX = fieldStrengthX;
primaryDataset.fieldStrengthY = fieldStrengthY;
primaryDataset.fieldStrengthZ = fieldStrengthZ;
primaryDataset.setValidity(true, true);
}
return RETURN_OK;
}

View File

@ -1,104 +0,0 @@
#ifndef MISSION_DEVICES_MGMRM3100HANDLER_H_
#define MISSION_DEVICES_MGMRM3100HANDLER_H_
#include "OBSWConfig.h"
#include "devicedefinitions/MGMHandlerRM3100Definitions.h"
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
#if OBSW_VERBOSE_LEVEL >= 1
#include "fsfw/globalfunctions/PeriodicOperationDivider.h"
#endif
/**
* @brief Device Handler for the RM3100 geomagnetic magnetometer sensor
* (https://www.pnicorp.com/rm3100/)
* @details
* Flight manual:
* https://egit.irs.uni-stuttgart.de/redmine/projects/eive-flight-manual/wiki/RM3100_MGM
*/
class MGMHandlerRM3100: public DeviceHandlerBase {
public:
static const uint8_t INTERFACE_ID = CLASS_ID::MGM_RM3100;
//! [EXPORT] : [COMMENT] P1: TMRC value which was set, P2: 0
static constexpr Event tmrcSet = event::makeEvent(SUBSYSTEM_ID::MGM_RM3100,
0x00, severity::INFO);
//! [EXPORT] : [COMMENT] Cycle counter set. P1: First two bytes new Cycle Count X
//! P1: Second two bytes new Cycle Count Y
//! P2: New cycle count Z
static constexpr Event cycleCountersSet = event::makeEvent(
SUBSYSTEM_ID::MGM_RM3100, 0x01, severity::INFO);
MGMHandlerRM3100(object_id_t objectId, object_id_t deviceCommunication,
CookieIF* comCookie);
virtual ~MGMHandlerRM3100();
protected:
/* DeviceHandlerBase overrides */
ReturnValue_t buildTransitionDeviceCommand(
DeviceCommandId_t *id) override;
void doStartUp() override;
void doShutDown() override;
ReturnValue_t buildNormalDeviceCommand(
DeviceCommandId_t *id) override;
ReturnValue_t buildCommandFromCommand(
DeviceCommandId_t deviceCommand, const uint8_t *commandData,
size_t commandDataLen) override;
ReturnValue_t scanForReply(const uint8_t *start, size_t len,
DeviceCommandId_t *foundId, size_t *foundLen) override;
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id,
const uint8_t *packet) override;
void fillCommandAndReplyMap() override;
void modeChanged(void) override;
uint32_t getTransitionDelayMs(Mode_t from, Mode_t to) override;
ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) override;
private:
enum class InternalState {
NONE,
CONFIGURE_CMM,
READ_CMM,
// The cycle count states are propably not going to be used because
// the default cycle count will be used.
STATE_CONFIGURE_CYCLE_COUNT,
STATE_READ_CYCLE_COUNT,
STATE_CONFIGURE_TMRC,
STATE_READ_TMRC,
NORMAL
};
InternalState internalState = InternalState::NONE;
bool commandExecuted = false;
RM3100::Rm3100PrimaryDataset primaryDataset;
uint8_t commandBuffer[10];
uint8_t commandBufferLen = 0;
uint8_t cmmRegValue = RM3100::CMM_VALUE;
uint8_t tmrcRegValue = RM3100::TMRC_DEFAULT_VALUE;
uint16_t cycleCountRegValueX = RM3100::CYCLE_COUNT_VALUE;
uint16_t cycleCountRegValueY = RM3100::CYCLE_COUNT_VALUE;
uint16_t cycleCountRegValueZ = RM3100::CYCLE_COUNT_VALUE;
float scaleFactorX = 1 / RM3100::DEFAULT_GAIN;
float scaleFactorY = 1 / RM3100::DEFAULT_GAIN;
float scaleFactorZ = 1 / RM3100::DEFAULT_GAIN;
ReturnValue_t handleCycleCountConfigCommand(DeviceCommandId_t deviceCommand,
const uint8_t *commandData,size_t commandDataLen);
ReturnValue_t handleCycleCommand(bool oneCycleValue,
const uint8_t *commandData, size_t commandDataLen);
ReturnValue_t handleTmrcConfigCommand(DeviceCommandId_t deviceCommand,
const uint8_t *commandData,size_t commandDataLen);
ReturnValue_t handleDataReadout(const uint8_t* packet);
#if OBSW_VERBOSE_LEVEL >= 1
PeriodicOperationDivider* debugDivider;
#endif
};
#endif /* MISSION_DEVICEHANDLING_MGMRM3100HANDLER_H_ */

View File

@ -1,3 +1,4 @@
#include <fsfw/datapool/PoolReadGuard.h>
#include "P60DockHandler.h" #include "P60DockHandler.h"
#include "OBSWConfig.h" #include "OBSWConfig.h"
@ -27,15 +28,24 @@ void P60DockHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_P60DOCK == 1 #if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_P60DOCK == 1
p60dockHkTableDataset.read(); p60dockHkTableDataset.read();
sif::info << "P60 Dock: ACU VCC switch: " << static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStateAcuVcc.value) << std::endl; sif::info << "P60 Dock: ACU VCC switch: " <<
sif::info << "P60 Dock: PDU1 VCC switch: " << static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStatePdu1Vcc.value) << std::endl; static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStateAcuVcc.value) << std::endl;
sif::info << "P60 Dock: PDU2 VCC switch: " << static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStatePdu2Vcc.value) << std::endl; sif::info << "P60 Dock: PDU1 VCC switch: " <<
sif::info << "P60 Dock: ACU VBAT switch: " << static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStateAcuVbat.value) << std::endl; static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStatePdu1Vcc.value) << std::endl;
sif::info << "P60 Dock: PDU1 VBAT switch: " << static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStatePdu1Vbat.value) << std::endl; sif::info << "P60 Dock: PDU2 VCC switch: " <<
sif::info << "P60 Dock: PDU2 VBAT switch: " << static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStatePdu2Vbat.value) << std::endl; static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStatePdu2Vcc.value) << std::endl;
sif::info << "P60 Dock: Stack VBAT switch: " << static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStateStackVbat.value) << std::endl; sif::info << "P60 Dock: ACU VBAT switch: " <<
sif::info << "P60 Dock: Stack 3V3 switch: " << static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStateStack3V3.value) << std::endl; static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStateAcuVbat.value) << std::endl;
sif::info << "P60 Dock: Stack 5V switch: " << static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStateStack5V.value) << std::endl; sif::info << "P60 Dock: PDU1 VBAT switch: " <<
static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStatePdu1Vbat.value) << std::endl;
sif::info << "P60 Dock: PDU2 VBAT switch: " <<
static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStatePdu2Vbat.value) << std::endl;
sif::info << "P60 Dock: Stack VBAT switch: " <<
static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStateStackVbat.value) << std::endl;
sif::info << "P60 Dock: Stack 3V3 switch: " <<
static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStateStack3V3.value) << std::endl;
sif::info << "P60 Dock: Stack 5V switch: " <<
static_cast<unsigned int>(p60dockHkTableDataset.outputEnableStateStack5V.value) << std::endl;
float temperatureC = p60dockHkTableDataset.temperature1.value * 0.1; float temperatureC = p60dockHkTableDataset.temperature1.value * 0.1;
sif::info << "P60 Dock: Temperature 1: " << temperatureC << " °C" << std::endl; sif::info << "P60 Dock: Temperature 1: " << temperatureC << " °C" << std::endl;
@ -395,3 +405,76 @@ ReturnValue_t P60DockHandler::initializeLocalDataPool(
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t P60DockHandler::printStatus(DeviceCommandId_t cmd) {
switch(cmd) {
case(GOMSPACE::PRINT_SWITCH_V_I): {
PoolReadGuard pg(&p60dockHkTableDataset);
ReturnValue_t readResult = pg.getReadResult();
if(readResult != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "Reading PDU1 HK table failed!" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
printHkTable();
return HasReturnvaluesIF::RETURN_OK;
}
default: {
return HasReturnvaluesIF::RETURN_FAILED;
}
}
}
void P60DockHandler::printHkTable() {
sif::info << "P60 Dock Info: SwitchState, Currents [mA], Voltages [mV]" << std::endl;
sif::info << std::setw(30) << std::left << "ACU VCC" << std::dec << "| " <<
unsigned(p60dockHkTableDataset.outputEnableStateAcuVcc.value) << ", " <<
std::setw(4) << std::right <<
p60dockHkTableDataset.currentAcuVcc.value << ", " << std::setw(5) <<
p60dockHkTableDataset.voltageAcuVcc.value << std::endl;
sif::info << std::setw(30) << std::left << "ACU VBAT" << std::dec << "| " <<
unsigned(p60dockHkTableDataset.outputEnableStateAcuVbat.value) << ", " <<
std::setw(4) << std::right <<
p60dockHkTableDataset.currentAcuVbat.value << ", " << std::setw(5) <<
p60dockHkTableDataset.voltageAcuVbat.value << std::endl;
sif::info << std::setw(30) << std::left << "PDU1 VCC" << std::dec << "| " <<
unsigned(p60dockHkTableDataset.outputEnableStatePdu1Vcc.value) << ", " <<
std::setw(4) << std::right <<
p60dockHkTableDataset.currentPdu1Vcc.value << ", " << std::setw(5) <<
p60dockHkTableDataset.voltagePdu1Vcc.value << std::endl;
sif::info << std::setw(30) << std::left << "PDU1 VBAT" << std::dec << "| " <<
unsigned(p60dockHkTableDataset.outputEnableStatePdu1Vbat.value) << ", " <<
std::setw(4) << std::right <<
p60dockHkTableDataset.currentPdu1Vbat.value << ", " << std::setw(5) <<
p60dockHkTableDataset.voltagePdu1Vbat.value << std::endl;
sif::info << std::setw(30) << std::left << "PDU2 VCC" << std::dec << "| " <<
unsigned(p60dockHkTableDataset.outputEnableStatePdu2Vcc.value) << ", " <<
std::setw(4) << std::right <<
p60dockHkTableDataset.currentPdu2Vcc.value << ", " << std::setw(5) <<
p60dockHkTableDataset.voltagePdu2Vcc.value << std::endl;
sif::info << std::setw(30) << std::left << "PDU2 VBAT" << std::dec << "| " <<
unsigned(p60dockHkTableDataset.outputEnableStatePdu2Vbat.value) << ", " <<
std::setw(4) << std::right <<
p60dockHkTableDataset.currentPdu2Vbat.value << ", " << std::setw(5) <<
p60dockHkTableDataset.voltagePdu2Vbat.value << std::endl;
sif::info << std::setw(30) << std::left << "Stack VBAT" << std::dec << "| " <<
unsigned(p60dockHkTableDataset.outputEnableStateStackVbat.value) << ", " <<
std::setw(4) << std::right <<
p60dockHkTableDataset.currentStackVbat.value << ", " << std::setw(5) <<
p60dockHkTableDataset.voltageStackVbat.value << std::endl;
sif::info << std::setw(30) << std::left << "Stack 3V3" << std::dec << "| " <<
unsigned(p60dockHkTableDataset.outputEnableStateStack3V3.value) << ", " <<
std::setw(4) << std::right <<
p60dockHkTableDataset.currentStack3V3.value << ", " << std::setw(5) <<
p60dockHkTableDataset.voltageStack3V3.value << std::endl;
sif::info << std::setw(30) << std::left << "Stack 5V" << std::dec << "| " <<
unsigned(p60dockHkTableDataset.outputEnableStateStack5V.value) << ", " <<
std::setw(4) << std::right <<
p60dockHkTableDataset.currentStack5V.value << ", " << std::setw(5) <<
p60dockHkTableDataset.voltageStack5V.value << std::endl;
}

View File

@ -26,6 +26,14 @@ protected:
virtual void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) override; virtual void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) override;
/**
* This command handles printing the HK table to the console. This is useful for debugging
* purposes
* @return
*/
ReturnValue_t printStatus(DeviceCommandId_t cmd) override;
void printHkTable();
private: private:
P60Dock::HkTableDataset p60dockHkTableDataset; P60Dock::HkTableDataset p60dockHkTableDataset;

View File

@ -93,7 +93,7 @@ void PCDUHandler::initializeSwitchStates() {
switchStates[pcduSwitches::SUS_NOMINAL] = pcduSwitches::INIT_STATE_SUS_NOMINAL; switchStates[pcduSwitches::SUS_NOMINAL] = pcduSwitches::INIT_STATE_SUS_NOMINAL;
switchStates[pcduSwitches::SOLAR_CELL_EXP] = pcduSwitches::INIT_STATE_SOLAR_CELL_EXP; switchStates[pcduSwitches::SOLAR_CELL_EXP] = pcduSwitches::INIT_STATE_SOLAR_CELL_EXP;
switchStates[pcduSwitches::PLOC] = pcduSwitches::INIT_STATE_PLOC; switchStates[pcduSwitches::PLOC] = pcduSwitches::INIT_STATE_PLOC;
switchStates[pcduSwitches::ACS_BORAD_SIDE_A] = pcduSwitches::INIT_STATE_ACS_BOARD_SIDE_A; switchStates[pcduSwitches::ACS_BOARD_SIDE_A] = pcduSwitches::INIT_STATE_ACS_BOARD_SIDE_A;
} }
void PCDUHandler::readCommandQueue() { void PCDUHandler::readCommandQueue() {
@ -186,7 +186,7 @@ void PCDUHandler::updatePdu1SwitchStates() {
switchStates[pcduSwitches::SUS_NOMINAL] = pdu1HkTableDataset.voltageOutSUSNominal.value; switchStates[pcduSwitches::SUS_NOMINAL] = pdu1HkTableDataset.voltageOutSUSNominal.value;
switchStates[pcduSwitches::SOLAR_CELL_EXP] = pdu1HkTableDataset.voltageOutSolarCellExp.value; switchStates[pcduSwitches::SOLAR_CELL_EXP] = pdu1HkTableDataset.voltageOutSolarCellExp.value;
switchStates[pcduSwitches::PLOC] = pdu1HkTableDataset.voltageOutPLOC.value; switchStates[pcduSwitches::PLOC] = pdu1HkTableDataset.voltageOutPLOC.value;
switchStates[pcduSwitches::ACS_BORAD_SIDE_A] = pdu1HkTableDataset.voltageOutACSBoardSideA.value; switchStates[pcduSwitches::ACS_BOARD_SIDE_A] = pdu1HkTableDataset.voltageOutACSBoardSideA.value;
} }
else { else {
sif::debug << "PCDUHandler::updatePdu1SwitchStates: Failed to read dataset" << std::endl; sif::debug << "PCDUHandler::updatePdu1SwitchStates: Failed to read dataset" << std::endl;

View File

@ -1,11 +1,12 @@
#include "OBSWConfig.h"
#include "PDU1Handler.h" #include "PDU1Handler.h"
#include <mission/devices/devicedefinitions/GomSpacePackets.h>
#include <OBSWConfig.h> #include <fsfw/datapool/PoolReadGuard.h>
PDU1Handler::PDU1Handler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie) : PDU1Handler::PDU1Handler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie) :
GomspaceDeviceHandler(objectId, comIF, comCookie, PDU::MAX_CONFIGTABLE_ADDRESS, GomspaceDeviceHandler(objectId, comIF, comCookie, PDU::MAX_CONFIGTABLE_ADDRESS,
PDU::MAX_HKTABLE_ADDRESS, PDU::HK_TABLE_REPLY_SIZE, &pdu1HkTableDataset), pdu1HkTableDataset( PDU::MAX_HKTABLE_ADDRESS, PDU::HK_TABLE_REPLY_SIZE, &pdu1HkTableDataset),
this) { pdu1HkTableDataset(this) {
} }
PDU1Handler::~PDU1Handler() { PDU1Handler::~PDU1Handler() {
@ -55,25 +56,9 @@ void PDU1Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pac
<< std::endl; << std::endl;
sif::info << "PDU1 channel 8 current: " << pdu1HkTableDataset.currentOutChannel8 sif::info << "PDU1 channel 8 current: " << pdu1HkTableDataset.currentOutChannel8
<< std::endl; << std::endl;
sif::info << "PDU1 TCS Board switch: " printOutputSwitchStates();
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledTCSBoard3V3.value) << std::endl; sif::info << "PDU1 battery mode: " <<
sif::info << "PDU1 Syrlinks switch: " static_cast<unsigned int>(pdu1HkTableDataset.battMode.value) << std::endl;
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledSyrlinks.value) << std::endl;
sif::info << "PDU1 star tracker switch: "
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledStarTracker.value) << std::endl;
sif::info << "PDU1 MGT switch: "
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledMGT.value) << std::endl;
sif::info << "PDU1 SUS nominal switch: "
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledSUSNominal.value) << std::endl;
sif::info << "PDU1 solar cell experiment switch: "
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledSolarCellExp.value) << std::endl;
sif::info << "PDU1 PLOC switch: "
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledPLOC.value) << std::endl;
sif::info << "PDU1 ACS Side A switch: "
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledAcsBoardSideA.value) << std::endl;
sif::info << "PDU1 channel 8 switch: "
<< static_cast<unsigned int>(pdu1HkTableDataset.outEnabledChannel8.value) << std::endl;
sif::info << "PDU1 battery mode: " << static_cast<unsigned int>(pdu1HkTableDataset.battMode.value) << std::endl;
sif::info << "PDU1 VCC: " << pdu1HkTableDataset.vcc << " mV" << std::endl; sif::info << "PDU1 VCC: " << pdu1HkTableDataset.vcc << " mV" << std::endl;
float vbat = pdu1HkTableDataset.vbat.value * 0.001; float vbat = pdu1HkTableDataset.vbat.value * 0.001;
sif::info << "PDU1 VBAT: " << vbat << "V" << std::endl; sif::info << "PDU1 VBAT: " << vbat << "V" << std::endl;
@ -89,7 +74,12 @@ void PDU1Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pac
void PDU1Handler::parseHkTableReply(const uint8_t *packet) { void PDU1Handler::parseHkTableReply(const uint8_t *packet) {
uint16_t dataOffset = 0; uint16_t dataOffset = 0;
pdu1HkTableDataset.read(); PoolReadGuard pg(&pdu1HkTableDataset);
ReturnValue_t readResult = pg.getReadResult();
if(readResult != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "Reading PDU1 HK table failed!" << std::endl;
return;
}
/* Fist 10 bytes contain the gomspace header. Each variable is preceded by the 16-bit table /* Fist 10 bytes contain the gomspace header. Each variable is preceded by the 16-bit table
* address. */ * address. */
dataOffset += 12; dataOffset += 12;
@ -249,8 +239,10 @@ void PDU1Handler::parseHkTableReply(const uint8_t *packet) {
dataOffset += 3; dataOffset += 3;
pdu1HkTableDataset.csp2WatchdogPingsLeft = *(packet + dataOffset); pdu1HkTableDataset.csp2WatchdogPingsLeft = *(packet + dataOffset);
pdu1HkTableDataset.commit();
pdu1HkTableDataset.setChanged(true); pdu1HkTableDataset.setChanged(true);
if(not pdu1HkTableDataset.isValid()) {
pdu1HkTableDataset.setValidity(true, true);
}
} }
ReturnValue_t PDU1Handler::initializeLocalDataPool( ReturnValue_t PDU1Handler::initializeLocalDataPool(
@ -341,3 +333,70 @@ ReturnValue_t PDU1Handler::initializeLocalDataPool(
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t PDU1Handler::printStatus(DeviceCommandId_t cmd) {
switch(cmd) {
case(GOMSPACE::PRINT_SWITCH_V_I): {
PoolReadGuard pg(&pdu1HkTableDataset);
ReturnValue_t readResult = pg.getReadResult();
if(readResult != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "Reading PDU1 HK table failed!" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
printHkTable();
return HasReturnvaluesIF::RETURN_OK;
}
default: {
return HasReturnvaluesIF::RETURN_FAILED;
}
}
}
void PDU1Handler::printHkTable() {
sif::info << "PDU1 Info: SwitchState, Currents [mA], Voltages [mV]" << std::endl;
sif::info << std::setw(30) << std::left << "TCS Board" << std::dec << "| " <<
unsigned(pdu1HkTableDataset.outEnabledTCSBoard3V3.value) << ", " <<
std::setw(4) << std::right <<
pdu1HkTableDataset.currentOutTCSBoard3V3.value << ", " << std::setw(4) <<
pdu1HkTableDataset.voltageOutTCSBoard3V3.value << std::endl;
sif::info << std::setw(30) << std::left << "Syrlinks" << std::dec << "| " <<
unsigned(pdu1HkTableDataset.outEnabledSyrlinks.value) << ", " <<
std::setw(4) << std::right <<
pdu1HkTableDataset.currentOutSyrlinks.value << ", " << std::setw(4) <<
pdu1HkTableDataset.voltageOutSyrlinks.value << std::endl;
sif::info << std::setw(30) << std::left << "Star Tracker" << std::dec << "| " <<
static_cast<unsigned int>(pdu1HkTableDataset.outEnabledStarTracker.value) << ", " <<
std::setw(4) << std::right <<
pdu1HkTableDataset.currentOutStarTracker.value << ", " << std::setw(4) <<
pdu1HkTableDataset.voltageOutStarTracker.value << std::endl;
sif::info << std::setw(30) << std::left << "MGT" << std::dec << "| " <<
static_cast<unsigned int>(pdu1HkTableDataset.outEnabledMGT.value) << ", " <<
std::setw(4) << std::right <<
pdu1HkTableDataset.currentOutMGT.value << ", " << std::setw(4) <<
pdu1HkTableDataset.voltageOutMGT.value << std::endl;
sif::info << std::setw(30) << std::left << "SuS nominal" << std::dec << "| " <<
static_cast<unsigned int>(pdu1HkTableDataset.outEnabledSUSNominal.value) << ", " <<
std::setw(4) << std::right <<
pdu1HkTableDataset.currentOutSUSNominal.value << ", " << std::setw(4) <<
pdu1HkTableDataset.voltageOutSUSNominal.value << std::endl;
sif::info << std::setw(30) << std::left << "Solar Cell Experiment" << std::dec << "| " <<
static_cast<unsigned int>(pdu1HkTableDataset.outEnabledSolarCellExp.value) << ", " <<
std::setw(4) << std::right <<
pdu1HkTableDataset.currentOutSolarCellExp.value << ", " << std::setw(4) <<
pdu1HkTableDataset.voltageOutSolarCellExp.value << std::endl;
sif::info << std::setw(30) << std::left << "PLOC" << std::dec << "| " <<
static_cast<unsigned int>(pdu1HkTableDataset.outEnabledPLOC.value) << ", " <<
std::setw(4) << std::right <<
pdu1HkTableDataset.currentOutPLOC.value << ", " << std::setw(4) <<
pdu1HkTableDataset.voltageOutPLOC.value << std::endl;
sif::info << std::setw(30) << std::left << "ACS Side A" << std::dec << "| " <<
static_cast<unsigned int>(pdu1HkTableDataset.outEnabledAcsBoardSideA.value) << ", " <<
std::setw(4) << std::right <<
pdu1HkTableDataset.currentOutACSBoardSideA.value << ", " << std::setw(4) <<
pdu1HkTableDataset.voltageOutACSBoardSideA.value << std::endl;
sif::info << std::setw(30) << std::left << "Channel 8" << std::dec << "| " <<
static_cast<unsigned int>(pdu1HkTableDataset.outEnabledChannel8.value) << ", " <<
std::setw(4) << std::right <<
pdu1HkTableDataset.currentOutChannel8.value << ", " << std::setw(4) <<
pdu1HkTableDataset.voltageOutChannel8.value << std::right << std::endl;
}

View File

@ -2,7 +2,7 @@
#define MISSION_DEVICES_PDU1Handler_H_ #define MISSION_DEVICES_PDU1Handler_H_
#include "GomspaceDeviceHandler.h" #include "GomspaceDeviceHandler.h"
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h> #include "devicedefinitions/GomspaceDefinitions.h"
/** /**
* @brief This is the device handler for the PDU1. * @brief This is the device handler for the PDU1.
@ -32,11 +32,13 @@ protected:
*/ */
virtual ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t * id) override; virtual ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t * id) override;
virtual void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) override; virtual void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) override;
ReturnValue_t printStatus(DeviceCommandId_t cmd) override;
private: private:
/** Dataset for the housekeeping table of the PDU1 */ /** Dataset for the housekeeping table of the PDU1 */
PDU1::PDU1HkTableDataset pdu1HkTableDataset; PDU1::PDU1HkTableDataset pdu1HkTableDataset;
void printHkTable();
void parseHkTableReply(const uint8_t *packet); void parseHkTableReply(const uint8_t *packet);
}; };

View File

@ -1,20 +1,22 @@
#include "OBSWConfig.h"
#include "PDU2Handler.h" #include "PDU2Handler.h"
#include <mission/devices/devicedefinitions/GomSpacePackets.h> #include <mission/devices/devicedefinitions/GomSpacePackets.h>
#include <OBSWConfig.h> #include <fsfw/datapool/PoolReadGuard.h>
PDU2Handler::PDU2Handler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie) : PDU2Handler::PDU2Handler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie) :
GomspaceDeviceHandler(objectId, comIF, comCookie, PDU::MAX_CONFIGTABLE_ADDRESS, GomspaceDeviceHandler(objectId, comIF, comCookie, PDU::MAX_CONFIGTABLE_ADDRESS,
PDU::MAX_HKTABLE_ADDRESS, PDU::HK_TABLE_REPLY_SIZE, &pdu2HkTableDataset), pdu2HkTableDataset( PDU::MAX_HKTABLE_ADDRESS, PDU::HK_TABLE_REPLY_SIZE, &pdu2HkTableDataset),
this) { pdu2HkTableDataset(this) {
} }
PDU2Handler::~PDU2Handler() { PDU2Handler::~PDU2Handler() {
} }
ReturnValue_t PDU2Handler::buildNormalDeviceCommand( ReturnValue_t PDU2Handler::buildNormalDeviceCommand(
DeviceCommandId_t * id) { DeviceCommandId_t * id) {
*id = GOMSPACE::REQUEST_HK_TABLE; *id = GOMSPACE::REQUEST_HK_TABLE;
return buildCommandFromCommand(*id, NULL, 0); return buildCommandFromCommand(*id, NULL, 0);
} }
void PDU2Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) { void PDU2Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) {
@ -34,23 +36,7 @@ void PDU2Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pac
sif::info << "PDU2 VBAT: " << vbat << std::endl; sif::info << "PDU2 VBAT: " << vbat << std::endl;
float temperatureC = pdu2HkTableDataset.temperature.value * 0.1; float temperatureC = pdu2HkTableDataset.temperature.value * 0.1;
sif::info << "PDU2 Temperature: " << temperatureC << " °C" << std::endl; sif::info << "PDU2 Temperature: " << temperatureC << " °C" << std::endl;
sif::info << "PDU2 Q7S enable state: " << unsigned(pdu2HkTableDataset.outEnabledQ7S.value) << std::endl; printOutputSwitchStates();
sif::info << "PDU2 Payload PCDU channel 1 enable state: "
<< unsigned(pdu2HkTableDataset.outEnabledPlPCDUCh1.value) << std::endl;
sif::info << "PDU2 reaction wheels enable state: "
<< unsigned(pdu2HkTableDataset.outEnabledReactionWheels.value) << std::endl;
sif::info << "PDU2 TCS Board 8V heater input enable state: "
<< unsigned(pdu2HkTableDataset.outEnabledTCSBoardHeaterIn.value) << std::endl;
sif::info << "PDU2 redundant SUS group enable state: "
<< unsigned(pdu2HkTableDataset.outEnabledSUSRedundant.value) << std::endl;
sif::info << "PDU2 deployment mechanism enable state: "
<< unsigned(pdu2HkTableDataset.outEnabledDeplMechanism.value) << std::endl;
sif::info << "PDU2 PCDU channel 6 enable state: "
<< unsigned(pdu2HkTableDataset.outEnabledPlPCDUCh6.value) << std::endl;
sif::info << "PDU2 ACS board side B enable state: "
<< unsigned(pdu2HkTableDataset.outEnabledAcsBoardSideB.value) << std::endl;
sif::info << "PDU2 payload camera enable state: "
<< unsigned(pdu2HkTableDataset.outEnabledPayloadCamera.value) << std::endl;
sif::info << "PDU2 uptime: " << pdu2HkTableDataset.uptime << " seconds" << std::endl; sif::info << "PDU2 uptime: " << pdu2HkTableDataset.uptime << " seconds" << std::endl;
sif::info << "PDU2 battery mode: " << unsigned(pdu2HkTableDataset.battMode.value) << std::endl; sif::info << "PDU2 battery mode: " << unsigned(pdu2HkTableDataset.battMode.value) << std::endl;
sif::info << "PDU2 ground watchdog reboots: " << pdu2HkTableDataset.gndWdtReboots << std::endl; sif::info << "PDU2 ground watchdog reboots: " << pdu2HkTableDataset.gndWdtReboots << std::endl;
@ -323,3 +309,70 @@ ReturnValue_t PDU2Handler::initializeLocalDataPool(
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t PDU2Handler::printStatus(DeviceCommandId_t cmd) {
switch(cmd) {
case(GOMSPACE::PRINT_SWITCH_V_I): {
PoolReadGuard pg(&pdu2HkTableDataset);
ReturnValue_t readResult = pg.getReadResult();
if(readResult != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "Reading PDU1 HK table failed!" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
printHkTable();
return HasReturnvaluesIF::RETURN_OK;
}
default: {
return HasReturnvaluesIF::RETURN_FAILED;
}
}
}
void PDU2Handler::printHkTable() {
sif::info << "PDU2 Info: SwitchState, Currents [mA], Voltages [mV]" << std::endl;
sif::info << std::setw(30) << std::left << "Q7S" << std::dec << "| " <<
unsigned(pdu2HkTableDataset.outEnabledQ7S.value) << ", " <<
std::setw(4) << std::right <<
pdu2HkTableDataset.currentOutQ7S.value << ", " << std::setw(4) <<
pdu2HkTableDataset.voltageOutQ7S.value << std::endl;
sif::info << std::setw(30) << std::left << "Payload PCDU Channel 1" << std::dec << "| " <<
unsigned(pdu2HkTableDataset.outEnabledPlPCDUCh1.value) << ", " <<
std::setw(4) << std::right <<
pdu2HkTableDataset.currentOutPayloadPCDUCh1.value << ", " << std::setw(4) <<
pdu2HkTableDataset.voltageOutPayloadPCDUCh1.value << std::endl;
sif::info << std::setw(30) << std::left << "Reaction Wheels" << std::dec << "| " <<
unsigned(pdu2HkTableDataset.outEnabledReactionWheels.value) << ", " <<
std::setw(4) << std::right <<
pdu2HkTableDataset.currentOutReactionWheels.value << ", " << std::setw(4) <<
pdu2HkTableDataset.voltageOutReactionWheels.value << std::endl;
sif::info << std::setw(30) << std::left << "TCS Board 8V heater input" << std::dec << "| " <<
unsigned(pdu2HkTableDataset.outEnabledTCSBoardHeaterIn.value) << ", " <<
std::setw(4) << std::right <<
pdu2HkTableDataset.currentOutTCSBoardHeaterIn.value << ", " << std::setw(4) <<
pdu2HkTableDataset.voltageOutTCSBoardHeaterIn.value << std::endl;
sif::info << std::setw(30) << std::left << "Redundant SUS group" << std::dec << "| " <<
unsigned(pdu2HkTableDataset.outEnabledSUSRedundant.value) << ", " <<
std::setw(4) << std::right <<
pdu2HkTableDataset.currentOutSUSRedundant.value << ", " << std::setw(4) <<
pdu2HkTableDataset.voltageOutSUSRedundant.value << std::endl;
sif::info << std::setw(30) << std::left << "Deployment mechanism" << std::dec << "| " <<
unsigned(pdu2HkTableDataset.outEnabledDeplMechanism.value) << ", " <<
std::setw(4) << std::right <<
pdu2HkTableDataset.currentOutDeplMechanism.value << ", " << std::setw(4) <<
pdu2HkTableDataset.voltageOutDeplMechanism.value << std::endl;
sif::info << std::setw(30) << std::left << "Payload PCDU Channel 6" << std::dec << "| " <<
unsigned(pdu2HkTableDataset.outEnabledPlPCDUCh6.value) << ", " <<
std::setw(4) << std::right <<
pdu2HkTableDataset.currentOutPayloadPCDUCh6.value << ", " << std::setw(4) <<
pdu2HkTableDataset.voltageOutPayloadPCDUCh6.value<< std::endl;
sif::info << std::setw(30) << std::left << "ACS Board Side B" << std::dec << "| " <<
unsigned(pdu2HkTableDataset.outEnabledAcsBoardSideB.value) << ", " <<
std::setw(4) << std::right <<
pdu2HkTableDataset.currentOutACSBoardSideB.value << ", " << std::setw(4) <<
pdu2HkTableDataset.voltageOutACSBoardSideB.value << std::endl;
sif::info << std::setw(30) << std::left << "Payload Camera enable state" << std::dec << "| " <<
unsigned(pdu2HkTableDataset.outEnabledPayloadCamera.value) << ", " <<
std::setw(4) << std::right <<
pdu2HkTableDataset.currentOutPayloadCamera.value << ", " << std::setw(4) <<
pdu2HkTableDataset.voltageOutPayloadCamera.value << std::right << std::endl;
}

View File

@ -20,25 +20,28 @@
*/ */
class PDU2Handler: public GomspaceDeviceHandler { class PDU2Handler: public GomspaceDeviceHandler {
public: public:
PDU2Handler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie); PDU2Handler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie);
virtual ~PDU2Handler(); virtual ~PDU2Handler();
virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override; LocalDataPoolManager& poolManager) override;
protected: protected:
/** /**
* @brief As soon as the device is in MODE_NORMAL, this function is executed periodically. * @brief As soon as the device is in MODE_NORMAL, this function is executed periodically.
*/ */
virtual ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t * id) override; virtual ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t * id) override;
virtual void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) override; virtual void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) override;
ReturnValue_t printStatus(DeviceCommandId_t cmd) override;
private: private:
/** Dataset for the housekeeping table of the PDU2 */ /** Dataset for the housekeeping table of the PDU2 */
PDU2::PDU2HkTableDataset pdu2HkTableDataset; PDU2::PDU2HkTableDataset pdu2HkTableDataset;
void parseHkTableReply(const uint8_t *packet); void printHkTable();
void parseHkTableReply(const uint8_t *packet);
}; };
#endif /* MISSION_DEVICES_PDU2HANDLER_H_ */ #endif /* MISSION_DEVICES_PDU2HANDLER_H_ */

View File

@ -144,47 +144,48 @@ void RwHandler::fillCommandAndReplyMap() {
ReturnValue_t RwHandler::scanForReply(const uint8_t *start, size_t remainingSize, ReturnValue_t RwHandler::scanForReply(const uint8_t *start, size_t remainingSize,
DeviceCommandId_t *foundId, size_t *foundLen) { DeviceCommandId_t *foundId, size_t *foundLen) {
uint8_t replyByte = *start;
switch (*(start)) { switch (replyByte) {
case (static_cast<uint8_t>(RwDefinitions::GET_LAST_RESET_STATUS)): { case (RwDefinitions::GET_LAST_RESET_STATUS): {
*foundLen = RwDefinitions::SIZE_GET_RESET_STATUS; *foundLen = RwDefinitions::SIZE_GET_RESET_STATUS;
*foundId = RwDefinitions::GET_LAST_RESET_STATUS; *foundId = RwDefinitions::GET_LAST_RESET_STATUS;
break; break;
} }
case (static_cast<uint8_t>(RwDefinitions::CLEAR_LAST_RESET_STATUS)): { case (RwDefinitions::CLEAR_LAST_RESET_STATUS): {
*foundLen = RwDefinitions::SIZE_CLEAR_RESET_STATUS; *foundLen = RwDefinitions::SIZE_CLEAR_RESET_STATUS;
*foundId = RwDefinitions::CLEAR_LAST_RESET_STATUS; *foundId = RwDefinitions::CLEAR_LAST_RESET_STATUS;
break; break;
} }
case (static_cast<uint8_t>(RwDefinitions::GET_RW_STATUS)): { case (RwDefinitions::GET_RW_STATUS): {
*foundLen = RwDefinitions::SIZE_GET_RW_STATUS; *foundLen = RwDefinitions::SIZE_GET_RW_STATUS;
*foundId = RwDefinitions::GET_RW_STATUS; *foundId = RwDefinitions::GET_RW_STATUS;
break; break;
} }
case (static_cast<uint8_t>(RwDefinitions::INIT_RW_CONTROLLER)): { case (RwDefinitions::INIT_RW_CONTROLLER): {
*foundLen = RwDefinitions::SIZE_INIT_RW; *foundLen = RwDefinitions::SIZE_INIT_RW;
*foundId = RwDefinitions::INIT_RW_CONTROLLER; *foundId = RwDefinitions::INIT_RW_CONTROLLER;
break; break;
} }
case (static_cast<uint8_t>(RwDefinitions::SET_SPEED)): { case (RwDefinitions::SET_SPEED): {
*foundLen = RwDefinitions::SIZE_SET_SPEED_REPLY; *foundLen = RwDefinitions::SIZE_SET_SPEED_REPLY;
*foundId = RwDefinitions::SET_SPEED; *foundId = RwDefinitions::SET_SPEED;
break; break;
} }
case (static_cast<uint8_t>(RwDefinitions::GET_TEMPERATURE)): { case (RwDefinitions::GET_TEMPERATURE): {
*foundLen = RwDefinitions::SIZE_GET_TEMPERATURE_REPLY; *foundLen = RwDefinitions::SIZE_GET_TEMPERATURE_REPLY;
*foundId = RwDefinitions::GET_TEMPERATURE; *foundId = RwDefinitions::GET_TEMPERATURE;
break; break;
} }
case (static_cast<uint8_t>(RwDefinitions::GET_TM)): { case (RwDefinitions::GET_TM): {
*foundLen = RwDefinitions::SIZE_GET_TELEMETRY_REPLY; *foundLen = RwDefinitions::SIZE_GET_TELEMETRY_REPLY;
*foundId = RwDefinitions::GET_TM; *foundId = RwDefinitions::GET_TM;
break; break;
} }
default: { default: {
sif::debug << "RwHandler::scanForReply: Reply contains invalid command code" << std::endl; sif::warning << "RwHandler::scanForReply: Reply contains invalid command code" <<
std::endl;
*foundLen = remainingSize;
return RETURN_FAILED; return RETURN_FAILED;
break;
} }
} }

View File

@ -7,6 +7,7 @@
namespace GpsHyperion { namespace GpsHyperion {
static constexpr DeviceCommandId_t GPS_REPLY = 0; static constexpr DeviceCommandId_t GPS_REPLY = 0;
static constexpr DeviceCommandId_t TRIGGER_RESET_PIN = 5;
static constexpr uint32_t DATASET_ID = 0; static constexpr uint32_t DATASET_ID = 0;

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_GYROADIS16507DEFINITIONS_H_ #ifndef MISSION_DEVICES_DEVICEDEFINITIONS_GYROADIS16507DEFINITIONS_H_
#define MISSION_DEVICES_DEVICEDEFINITIONS_GYROADIS16507DEFINITIONS_H_ #define MISSION_DEVICES_DEVICEDEFINITIONS_GYROADIS16507DEFINITIONS_H_
#include "fsfw/devicehandlers/DeviceHandlerIF.h"
#include "fsfw/datapoollocal/StaticLocalDataSet.h" #include "fsfw/datapoollocal/StaticLocalDataSet.h"
#include <cstddef> #include <cstddef>

View File

@ -1,166 +0,0 @@
#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_MGMHANDLERLIS3DEFINITIONS_H_
#define MISSION_DEVICES_DEVICEDEFINITIONS_MGMHANDLERLIS3DEFINITIONS_H_
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
#include <fsfw/datapoollocal/LocalPoolVariable.h>
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include <cstdint>
namespace MGMLIS3MDL {
enum set {
ON, OFF
};
enum opMode {
LOW, MEDIUM, HIGH, ULTRA
};
/* Actually 15, we just round up a bit */
static constexpr size_t MAX_BUFFER_SIZE = 16;
static constexpr uint8_t GAUSS_TO_MICROTESLA_FACTOR = 100;
static const DeviceCommandId_t READ_CONFIG_AND_DATA = 0x00;
static const DeviceCommandId_t SETUP_MGM = 0x01;
static const DeviceCommandId_t READ_TEMPERATURE = 0x02;
static const DeviceCommandId_t IDENTIFY_DEVICE = 0x03;
static const DeviceCommandId_t TEMP_SENSOR_ENABLE = 0x04;
static const DeviceCommandId_t ACCURACY_OP_MODE_SET = 0x05;
/* Number of all control registers */
static const uint8_t NR_OF_CTRL_REGISTERS = 5;
/* Number of registers in the MGM */
static const uint8_t NR_OF_REGISTERS = 19;
/* Total number of adresses for all registers */
static const uint8_t TOTAL_NR_OF_ADRESSES = 52;
static const uint8_t NR_OF_DATA_AND_CFG_REGISTERS = 14;
static const uint8_t TEMPERATURE_REPLY_LEN = 3;
static const uint8_t SETUP_REPLY_LEN = 6;
/*------------------------------------------------------------------------*/
/* Register adresses */
/*------------------------------------------------------------------------*/
/* Register adress returns identifier of device with default 0b00111101 */
static const uint8_t IDENTIFY_DEVICE_REG_ADDR = 0b00001111;
static const uint8_t DEVICE_ID = 0b00111101; // Identifier for Device
/* Register adress to access register 1 */
static const uint8_t CTRL_REG1 = 0b00100000;
/* Register adress to access register 2 */
static const uint8_t CTRL_REG2 = 0b00100001;
/* Register adress to access register 3 */
static const uint8_t CTRL_REG3 = 0b00100010;
/* Register adress to access register 4 */
static const uint8_t CTRL_REG4 = 0b00100011;
/* Register adress to access register 5 */
static const uint8_t CTRL_REG5 = 0b00100100;
/* Register adress to access status register */
static const uint8_t STATUS_REG_IDX = 8;
static const uint8_t STATUS_REG = 0b00100111;
/* Register adress to access low byte of x-axis */
static const uint8_t X_LOWBYTE_IDX = 9;
static const uint8_t X_LOWBYTE = 0b00101000;
/* Register adress to access high byte of x-axis */
static const uint8_t X_HIGHBYTE_IDX = 10;
static const uint8_t X_HIGHBYTE = 0b00101001;
/* Register adress to access low byte of y-axis */
static const uint8_t Y_LOWBYTE_IDX = 11;
static const uint8_t Y_LOWBYTE = 0b00101010;
/* Register adress to access high byte of y-axis */
static const uint8_t Y_HIGHBYTE_IDX = 12;
static const uint8_t Y_HIGHBYTE = 0b00101011;
/* Register adress to access low byte of z-axis */
static const uint8_t Z_LOWBYTE_IDX = 13;
static const uint8_t Z_LOWBYTE = 0b00101100;
/* Register adress to access high byte of z-axis */
static const uint8_t Z_HIGHBYTE_IDX = 14;
static const uint8_t Z_HIGHBYTE = 0b00101101;
/* Register adress to access low byte of temperature sensor */
static const uint8_t TEMP_LOWBYTE = 0b00101110;
/* Register adress to access high byte of temperature sensor */
static const uint8_t TEMP_HIGHBYTE = 0b00101111;
/*------------------------------------------------------------------------*/
/* Initialize Setup Register set bits */
/*------------------------------------------------------------------------*/
/* General transfer bits */
// Read=1 / Write=0 Bit
static const uint8_t RW_BIT = 7;
// Continous Read/Write Bit, increment adress
static const uint8_t MS_BIT = 6;
/* CTRL_REG1 bits */
static const uint8_t ST = 0; // Self test enable bit, enabled = 1
// Enable rates higher than 80 Hz enabled = 1
static const uint8_t FAST_ODR = 1;
static const uint8_t DO0 = 2; // Output data rate bit 2
static const uint8_t DO1 = 3; // Output data rate bit 3
static const uint8_t DO2 = 4; // Output data rate bit 4
static const uint8_t OM0 = 5; // XY operating mode bit 5
static const uint8_t OM1 = 6; // XY operating mode bit 6
static const uint8_t TEMP_EN = 7; // Temperature sensor enable enabled = 1
static const uint8_t CTRL_REG1_DEFAULT = (1 << TEMP_EN) | (1 << OM1) |
(1 << DO0) | (1 << DO1) | (1 << DO2);
/* CTRL_REG2 bits */
//reset configuration registers and user registers
static const uint8_t SOFT_RST = 2;
static const uint8_t REBOOT = 3; //reboot memory content
static const uint8_t FSO = 5; //full-scale selection bit 5
static const uint8_t FS1 = 6; //full-scale selection bit 6
static const uint8_t CTRL_REG2_DEFAULT = 0;
/* CTRL_REG3 bits */
static const uint8_t MD0 = 0; //Operating mode bit 0
static const uint8_t MD1 = 1; //Operating mode bit 1
//SPI serial interface mode selection enabled = 3-wire-mode
static const uint8_t SIM = 2;
static const uint8_t LP = 5; //low-power mode
static const uint8_t CTRL_REG3_DEFAULT = 0;
/* CTRL_REG4 bits */
//big/little endian data selection enabled = MSb at lower adress
static const uint8_t BLE = 1;
static const uint8_t OMZ0 = 2; //Z operating mode bit 2
static const uint8_t OMZ1 = 3; //Z operating mode bit 3
static const uint8_t CTRL_REG4_DEFAULT = (1 << OMZ1);
/* CTRL_REG5 bits */
static const uint8_t BDU = 6; //Block data update
static const uint8_t FAST_READ = 7; //Fast read enabled = 1
static const uint8_t CTRL_REG5_DEFAULT = 0;
static const uint32_t MGM_DATA_SET_ID = READ_CONFIG_AND_DATA;
enum MgmPoolIds: lp_id_t {
FIELD_STRENGTH_X,
FIELD_STRENGTH_Y,
FIELD_STRENGTH_Z,
TEMPERATURE_CELCIUS
};
class MgmPrimaryDataset: public StaticLocalDataSet<5> {
public:
MgmPrimaryDataset(HasLocalDataPoolIF* hkOwner):
StaticLocalDataSet(hkOwner, MGM_DATA_SET_ID) {}
MgmPrimaryDataset(object_id_t mgmId):
StaticLocalDataSet(sid_t(mgmId, MGM_DATA_SET_ID)) {}
lp_var_t<float> fieldStrengthX = lp_var_t<float>(sid.objectId,
FIELD_STRENGTH_X, this);
lp_var_t<float> fieldStrengthY = lp_var_t<float>(sid.objectId,
FIELD_STRENGTH_Y, this);
lp_var_t<float> fieldStrengthZ = lp_var_t<float>(sid.objectId,
FIELD_STRENGTH_Z, this);
lp_var_t<float> temperature = lp_var_t<float>(sid.objectId,
TEMPERATURE_CELCIUS, this);
};
}
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_MGMHANDLERLIS3DEFINITIONS_H_ */

View File

@ -1,132 +0,0 @@
#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_MGMHANDLERRM3100DEFINITIONS_H_
#define MISSION_DEVICES_DEVICEDEFINITIONS_MGMHANDLERRM3100DEFINITIONS_H_
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
#include <fsfw/datapoollocal/LocalPoolVariable.h>
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include <fsfw/serialize/SerialLinkedListAdapter.h>
#include <cstdint>
namespace RM3100 {
/* Actually 10, we round up a little bit */
static constexpr size_t MAX_BUFFER_SIZE = 12;
static constexpr uint8_t READ_MASK = 0x80;
/*----------------------------------------------------------------------------*/
/* CMM Register */
/*----------------------------------------------------------------------------*/
static constexpr uint8_t SET_CMM_CMZ = 1 << 6;
static constexpr uint8_t SET_CMM_CMY = 1 << 5;
static constexpr uint8_t SET_CMM_CMX = 1 << 4;
static constexpr uint8_t SET_CMM_DRDM = 1 << 2;
static constexpr uint8_t SET_CMM_START = 1;
static constexpr uint8_t CMM_REGISTER = 0x01;
static constexpr uint8_t CMM_VALUE = SET_CMM_CMZ | SET_CMM_CMY | SET_CMM_CMX |
SET_CMM_DRDM | SET_CMM_START;
/*----------------------------------------------------------------------------*/
/* Cycle count register */
/*----------------------------------------------------------------------------*/
// Default value (200)
static constexpr uint8_t CYCLE_COUNT_VALUE = 0xC8;
static constexpr float DEFAULT_GAIN = static_cast<float>(CYCLE_COUNT_VALUE) /
100 * 38;
static constexpr uint8_t CYCLE_COUNT_START_REGISTER = 0x04;
/*----------------------------------------------------------------------------*/
/* TMRC register */
/*----------------------------------------------------------------------------*/
static constexpr uint8_t TMRC_150HZ_VALUE = 0x94;
static constexpr uint8_t TMRC_75HZ_VALUE = 0x95;
static constexpr uint8_t TMRC_DEFAULT_37HZ_VALUE = 0x96;
static constexpr uint8_t TMRC_REGISTER = 0x0B;
static constexpr uint8_t TMRC_DEFAULT_VALUE = TMRC_DEFAULT_37HZ_VALUE;
static constexpr uint8_t MEASUREMENT_REG_START = 0x24;
static constexpr uint8_t BIST_REGISTER = 0x33;
static constexpr uint8_t DATA_READY_VAL = 0b1000'0000;
static constexpr uint8_t STATUS_REGISTER = 0x34;
static constexpr uint8_t REVID_REGISTER = 0x36;
// Range in Microtesla. 1 T equals 10000 Gauss (for comparison with LIS3 MGM)
static constexpr uint16_t RANGE = 800;
static constexpr DeviceCommandId_t READ_DATA = 0;
static constexpr DeviceCommandId_t CONFIGURE_CMM = 1;
static constexpr DeviceCommandId_t READ_CMM = 2;
static constexpr DeviceCommandId_t CONFIGURE_TMRC = 3;
static constexpr DeviceCommandId_t READ_TMRC = 4;
static constexpr DeviceCommandId_t CONFIGURE_CYCLE_COUNT = 5;
static constexpr DeviceCommandId_t READ_CYCLE_COUNT = 6;
class CycleCountCommand: public SerialLinkedListAdapter<SerializeIF> {
public:
CycleCountCommand(bool oneCycleCount = true): oneCycleCount(oneCycleCount) {
setLinks(oneCycleCount);
}
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
Endianness streamEndianness) override {
ReturnValue_t result = SerialLinkedListAdapter::deSerialize(buffer,
size, streamEndianness);
if(oneCycleCount) {
cycleCountY = cycleCountX;
cycleCountZ = cycleCountX;
}
return result;
}
SerializeElement<uint16_t> cycleCountX;
SerializeElement<uint16_t> cycleCountY;
SerializeElement<uint16_t> cycleCountZ;
private:
void setLinks(bool oneCycleCount) {
setStart(&cycleCountX);
if(not oneCycleCount) {
cycleCountX.setNext(&cycleCountY);
cycleCountY.setNext(&cycleCountZ);
}
}
bool oneCycleCount;
};
static constexpr uint32_t MGM_DATASET_ID = READ_DATA;
enum MgmPoolIds: lp_id_t {
FIELD_STRENGTH_X,
FIELD_STRENGTH_Y,
FIELD_STRENGTH_Z,
};
class Rm3100PrimaryDataset: public StaticLocalDataSet<3 * sizeof(float)> {
public:
Rm3100PrimaryDataset(HasLocalDataPoolIF* hkOwner):
StaticLocalDataSet(hkOwner, MGM_DATASET_ID) {}
Rm3100PrimaryDataset(object_id_t mgmId):
StaticLocalDataSet(sid_t(mgmId, MGM_DATASET_ID)) {}
// Field strengths in micro Tesla.
lp_var_t<float> fieldStrengthX = lp_var_t<float>(sid.objectId,
FIELD_STRENGTH_X, this);
lp_var_t<float> fieldStrengthY = lp_var_t<float>(sid.objectId,
FIELD_STRENGTH_Y, this);
lp_var_t<float> fieldStrengthZ = lp_var_t<float>(sid.objectId,
FIELD_STRENGTH_Z, this);
};
}
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_MGMHANDLERRM3100DEFINITIONS_H_ */

@ -1 +1 @@
Subproject commit 657c06e4a6e4c460e897c4a5b4eaefe7c6d1085e Subproject commit 2d10c6b85ea4cab4f4baf1918c51d54eee4202c2

2
thirdparty/lwgps vendored

@ -1 +1 @@
Subproject commit 3dbfe390a6784ebc723d3907062cf883c8cf85cd Subproject commit 52999ddfe5177493b96b55871961a8a97131596d

2
tmtc

@ -1 +1 @@
Subproject commit 9b176aebfaba51f4d045881a125d42b123f4eeb3 Subproject commit 53bf65083889af10f77c3899972b1153ea835f3c