deleted polling sequence file

This commit is contained in:
Martin Zietz 2021-03-22 12:47:45 +01:00
commit 862a546637
55 changed files with 1039 additions and 741 deletions

View File

@ -141,7 +141,7 @@ The [TCF agent](https://wiki.eclipse.org/TCF) can be used to perform remote debu
1. Install the TCF agent plugin in Eclipse from the [releases](https://www.eclipse.org/tcf/downloads.php). Go to Help → Install New Software and use the download page, for example https://download.eclipse.org/tools/tcf/releases/1.6/1.6.2/ to search for the plugin and install it. 1. Install the TCF agent plugin in Eclipse from the [releases](https://www.eclipse.org/tcf/downloads.php). Go to Help → Install New Software and use the download page, for example https://download.eclipse.org/tools/tcf/releases/1.6/1.6.2/ to search for the plugin and install it.
2. Go to Window → Perspective → Open Perspective and open the **Target Explorer Perspective**. 2. Go to Window → Perspective → Open Perspective and open the **Target Explorer Perspective**.
Here, the Q7S should show up if the local port forwarding was set up as explained previously. Here, the Q7S should show up if the local port forwarding was set up as explained previously. Please note that you have to connect to `localhost` and port `1534` with port forwaring set up.
3. A launch configuration was provided, but it might be necessary to adapt it for your own needs. Alternatively: 3. A launch configuration was provided, but it might be necessary to adapt it for your own needs. Alternatively:
@ -244,7 +244,7 @@ To launch application from Xilinx SDK setup port fowarding on the development ma
(not on the flatsat!) (not on the flatsat!)
```sh ```sh
ssh -L 1534:192.168.133.10:1534 eive@2001:7c0:2018:1099:babe:0:e1fe:f1a5 ssh -L 1534:192.168.133.10:1534 eive@2001:7c0:2018:1099:babe:0:e1fe:f1a5 -t bash
``` ```
This forwards any requests to localhost:1534 to the port 1534 of the Q7S with the IP address 192.168.133.10. This forwards any requests to localhost:1534 to the port 1534 of the Q7S with the IP address 192.168.133.10.

View File

@ -3,8 +3,8 @@
const char* const SW_NAME = "eive"; const char* const SW_NAME = "eive";
#define SW_VERSION 0 #define SW_VERSION 1
#define SW_SUBVERSION 2 #define SW_SUBVERSION 0
#define SW_SUBSUBVERSION 0 #define SW_SUBSUBVERSION 0

View File

@ -11,8 +11,7 @@
#include <fsfw/tasks/FixedTimeslotTaskIF.h> #include <fsfw/tasks/FixedTimeslotTaskIF.h>
#include <fsfw/tasks/PeriodicTaskIF.h> #include <fsfw/tasks/PeriodicTaskIF.h>
#include <fsfw/tasks/TaskFactory.h> #include <fsfw/tasks/TaskFactory.h>
#include <fsfwconfig/pollingsequence/PollingSequenceFactory.h> #include <fsfwconfig/pollingsequence/pollingSequenceFactory.h>
#include <iostream> #include <iostream>
/* This is configured for linux without CR */ /* This is configured for linux without CR */
@ -70,6 +69,7 @@ void initmission::initTasks() {
initmission::printAddObjectError("TM_FUNNEL", objects::TM_FUNNEL); initmission::printAddObjectError("TM_FUNNEL", objects::TM_FUNNEL);
} }
/* UDP bridge */
PeriodicTaskIF* udpBridgeTask = factory->createPeriodicTask( PeriodicTaskIF* udpBridgeTask = factory->createPeriodicTask(
"UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); "UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = udpBridgeTask->addComponent(objects::UDP_BRIDGE); result = udpBridgeTask->addComponent(objects::UDP_BRIDGE);

View File

@ -8,7 +8,10 @@
#include <bsp_q7s/devices/HeaterHandler.h> #include <bsp_q7s/devices/HeaterHandler.h>
#include <bsp_q7s/devices/SolarArrayDeploymentHandler.h> #include <bsp_q7s/devices/SolarArrayDeploymentHandler.h>
<<<<<<< HEAD
#include <bsp_q7s/gpio/gpioCallbacks.h> #include <bsp_q7s/gpio/gpioCallbacks.h>
=======
>>>>>>> develop
#include <mission/core/GenericFactory.h> #include <mission/core/GenericFactory.h>
#include <mission/devices/PDU1Handler.h> #include <mission/devices/PDU1Handler.h>
@ -17,10 +20,13 @@
#include <mission/devices/PCDUHandler.h> #include <mission/devices/PCDUHandler.h>
#include <mission/devices/P60DockHandler.h> #include <mission/devices/P60DockHandler.h>
#include <mission/devices/Tmp1075Handler.h> #include <mission/devices/Tmp1075Handler.h>
<<<<<<< HEAD
#include <mission/devices/Max31865PT1000Handler.h> #include <mission/devices/Max31865PT1000Handler.h>
#include <mission/devices/devicedefinitions/Max31865Definitions.h> #include <mission/devices/devicedefinitions/Max31865Definitions.h>
#include <mission/devices/SyrlinksHkHandler.h> #include <mission/devices/SyrlinksHkHandler.h>
=======
>>>>>>> develop
#include <mission/devices/devicedefinitions/GomSpacePackets.h> #include <mission/devices/devicedefinitions/GomSpacePackets.h>
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h> #include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
#include <mission/devices/devicedefinitions/SyrlinksDefinitions.h> #include <mission/devices/devicedefinitions/SyrlinksDefinitions.h>
@ -44,6 +50,13 @@
#include <fsfw/tmtcpacket/pus/TmPacketStored.h> #include <fsfw/tmtcpacket/pus/TmPacketStored.h>
#include <fsfw/osal/linux/TcUnixUdpPollingTask.h> #include <fsfw/osal/linux/TcUnixUdpPollingTask.h>
#include <fsfw/datapoollocal/LocalDataPoolManager.h>
#include <fsfw/tmtcservices/CommandingServiceBase.h>
#include <fsfw/tmtcservices/PusServiceBase.h>
#include <fsfw/osal/linux/TmTcUnixUdpBridge.h>
#include <fsfw/tmtcpacket/pus/TmPacketStored.h>
#include <fsfw/osal/linux/TcUnixUdpPollingTask.h>
#if TEST_LIBGPIOD == 1 #if TEST_LIBGPIOD == 1
#include <linux/boardtest/LibgpiodTest.h> #include <linux/boardtest/LibgpiodTest.h>
#endif #endif
@ -114,11 +127,18 @@ void ObjectFactory::produce(){
* Setting PCDU devices to mode normal immediately after start up because PCDU is always * Setting PCDU devices to mode normal immediately after start up because PCDU is always
* running. * running.
*/ */
<<<<<<< HEAD
/** For now this needs to be commented out because there is no PCDU connected to the OBC */ /** For now this needs to be commented out because there is no PCDU connected to the OBC */
// p60dockhandler->setModeNormal(); // p60dockhandler->setModeNormal();
// pdu1handler->setModeNormal(); // pdu1handler->setModeNormal();
// pdu2handler->setModeNormal(); // pdu2handler->setModeNormal();
// acuhandler->setModeNormal(); // acuhandler->setModeNormal();
=======
//p60dockhandler->setModeNormal();
//pdu1handler->setModeNormal();
//pdu2handler->setModeNormal();
//acuhandler->setModeNormal();
>>>>>>> develop
#endif #endif
/* Temperature sensors */ /* Temperature sensors */
Tmp1075Handler* tmp1075Handler_1 = new Tmp1075Handler( Tmp1075Handler* tmp1075Handler_1 = new Tmp1075Handler(

View File

@ -201,8 +201,8 @@ void HeaterHandler::handleSwitchOnCommand(HeaterMapIter heaterMapIter) {
heaterMapIter->second.active = false; heaterMapIter->second.active = false;
heaterMapIter->second.waitMainSwitchOn = false; heaterMapIter->second.waitMainSwitchOn = false;
if (heaterMapIter->second.replyQueue != commandQueue->getId()) { if (heaterMapIter->second.replyQueue != commandQueue->getId()) {
actionHelper.finish(heaterMapIter->second.replyQueue, heaterMapIter->second.action, actionHelper.finish(false, heaterMapIter->second.replyQueue,
MAIN_SWITCH_SET_TIMEOUT ); heaterMapIter->second.action, MAIN_SWITCH_SET_TIMEOUT );
} }
return; return;
} }
@ -229,8 +229,15 @@ void HeaterHandler::handleSwitchOnCommand(HeaterMapIter heaterMapIter) {
/* There is no need to send action finish replies if the sender was the /* There is no need to send action finish replies if the sender was the
* HeaterHandler itself. */ * HeaterHandler itself. */
if (heaterMapIter->second.replyQueue != commandQueue->getId()) { if (heaterMapIter->second.replyQueue != commandQueue->getId()) {
actionHelper.finish(heaterMapIter->second.replyQueue, if(result == RETURN_OK) {
heaterMapIter->second.action, result); actionHelper.finish(true, heaterMapIter->second.replyQueue,
heaterMapIter->second.action, result);
}
else {
actionHelper.finish(false, heaterMapIter->second.replyQueue,
heaterMapIter->second.action, result);
}
} }
heaterMapIter->second.active = false; heaterMapIter->second.active = false;
heaterMapIter->second.waitMainSwitchOn = false; heaterMapIter->second.waitMainSwitchOn = false;
@ -250,7 +257,7 @@ void HeaterHandler::handleSwitchOnCommand(HeaterMapIter heaterMapIter) {
sif::debug << "HeaterHandler::handleActiveCommands: Failed to get state of" sif::debug << "HeaterHandler::handleActiveCommands: Failed to get state of"
<< " main line switch" << std::endl; << " main line switch" << std::endl;
if (heaterMapIter->second.replyQueue != commandQueue->getId()) { if (heaterMapIter->second.replyQueue != commandQueue->getId()) {
actionHelper.finish(heaterMapIter->second.replyQueue, actionHelper.finish(false, heaterMapIter->second.replyQueue,
heaterMapIter->second.action, mainSwitchState); heaterMapIter->second.action, mainSwitchState);
} }
heaterMapIter->second.active = false; heaterMapIter->second.active = false;
@ -282,8 +289,15 @@ void HeaterHandler::handleSwitchOffCommand(HeaterMapIter heaterMapIter) {
triggerEvent(SWITCH_ALREADY_OFF, switchNr); triggerEvent(SWITCH_ALREADY_OFF, switchNr);
} }
if (heaterMapIter->second.replyQueue != NO_COMMANDER) { if (heaterMapIter->second.replyQueue != NO_COMMANDER) {
actionHelper.finish(heaterMapIter->second.replyQueue, /* Report back switch command reply if necessary */
heaterMapIter->second.action, result); if(result == HasReturnvaluesIF::RETURN_OK) {
actionHelper.finish(true, heaterMapIter->second.replyQueue,
heaterMapIter->second.action, result);
}
else {
actionHelper.finish(false, heaterMapIter->second.replyQueue,
heaterMapIter->second.action, result);
}
} }
heaterMapIter->second.active = false; heaterMapIter->second.active = false;
} }

View File

@ -108,7 +108,7 @@ void SolarArrayDeploymentHandler::performWaitOn8VActions() {
} else { } else {
if (mainSwitchCountdown.hasTimedOut()) { if (mainSwitchCountdown.hasTimedOut()) {
triggerEvent(MAIN_SWITCH_ON_TIMEOUT); triggerEvent(MAIN_SWITCH_ON_TIMEOUT);
actionHelper.finish(rememberCommanderId, DEPLOY_SOLAR_ARRAYS, actionHelper.finish(false, rememberCommanderId, DEPLOY_SOLAR_ARRAYS,
MAIN_SWITCH_TIMEOUT_FAILURE); MAIN_SWITCH_TIMEOUT_FAILURE);
stateMachine = WAIT_ON_DELOYMENT_COMMAND; stateMachine = WAIT_ON_DELOYMENT_COMMAND;
} }
@ -125,7 +125,7 @@ void SolarArrayDeploymentHandler::switchDeploymentTransistors() {
* the deployment sequence. */ * the deployment sequence. */
stateMachine = WAIT_ON_DELOYMENT_COMMAND; stateMachine = WAIT_ON_DELOYMENT_COMMAND;
triggerEvent(DEPL_SA1_GPIO_SWTICH_ON_FAILED); triggerEvent(DEPL_SA1_GPIO_SWTICH_ON_FAILED);
actionHelper.finish(rememberCommanderId, DEPLOY_SOLAR_ARRAYS, actionHelper.finish(false, rememberCommanderId, DEPLOY_SOLAR_ARRAYS,
SWITCHING_DEPL_SA2_FAILED); SWITCHING_DEPL_SA2_FAILED);
mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF); mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF);
} }
@ -135,7 +135,7 @@ void SolarArrayDeploymentHandler::switchDeploymentTransistors() {
" array deployment switch 2 high " << std::endl; " array deployment switch 2 high " << std::endl;
stateMachine = WAIT_ON_DELOYMENT_COMMAND; stateMachine = WAIT_ON_DELOYMENT_COMMAND;
triggerEvent(DEPL_SA2_GPIO_SWTICH_ON_FAILED); triggerEvent(DEPL_SA2_GPIO_SWTICH_ON_FAILED);
actionHelper.finish(rememberCommanderId, DEPLOY_SOLAR_ARRAYS, actionHelper.finish(false, rememberCommanderId, DEPLOY_SOLAR_ARRAYS,
SWITCHING_DEPL_SA2_FAILED); SWITCHING_DEPL_SA2_FAILED);
mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF); mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF);
} }
@ -146,7 +146,7 @@ void SolarArrayDeploymentHandler::switchDeploymentTransistors() {
void SolarArrayDeploymentHandler::handleDeploymentFinish() { void SolarArrayDeploymentHandler::handleDeploymentFinish() {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
if (deploymentCountdown.hasTimedOut()) { if (deploymentCountdown.hasTimedOut()) {
actionHelper.finish(rememberCommanderId, DEPLOY_SOLAR_ARRAYS, RETURN_OK); actionHelper.finish(true, rememberCommanderId, DEPLOY_SOLAR_ARRAYS, RETURN_OK);
result = gpioInterface->pullLow(deplSA1); result = gpioInterface->pullLow(deplSA1);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar" sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar"

View File

@ -3,8 +3,11 @@
#include <fsfwconfig/objects/systemObjectList.h> #include <fsfwconfig/objects/systemObjectList.h>
#include <fsfwconfig/OBSWConfig.h> #include <fsfwconfig/OBSWConfig.h>
<<<<<<< HEAD
#include <fsfwconfig/pollingsequence/PollingSequenceFactory.h> #include <fsfwconfig/pollingsequence/PollingSequenceFactory.h>
=======
>>>>>>> develop
#include <mission/utility/InitMission.h> #include <mission/utility/InitMission.h>
#include <fsfw/objectmanager/ObjectManagerIF.h> #include <fsfw/objectmanager/ObjectManagerIF.h>
@ -14,6 +17,10 @@
#include <fsfw/tasks/FixedTimeslotTaskIF.h> #include <fsfw/tasks/FixedTimeslotTaskIF.h>
#include <fsfw/tasks/PeriodicTaskIF.h> #include <fsfw/tasks/PeriodicTaskIF.h>
#include <fsfw/tasks/TaskFactory.h> #include <fsfw/tasks/TaskFactory.h>
<<<<<<< HEAD
=======
#include <fsfwconfig/pollingsequence/pollingSequenceFactory.h>
>>>>>>> develop
#include <iostream> #include <iostream>
@ -117,6 +124,8 @@ void initmission::initTasks() {
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS); result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
if(result != HasReturnvaluesIF::RETURN_OK) { if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS); initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS);
<<<<<<< HEAD
=======
} }
PeriodicTaskIF* pusLowPrio = factory->createPeriodicTask( PeriodicTaskIF* pusLowPrio = factory->createPeriodicTask(
@ -126,6 +135,24 @@ void initmission::initTasks() {
initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST); initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST);
} }
#if RPI_TEST_ACS_BOARD == 1
FixedTimeslotTaskIF* acsTask = factory->createFixedTimeslotTask(
"ACS_PST", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 1.0, missedDeadlineFunc);
result = pst::pollingSequenceAcsTest(acsTask);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "initmission::initTasks: ACS PST initialization failed!" << std::endl;
>>>>>>> develop
}
#endif /* RPI_TEST_ACS_BOARD == 1 */
<<<<<<< HEAD
PeriodicTaskIF* pusLowPrio = factory->createPeriodicTask(
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST);
}
#if RPI_TEST_ACS_BOARD == 1 #if RPI_TEST_ACS_BOARD == 1
FixedTimeslotTaskIF* acsTask = factory->createFixedTimeslotTask( FixedTimeslotTaskIF* acsTask = factory->createFixedTimeslotTask(
"ACS_PST", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc); "ACS_PST", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc);
@ -161,6 +188,34 @@ void initmission::initTasks() {
udpBridgeTask->startTask(); udpBridgeTask->startTask();
udpPollingTask->startTask(); udpPollingTask->startTask();
=======
PeriodicTaskIF* testTask = factory->createPeriodicTask(
"TEST_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
#if OBSW_ADD_TEST_CODE == 1
result = testTask->addComponent(objects::TEST_TASK);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
}
#endif /* OBSW_ADD_TEST_CODE == 1 */
#if RPI_ADD_SPI_TEST == 1
result = testTask->addComponent(objects::SPI_TEST);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST);
}
#endif /* RPI_ADD_SPI_TEST == 1 */
#if RPI_ADD_GPIO_TEST == 1
result = testTask->addComponent(objects::LIBGPIOD_TEST);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("GPIOD_TEST", objects::LIBGPIOD_TEST);
}
#endif /* RPI_ADD_GPIO_TEST == 1 */
sif::info << "Starting tasks.." << std::endl;
tmTcDistributor->startTask();
udpBridgeTask->startTask();
udpPollingTask->startTask();
>>>>>>> develop
pusVerification->startTask(); pusVerification->startTask();
pusEvents->startTask(); pusEvents->startTask();
pusHighPrio->startTask(); pusHighPrio->startTask();

View File

@ -1,5 +1,6 @@
#include "ObjectFactory.h" #include "ObjectFactory.h"
#include <bsp_rpi/gpio/GPIORPi.h> #include <bsp_rpi/gpio/GPIORPi.h>
<<<<<<< HEAD
#include <objects/systemObjectList.h> #include <objects/systemObjectList.h>
#include <devices/addresses.h> #include <devices/addresses.h>
@ -19,6 +20,29 @@
#include <mission/utility/TmFunnel.h> #include <mission/utility/TmFunnel.h>
#include <mission/devices/MGMHandlerLIS3MDL.h> #include <mission/devices/MGMHandlerLIS3MDL.h>
=======
#include <fsfwconfig/objects/systemObjectList.h>
#include <fsfwconfig/devices/addresses.h>
#include <fsfwconfig/devices/gpioIds.h>
#include <fsfwconfig/OBSWConfig.h>
#include <fsfwconfig/tmtc/apid.h>
#include <fsfwconfig/tmtc/pusIds.h>
#include <fsfwconfig/devices/spi.h>
#include <linux/boardtest/LibgpiodTest.h>
#include <linux/boardtest/SpiTestClass.h>
#include <linux/gpio/GpioCookie.h>
#include <linux/gpio/LinuxLibgpioIF.h>
#include <linux/spi/SpiCookie.h>
#include <linux/spi/SpiComIF.h>
#include <mission/core/GenericFactory.h>
#include <mission/utility/TmFunnel.h>
#include <mission/devices/MGMHandlerLIS3MDL.h>
#include <mission/devices/MGMHandlerRM3100.h>
>>>>>>> develop
#include <fsfw/datapoollocal/LocalDataPoolManager.h> #include <fsfw/datapoollocal/LocalDataPoolManager.h>
#include <fsfw/tmtcservices/CommandingServiceBase.h> #include <fsfw/tmtcservices/CommandingServiceBase.h>
#include <fsfw/tmtcservices/PusServiceBase.h> #include <fsfw/tmtcservices/PusServiceBase.h>
@ -26,7 +50,12 @@
#include <fsfw/tmtcpacket/pus/TmPacketStored.h> #include <fsfw/tmtcpacket/pus/TmPacketStored.h>
#include <fsfw/osal/linux/TcUnixUdpPollingTask.h> #include <fsfw/osal/linux/TcUnixUdpPollingTask.h>
#include <fsfw/tasks/TaskFactory.h> #include <fsfw/tasks/TaskFactory.h>
<<<<<<< HEAD
#include <linux/spi/SpiComIF.h> #include <linux/spi/SpiComIF.h>
=======
#include <mission/devices/GyroL3GD20Handler.h>
>>>>>>> develop
void Factory::setStaticFrameworkObjectIds() { void Factory::setStaticFrameworkObjectIds() {
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR; PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
@ -96,12 +125,34 @@ void ObjectFactory::produce(){
gpio::createRpiGpioConfig(gpioCookieAcsBoard, gpioIds::GYRO_2_L3G_CS, gpio::GYRO_2_BCM_PIN, gpio::createRpiGpioConfig(gpioCookieAcsBoard, gpioIds::GYRO_2_L3G_CS, gpio::GYRO_2_BCM_PIN,
"GYRO_2_L3G", gpio::Direction::OUT, 1); "GYRO_2_L3G", gpio::Direction::OUT, 1);
gpioIF->addGpios(gpioCookieAcsBoard); gpioIF->addGpios(gpioCookieAcsBoard);
<<<<<<< HEAD
SpiCookie* spiCookie = new SpiCookie(addresses::MGM_0_LIS3, SpiCookie* spiCookie = new SpiCookie(addresses::MGM_0_LIS3,
gpioIds::MGM_0_LIS3_CS, "/dev/spidev0.0", 24, spi::SpiMode::MODE_3, 3'900'000); gpioIds::MGM_0_LIS3_CS, "/dev/spidev0.0", 24, spi::SpiMode::MODE_3, 3'900'000);
auto mgmHandler = new MGMHandlerLIS3MDL(objects::MGM_0_LIS3_HANDLER, auto mgmHandler = new MGMHandlerLIS3MDL(objects::MGM_0_LIS3_HANDLER,
objects::SPI_COM_IF, spiCookie); objects::SPI_COM_IF, spiCookie);
mgmHandler->setStartUpImmediately(); mgmHandler->setStartUpImmediately();
=======
std::string spiDev = "/dev/spidev0.0";
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);
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();
>>>>>>> develop
#endif /* RPI_TEST_ACS_BOARD == 1 */ #endif /* RPI_TEST_ACS_BOARD == 1 */
} }

View File

@ -8,7 +8,7 @@
/* Only one of those 2 should be enabled! */ /* Only one of those 2 should be enabled! */
#define RPI_ADD_SPI_TEST 0 #define RPI_ADD_SPI_TEST 0
#define RPI_TEST_ACS_BOARD 1 #define RPI_TEST_ACS_BOARD 0
/* Adapt these values accordingly */ /* Adapt these values accordingly */
namespace gpio { namespace gpio {

View File

@ -16,7 +16,7 @@ fi
build_generator="" build_generator=""
os_fsfw="host" os_fsfw="host"
build_dir="Debug-Release" build_dir="Release-Host"
if [ "${OS}" = "Windows_NT" ]; then if [ "${OS}" = "Windows_NT" ]; then
build_generator="MinGW Makefiles" build_generator="MinGW Makefiles"
# Could be other OS but this works for now. # Could be other OS but this works for now.

View File

@ -16,5 +16,10 @@ fi
build_generator="Unix Makefiles" build_generator="Unix Makefiles"
os_fsfw="linux" os_fsfw="linux"
builddir="Debug-Linux"
python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" echo "Running command (without the leading +):"
set -x # Print command
python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -l "${builddir}"
# Use this if commands are added which should not be printed
# set +x

View File

@ -16,5 +16,10 @@ fi
build_generator="Unix Makefiles" build_generator="Unix Makefiles"
os_fsfw="linux" os_fsfw="linux"
builddir="Release-Linux"
python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "release" echo "Running command (without the leading +):"
set -x # Print command
python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -l "${builddir}"
# Use this if commands are added which should not be printed
# set +x

View File

@ -16,5 +16,10 @@ fi
build_generator="Unix Makefiles" build_generator="Unix Makefiles"
os_fsfw="linux" os_fsfw="linux"
builddir="RelWithDeb-Linux"
python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "reldeb" echo "Running command (without the leading +):"
set -x # Print command
python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -l "${builddir}"
# Use this if commands are added which should not be printed
# set +x

0
cmake/scripts/Q7S/create_cmake_debug_cfg.sh Normal file → Executable file
View File

0
cmake/scripts/Q7S/create_cmake_release_cfg.sh Normal file → Executable file
View File

0
cmake/scripts/Q7S/create_cmake_relwithdeb_cfg.sh Normal file → Executable file
View File

0
cmake/scripts/RPi/create_cmake_debug_cfg.sh Normal file → Executable file
View File

0
cmake/scripts/RPi/create_cmake_release_cfg.sh Normal file → Executable file
View File

0
cmake/scripts/RPi/create_cmake_relwithdeb_cfg.sh Normal file → Executable file
View File

0
cmake/scripts/RPi/create_cmake_size_cfg.sh Normal file → Executable file
View File

2
fsfw

@ -1 +1 @@
Subproject commit e994d81e1862fade52b090311b3978fb59061966 Subproject commit 83d0db824289b28dbad81cce0c80276c4fc839c8

View File

@ -1,6 +1,6 @@
target_sources(${TARGET_NAME} PRIVATE target_sources(${TARGET_NAME} PRIVATE
ipc/MissionMessageTypes.cpp ipc/MissionMessageTypes.cpp
pollingsequence/PollingSequenceFactory.cpp pollingsequence/pollingSequenceFactory.cpp
) )
target_include_directories(${TARGET_NAME} PUBLIC target_include_directories(${TARGET_NAME} PUBLIC

View File

@ -25,10 +25,15 @@ debugging. */
#define PDU1_DEBUG 0 #define PDU1_DEBUG 0
#define PDU2_DEBUG 0 #define PDU2_DEBUG 0
#define ACU_DEBUG 0 #define ACU_DEBUG 0
#define SYRLINKS_DEBUG 1 #define SYRLINKS_DEBUG 0
#include "OBSWVersion.h" #include "OBSWVersion.h"
/* Can be used to switch device to NORMAL mode immediately */
#define OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP 1
/* Can be used for low-level debugging of the SPI bus */
#define FSFW_LINUX_SPI_WIRETAPPING 0
#ifdef __cplusplus #ifdef __cplusplus
#include "objects/systemObjectList.h" #include "objects/systemObjectList.h"

27
fsfwconfig/devices/spi.h Normal file
View File

@ -0,0 +1,27 @@
#ifndef FSFWCONFIG_DEVICES_SPI_H_
#define FSFWCONFIG_DEVICES_SPI_H_
#include <cstdint>
#include <linux/spi/spiDefinitions.h>
/**
* SPI configuration will be contained here to let the device handlers remain independent
* of SPI specific properties.
*/
namespace spi {
/* Default values, changing them is not supported for now */
static constexpr uint32_t DEFAULT_LIS3_SPEED = 3'900'000;
static constexpr spi::SpiModes DEFAULT_LIS3_MODE = spi::SpiModes::MODE_3;
static constexpr uint32_t DEFAULT_RM3100_SPEED = 976'000;
static constexpr spi::SpiModes DEFAULT_RM3100_MODE = spi::SpiModes::MODE_3;
static constexpr uint32_t DEFAULT_L3G_SPEED = 3'900'000;
static constexpr spi::SpiModes DEFAULT_L3G_MODE = spi::SpiModes::MODE_3;
}
#endif /* FSFWCONFIG_DEVICES_SPI_H_ */

View File

@ -43,6 +43,13 @@ namespace objects {
ACU_HANDLER = 0x44000004, ACU_HANDLER = 0x44000004,
TMP1075_HANDLER_1 = 0x44000005, TMP1075_HANDLER_1 = 0x44000005,
TMP1075_HANDLER_2 = 0x44000006, TMP1075_HANDLER_2 = 0x44000006,
MGM_0_LIS3_HANDLER = 0x4400007,
MGM_1_RM3100_HANDLER = 0x44000008,
MGM_2_LIS3_HANDLER = 0x44000009,
MGM_3_RM3100_HANDLER = 0x44000010,
GYRO_0_ADIS_HANDLER = 0x44000011,
GYRO_1_L3G_HANDLER = 0x44000012,
GYRO_2_L3G_HANDLER = 0x44000013,
MGM_0_LIS3_HANDLER = 0x4400007, MGM_0_LIS3_HANDLER = 0x4400007,
MGM_1_RM3100_HANDLER = 0x44000008, MGM_1_RM3100_HANDLER = 0x44000008,
@ -55,7 +62,10 @@ namespace objects {
/* Custom device handler */ /* Custom device handler */
PCDU_HANDLER = 0x44001000, PCDU_HANDLER = 0x44001000,
SOLAR_ARRAY_DEPL_HANDLER = 0x44001001, SOLAR_ARRAY_DEPL_HANDLER = 0x44001001,
<<<<<<< HEAD
SYRLINKS_HK_HANDLER = 0x44000009, SYRLINKS_HK_HANDLER = 0x44000009,
=======
>>>>>>> develop
/* 0x54 ('T') for thermal objects */ /* 0x54 ('T') for thermal objects */
HEATER_HANDLER = 0x54000003, HEATER_HANDLER = 0x54000003,

View File

@ -1,123 +0,0 @@
#include <fsfw/objectmanager/ObjectManagerIF.h>
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
#include <fsfwconfig/objects/systemObjectList.h>
#include <fsfwconfig/pollingsequence/PollingSequenceFactory.h>
ReturnValue_t pst::pollingSequenceInitDefault(FixedTimeslotTaskIF *thisSequence)
{
/* Length of a communication cycle */
uint32_t length = thisSequence->getPeriodMs();
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::HEATER_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SOLAR_ARRAY_DEPL_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
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::SYRLINKS_HK_HANDLER, length * 0.2, DeviceHandlerIF::SEND_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::SYRLINKS_HK_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE);
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::SYRLINKS_HK_HANDLER, length * 0.6, DeviceHandlerIF::SEND_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::SYRLINKS_HK_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
return HasReturnvaluesIF::RETURN_OK;
}
sif::error << "PollingSequence::initialize has errors!" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
ReturnValue_t pst::gomspacePstInit(FixedTimeslotTaskIF *thisSequence){
uint32_t length = thisSequence->getPeriodMs();
thisSequence->addSlot(objects::PCDU_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::PCDU_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::P60DOCK_HANDLER,
length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::PDU1_HANDLER,
length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::PDU2_HANDLER,
length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::ACU_HANDLER,
length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::P60DOCK_HANDLER,
length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::PDU1_HANDLER,
length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::PDU2_HANDLER,
length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::ACU_HANDLER,
length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::P60DOCK_HANDLER,
length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::PDU1_HANDLER,
length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::PDU2_HANDLER,
length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::ACU_HANDLER,
length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::P60DOCK_HANDLER,
length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::PDU1_HANDLER,
length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::PDU2_HANDLER,
length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::ACU_HANDLER,
length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::P60DOCK_HANDLER,
length * 0.8, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::PDU1_HANDLER,
length * 0.8, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::PDU2_HANDLER,
length * 0.8, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::ACU_HANDLER,
length * 0.8, DeviceHandlerIF::GET_READ);
if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Initialization of GomSpace PST failed" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t pst::pollingSequenceAcsTest(FixedTimeslotTaskIF *thisSequence) {
uint32_t length = thisSequence->getPeriodMs();
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);
if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Initialization of ACS Board PST failed" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
return HasReturnvaluesIF::RETURN_OK;
}

View File

@ -1,5 +1,6 @@
#ifndef POLLINGSEQUENCEFACTORY_H_ #ifndef POLLINGSEQUENCEFACTORY_H_
#define POLLINGSEQUENCEFACTORY_H_ #define POLLINGSEQUENCEFACTORY_H_
#include <fsfw/returnvalues/HasReturnvaluesIF.h> #include <fsfw/returnvalues/HasReturnvaluesIF.h>
class FixedTimeslotTaskIF; class FixedTimeslotTaskIF;

View File

@ -1,14 +1,19 @@
#include "SpiTestClass.h" #include "SpiTestClass.h"
#include <fsfwconfig/devices/gpioIds.h> #include <fsfwconfig/devices/gpioIds.h>
#include <fsfw/serviceinterface/ServiceInterface.h>
#include <linux/spi/spidev.h> #include <fsfw/serviceinterface/ServiceInterface.h>
#include <fcntl.h> #include <fsfw/globalfunctions/arrayprinter.h>
#include <fsfw/tasks/TaskFactory.h>
#include <fsfw/timemanager/Stopwatch.h> #include <fsfw/timemanager/Stopwatch.h>
#include <linux/gpio/gpioDefinitions.h> #include <linux/gpio/gpioDefinitions.h>
#include <linux/gpio/GpioCookie.h> #include <linux/gpio/GpioCookie.h>
#include <linux/utility/Utility.h> #include <linux/utility/Utility.h>
#include <linux/spi/spidev.h>
#include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <bitset> #include <bitset>
@ -19,7 +24,7 @@ SpiTestClass::SpiTestClass(object_id_t objectId, GpioIF* gpioIF): TestTask(objec
if(gpioIF == nullptr) { if(gpioIF == nullptr) {
sif::error << "SpiTestClass::SpiTestClass: Invalid GPIO ComIF!" << std::endl; sif::error << "SpiTestClass::SpiTestClass: Invalid GPIO ComIF!" << std::endl;
} }
testMode = TestModes::MGM_LIS3MDL; testMode = TestModes::GYRO_L3GD20H;
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());
} }
@ -38,6 +43,7 @@ ReturnValue_t SpiTestClass::performOneShotAction() {
break; break;
} }
case(TestModes::GYRO_L3GD20H): { case(TestModes::GYRO_L3GD20H): {
performL3gTest(gyro1L3gd20ChipSelect);
break; break;
} }
} }
@ -64,10 +70,10 @@ void SpiTestClass::performRm3100Test(uint8_t mgmId) {
else { else {
currentGpioId = gpioIds::MGM_3_RM3100_CS; currentGpioId = gpioIds::MGM_3_RM3100_CS;
} }
uint32_t rm3100speed = 3'900'000; uint32_t rm3100speed = 976'000;
uint8_t rm3100revidReg = 0x36; uint8_t rm3100revidReg = 0x36;
spi::SpiMode rm3100mode = spi::SpiMode::MODE_3; spi::SpiModes rm3100mode = spi::SpiModes::MODE_3;
//spiTransferStruct.speed_hz = rm3100Speed;
#ifdef RASPBERRY_PI #ifdef RASPBERRY_PI
std::string deviceName = "/dev/spidev0.0"; std::string deviceName = "/dev/spidev0.0";
#else #else
@ -85,9 +91,67 @@ void SpiTestClass::performRm3100Test(uint8_t mgmId) {
} }
setSpiSpeedAndMode(fileDescriptor, rm3100mode, rm3100speed); setSpiSpeedAndMode(fileDescriptor, rm3100mode, rm3100speed);
uint8_t revId = readStmRegister(fileDescriptor, currentGpioId, rm3100revidReg, false); uint8_t revId = readRegister(fileDescriptor, currentGpioId, rm3100revidReg);
sif::info << "SpiTestClass::performRm3100Test: Revision ID 0b" << std::bitset<8>(revId) << sif::info << "SpiTestClass::performRm3100Test: Revision ID 0b" << std::bitset<8>(revId) <<
std::endl; std::endl;
/* Write configuration to CMM register */
writeRegister(fileDescriptor, currentGpioId, 0x01, 0x75);
uint8_t cmmRegister = readRm3100Register(fileDescriptor , currentGpioId, 0x01);
sif::info << "SpiTestClass::performRm3100Test: CMM register value: " <<
std::hex << "0x" << static_cast<int>(cmmRegister) << std::dec << std::endl;
/* Read the cycle count registers */
uint8_t cycleCountsRaw[6];
readMultipleRegisters(fileDescriptor, currentGpioId, 0x04, cycleCountsRaw, 6);
uint16_t cycleCountX = cycleCountsRaw[0] << 8 | cycleCountsRaw[1];
uint16_t cycleCountY = cycleCountsRaw[2] << 8 | cycleCountsRaw[3];
uint16_t cycleCountZ = cycleCountsRaw[4] << 8 | cycleCountsRaw[5];
sif::info << "Cycle count X: " << cycleCountX << std::endl;
sif::info << "Cycle count Y: " << cycleCountY << std::endl;
sif::info << "Cycle count z: " << cycleCountZ << std::endl;
writeRegister(fileDescriptor, currentGpioId, 0x0B, 0x95);
uint8_t tmrcReg = readRm3100Register(fileDescriptor, currentGpioId, 0x0B);
sif::info << "SpiTestClass::performRm3100Test: TMRC register value: " <<
std::hex << "0x" << static_cast<int>(tmrcReg) << std::dec << std::endl;
TaskFactory::delayTask(10);
uint8_t statusReg = readRm3100Register(fileDescriptor, currentGpioId, 0x34);
sif::info << "SpiTestClass::performRm3100Test: Status Register 0b" <<
std::bitset<8>(statusReg) << std::endl;
/* This means that data is not ready */
if((statusReg & 0b1000'0000) == 0) {
sif::warning << "SpiTestClass::performRm3100Test: Data not ready!" << std::endl;
TaskFactory::delayTask(10);
uint8_t statusReg = readRm3100Register(fileDescriptor, currentGpioId, 0x34);
if((statusReg & 0b1000'0000) == 0) {
return;
}
}
uint32_t rm3100DefaultCycleCout = 0xC8;
/* Gain scales lineary with cycle count and is 38 for cycle count 100 */
float rm3100Gain = rm3100DefaultCycleCout / 100.0 * 38.0;
float scaleFactor = 1 / rm3100Gain;
uint8_t rawValues[9];
readMultipleRegisters(fileDescriptor, currentGpioId, 0x24, rawValues, 9);
/* The sensor generates 24 bit signed values */
int32_t rawX = ((rawValues[0] << 24) | (rawValues[1] << 16) | (rawValues[2] << 8)) >> 8;
int32_t rawY = ((rawValues[3] << 24) | (rawValues[4] << 16) | (rawValues[5] << 8)) >> 8;
int32_t rawZ = ((rawValues[6] << 24) | (rawValues[7] << 16) | (rawValues[8] << 8)) >> 8;
float fieldStrengthX = rawX * scaleFactor;
float fieldStrengthY = rawY * scaleFactor;
float fieldStrengthZ = rawZ * scaleFactor;
sif::info << "RM3100 measured field strenghts in microtesla:" << std::endl;
sif::info << "Field Strength X: " << fieldStrengthX << " \xC2\xB5T" << std::endl;
sif::info << "Field Strength Y: " << fieldStrengthY << " \xC2\xB5T" << std::endl;
sif::info << "Field Strength Z: " << fieldStrengthZ << " \xC2\xB5T" << std::endl;
} }
void SpiTestClass::performLis3MdlTest(uint8_t lis3Id) { void SpiTestClass::performLis3MdlTest(uint8_t lis3Id) {
@ -108,7 +172,7 @@ void SpiTestClass::performLis3MdlTest(uint8_t lis3Id) {
currentGpioId = gpioIds::MGM_2_LIS3_CS; currentGpioId = gpioIds::MGM_2_LIS3_CS;
} }
uint32_t spiSpeed = 3'900'000; uint32_t spiSpeed = 3'900'000;
spi::SpiMode spiMode = spi::SpiMode::MODE_3; spi::SpiModes spiMode = spi::SpiModes::MODE_3;
#ifdef RASPBERRY_PI #ifdef RASPBERRY_PI
std::string deviceName = "/dev/spidev0.0"; std::string deviceName = "/dev/spidev0.0";
#else #else
@ -126,77 +190,152 @@ void SpiTestClass::performLis3MdlTest(uint8_t lis3Id) {
setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed); setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed);
uint8_t whoAmIRegVal = readStmRegister(fileDescriptor, currentGpioId, whoAmIReg, false); uint8_t whoAmIRegVal = readStmRegister(fileDescriptor, currentGpioId, whoAmIReg, false);
sif::info << "SpiTestClass::performLis3MdlTest: WHO AM I Regiter 0b" << sif::info << "SpiTestClass::performLis3MdlTest: WHO AM I register 0b" <<
std::bitset<8>(whoAmIRegVal) << std::endl; std::bitset<8>(whoAmIRegVal) << std::endl;
} }
void SpiTestClass::performL3gTest(uint8_t l3gId) {
/* Configure all SPI chip selects and pull them high */
acsInit();
l3gId = gyro2L3gd20ChipSelect;
/* Adapt accordingly */
if(l3gId != gyro1L3gd20ChipSelect and l3gId != gyro2L3gd20ChipSelect) {
sif::warning << "SpiTestClass::performLis3MdlTest: Invalid MGM ID!" << std::endl;
}
gpioId_t currentGpioId = 0;
uint8_t chipSelectPin = l3gId;
uint8_t whoAmIReg = 0b0000'1111;
uint8_t whoAmIRegExpectedVal = 0b1101'0111;
if(chipSelectPin == gyro1L3gd20ChipSelect) {
currentGpioId = gpioIds::GYRO_1_L3G_CS;
}
else {
currentGpioId = gpioIds::GYRO_2_L3G_CS;
}
uint32_t spiSpeed = 3'900'000;
spi::SpiModes spiMode = spi::SpiModes::MODE_3;
#ifdef RASPBERRY_PI
std::string deviceName = "/dev/spidev0.0";
#else
std::string deviceName = "placeholder";
#endif
int fileDescriptor = 0;
utility::UnixFileHelper fileHelper(deviceName, &fileDescriptor, O_RDWR,
"SpiComIF::initializeInterface: ");
if(fileHelper.getOpenResult()) {
sif::error << "SpiTestClass::performLis3Mdl3100Test: File descriptor could not be opened!"
<< std::endl;
return;
}
setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed);
uint8_t whoAmIRegVal = readStmRegister(fileDescriptor, currentGpioId, whoAmIReg, false);
sif::info << "SpiTestClass::performLis3MdlTest: WHO AM I register 0b" <<
std::bitset<8>(whoAmIRegVal) << std::endl;
if(whoAmIRegVal != whoAmIRegExpectedVal) {
sif::warning << "SpiTestClass::performL3gTest: Read WHO AM I register invalid!" <<
std::endl;
}
uint8_t ctrlReg1Addr = 0b0010'0000;
{
uint8_t commandRegs[5];
commandRegs[0] = 0b0000'1111;
commandRegs[1] = 0x0;
commandRegs[2] = 0x0;
/* Configure big endian data format */
commandRegs[3] = 0b0100'0000;
commandRegs[4] = 0x0;
writeMultipleStmRegisters(fileDescriptor, currentGpioId, ctrlReg1Addr, commandRegs,
sizeof(commandRegs));
uint8_t readRegs[5];
readMultipleRegisters(fileDescriptor, currentGpioId, ctrlReg1Addr, readRegs,
sizeof(readRegs));
for(uint8_t idx = 0; idx < sizeof(readRegs); idx++) {
if(readRegs[idx] != commandRegs[0]) {
sif::warning << "SpiTestClass::performL3gTest: Read control register" <<
static_cast<int>(idx + 1) << "not equal to configured value" << std::endl;
}
}
}
uint8_t readOutBuffer[14];
readMultipleStmRegisters(fileDescriptor, currentGpioId, ctrlReg1Addr, readOutBuffer,
sizeof(readOutBuffer));
uint8_t statusReg = readOutBuffer[7];
sif::info << "SpiTestClass::performL3gTest: Status Register 0b" <<
std::bitset<8>(statusReg) << std::endl;
uint16_t l3gRange = 245;
float scaleFactor = static_cast<float>(l3gRange) / INT16_MAX;
/* The sensor spits out little endian */
int16_t angVelocRawX = (readOutBuffer[8] << 8) | readOutBuffer[9];
int16_t angVelocRawY = (readOutBuffer[10] << 8) | readOutBuffer[11];
int16_t angVelocRawZ = (readOutBuffer[12] << 8) | readOutBuffer[13];
float angVelocX = scaleFactor * angVelocRawX;
float angVelocY = scaleFactor * angVelocRawY;
float angVelocZ = scaleFactor * angVelocRawZ;
sif::info << "Angular velocities for the L3GD20H in degrees per second:" << std::endl;
sif::info << "X: " << angVelocX << std::endl;
sif::info << "Y: " << angVelocY << std::endl;
sif::info << "Z: " << angVelocZ << std::endl;
}
void SpiTestClass::acsInit() { void SpiTestClass::acsInit() {
GpioCookie* gpioCookie = new GpioCookie(); GpioCookie* gpioCookie = new GpioCookie();
std::string rpiGpioName = "gpiochip0"; std::string rpiGpioName = "gpiochip0";
{ {
GpiodRegular gpio(rpiGpioName, mgm0Lis3ChipSelect, "MGM_0_LIS3", GpiodRegular gpio(rpiGpioName, mgm0Lis3ChipSelect, "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);
} }
{ {
GpiodRegular gpio(rpiGpioName, mgm1Rm3100ChipSelect, "MGM_1_RM3100", GpiodRegular gpio(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);
} }
{ {
GpiodRegular gpio(rpiGpioName, gyro0AdisChipSelect, "GYRO_0_ADIS", GpiodRegular gpio(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);
} }
{ {
GpiodRegular gpio(rpiGpioName, gyro1L3gd20ChipSelect, "GYRO_1_L3G", GpiodRegular gpio(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);
} }
{ {
GpiodRegular gpio(rpiGpioName, gyro2L3gd20ChipSelect, "GYRO_2_L3G", GpiodRegular gpio(rpiGpioName, gyro2L3gd20ChipSelect, "GYRO_2_L3G",
gpio::Direction::OUT, 1); gpio::Direction::OUT, 1);
gpioCookie->addGpio(gpioIds::GYRO_2_L3G_CS, &gpio); gpioCookie->addGpio(gpioIds::GYRO_2_L3G_CS, gpio);
} }
{ {
GpiodRegular gpio(rpiGpioName, mgm2Lis3mdlChipSelect, "MGM_2_LIS3", GpiodRegular gpio(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);
} }
{ {
GpiodRegular gpio(rpiGpioName, mgm3Rm3100ChipSelect, "MGM_3_RM3100", GpiodRegular gpio(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);
} }
if(gpioIF != nullptr) { if(gpioIF != nullptr) {
gpioIF->addGpios(gpioCookie); gpioIF->addGpios(gpioCookie);
} }
} }
void SpiTestClass::writeStmRegister(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t value, void SpiTestClass::setSpiSpeedAndMode(int spiFd, spi::SpiModes mode, uint32_t speed) {
bool autoIncrement) { int mode_test = SPI_MODE_3;
if(autoIncrement) { int retval = ioctl(spiFd, SPI_IOC_WR_MODE, &mode_test);//reinterpret_cast<uint8_t*>(&mode));
reg |= STM_AUTO_INCR_MASK;
}
spiTransferStruct.len = 2;
sendBuffer[0] = reg;
sendBuffer[1] = value;
if(gpioIF != nullptr and chipSelect != gpio::NO_GPIO) {
gpioIF->pullLow(chipSelect);
}
int retval = ioctl(fd, SPI_IOC_MESSAGE(1), &spiTransferStruct);
if(retval != 0) {
utility::handleIoctlError("SpiTestClass::writeStmRegister: Write failed");
}
if(gpioIF != nullptr and chipSelect != gpio::NO_GPIO) {
gpioIF->pullHigh(chipSelect);
}
}
void SpiTestClass::setSpiSpeedAndMode(int spiFd, spi::SpiMode mode, uint32_t speed) {
int retval = ioctl(spiFd, SPI_IOC_WR_MODE, reinterpret_cast<uint8_t*>(&mode));
if(retval != 0) { if(retval != 0) {
utility::handleIoctlError("SpiTestClass::performRm3100Test: Setting SPI mode failed!"); utility::handleIoctlError("SpiTestClass::performRm3100Test: Setting SPI mode failed!");
} }
@ -207,12 +346,114 @@ void SpiTestClass::setSpiSpeedAndMode(int spiFd, spi::SpiMode mode, uint32_t spe
} }
} }
void SpiTestClass::writeRegister(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t value) {
spiTransferStruct.len = 2;
sendBuffer[0] = reg;
sendBuffer[1] = value;
if(gpioIF != nullptr and chipSelect != gpio::NO_GPIO) {
gpioIF->pullLow(chipSelect);
}
int retval = ioctl(fd, SPI_IOC_MESSAGE(1), &spiTransferStruct);
if(retval < 0) {
utility::handleIoctlError("SpiTestClass::writeRegister: Write failed");
}
if(gpioIF != nullptr and chipSelect != gpio::NO_GPIO) {
gpioIF->pullHigh(chipSelect);
}
}
void SpiTestClass::writeStmRegister(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t value,
bool autoIncrement) {
if(autoIncrement) {
reg |= STM_AUTO_INCR_MASK;
}
writeRegister(fd, chipSelect, reg, value);
}
void SpiTestClass::writeMultipleStmRegisters(int fd, gpioId_t chipSelect, uint8_t reg,
uint8_t *values, size_t len) {
if(values == nullptr) {
return;
}
reg |= STM_AUTO_INCR_MASK;
/* Clear read mask */
reg &= ~STM_READ_MASK;
writeMultipleRegisters(fd, chipSelect, reg, values, len);
}
void SpiTestClass::writeMultipleRegisters(int fd, gpioId_t chipSelect, uint8_t reg,
uint8_t *values, size_t len) {
if(values == nullptr) {
return;
}
sendBuffer[0] = reg;
std::memcpy(sendBuffer.data() + 1, values, len);
spiTransferStruct.len = len + 1;
if(gpioIF != nullptr and chipSelect != gpio::NO_GPIO) {
gpioIF->pullLow(chipSelect);
}
int retval = ioctl(fd, SPI_IOC_MESSAGE(1), &spiTransferStruct);
if(retval < 0) {
utility::handleIoctlError("SpiTestClass::readRegister: Read failed");
}
if(gpioIF != nullptr and chipSelect != gpio::NO_GPIO) {
gpioIF->pullHigh(chipSelect);
}
}
uint8_t SpiTestClass::readRm3100Register(int fd, gpioId_t chipSelect, uint8_t reg) {
return readStmRegister(fd, chipSelect, reg, false);
}
void SpiTestClass::readMultipleStmRegisters(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t *reply,
size_t len) {
reg |= STM_AUTO_INCR_MASK;
readMultipleRegisters(fd, chipSelect, reg, reply, len);
}
void SpiTestClass::readMultipleRegisters(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t *reply,
size_t len) {
if(reply == nullptr) {
return;
}
spiTransferStruct.len = len + 1;
sendBuffer[0] = reg | STM_READ_MASK;
for(uint8_t idx = 0; idx < len ; idx ++) {
sendBuffer[idx + 1] = 0;
}
if(gpioIF != nullptr and chipSelect != gpio::NO_GPIO) {
gpioIF->pullLow(chipSelect);
}
int retval = ioctl(fd, SPI_IOC_MESSAGE(1), &spiTransferStruct);
if(retval < 0) {
utility::handleIoctlError("SpiTestClass::readRegister: Read failed");
}
if(gpioIF != nullptr and chipSelect != gpio::NO_GPIO) {
gpioIF->pullHigh(chipSelect);
}
std::memcpy(reply, recvBuffer.data() + 1, len);
}
uint8_t SpiTestClass::readStmRegister(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t SpiTestClass::readStmRegister(int fd, gpioId_t chipSelect, uint8_t reg,
bool autoIncrement) { bool autoIncrement) {
reg |= STM_READ_MASK; reg |= STM_READ_MASK;
if(autoIncrement) { if(autoIncrement) {
reg |= STM_AUTO_INCR_MASK; reg |= STM_AUTO_INCR_MASK;
} }
return readRegister(fd, chipSelect, reg);
}
uint8_t SpiTestClass::readRegister(int fd, gpioId_t chipSelect, uint8_t reg) {
spiTransferStruct.len = 2; spiTransferStruct.len = 2;
sendBuffer[0] = reg; sendBuffer[0] = reg;
sendBuffer[1] = 0; sendBuffer[1] = 0;
@ -222,7 +463,7 @@ uint8_t SpiTestClass::readStmRegister(int fd, gpioId_t chipSelect, uint8_t reg,
} }
int retval = ioctl(fd, SPI_IOC_MESSAGE(1), &spiTransferStruct); int retval = ioctl(fd, SPI_IOC_MESSAGE(1), &spiTransferStruct);
if(retval < 0) { if(retval < 0) {
utility::handleIoctlError("SpiTestClass::readStmRegiste: Read failed"); utility::handleIoctlError("SpiTestClass::readRegister: Read failed");
} }
if(gpioIF != nullptr and chipSelect != gpio::NO_GPIO) { if(gpioIF != nullptr and chipSelect != gpio::NO_GPIO) {
gpioIF->pullHigh(chipSelect); gpioIF->pullHigh(chipSelect);

View File

@ -28,10 +28,11 @@ private:
std::array<uint8_t, 128> recvBuffer; std::array<uint8_t, 128> recvBuffer;
std::array<uint8_t, 128> sendBuffer; std::array<uint8_t, 128> sendBuffer;
struct spi_ioc_transfer spiTransferStruct; struct spi_ioc_transfer spiTransferStruct = {};
void performRm3100Test(uint8_t mgmId); void performRm3100Test(uint8_t mgmId);
void performLis3MdlTest(uint8_t lis3Id); void performLis3MdlTest(uint8_t lis3Id);
void performL3gTest(uint8_t l3gId);
/* ACS board specific code which pulls all GPIOs high */ /* ACS board specific code which pulls all GPIOs high */
void acsInit(); void acsInit();
@ -46,12 +47,35 @@ private:
uint8_t mgm3Rm3100ChipSelect = 27; uint8_t mgm3Rm3100ChipSelect = 27;
static constexpr uint8_t STM_READ_MASK = 0b1000'0000; static constexpr uint8_t STM_READ_MASK = 0b1000'0000;
<<<<<<< HEAD
static constexpr uint8_t STM_AUTO_INCR_MASK = 0b0100'0000; static constexpr uint8_t STM_AUTO_INCR_MASK = 0b0100'0000;
void setSpiSpeedAndMode(int spiFd, spi::SpiMode mode, uint32_t speed); void setSpiSpeedAndMode(int spiFd, spi::SpiMode mode, uint32_t speed);
void writeStmRegister(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t value, void writeStmRegister(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t value,
bool autoIncrement); bool autoIncrement);
uint8_t readStmRegister(int fd, gpioId_t chipSelect, uint8_t reg, bool autoIncrement); uint8_t readStmRegister(int fd, gpioId_t chipSelect, uint8_t reg, bool autoIncrement);
=======
static constexpr uint8_t RM3100_READ_MASK = STM_READ_MASK;
static constexpr uint8_t STM_AUTO_INCR_MASK = 0b0100'0000;
void setSpiSpeedAndMode(int spiFd, spi::SpiModes mode, uint32_t speed);
void writeStmRegister(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t value,
bool autoIncrement);
void writeMultipleStmRegisters(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t* values,
size_t len);
void writeMultipleRegisters(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t *values,
size_t len);
void writeRegister(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t value);
uint8_t readRm3100Register(int fd, gpioId_t chipSelect, uint8_t reg);
uint8_t readStmRegister(int fd, gpioId_t chipSelect, uint8_t reg, bool autoIncrement);
uint8_t readRegister(int fd, gpioId_t chipSelect, uint8_t reg);
void readMultipleStmRegisters(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t *reply,
size_t len);
void readMultipleRegisters(int fd, gpioId_t chipSelect, uint8_t reg,
uint8_t* reply, size_t len);
>>>>>>> develop
}; };

View File

@ -88,8 +88,12 @@ ReturnValue_t LinuxLibgpioIF::configureRegularGpio(gpioId_t gpioId, GpiodRegular
lineNum = regularGpio->lineNum; lineNum = regularGpio->lineNum;
lineHandle = gpiod_chip_get_line(chip, lineNum); lineHandle = gpiod_chip_get_line(chip, lineNum);
if (!lineHandle) { if (!lineHandle) {
<<<<<<< HEAD
sif::error << "LinuxLibgpioIF::configureGpios: Failed to open line for GPIO with id " sif::error << "LinuxLibgpioIF::configureGpios: Failed to open line for GPIO with id "
<< gpioId << std::endl; << gpioId << std::endl;
=======
sif::error << "LinuxLibgpioIF::configureGpios: Failed to open line" << std::endl;
>>>>>>> develop
gpiod_chip_close(chip); gpiod_chip_close(chip);
return RETURN_FAILED; return RETURN_FAILED;
} }

View File

@ -1,10 +1,11 @@
#include "SpiComIF.h" #include "SpiComIF.h"
#include <OBSWConfig.h>
#include <linux/utility/Utility.h> #include <linux/utility/Utility.h>
#include <linux/spi/SpiCookie.h> #include <linux/spi/SpiCookie.h>
#include <fsfw/ipc/MutexFactory.h> #include <fsfw/ipc/MutexFactory.h>
#include <fsfw/ipc/MutexHelper.h> #include <fsfw/ipc/MutexGuard.h>
#include <fsfw/globalfunctions/arrayprinter.h> #include <fsfw/globalfunctions/arrayprinter.h>
#include <linux/spi/spidev.h> #include <linux/spi/spidev.h>
@ -78,7 +79,7 @@ ReturnValue_t SpiComIF::initializeInterface(CookieIF *cookie) {
} }
size_t spiSpeed = 0; size_t spiSpeed = 0;
spi::SpiMode spiMode = spi::SpiMode::MODE_0; spi::SpiModes spiMode = spi::SpiModes::MODE_0;
SpiCookie::UncommonParameters params; SpiCookie::UncommonParameters params;
spiCookie->getSpiParameters(spiMode, spiSpeed, &params); spiCookie->getSpiParameters(spiMode, spiSpeed, &params);
@ -162,7 +163,7 @@ ReturnValue_t SpiComIF::sendMessage(CookieIF *cookie, const uint8_t *sendData, s
if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) { if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) {
return OPENING_FILE_FAILED; return OPENING_FILE_FAILED;
} }
spi::SpiMode spiMode = spi::SpiMode::MODE_0; spi::SpiModes spiMode = spi::SpiModes::MODE_0;
uint32_t spiSpeed = 0; uint32_t spiSpeed = 0;
spiCookie->getSpiParameters(spiMode, spiSpeed, nullptr); spiCookie->getSpiParameters(spiMode, spiSpeed, nullptr);
setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed); setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed);
@ -173,7 +174,7 @@ ReturnValue_t SpiComIF::sendMessage(CookieIF *cookie, const uint8_t *sendData, s
gpioId_t gpioId = spiCookie->getChipSelectPin(); gpioId_t gpioId = spiCookie->getChipSelectPin();
/* GPIO access is mutex protected */ /* GPIO access is mutex protected */
MutexHelper(spiMutex, timeoutType, timeoutMs); MutexGuard(spiMutex, timeoutType, timeoutMs);
/* Pull SPI CS low. For now, no support for active high given */ /* Pull SPI CS low. For now, no support for active high given */
if(gpioId != gpio::NO_GPIO) { if(gpioId != gpio::NO_GPIO) {
@ -188,6 +189,18 @@ ReturnValue_t SpiComIF::sendMessage(CookieIF *cookie, const uint8_t *sendData, s
utility::handleIoctlError("SpiComIF::sendMessage: ioctl error."); utility::handleIoctlError("SpiComIF::sendMessage: ioctl error.");
result = FULL_DUPLEX_TRANSFER_FAILED; result = FULL_DUPLEX_TRANSFER_FAILED;
} }
#if FSFW_LINUX_SPI_WIRETAPPING == 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "Sent SPI data: " << std::endl;
size_t dataLen = spiCookie->getTransferStructHandle()->len;
uint8_t* dataPtr = reinterpret_cast<uint8_t*>(spiCookie->getTransferStructHandle()->tx_buf);
arrayprinter::print(dataPtr, dataLen, OutputType::HEX, false);
sif::info << "Received SPI data: " << std::endl;
dataPtr = reinterpret_cast<uint8_t*>(spiCookie->getTransferStructHandle()->rx_buf);
arrayprinter::print(dataPtr, dataLen, OutputType::HEX, false);
#else
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
#endif /* FSFW_LINUX_SPI_WIRETAPPING == 1 */
} }
else { else {
/* We write with a blocking half-duplex transfer here */ /* We write with a blocking half-duplex transfer here */
@ -242,7 +255,7 @@ ReturnValue_t SpiComIF::requestReceiveMessage(CookieIF *cookie, size_t requestLe
} }
gpioId_t gpioId = spiCookie->getChipSelectPin(); gpioId_t gpioId = spiCookie->getChipSelectPin();
MutexHelper(spiMutex, timeoutType, timeoutMs); MutexGuard(spiMutex, timeoutType, timeoutMs);
if(gpioId != gpio::NO_GPIO) { if(gpioId != gpio::NO_GPIO) {
gpioComIF->pullLow(gpioId); gpioComIF->pullLow(gpioId);
} }
@ -295,7 +308,7 @@ ReturnValue_t SpiComIF::getReadBuffer(address_t spiAddress, uint8_t** buffer) {
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
void SpiComIF::setSpiSpeedAndMode(int spiFd, spi::SpiMode mode, uint32_t speed) { void SpiComIF::setSpiSpeedAndMode(int spiFd, spi::SpiModes mode, uint32_t speed) {
int retval = ioctl(spiFd, SPI_IOC_WR_MODE, reinterpret_cast<uint8_t*>(&mode)); int retval = ioctl(spiFd, SPI_IOC_WR_MODE, reinterpret_cast<uint8_t*>(&mode));
if(retval != 0) { if(retval != 0) {
utility::handleIoctlError("SpiTestClass::performRm3100Test: Setting SPI mode failed!"); utility::handleIoctlError("SpiTestClass::performRm3100Test: Setting SPI mode failed!");

View File

@ -57,7 +57,7 @@ private:
ReturnValue_t getReadBuffer(address_t spiAddress, uint8_t** buffer); ReturnValue_t getReadBuffer(address_t spiAddress, uint8_t** buffer);
void setSpiSpeedAndMode(int spiFd, spi::SpiMode mode, uint32_t speed); void setSpiSpeedAndMode(int spiFd, spi::SpiModes mode, uint32_t speed);
}; };
#endif /* LINUX_SPI_SPICOMIF_H_ */ #endif /* LINUX_SPI_SPICOMIF_H_ */

View File

@ -1,17 +1,17 @@
#include "SpiCookie.h" #include "SpiCookie.h"
SpiCookie::SpiCookie(address_t spiAddress, gpioId_t chipSelect, std::string spiDev, SpiCookie::SpiCookie(address_t spiAddress, gpioId_t chipSelect, std::string spiDev,
const size_t maxSize, spi::SpiMode spiMode, uint32_t spiSpeed): spiAddress(spiAddress), const size_t maxSize, spi::SpiModes spiMode, uint32_t spiSpeed): spiAddress(spiAddress),
chipSelectPin(chipSelect), spiDevice(spiDev), maxSize(maxSize), spiMode(spiMode), chipSelectPin(chipSelect), spiDevice(spiDev), maxSize(maxSize), spiMode(spiMode),
spiSpeed(spiSpeed) { spiSpeed(spiSpeed) {
} }
SpiCookie::SpiCookie(address_t spiAddress, std::string spiDev, const size_t maxSize, SpiCookie::SpiCookie(address_t spiAddress, std::string spiDev, const size_t maxSize,
spi::SpiMode spiMode, uint32_t spiSpeed): spi::SpiModes spiMode, uint32_t spiSpeed):
SpiCookie(spiAddress, gpio::NO_GPIO, spiDev, maxSize, spiMode, spiSpeed) { SpiCookie(spiAddress, gpio::NO_GPIO, spiDev, maxSize, spiMode, spiSpeed) {
} }
void SpiCookie::getSpiParameters(spi::SpiMode& spiMode, uint32_t& spiSpeed, void SpiCookie::getSpiParameters(spi::SpiModes& spiMode, uint32_t& spiSpeed,
UncommonParameters* parameters) const { UncommonParameters* parameters) const {
spiMode = this->spiMode; spiMode = this->spiMode;
spiSpeed = this->spiSpeed; spiSpeed = this->spiSpeed;
@ -97,3 +97,11 @@ void SpiCookie::assignTransferSize(size_t transferSize) {
size_t SpiCookie::getCurrentTransferSize() const { size_t SpiCookie::getCurrentTransferSize() const {
return spiTransferStruct.len; return spiTransferStruct.len;
} }
void SpiCookie::setSpiSpeed(uint32_t newSpeed) {
this->spiSpeed = newSpeed;
}
void SpiCookie::setSpiMode(spi::SpiModes newMode) {
this->spiMode = newMode;
}

View File

@ -17,22 +17,27 @@ public:
* @param chipSelect Chip select. gpio::NO_GPIO can be used for hardware slave selects. * @param chipSelect Chip select. gpio::NO_GPIO can be used for hardware slave selects.
* @param spiDev * @param spiDev
* @param maxSize * @param maxSize
* @param spieSpeed SPI clock frequency in Hz.
*/ */
SpiCookie(address_t spiAddress, gpioId_t chipSelect, std::string spiDev, SpiCookie(address_t spiAddress, gpioId_t chipSelect, std::string spiDev,
const size_t maxReplySize, spi::SpiMode spiMode, uint32_t spiSpeed); const size_t maxReplySize, spi::SpiModes spiMode, uint32_t spiSpeed);
/** /**
* Like constructor above, but without a dedicated GPIO CS. Can be used for hardware * Like constructor above, but without a dedicated GPIO CS. Can be used for hardware
* slave select or if CS logic is performed with decoders. * slave select or if CS logic is performed with decoders.
*/ */
SpiCookie(address_t spiAddress, std::string spiDev, const size_t maxReplySize, SpiCookie(address_t spiAddress, std::string spiDev, const size_t maxReplySize,
spi::SpiMode spiMode, uint32_t spiSpeed); spi::SpiModes spiMode, uint32_t spiSpeed);
address_t getSpiAddress() const; address_t getSpiAddress() const;
std::string getSpiDevice() const; std::string getSpiDevice() const;
gpioId_t getChipSelectPin() const; gpioId_t getChipSelectPin() const;
size_t getMaxBufferSize() const; size_t getMaxBufferSize() const;
/** Enables changing SPI speed at run-time */
void setSpiSpeed(uint32_t newSpeed);
/** Enables changing the SPI mode at run-time */
void setSpiMode(spi::SpiModes newMode);
/** /**
* True if SPI transfers should be performed in full duplex mode * True if SPI transfers should be performed in full duplex mode
* @return * @return
@ -82,7 +87,7 @@ public:
void setCsHigh(bool enable); void setCsHigh(bool enable);
void setBitsPerWord(uint8_t bitsPerWord); void setBitsPerWord(uint8_t bitsPerWord);
void getSpiParameters(spi::SpiMode& spiMode, uint32_t& spiSpeed, void getSpiParameters(spi::SpiModes& spiMode, uint32_t& spiSpeed,
UncommonParameters* parameters = nullptr) const; UncommonParameters* parameters = nullptr) const;
/** /**
@ -101,7 +106,7 @@ private:
std::string spiDevice; std::string spiDevice;
const size_t maxSize; const size_t maxSize;
spi::SpiMode spiMode; spi::SpiModes spiMode;
uint32_t spiSpeed; uint32_t spiSpeed;
bool halfDuplex = false; bool halfDuplex = false;

View File

@ -1,9 +1,11 @@
#ifndef LINUX_SPI_SPIDEFINITONS_H_ #ifndef LINUX_SPI_SPIDEFINITONS_H_
#define LINUX_SPI_SPIDEFINITONS_H_ #define LINUX_SPI_SPIDEFINITONS_H_
#include <cstdint>
namespace spi { namespace spi {
enum SpiMode { enum SpiModes: uint8_t {
MODE_0, MODE_0,
MODE_1, MODE_1,
MODE_2, MODE_2,

View File

@ -19,7 +19,7 @@
<folderInfo id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443." name="/" resourcePath=""> <folderInfo id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.mingw.base.1176904738" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.base"> <toolChain id="cdt.managedbuild.toolchain.gnu.mingw.base.1176904738" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.base">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.GNU_ELF;org.eclipse.cdt.core.PE64" id="cdt.managedbuild.target.gnu.platform.mingw.base.1087094604" name="Debug Platform" osList="win32" superClass="cdt.managedbuild.target.gnu.platform.mingw.base"/> <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.GNU_ELF;org.eclipse.cdt.core.PE64" id="cdt.managedbuild.target.gnu.platform.mingw.base.1087094604" name="Debug Platform" osList="win32" superClass="cdt.managedbuild.target.gnu.platform.mingw.base"/>
<builder arguments="--build ." buildPath="${workspace_loc:/eive_obsw/Debug}" command="cmake" id="cdt.managedbuild.builder.gnu.cross.1026777292" incrementalBuildTarget="" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.builder.gnu.cross"/> <builder arguments="--build ." buildPath="${workspace_loc:/eive_obsw/Debug-Host}" command="cmake" id="cdt.managedbuild.builder.gnu.cross.1026777292" incrementalBuildTarget="" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.builder.gnu.cross"/>
<tool id="cdt.managedbuild.tool.gnu.assembler.mingw.base.813737526" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.base"> <tool id="cdt.managedbuild.tool.gnu.assembler.mingw.base.813737526" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.base">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1289649483" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1289649483" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool> </tool>
@ -70,7 +70,7 @@
<folderInfo id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.1043649249." name="/" resourcePath=""> <folderInfo id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.1043649249." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.mingw.base.754560869" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.base"> <toolChain id="cdt.managedbuild.toolchain.gnu.mingw.base.754560869" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.base">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.GNU_ELF;org.eclipse.cdt.core.PE64" id="cdt.managedbuild.target.gnu.platform.mingw.base.2125491129" name="Debug Platform" osList="win32" superClass="cdt.managedbuild.target.gnu.platform.mingw.base"/> <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.GNU_ELF;org.eclipse.cdt.core.PE64" id="cdt.managedbuild.target.gnu.platform.mingw.base.2125491129" name="Debug Platform" osList="win32" superClass="cdt.managedbuild.target.gnu.platform.mingw.base"/>
<builder arguments="--build ." buildPath="${workspace_loc:/eive_obsw/Release}" command="cmake" id="cdt.managedbuild.builder.gnu.cross.1840576359" incrementalBuildTarget="" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.builder.gnu.cross"/> <builder arguments="--build ." buildPath="${workspace_loc:/eive_obsw/Release-Host}" command="cmake" id="cdt.managedbuild.builder.gnu.cross.1840576359" incrementalBuildTarget="" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.builder.gnu.cross"/>
<tool id="cdt.managedbuild.tool.gnu.assembler.mingw.base.1445228447" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.base"> <tool id="cdt.managedbuild.tool.gnu.assembler.mingw.base.1445228447" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.base">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1571446155" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1571446155" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool> </tool>
@ -233,7 +233,7 @@
</extensions> </extensions>
</storageModule> </storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0"> <storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildProperties="" description="" errorParsers="org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GCCErrorParser" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851" name="eive-rpi-debug-win" optionalBuildProperties="org.eclipse.cdt.docker.launcher.containerbuild.property.enablement=null,org.eclipse.cdt.docker.launcher.containerbuild.property.selectedvolumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.volumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.image=null,org.eclipse.cdt.docker.launcher.containerbuild.property.connection=null" parent="org.eclipse.cdt.build.core.emptycfg"> <configuration artifactName="${ProjName}" buildProperties="" description="" errorParsers="org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GCCErrorParser" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851" name="eive-rpi-debug-win" optionalBuildProperties="org.eclipse.cdt.docker.launcher.containerbuild.property.enablement=null,org.eclipse.cdt.docker.launcher.containerbuild.property.volumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.connection=null,org.eclipse.cdt.docker.launcher.containerbuild.property.selectedvolumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.image=null" parent="org.eclipse.cdt.build.core.emptycfg">
<folderInfo id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851." name="/" resourcePath=""> <folderInfo id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851." name="/" resourcePath="">
<toolChain id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1971474557" name="Arm Cross GCC" superClass="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base"> <toolChain id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1971474557" name="Arm Cross GCC" superClass="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base">
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.1813444167" name="Architecture" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.architecture" value="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.arm" valueType="enumerated"/> <option id="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.1813444167" name="Architecture" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.architecture" value="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.arm" valueType="enumerated"/>
@ -310,7 +310,7 @@
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.other.1620157986" name="Other debugging flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.other"/> <option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.other.1620157986" name="Other debugging flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.other"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.showDevicesTab.1227132942" name="showDevicesTab" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.showDevicesTab"/> <option id="ilg.gnuarmeclipse.managedbuild.cross.option.showDevicesTab.1227132942" name="showDevicesTab" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.showDevicesTab"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform.864731133" isAbstract="false" osList="all" superClass="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform"/> <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform.864731133" isAbstract="false" osList="all" superClass="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform"/>
<builder arguments="--build ." buildPath="${workspace_loc:/eive_obsw/Debug}" command="cmake" id="ilg.gnuarmeclipse.managedbuild.cross.builder.342223596" incrementalBuildTarget="" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="ilg.gnuarmeclipse.managedbuild.cross.builder"/> <builder arguments="--build ." autoBuildTarget="all" buildPath="${workspace_loc:/eive_obsw/Debug-RPi}" cleanBuildTarget="clean" command="cmake" enableAutoBuild="false" enableCleanBuild="true" enabledIncrementalBuild="true" id="ilg.gnuarmeclipse.managedbuild.cross.builder.342223596" incrementalBuildTarget="" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="ilg.gnuarmeclipse.managedbuild.cross.builder"/>
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.944427471" name="GNU Arm Cross Assembler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler"> <tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.944427471" name="GNU Arm Cross Assembler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler">
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor.319232842" name="Use preprocessor" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor" value="true" valueType="boolean"/> <option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor.319232842" name="Use preprocessor" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor" value="true" valueType="boolean"/>
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input.44504375" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input"/> <inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input.44504375" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input"/>
@ -322,6 +322,7 @@
</option> </option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs.864441147" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols"> <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs.864441147" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
<listOptionValue builtIn="false" value="LINUX=1"/> <listOptionValue builtIn="false" value="LINUX=1"/>
<listOptionValue builtIn="false" value="RASPBERRY_PI"/>
</option> </option>
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.920837857" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input"/> <inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.920837857" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input"/>
</tool> </tool>
@ -332,6 +333,7 @@
</option> </option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs.1683468766" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols"> <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs.1683468766" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
<listOptionValue builtIn="false" value="LINUX=1"/> <listOptionValue builtIn="false" value="LINUX=1"/>
<listOptionValue builtIn="false" value="RASPBERRY_PI"/>
</option> </option>
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.1925043110" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input"/> <inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.1925043110" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input"/>
</tool> </tool>
@ -459,7 +461,7 @@
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.other.2081670577" name="Other debugging flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.other"/> <option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.other.2081670577" name="Other debugging flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.other"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.showDevicesTab.636531967" name="showDevicesTab" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.showDevicesTab"/> <option id="ilg.gnuarmeclipse.managedbuild.cross.option.showDevicesTab.636531967" name="showDevicesTab" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.showDevicesTab"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform.1186120086" isAbstract="false" osList="all" superClass="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform"/> <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform.1186120086" isAbstract="false" osList="all" superClass="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform"/>
<builder arguments="--build ." buildPath="${workspace_loc:/fsfw_example/Release}" command="cmake" id="ilg.gnuarmeclipse.managedbuild.cross.builder.292623790" incrementalBuildTarget="" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="ilg.gnuarmeclipse.managedbuild.cross.builder"/> <builder arguments="--build ." buildPath="${workspace_loc:/eive_obsw/Release-RPi}" command="cmake" id="ilg.gnuarmeclipse.managedbuild.cross.builder.292623790" incrementalBuildTarget="" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="ilg.gnuarmeclipse.managedbuild.cross.builder"/>
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.1419530222" name="GNU Arm Cross Assembler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler"> <tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.1419530222" name="GNU Arm Cross Assembler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler">
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor.700547918" name="Use preprocessor" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor" value="true" valueType="boolean"/> <option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor.700547918" name="Use preprocessor" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor" value="true" valueType="boolean"/>
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input.789142005" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input"/> <inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input.789142005" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input"/>
@ -471,6 +473,7 @@
</option> </option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs.1796598598" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols"> <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs.1796598598" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
<listOptionValue builtIn="false" value="LINUX=1"/> <listOptionValue builtIn="false" value="LINUX=1"/>
<listOptionValue builtIn="false" value="RASPBERRY_PI"/>
</option> </option>
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.2081570054" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input"/> <inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.2081570054" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input"/>
</tool> </tool>
@ -481,6 +484,7 @@
</option> </option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs.1881223360" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols"> <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs.1881223360" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
<listOptionValue builtIn="false" value="LINUX=1"/> <listOptionValue builtIn="false" value="LINUX=1"/>
<listOptionValue builtIn="false" value="RASPBERRY_PI"/>
</option> </option>
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.1551006500" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input"/> <inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.1551006500" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input"/>
</tool> </tool>

View File

@ -18,7 +18,7 @@
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/> <stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/> <booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/> <stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Debug/eive_obsw"/> <stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Debug-Linux/eive_obsw"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="eive_obsw"/> <stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="eive_obsw"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/> <booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473"/> <stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473"/>

View File

@ -18,7 +18,7 @@
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/> <stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/> <booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/> <stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Debug/eive_obsw"/> <stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Debug-Release/eive_obsw.exe"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="eive_obsw"/> <stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="eive_obsw"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/> <booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.1043649249"/> <stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.1043649249"/>

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType">
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB" value="true"/>
<listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="gdb"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_ON_FORK" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.EXTERNAL_CONSOLE" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=".gdbinit"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE_MODE" value="UseSoftTrace"/>
<listAttribute key="org.eclipse.cdt.dsf.gdb.SOLIB_PATH"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.TRACEPOINT_MODE" value="TP_NORMAL_ONLY"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.internal.ui.launching.LocalApplicationCDebuggerTab.DEFAULTS_SET" value="true"/>
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="gdb"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="_bin/linux/devel/eiveobsw-host.elf"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="eive_obsw"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/eive_obsw"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;"/>
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
</launchConfiguration>

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType">
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB" value="true"/>
<listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="gdb"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_ON_FORK" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.EXTERNAL_CONSOLE" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=".gdbinit"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE_MODE" value="UseSoftTrace"/>
<listAttribute key="org.eclipse.cdt.dsf.gdb.SOLIB_PATH"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.TRACEPOINT_MODE" value="TP_NORMAL_ONLY"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.internal.ui.launching.LocalApplicationCDebuggerTab.DEFAULTS_SET" value="true"/>
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="gdb"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Release/eive_obsw"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="eive_obsw"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.447898075"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/eive_obsw"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;"/>
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
</launchConfiguration>

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType">
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB" value="true"/>
<listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="gdb"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_ON_FORK" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.EXTERNAL_CONSOLE" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=".gdbinit"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE_MODE" value="UseSoftTrace"/>
<listAttribute key="org.eclipse.cdt.dsf.gdb.SOLIB_PATH"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.TRACEPOINT_MODE" value="TP_NORMAL_ONLY"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.internal.ui.launching.LocalApplicationCDebuggerTab.DEFAULTS_SET" value="true"/>
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="gdb"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="_bin/linux/devel/eiveobsw-host.elf"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="eive_obsw"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.447898075"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/eive_obsw"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;"/>
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
</launchConfiguration>

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType">
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB" value="true"/>
<listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="gdb"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_ON_FORK" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.EXTERNAL_CONSOLE" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=".gdbinit"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE_MODE" value="UseSoftTrace"/>
<listAttribute key="org.eclipse.cdt.dsf.gdb.SOLIB_PATH"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.TRACEPOINT_MODE" value="TP_NORMAL_ONLY"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.internal.ui.launching.LocalApplicationCDebuggerTab.DEFAULTS_SET" value="true"/>
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="gdb"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="_bin/host/devel/eiveobsw-host.exe"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="eive_obsw"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/eive_obsw"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;"/>
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
</launchConfiguration>

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType">
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB" value="true"/>
<listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="gdb"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_ON_FORK" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.EXTERNAL_CONSOLE" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=".gdbinit"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE_MODE" value="UseSoftTrace"/>
<listAttribute key="org.eclipse.cdt.dsf.gdb.SOLIB_PATH"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.TRACEPOINT_MODE" value="TP_NORMAL_ONLY"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.internal.ui.launching.LocalApplicationCDebuggerTab.DEFAULTS_SET" value="true"/>
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="gdb"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="_bin/host/devel/eiveobsw-host.exe"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="eive_obsw"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.1043649249"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/eive_obsw"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;"/>
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
</launchConfiguration>

View File

@ -1,38 +1,55 @@
#include <mission/devices/GyroL3GD20Handler.h> #include "GyroL3GD20Handler.h"
#include <fsfw/datapool/PoolReadHelper.h> #include <OBSWConfig.h>
GyroHandler::GyroHandler(object_id_t objectId, object_id_t deviceCommunication, #include <fsfw/datapool/PoolReadGuard.h>
GyroHandlerL3GD20H::GyroHandlerL3GD20H(object_id_t objectId, object_id_t deviceCommunication,
CookieIF *comCookie): CookieIF *comCookie):
DeviceHandlerBase(objectId, deviceCommunication, comCookie), DeviceHandlerBase(objectId, deviceCommunication, comCookie),
dataset(this) { dataset(this) {
#if OBSW_VERBOSE_LEVEL >= 1
debugDivider = new PeriodicOperationDivider(5);
#endif
} }
GyroHandler::~GyroHandler() {} GyroHandlerL3GD20H::~GyroHandlerL3GD20H() {}
void GyroHandler::doStartUp() { void GyroHandlerL3GD20H::doStartUp() {
if(internalState == InternalState::STATE_NONE) { if(internalState == InternalState::NONE) {
internalState = InternalState::STATE_CONFIGURE; internalState = InternalState::CONFIGURE;
} }
if(internalState == InternalState::STATE_CONFIGURE) { if(internalState == InternalState::CONFIGURE) {
if(commandExecuted) { if(commandExecuted) {
internalState = InternalState::STATE_NORMAL; internalState = InternalState::CHECK_REGS;
commandExecuted = false; commandExecuted = false;
} }
} }
if(internalState == InternalState::CHECK_REGS) {
if(commandExecuted) {
internalState = InternalState::NORMAL;
#if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1
setMode(MODE_NORMAL);
#else
setMode(_MODE_TO_ON);
#endif
commandExecuted = false;
}
}
} }
void GyroHandler::doShutDown() { void GyroHandlerL3GD20H::doShutDown() {
setMode(_MODE_POWER_DOWN); setMode(_MODE_POWER_DOWN);
} }
ReturnValue_t GyroHandler::buildTransitionDeviceCommand(DeviceCommandId_t *id) { ReturnValue_t GyroHandlerL3GD20H::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
switch(internalState) { switch(internalState) {
case(InternalState::STATE_NONE): case(InternalState::NONE):
case(InternalState::STATE_NORMAL): { case(InternalState::NORMAL): {
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
case(InternalState::STATE_CONFIGURE): { case(InternalState::CONFIGURE): {
*id = L3GD20H::CONFIGURE_CTRL_REGS; *id = L3GD20H::CONFIGURE_CTRL_REGS;
uint8_t command [5]; uint8_t command [5];
command[0] = L3GD20H::CTRL_REG_1_VAL; command[0] = L3GD20H::CTRL_REG_1_VAL;
@ -41,10 +58,13 @@ ReturnValue_t GyroHandler::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
command[3] = L3GD20H::CTRL_REG_4_VAL; command[3] = L3GD20H::CTRL_REG_4_VAL;
command[4] = L3GD20H::CTRL_REG_5_VAL; command[4] = L3GD20H::CTRL_REG_5_VAL;
return buildCommandFromCommand(*id, command, 5); return buildCommandFromCommand(*id, command, 5);
break; }
case(InternalState::CHECK_REGS): {
*id = L3GD20H::READ_REGS;
return buildCommandFromCommand(*id, nullptr, 0);
} }
default: default:
// might be a configuration error. /* Might be a configuration error. */
sif::debug << "GyroHandler::buildTransitionDeviceCommand: Unknown " sif::debug << "GyroHandler::buildTransitionDeviceCommand: Unknown "
<< "internal state!" << std::endl; << "internal state!" << std::endl;
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
@ -52,12 +72,12 @@ ReturnValue_t GyroHandler::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t GyroHandler::buildNormalDeviceCommand(DeviceCommandId_t *id) { ReturnValue_t GyroHandlerL3GD20H::buildNormalDeviceCommand(DeviceCommandId_t *id) {
*id = L3GD20H::READ_REGS; *id = L3GD20H::READ_REGS;
return buildCommandFromCommand(*id, nullptr, 0); return buildCommandFromCommand(*id, nullptr, 0);
} }
ReturnValue_t GyroHandler::buildCommandFromCommand( ReturnValue_t GyroHandlerL3GD20H::buildCommandFromCommand(
DeviceCommandId_t deviceCommand, const uint8_t *commandData, DeviceCommandId_t deviceCommand, const uint8_t *commandData,
size_t commandDataLen) { size_t commandDataLen) {
switch(deviceCommand) { switch(deviceCommand) {
@ -120,24 +140,25 @@ ReturnValue_t GyroHandler::buildCommandFromCommand(
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t GyroHandler::scanForReply(const uint8_t *start, size_t len, ReturnValue_t GyroHandlerL3GD20H::scanForReply(const uint8_t *start, size_t len,
DeviceCommandId_t *foundId, size_t *foundLen) { DeviceCommandId_t *foundId, size_t *foundLen) {
// SPI, ID will always be the one of the last sent command. /* For SPI, the ID will always be the one of the last sent command. */
*foundId = this->getPendingCommand(); *foundId = this->getPendingCommand();
*foundLen = this->rawPacketLen; *foundLen = this->rawPacketLen;
// Data with SPI Interface has always this answer /* Data with SPI Interface has always this answer */
if (start[0] == 0b11111111) { if (start[0] == 0b11111111) {
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
return DeviceHandlerIF::INVALID_DATA; return DeviceHandlerIF::INVALID_DATA;
} }
ReturnValue_t GyroHandler::interpretDeviceReply(DeviceCommandId_t id, ReturnValue_t GyroHandlerL3GD20H::interpretDeviceReply(DeviceCommandId_t id,
const uint8_t *packet) { const uint8_t *packet) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
switch(id) { switch(id) {
case(L3GD20H::CONFIGURE_CTRL_REGS): { case(L3GD20H::CONFIGURE_CTRL_REGS): {
commandExecuted = true;
break; break;
} }
case(L3GD20H::READ_CTRL_REGS): { case(L3GD20H::READ_CTRL_REGS): {
@ -147,18 +168,23 @@ ReturnValue_t GyroHandler::interpretDeviceReply(DeviceCommandId_t id,
commandExecuted = true; commandExecuted = true;
} }
else { else {
// Attempt reconfiguration. /* Attempt reconfiguration. */
internalState = InternalState::STATE_CONFIGURE; internalState = InternalState::CONFIGURE;
return DeviceHandlerIF::DEVICE_REPLY_INVALID; return DeviceHandlerIF::DEVICE_REPLY_INVALID;
} }
break; break;
} }
case(L3GD20H::READ_START): { case(L3GD20H::READ_REGS): {
if(packet[1] != ctrlReg1Value and packet[2] != ctrlReg2Value and if(packet[1] != ctrlReg1Value and packet[2] != ctrlReg2Value and
packet[3] != ctrlReg3Value and packet[4] != ctrlReg4Value and packet[3] != ctrlReg3Value and packet[4] != ctrlReg4Value and
packet[5] != ctrlReg5Value) { packet[5] != ctrlReg5Value) {
return DeviceHandlerIF::DEVICE_REPLY_INVALID; return DeviceHandlerIF::DEVICE_REPLY_INVALID;
} }
else {
if(internalState == InternalState::CHECK_REGS) {
commandExecuted = true;
}
}
statusReg = packet[L3GD20H::STATUS_IDX]; statusReg = packet[L3GD20H::STATUS_IDX];
@ -171,8 +197,25 @@ ReturnValue_t GyroHandler::interpretDeviceReply(DeviceCommandId_t id,
int8_t temperaturOffset = (-1) * packet[L3GD20H::TEMPERATURE_IDX]; int8_t temperaturOffset = (-1) * packet[L3GD20H::TEMPERATURE_IDX];
float temperature = 25.0 + temperaturOffset; float temperature = 25.0 + temperaturOffset;
#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 << "GyroHandlerL3GD20H: Angular velocities in degrees per second:" <<
std::endl;
sif::info << "X: " << angVelocX << " \xC2\xB0" << std::endl;
sif::info << "Y: " << angVelocY << " \xC2\xB0" << std::endl;
sif::info << "Z: " << angVelocZ << " \xC2\xB0" << std::endl;
#else
sif::printInfo("GyroHandlerL3GD20H: Angular velocities in degrees per second:\n");
sif::printInfo("X: %f " "\xC2\xB0" "T\n", angVelocX);
sif::printInfo("Y: %f " "\xC2\xB0" "T\n", angVelocY);
sif::printInfo("Z: %f " "\xC2\xB0" "T\n", angVelocZ);
#endif
}
#endif
PoolReadHelper readSet(&dataset); PoolReadGuard readSet(&dataset);
if(readSet.getReadResult() == HasReturnvaluesIF::RETURN_OK) { if(readSet.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
dataset.angVelocX = angVelocX; dataset.angVelocX = angVelocX;
dataset.angVelocY = angVelocY; dataset.angVelocY = angVelocY;
@ -189,11 +232,11 @@ ReturnValue_t GyroHandler::interpretDeviceReply(DeviceCommandId_t id,
} }
uint32_t GyroHandler::getTransitionDelayMs(Mode_t from, Mode_t to) { uint32_t GyroHandlerL3GD20H::getTransitionDelayMs(Mode_t from, Mode_t to) {
return 5000; return 10000;
} }
ReturnValue_t GyroHandler::initializeLocalDataPool( ReturnValue_t GyroHandlerL3GD20H::initializeLocalDataPool(
localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) {
localDataPoolMap.emplace(L3GD20H::ANG_VELOC_X, localDataPoolMap.emplace(L3GD20H::ANG_VELOC_X,
new PoolEntry<float>({0.0})); new PoolEntry<float>({0.0}));
@ -206,12 +249,12 @@ ReturnValue_t GyroHandler::initializeLocalDataPool(
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
void GyroHandler::fillCommandAndReplyMap() { void GyroHandlerL3GD20H::fillCommandAndReplyMap() {
insertInCommandAndReplyMap(L3GD20H::READ_REGS, 1, &dataset); insertInCommandAndReplyMap(L3GD20H::READ_REGS, 1, &dataset);
insertInCommandAndReplyMap(L3GD20H::CONFIGURE_CTRL_REGS, 1); insertInCommandAndReplyMap(L3GD20H::CONFIGURE_CTRL_REGS, 1);
insertInCommandAndReplyMap(L3GD20H::READ_CTRL_REGS, 1); insertInCommandAndReplyMap(L3GD20H::READ_CTRL_REGS, 1);
} }
void GyroHandler::modeChanged() { void GyroHandlerL3GD20H::modeChanged() {
internalState = InternalState::STATE_NONE; internalState = InternalState::NONE;
} }

View File

@ -1,8 +1,12 @@
#ifndef MISSION_DEVICES_GYROL3GD20HANDLER_H_ #ifndef MISSION_DEVICES_GYROL3GD20HANDLER_H_
#define MISSION_DEVICES_GYROL3GD20HANDLER_H_ #define MISSION_DEVICES_GYROL3GD20HANDLER_H_
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
#include "devicedefinitions/GyroL3GD20Definitions.h" #include "devicedefinitions/GyroL3GD20Definitions.h"
#include <OBSWConfig.h>
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
/** /**
* @brief Device Handler for the L3GD20H gyroscope sensor * @brief Device Handler for the L3GD20H gyroscope sensor
@ -10,12 +14,14 @@
* @details * @details
* Advanced documentation: * Advanced documentation:
* https://egit.irs.uni-stuttgart.de/redmine/projects/eive-flight-manual/wiki/L3GD20H_Gyro * https://egit.irs.uni-stuttgart.de/redmine/projects/eive-flight-manual/wiki/L3GD20H_Gyro
*
* Data is read big endian with the smallest possible range of 245 degrees per second.
*/ */
class GyroHandler: public DeviceHandlerBase { class GyroHandlerL3GD20H: public DeviceHandlerBase {
public: public:
GyroHandler(object_id_t objectId, object_id_t deviceCommunication, GyroHandlerL3GD20H(object_id_t objectId, object_id_t deviceCommunication,
CookieIF* comCookie); CookieIF* comCookie);
virtual ~GyroHandler(); virtual ~GyroHandlerL3GD20H();
protected: protected:
@ -41,14 +47,15 @@ protected:
LocalDataPoolManager &poolManager) override; LocalDataPoolManager &poolManager) override;
private: private:
L3GD20H::GyroPrimaryDataset dataset; GyroPrimaryDataset dataset;
enum class InternalState { enum class InternalState {
STATE_NONE, NONE,
STATE_CONFIGURE, CONFIGURE,
STATE_NORMAL CHECK_REGS,
NORMAL
}; };
InternalState internalState = InternalState::STATE_NONE; InternalState internalState = InternalState::NONE;
bool commandExecuted = false; bool commandExecuted = false;
uint8_t statusReg = 0; uint8_t statusReg = 0;
@ -62,6 +69,10 @@ private:
uint8_t commandBuffer[L3GD20H::READ_LEN + 1]; uint8_t commandBuffer[L3GD20H::READ_LEN + 1];
float scaleFactor = static_cast<float>(L3GD20H::RANGE_DPS_00) / INT16_MAX; float scaleFactor = static_cast<float>(L3GD20H::RANGE_DPS_00) / INT16_MAX;
#if OBSW_VERBOSE_LEVEL >= 1
PeriodicOperationDivider* debugDivider = nullptr;
#endif
}; };

View File

@ -1,13 +1,14 @@
#include <fsfw/datapool/PoolReadHelper.h> #include <fsfw/datapool/PoolReadHelper.h>
#include "MGMHandlerLIS3MDL.h" #include "MGMHandlerLIS3MDL.h"
#include <fsfw/datapool/PoolReadGuard.h>
MGMHandlerLIS3MDL::MGMHandlerLIS3MDL(object_id_t objectId, MGMHandlerLIS3MDL::MGMHandlerLIS3MDL(object_id_t objectId,
object_id_t deviceCommunication, CookieIF* comCookie): object_id_t deviceCommunication, CookieIF* comCookie):
DeviceHandlerBase(objectId, deviceCommunication, comCookie), DeviceHandlerBase(objectId, deviceCommunication, comCookie),
dataset(this) { dataset(this) {
#if OBSW_VERBOSE_LEVEL >= 1 #if OBSW_VERBOSE_LEVEL >= 1
debugDivider = new PeriodicOperationDivider(10); debugDivider = new PeriodicOperationDivider(5);
#endif #endif
/* Set to default values right away. */ /* Set to default values right away. */
registers[0] = MGMLIS3MDL::CTRL_REG1_DEFAULT; registers[0] = MGMLIS3MDL::CTRL_REG1_DEFAULT;
@ -44,8 +45,11 @@ void MGMHandlerLIS3MDL::doStartUp() {
/* Set up cached registers which will be used to configure the MGM. */ /* Set up cached registers which will be used to configure the MGM. */
if(commandExecuted) { if(commandExecuted) {
commandExecuted = false; commandExecuted = false;
/* Replace _MODE_TO_ON with MODE_NORMAL to jump to normal mode quickly */ #if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1
setMode(MODE_NORMAL);
#else
setMode(_MODE_TO_ON); setMode(_MODE_TO_ON);
#endif
} }
break; break;
} }
@ -299,7 +303,7 @@ ReturnValue_t MGMHandlerLIS3MDL::interpretDeviceReply(DeviceCommandId_t id,
#endif #endif
} }
#endif #endif
PoolReadHelper readHelper(&dataset); PoolReadGuard readHelper(&dataset);
if(readHelper.getReadResult() == HasReturnvaluesIF::RETURN_OK) { if(readHelper.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
dataset.fieldStrengthX = mgmX; dataset.fieldStrengthX = mgmX;
dataset.fieldStrengthY = mgmY; dataset.fieldStrengthY = mgmY;
@ -459,7 +463,7 @@ void MGMHandlerLIS3MDL::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
} }
uint32_t MGMHandlerLIS3MDL::getTransitionDelayMs(Mode_t from, Mode_t to) { uint32_t MGMHandlerLIS3MDL::getTransitionDelayMs(Mode_t from, Mode_t to) {
return 30000; return 10000;
} }
void MGMHandlerLIS3MDL::modeChanged(void) { void MGMHandlerLIS3MDL::modeChanged(void) {

View File

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

View File

@ -61,18 +61,18 @@ protected:
private: private:
enum class InternalState { enum class InternalState {
STATE_NONE, NONE,
STATE_CONFIGURE_CMM, CONFIGURE_CMM,
STATE_READ_CMM, READ_CMM,
// The cycle count states are propably not going to be used because // The cycle count states are propably not going to be used because
// the default cycle count will be used. // the default cycle count will be used.
STATE_CONFIGURE_CYCLE_COUNT, STATE_CONFIGURE_CYCLE_COUNT,
STATE_READ_CYCLE_COUNT, STATE_READ_CYCLE_COUNT,
STATE_CONFIGURE_TMRC, STATE_CONFIGURE_TMRC,
STATE_READ_TMRC, STATE_READ_TMRC,
STATE_NORMAL NORMAL
}; };
InternalState internalState = InternalState::STATE_NONE; InternalState internalState = InternalState::NONE;
bool commandExecuted = false; bool commandExecuted = false;
RM3100::Rm3100PrimaryDataset primaryDataset; RM3100::Rm3100PrimaryDataset primaryDataset;

View File

@ -49,7 +49,7 @@ ReturnValue_t PCDUHandler::initialize() {
sif::error << "PCDUHandler::initialize: Invalid pdu2Handler" << std::endl; sif::error << "PCDUHandler::initialize: Invalid pdu2Handler" << std::endl;
return RETURN_FAILED; return RETURN_FAILED;
} }
result = pdu2Handler->getSubscriptionInterface()->subscribeForSetUpdateMessages( result = pdu2Handler->getSubscriptionInterface()->subscribeForSetUpdateMessage(
PDU2::HK_TABLE_DATA_SET_ID, this->getObjectId(), commandQueue->getId(), true); PDU2::HK_TABLE_DATA_SET_ID, this->getObjectId(), commandQueue->getId(), true);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::error << "PCDUHandler::initialize: Failed to subscribe for set update messages from " sif::error << "PCDUHandler::initialize: Failed to subscribe for set update messages from "
@ -63,7 +63,7 @@ ReturnValue_t PCDUHandler::initialize() {
sif::error << "PCDUHandler::initialize: Invalid pdu1Handler" << std::endl; sif::error << "PCDUHandler::initialize: Invalid pdu1Handler" << std::endl;
return RETURN_FAILED; return RETURN_FAILED;
} }
result = pdu1Handler->getSubscriptionInterface()->subscribeForSetUpdateMessages( result = pdu1Handler->getSubscriptionInterface()->subscribeForSetUpdateMessage(
PDU1::HK_TABLE_DATA_SET_ID, this->getObjectId(), commandQueue->getId(), true); PDU1::HK_TABLE_DATA_SET_ID, this->getObjectId(), commandQueue->getId(), true);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::error << "PCDUHandler::initialize: Failed to subscribe for set update messages from " sif::error << "PCDUHandler::initialize: Failed to subscribe for set update messages from "

View File

@ -1,11 +1,15 @@
#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_GYROL3GD20DEFINITIONS_H_ #ifndef MISSION_DEVICES_DEVICEDEFINITIONS_GYROL3GD20DEFINITIONS_H_
#define MISSION_DEVICES_DEVICEDEFINITIONS_GYROL3GD20DEFINITIONS_H_ #define MISSION_DEVICES_DEVICEDEFINITIONS_GYROL3GD20DEFINITIONS_H_
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
#include <fsfw/devicehandlers/DeviceHandlerIF.h> #include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include <cstdint> #include <cstdint>
namespace L3GD20H { namespace L3GD20H {
/* Actual size is 15 but we round up a bit */
static constexpr size_t MAX_BUFFER_SIZE = 16;
static constexpr uint8_t READ_MASK = 0b1000'0000; static constexpr uint8_t READ_MASK = 0b1000'0000;
static constexpr uint8_t AUTO_INCREMENT_MASK = 0b0100'0000; static constexpr uint8_t AUTO_INCREMENT_MASK = 0b0100'0000;
@ -22,7 +26,7 @@ static constexpr uint8_t CTRL_REG_3 = 0b0010'0010;
static constexpr uint8_t CTRL_REG_4 = 0b0010'0011; static constexpr uint8_t CTRL_REG_4 = 0b0010'0011;
static constexpr uint8_t CTRL_REG_5 = 0b0010'0100; static constexpr uint8_t CTRL_REG_5 = 0b0010'0100;
// Register 1 /* Register 1 */
static constexpr uint8_t SET_DR_1 = 1 << 7; static constexpr uint8_t SET_DR_1 = 1 << 7;
static constexpr uint8_t SET_DR_0 = 1 << 6; static constexpr uint8_t SET_DR_0 = 1 << 6;
static constexpr uint8_t SET_BW_1 = 1 << 5; static constexpr uint8_t SET_BW_1 = 1 << 5;
@ -35,7 +39,7 @@ static constexpr uint8_t SET_Y_ENABLE = 1;
static constexpr uint8_t CTRL_REG_1_VAL = SET_POWER_NORMAL_MODE | SET_Z_ENABLE | static constexpr uint8_t CTRL_REG_1_VAL = SET_POWER_NORMAL_MODE | SET_Z_ENABLE |
SET_Y_ENABLE | SET_X_ENABLE; SET_Y_ENABLE | SET_X_ENABLE;
// Register 2 /* Register 2 */
static constexpr uint8_t EXTERNAL_EDGE_ENB = 1 << 7; static constexpr uint8_t EXTERNAL_EDGE_ENB = 1 << 7;
static constexpr uint8_t LEVEL_SENSITIVE_TRIGGER = 1 << 6; static constexpr uint8_t LEVEL_SENSITIVE_TRIGGER = 1 << 6;
static constexpr uint8_t SET_HPM_1 = 1 << 5; static constexpr uint8_t SET_HPM_1 = 1 << 5;
@ -47,10 +51,10 @@ static constexpr uint8_t SET_HPCF_0 = 1;
static constexpr uint8_t CTRL_REG_2_VAL = 0b0000'0000; static constexpr uint8_t CTRL_REG_2_VAL = 0b0000'0000;
// Register 3 /* Register 3 */
static constexpr uint8_t CTRL_REG_3_VAL = 0b0000'0000; static constexpr uint8_t CTRL_REG_3_VAL = 0b0000'0000;
// Register 4 /* Register 4 */
static constexpr uint8_t SET_BNU = 1 << 7; static constexpr uint8_t SET_BNU = 1 << 7;
static constexpr uint8_t SET_BLE = 1 << 6; static constexpr uint8_t SET_BLE = 1 << 6;
static constexpr uint8_t SET_FS_1 = 1 << 5; static constexpr uint8_t SET_FS_1 = 1 << 5;
@ -60,15 +64,16 @@ static constexpr uint8_t SET_SELF_TEST_ENB_1 = 1 << 2;
static constexpr uint8_t SET_SELF_TEST_ENB_0 = 1 << 1; static constexpr uint8_t SET_SELF_TEST_ENB_0 = 1 << 1;
static constexpr uint8_t SET_SPI_IF_SELECT = 1; static constexpr uint8_t SET_SPI_IF_SELECT = 1;
static constexpr uint8_t CTRL_REG_4_VAL = 0b0000'0000; /* Enable big endian data format */
static constexpr uint8_t CTRL_REG_4_VAL = SET_BLE;
// Register 5 /* Register 5 */
static constexpr uint8_t SET_REBOOT_MEM = 1 << 7; static constexpr uint8_t SET_REBOOT_MEM = 1 << 7;
static constexpr uint8_t SET_FIFO_ENB = 1 << 6; static constexpr uint8_t SET_FIFO_ENB = 1 << 6;
static constexpr uint8_t CTRL_REG_5_VAL = 0b0000'0000; static constexpr uint8_t CTRL_REG_5_VAL = 0b0000'0000;
// In degrees per second (DPS) for now. /* Possible range values in degrees per second (DPS). */
static constexpr uint16_t RANGE_DPS_00 = 245; static constexpr uint16_t RANGE_DPS_00 = 245;
static constexpr uint16_t RANGE_DPS_01 = 500; static constexpr uint16_t RANGE_DPS_01 = 500;
static constexpr uint16_t RANGE_DPS_11 = 2000; static constexpr uint16_t RANGE_DPS_11 = 2000;
@ -76,16 +81,16 @@ static constexpr uint16_t RANGE_DPS_11 = 2000;
static constexpr uint8_t READ_START = CTRL_REG_1; static constexpr uint8_t READ_START = CTRL_REG_1;
static constexpr size_t READ_LEN = 14; static constexpr size_t READ_LEN = 14;
// Indexing /* Indexing */
static constexpr uint8_t REFERENCE_IDX = 6; static constexpr uint8_t REFERENCE_IDX = 6;
static constexpr uint8_t TEMPERATURE_IDX = 7; static constexpr uint8_t TEMPERATURE_IDX = 7;
static constexpr uint8_t STATUS_IDX = 8; static constexpr uint8_t STATUS_IDX = 8;
static constexpr uint8_t OUT_X_L = 9; static constexpr uint8_t OUT_X_H = 9;
static constexpr uint8_t OUT_X_H = 10; static constexpr uint8_t OUT_X_L = 10;
static constexpr uint8_t OUT_Y_L = 11; static constexpr uint8_t OUT_Y_H = 11;
static constexpr uint8_t OUT_Y_H = 12; static constexpr uint8_t OUT_Y_L = 12;
static constexpr uint8_t OUT_Z_L = 13; static constexpr uint8_t OUT_Z_H = 13;
static constexpr uint8_t OUT_Z_H = 14; static constexpr uint8_t OUT_Z_L = 14;
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/* Device Handler specific */ /* Device Handler specific */
@ -103,27 +108,33 @@ enum GyroPoolIds: lp_id_t {
TEMPERATURE TEMPERATURE
}; };
class GyroPrimaryDataset: public StaticLocalDataSet<3 * sizeof(float)> {
public:
GyroPrimaryDataset(HasLocalDataPoolIF* hkOwner):
StaticLocalDataSet(hkOwner, GYRO_DATASET_ID) {}
GyroPrimaryDataset(object_id_t mgmId):
StaticLocalDataSet(sid_t(mgmId, GYRO_DATASET_ID)) {}
// Angular velocities in degrees per second (DPS)
lp_var_t<float> angVelocX = lp_var_t<float>(sid.objectId,
ANG_VELOC_X, this);
lp_var_t<float> angVelocY = lp_var_t<float>(sid.objectId,
ANG_VELOC_Y, this);
lp_var_t<float> angVelocZ = lp_var_t<float>(sid.objectId,
ANG_VELOC_Z, this);
lp_var_t<float> temperature = lp_var_t<float>(sid.objectId,
TEMPERATURE, this);
};
} }
class GyroPrimaryDataset: public StaticLocalDataSet<3 * sizeof(float)> {
public:
/** Constructor for data users like controllers */
GyroPrimaryDataset(object_id_t mgmId):
StaticLocalDataSet(sid_t(mgmId, L3GD20H::GYRO_DATASET_ID)) {
setAllVariablesReadOnly();
}
/* Angular velocities in degrees per second (DPS) */
lp_var_t<float> angVelocX = lp_var_t<float>(sid.objectId,
L3GD20H::ANG_VELOC_X, this);
lp_var_t<float> angVelocY = lp_var_t<float>(sid.objectId,
L3GD20H::ANG_VELOC_Y, this);
lp_var_t<float> angVelocZ = lp_var_t<float>(sid.objectId,
L3GD20H::ANG_VELOC_Z, this);
lp_var_t<float> temperature = lp_var_t<float>(sid.objectId,
L3GD20H::TEMPERATURE, this);
private:
friend class GyroHandlerL3GD20H;
/** Constructor for the data creator */
GyroPrimaryDataset(HasLocalDataPoolIF* hkOwner):
StaticLocalDataSet(hkOwner, L3GD20H::GYRO_DATASET_ID) {}
};
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_GYROL3GD20DEFINITIONS_H_ */ #endif /* MISSION_DEVICES_DEVICEDEFINITIONS_GYROL3GD20DEFINITIONS_H_ */

View File

@ -15,6 +15,9 @@ enum opMode {
LOW, MEDIUM, HIGH, ULTRA 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 constexpr uint8_t GAUSS_TO_MICROTESLA_FACTOR = 100;
static const DeviceCommandId_t SETUP_MGM = 0x00; static const DeviceCommandId_t SETUP_MGM = 0x00;

View File

@ -9,6 +9,9 @@
namespace RM3100 { namespace RM3100 {
/* Actually 10, we round up a little bit */
static constexpr size_t MAX_BUFFER_SIZE = 12;
static constexpr uint8_t READ_MASK = 0b1000'0000; static constexpr uint8_t READ_MASK = 0b1000'0000;
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/

View File

@ -68,7 +68,7 @@ gps_rx_data[] = ""
ReturnValue_t TestTask::performOneShotAction() { ReturnValue_t TestTask::performOneShotAction() {
#if OBSW_ADD_TEST_CODE == 1 #if OBSW_ADD_TEST_CODE == 1
performLwgpsTest(); //performLwgpsTest();
#endif #endif
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }

2
thirdparty/lwgps vendored

@ -1 +1 @@
Subproject commit d276f9722d1311b552e7c99ee5b03a68487a0fc5 Subproject commit 3dbfe390a6784ebc723d3907062cf883c8cf85cd

2
tmtc

@ -1 +1 @@
Subproject commit 81cd88f5211e0d9853ba3d9dd7611a9c2149cd55 Subproject commit 5f1803b66393210ded8c5d88fbc28cd8130cef91