Merge branch 'mueller/master' of https://egit.irs.uni-stuttgart.de/eive/eive_obsw into mueller/master
This commit is contained in:
commit
4bc8b60a4a
@ -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 */
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
|
|
||||||
#include <fsfwconfig/objects/systemObjectList.h>
|
#include <fsfwconfig/objects/systemObjectList.h>
|
||||||
#include <fsfwconfig/OBSWConfig.h>
|
#include <fsfwconfig/OBSWConfig.h>
|
||||||
#include <fsfwconfig/pollingsequence/PollingSequenceFactory.h>
|
|
||||||
|
|
||||||
#include <mission/utility/InitMission.h>
|
#include <mission/utility/InitMission.h>
|
||||||
|
|
||||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||||
@ -14,6 +12,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 <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
@ -128,7 +127,7 @@ void initmission::initTasks() {
|
|||||||
|
|
||||||
#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, 1.0, missedDeadlineFunc);
|
||||||
result = pst::pollingSequenceAcsTest(acsTask);
|
result = pst::pollingSequenceAcsTest(acsTask);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "initmission::initTasks: ACS PST initialization failed!" << std::endl;
|
sif::warning << "initmission::initTasks: ACS PST initialization failed!" << std::endl;
|
||||||
|
@ -1,23 +1,25 @@
|
|||||||
#include "ObjectFactory.h"
|
#include "ObjectFactory.h"
|
||||||
#include <bsp_rpi/gpio/GPIORPi.h>
|
#include <bsp_rpi/gpio/GPIORPi.h>
|
||||||
|
|
||||||
#include <objects/systemObjectList.h>
|
#include <fsfwconfig/objects/systemObjectList.h>
|
||||||
#include <devices/addresses.h>
|
#include <fsfwconfig/devices/addresses.h>
|
||||||
#include <devices/gpioIds.h>
|
#include <fsfwconfig/devices/gpioIds.h>
|
||||||
#include <OBSWConfig.h>
|
#include <fsfwconfig/OBSWConfig.h>
|
||||||
#include <tmtc/apid.h>
|
#include <fsfwconfig/tmtc/apid.h>
|
||||||
#include <tmtc/pusIds.h>
|
#include <fsfwconfig/tmtc/pusIds.h>
|
||||||
|
#include <fsfwconfig/devices/spi.h>
|
||||||
|
|
||||||
#include <linux/boardtest/LibgpiodTest.h>
|
#include <linux/boardtest/LibgpiodTest.h>
|
||||||
#include <linux/boardtest/SpiTestClass.h>
|
#include <linux/boardtest/SpiTestClass.h>
|
||||||
#include <linux/gpio/GpioCookie.h>
|
#include <linux/gpio/GpioCookie.h>
|
||||||
#include <linux/gpio/LinuxLibgpioIF.h>
|
#include <linux/gpio/LinuxLibgpioIF.h>
|
||||||
|
|
||||||
#include <linux/spi/SpiCookie.h>
|
#include <linux/spi/SpiCookie.h>
|
||||||
|
#include <linux/spi/SpiComIF.h>
|
||||||
|
|
||||||
#include <mission/core/GenericFactory.h>
|
#include <mission/core/GenericFactory.h>
|
||||||
#include <mission/utility/TmFunnel.h>
|
#include <mission/utility/TmFunnel.h>
|
||||||
#include <mission/devices/MGMHandlerLIS3MDL.h>
|
#include <mission/devices/MGMHandlerLIS3MDL.h>
|
||||||
|
#include <mission/devices/MGMHandlerRM3100.h>
|
||||||
|
|
||||||
#include <fsfw/datapoollocal/LocalDataPoolManager.h>
|
#include <fsfw/datapoollocal/LocalDataPoolManager.h>
|
||||||
#include <fsfw/tmtcservices/CommandingServiceBase.h>
|
#include <fsfw/tmtcservices/CommandingServiceBase.h>
|
||||||
@ -26,7 +28,8 @@
|
|||||||
#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>
|
||||||
#include <linux/spi/SpiComIF.h>
|
#include <mission/devices/GyroL3GD20Handler.h>
|
||||||
|
|
||||||
|
|
||||||
void Factory::setStaticFrameworkObjectIds() {
|
void Factory::setStaticFrameworkObjectIds() {
|
||||||
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
|
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
|
||||||
@ -97,11 +100,24 @@ void ObjectFactory::produce(){
|
|||||||
"GYRO_2_L3G", gpio::Direction::OUT, 1);
|
"GYRO_2_L3G", gpio::Direction::OUT, 1);
|
||||||
gpioIF->addGpios(gpioCookieAcsBoard);
|
gpioIF->addGpios(gpioCookieAcsBoard);
|
||||||
|
|
||||||
SpiCookie* spiCookie = new SpiCookie(addresses::MGM_0_LIS3,
|
std::string spiDev = "/dev/spidev0.0";
|
||||||
gpioIds::MGM_0_LIS3_CS, "/dev/spidev0.0", 24, spi::SpiMode::MODE_3, 3'900'000);
|
SpiCookie* spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev,
|
||||||
auto mgmHandler = new MGMHandlerLIS3MDL(objects::MGM_0_LIS3_HANDLER,
|
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);
|
objects::SPI_COM_IF, spiCookie);
|
||||||
mgmHandler->setStartUpImmediately();
|
mgmLis3Handler->setStartUpImmediately();
|
||||||
|
|
||||||
|
spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev,
|
||||||
|
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
||||||
|
auto mgmRm3100Handler = new MGMHandlerRM3100(objects::MGM_1_RM3100_HANDLER,
|
||||||
|
objects::SPI_COM_IF, spiCookie);
|
||||||
|
mgmRm3100Handler->setStartUpImmediately();
|
||||||
|
|
||||||
|
spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev,
|
||||||
|
L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||||
|
auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF,
|
||||||
|
spiCookie);
|
||||||
|
gyroL3gHandler->setStartUpImmediately();
|
||||||
|
|
||||||
#endif /* RPI_TEST_ACS_BOARD == 1 */
|
#endif /* RPI_TEST_ACS_BOARD == 1 */
|
||||||
}
|
}
|
||||||
|
@ -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 {
|
||||||
|
0
cmake/scripts/Q7S/create_cmake_debug_cfg.sh
Normal file → Executable file
0
cmake/scripts/Q7S/create_cmake_debug_cfg.sh
Normal file → Executable file
0
cmake/scripts/Q7S/create_cmake_release_cfg.sh
Normal file → Executable file
0
cmake/scripts/Q7S/create_cmake_release_cfg.sh
Normal file → Executable file
0
cmake/scripts/Q7S/create_cmake_relwithdeb_cfg.sh
Normal file → Executable file
0
cmake/scripts/Q7S/create_cmake_relwithdeb_cfg.sh
Normal file → Executable file
0
cmake/scripts/RPi/create_cmake_debug_cfg.sh
Normal file → Executable file
0
cmake/scripts/RPi/create_cmake_debug_cfg.sh
Normal file → Executable file
0
cmake/scripts/RPi/create_cmake_release_cfg.sh
Normal file → Executable file
0
cmake/scripts/RPi/create_cmake_release_cfg.sh
Normal file → Executable file
0
cmake/scripts/RPi/create_cmake_relwithdeb_cfg.sh
Normal file → Executable file
0
cmake/scripts/RPi/create_cmake_relwithdeb_cfg.sh
Normal file → Executable file
0
cmake/scripts/RPi/create_cmake_size_cfg.sh
Normal file → Executable file
0
cmake/scripts/RPi/create_cmake_size_cfg.sh
Normal file → Executable 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
|
||||||
|
@ -14,17 +14,22 @@
|
|||||||
|
|
||||||
/* These defines should be disabled for mission code but are useful for
|
/* These defines should be disabled for mission code but are useful for
|
||||||
debugging. */
|
debugging. */
|
||||||
#define OBSW_VERBOSE_LEVEL 1
|
#define OBSW_VERBOSE_LEVEL 1
|
||||||
#define OBSW_PRINT_MISSED_DEADLINES 1
|
#define OBSW_PRINT_MISSED_DEADLINES 1
|
||||||
#define OBSW_ADD_TEST_CODE 1
|
#define OBSW_ADD_TEST_CODE 1
|
||||||
#define TEST_LIBGPIOD 0
|
#define TEST_LIBGPIOD 0
|
||||||
|
|
||||||
#define TE0720 0
|
#define TE0720 0
|
||||||
|
|
||||||
#define P60DOCK_DEBUG 0
|
#define P60DOCK_DEBUG 0
|
||||||
#define PDU1_DEBUG 0
|
#define PDU1_DEBUG 0
|
||||||
#define PDU2_DEBUG 0
|
#define PDU2_DEBUG 0
|
||||||
#define ACU_DEBUG 1
|
#define ACU_DEBUG 1
|
||||||
|
|
||||||
|
/* 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
|
||||||
|
|
||||||
|
27
fsfwconfig/devices/spi.h
Normal file
27
fsfwconfig/devices/spi.h
Normal 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_ */
|
@ -1,9 +1,11 @@
|
|||||||
|
#include "pollingSequenceFactory.h"
|
||||||
|
|
||||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||||
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
||||||
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
||||||
#include <fsfwconfig/objects/systemObjectList.h>
|
#include <fsfwconfig/objects/systemObjectList.h>
|
||||||
#include <fsfwconfig/pollingsequence/PollingSequenceFactory.h>
|
|
||||||
|
|
||||||
ReturnValue_t pst::pollingSequenceInitDefault(FixedTimeslotTaskIF *thisSequence)
|
ReturnValue_t pst::pollingSequenceInitDefault(FixedTimeslotTaskIF *thisSequence)
|
||||||
{
|
{
|
||||||
@ -109,6 +111,28 @@ ReturnValue_t pst::pollingSequenceAcsTest(FixedTimeslotTaskIF *thisSequence) {
|
|||||||
DeviceHandlerIF::SEND_READ);
|
DeviceHandlerIF::SEND_READ);
|
||||||
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8,
|
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8,
|
||||||
DeviceHandlerIF::GET_READ);
|
DeviceHandlerIF::GET_READ);
|
||||||
|
|
||||||
|
thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0,
|
||||||
|
DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
|
thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2,
|
||||||
|
DeviceHandlerIF::SEND_WRITE);
|
||||||
|
thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4,
|
||||||
|
DeviceHandlerIF::GET_WRITE);
|
||||||
|
thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6,
|
||||||
|
DeviceHandlerIF::SEND_READ);
|
||||||
|
thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8,
|
||||||
|
DeviceHandlerIF::GET_READ);
|
||||||
|
|
||||||
|
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0,
|
||||||
|
DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
|
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2,
|
||||||
|
DeviceHandlerIF::SEND_WRITE);
|
||||||
|
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4,
|
||||||
|
DeviceHandlerIF::GET_WRITE);
|
||||||
|
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6,
|
||||||
|
DeviceHandlerIF::SEND_READ);
|
||||||
|
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8,
|
||||||
|
DeviceHandlerIF::GET_READ);
|
||||||
if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) {
|
if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "Initialization of ACS Board PST failed" << std::endl;
|
sif::error << "Initialization of ACS Board PST failed" << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
@ -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;
|
@ -1,14 +1,18 @@
|
|||||||
#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 +23,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 +42,7 @@ ReturnValue_t SpiTestClass::performOneShotAction() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case(TestModes::GYRO_L3GD20H): {
|
case(TestModes::GYRO_L3GD20H): {
|
||||||
|
performL3gTest(gyro1L3gd20ChipSelect);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,10 +69,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 +90,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 +171,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,11 +189,108 @@ 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";
|
||||||
@ -174,29 +334,9 @@ void SpiTestClass::acsInit() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 +347,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,10 +464,11 @@ 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);
|
||||||
}
|
}
|
||||||
return recvBuffer[1];
|
return recvBuffer[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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,26 @@ 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;
|
||||||
|
static constexpr uint8_t RM3100_READ_MASK = STM_READ_MASK;
|
||||||
static constexpr uint8_t STM_AUTO_INCR_MASK = 0b0100'0000;
|
static constexpr uint8_t STM_AUTO_INCR_MASK = 0b0100'0000;
|
||||||
|
|
||||||
void setSpiSpeedAndMode(int spiFd, spi::SpiMode mode, uint32_t speed);
|
void setSpiSpeedAndMode(int spiFd, spi::SpiModes mode, uint32_t speed);
|
||||||
|
|
||||||
void writeStmRegister(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t value,
|
void writeStmRegister(int fd, gpioId_t chipSelect, uint8_t reg, uint8_t value,
|
||||||
bool autoIncrement);
|
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 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);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#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>
|
||||||
@ -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, ¶ms);
|
spiCookie->getSpiParameters(spiMode, spiSpeed, ¶ms);
|
||||||
@ -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);
|
||||||
@ -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 */
|
||||||
@ -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!");
|
||||||
|
@ -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_ */
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
|
@ -19,19 +19,25 @@ public:
|
|||||||
* @param maxSize
|
* @param maxSize
|
||||||
*/
|
*/
|
||||||
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
|
||||||
@ -81,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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -100,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;
|
||||||
|
|
||||||
|
@ -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,
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
</extensions>
|
</extensions>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
<configuration artifactName="${ProjName}" buildProperties="" description="" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443" name="eive-mingw-debug" optionalBuildProperties="org.eclipse.cdt.docker.launcher.containerbuild.property.selectedvolumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.volumes=" parent="org.eclipse.cdt.build.core.emptycfg">
|
<configuration artifactName="${ProjName}" buildProperties="" description="" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443" name="eive-mingw-debug" optionalBuildProperties="org.eclipse.cdt.docker.launcher.containerbuild.property.volumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.selectedvolumes=" parent="org.eclipse.cdt.build.core.emptycfg">
|
||||||
<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"/>
|
||||||
@ -218,9 +218,9 @@
|
|||||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||||
</cconfiguration>
|
</cconfiguration>
|
||||||
<cconfiguration id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851">
|
<cconfiguration id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851">
|
||||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851" moduleId="org.eclipse.cdt.core.settings" name="eive-rpi-debug-win">
|
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851" moduleId="org.eclipse.cdt.core.settings" name="eive-rpi-debug">
|
||||||
<macros>
|
<macros>
|
||||||
<stringMacro name="RPI_SYSROOT" type="VALUE_TEXT" value="C:\Users\Robin\raspberrypi\rootfs"/>
|
<stringMacro name="RPI_SYSROOT" type="VALUE_TEXT" value="/home/rmueller/raspberrypi/rootfs"/>
|
||||||
</macros>
|
</macros>
|
||||||
<externalSettings/>
|
<externalSettings/>
|
||||||
<extensions>
|
<extensions>
|
||||||
@ -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" 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">
|
||||||
<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 ." buildPath="${workspace_loc:/eive_obsw/Debug-RPi}" 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"/>
|
||||||
<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>
|
||||||
@ -367,7 +369,7 @@
|
|||||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||||
</cconfiguration>
|
</cconfiguration>
|
||||||
<cconfiguration id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.190921171">
|
<cconfiguration id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.190921171">
|
||||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.190921171" moduleId="org.eclipse.cdt.core.settings" name="eive-rpi-release-win">
|
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.190921171" moduleId="org.eclipse.cdt.core.settings" name="eive-rpi-release">
|
||||||
<macros>
|
<macros>
|
||||||
<stringMacro name="RPI_SYSROOT" type="VALUE_TEXT" value="C:\Users\Robin\raspberrypi\rootfs"/>
|
<stringMacro name="RPI_SYSROOT" type="VALUE_TEXT" value="C:\Users\Robin\raspberrypi\rootfs"/>
|
||||||
</macros>
|
</macros>
|
||||||
@ -382,7 +384,7 @@
|
|||||||
</extensions>
|
</extensions>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
<configuration artifactName="${ProjName}" buildProperties="" description="" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.190921171" name="eive-rpi-release-win" optionalBuildProperties="org.eclipse.cdt.docker.launcher.containerbuild.property.selectedvolumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.volumes=" parent="org.eclipse.cdt.build.core.emptycfg">
|
<configuration artifactName="${ProjName}" buildProperties="" description="" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.190921171" name="eive-rpi-release" optionalBuildProperties="org.eclipse.cdt.docker.launcher.containerbuild.property.selectedvolumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.volumes=" parent="org.eclipse.cdt.build.core.emptycfg">
|
||||||
<folderInfo id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.190921171." name="/" resourcePath="">
|
<folderInfo id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.190921171." name="/" resourcePath="">
|
||||||
<toolChain id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.503156657" name="Arm Cross GCC" superClass="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base">
|
<toolChain id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.503156657" name="Arm Cross GCC" superClass="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base">
|
||||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.108878061" 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.108878061" name="Architecture" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.architecture" value="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.arm" valueType="enumerated"/>
|
||||||
@ -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:/fsfw_example/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"/>
|
||||||
@ -516,7 +518,7 @@
|
|||||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||||
</cconfiguration>
|
</cconfiguration>
|
||||||
<cconfiguration id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689">
|
<cconfiguration id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689">
|
||||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689" moduleId="org.eclipse.cdt.core.settings" name="eive-q7s-debug-win">
|
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689" moduleId="org.eclipse.cdt.core.settings" name="eive-q7s-debug">
|
||||||
<macros>
|
<macros>
|
||||||
<stringMacro name="Q7S_SYSROOT" type="VALUE_TEXT" value="C:\Xilinx\cortexa9hf-neon-xiphos-linux-gnueabi"/>
|
<stringMacro name="Q7S_SYSROOT" type="VALUE_TEXT" value="C:\Xilinx\cortexa9hf-neon-xiphos-linux-gnueabi"/>
|
||||||
</macros>
|
</macros>
|
||||||
@ -531,7 +533,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.1707795689" name="eive-q7s-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.1707795689" name="eive-q7s-debug" 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">
|
||||||
<folderInfo id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689." name="/" resourcePath="">
|
<folderInfo id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689." name="/" resourcePath="">
|
||||||
<toolChain id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1439714522" name="Arm Cross GCC" superClass="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base">
|
<toolChain id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1439714522" name="Arm Cross GCC" superClass="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base">
|
||||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.1064018737" 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.1064018737" name="Architecture" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.architecture" value="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.arm" valueType="enumerated"/>
|
||||||
@ -664,7 +666,7 @@
|
|||||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||||
</cconfiguration>
|
</cconfiguration>
|
||||||
<cconfiguration id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689.1286242200">
|
<cconfiguration id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689.1286242200">
|
||||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689.1286242200" moduleId="org.eclipse.cdt.core.settings" name="eive-q7s-release-win">
|
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689.1286242200" moduleId="org.eclipse.cdt.core.settings" name="eive-q7s-release">
|
||||||
<externalSettings/>
|
<externalSettings/>
|
||||||
<extensions>
|
<extensions>
|
||||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||||
@ -676,7 +678,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.1707795689.1286242200" name="eive-q7s-release-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.1707795689.1286242200" name="eive-q7s-release" 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">
|
||||||
<folderInfo id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689.1286242200." name="/" resourcePath="">
|
<folderInfo id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689.1286242200." name="/" resourcePath="">
|
||||||
<toolChain id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.175672677" name="Arm Cross GCC" superClass="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base">
|
<toolChain id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.175672677" name="Arm Cross GCC" superClass="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base">
|
||||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.592910335" 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.592910335" name="Architecture" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.architecture" value="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.arm" valueType="enumerated"/>
|
||||||
@ -809,25 +811,28 @@
|
|||||||
</cconfiguration>
|
</cconfiguration>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
<project id="eive_obsw.null.1569861610" name="eive_obsw"/>
|
<project id="eive_obsw.null.1062489770" name="eive_obsw"/>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||||
<storageModule moduleId="refreshScope" versionNumber="2">
|
<storageModule moduleId="refreshScope" versionNumber="2">
|
||||||
<configuration configurationName="eive-linux-host-debug"/>
|
|
||||||
<configuration configurationName="eive-q7s-release-win">
|
<configuration configurationName="eive-q7s-release-win">
|
||||||
<resource resourceType="PROJECT" workspacePath="/eive_obsw"/>
|
<resource resourceType="PROJECT" workspacePath="/eive_obsw"/>
|
||||||
</configuration>
|
</configuration>
|
||||||
<configuration configurationName="eive-mingw-release"/>
|
<configuration configurationName="eive-mingw-release"/>
|
||||||
<configuration configurationName="eive-rpi-release-win"/>
|
<configuration configurationName="eive-rpi-release-win"/>
|
||||||
<configuration configurationName="eive-linux-host-release"/>
|
|
||||||
<configuration configurationName="eive-mingw-debug">
|
|
||||||
<resource resourceType="PROJECT" workspacePath="/eive_obsw"/>
|
|
||||||
</configuration>
|
|
||||||
<configuration configurationName="Default">
|
<configuration configurationName="Default">
|
||||||
<resource resourceType="PROJECT" workspacePath="/eive_obsw"/>
|
<resource resourceType="PROJECT" workspacePath="/eive_obsw"/>
|
||||||
</configuration>
|
</configuration>
|
||||||
<configuration configurationName="eive-rpi-debug-win"/>
|
<configuration configurationName="eive-rpi-debug-win"/>
|
||||||
<configuration configurationName="eive-q7s-debug-win"/>
|
<configuration configurationName="eive-q7s-debug-win"/>
|
||||||
|
<configuration configurationName="eive-linux-host-debug"/>
|
||||||
|
<configuration configurationName="eive-q7s-release"/>
|
||||||
|
<configuration configurationName="eive-rpi-release"/>
|
||||||
|
<configuration configurationName="eive-q7s-debug"/>
|
||||||
|
<configuration configurationName="eive-linux-host-release"/>
|
||||||
|
<configuration configurationName="eive-mingw-debug">
|
||||||
|
<resource resourceType="PROJECT" workspacePath="/eive_obsw"/>
|
||||||
|
</configuration>
|
||||||
<configuration configurationName="eive-rpi-debug"/>
|
<configuration configurationName="eive-rpi-debug"/>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings">
|
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings">
|
||||||
@ -837,9 +842,17 @@
|
|||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
|
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
|
||||||
<buildTargets>
|
<buildTargets>
|
||||||
|
<target name="clean" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
|
<buildCommand>make</buildCommand>
|
||||||
|
<buildArguments>-j16</buildArguments>
|
||||||
|
<buildTarget>clean</buildTarget>
|
||||||
|
<stopOnError>true</stopOnError>
|
||||||
|
<useDefaultCommand>true</useDefaultCommand>
|
||||||
|
<runAllBuilders>true</runAllBuilders>
|
||||||
|
</target>
|
||||||
<target name="hardclean" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
<target name="hardclean" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
<buildCommand>make</buildCommand>
|
<buildCommand>make</buildCommand>
|
||||||
<buildArguments>-f Makefile-Hosted -j16</buildArguments>
|
<buildArguments>-j16</buildArguments>
|
||||||
<buildTarget>hardclean</buildTarget>
|
<buildTarget>hardclean</buildTarget>
|
||||||
<stopOnError>true</stopOnError>
|
<stopOnError>true</stopOnError>
|
||||||
<useDefaultCommand>true</useDefaultCommand>
|
<useDefaultCommand>true</useDefaultCommand>
|
||||||
@ -852,25 +865,13 @@
|
|||||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851;cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.2065184927;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.920837857">
|
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851;cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.2065184927;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.920837857">
|
||||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
</scannerConfigBuildInfo>
|
</scannerConfigBuildInfo>
|
||||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689;cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689.;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.628631287;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.216437361">
|
|
||||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
|
||||||
</scannerConfigBuildInfo>
|
|
||||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689;cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689.;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.1535302916;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.96000231">
|
|
||||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
|
||||||
</scannerConfigBuildInfo>
|
|
||||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.mingw.base.1031020513;cdt.managedbuild.toolchain.gnu.mingw.base.1031020513.519944638;cdt.managedbuild.tool.gnu.c.compiler.mingw.base.438317679;cdt.managedbuild.tool.gnu.c.compiler.input.336445831">
|
|
||||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
|
||||||
</scannerConfigBuildInfo>
|
|
||||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851;cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.1595165802;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.1925043110">
|
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851;cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.1595165802;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.1925043110">
|
||||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
</scannerConfigBuildInfo>
|
</scannerConfigBuildInfo>
|
||||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.190921171;cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.190921171.;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.2044466190;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.1551006500">
|
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.base.2047596104;cdt.managedbuild.toolchain.gnu.base.2047596104.1629235648;cdt.managedbuild.tool.gnu.c.compiler.base.1751527394;cdt.managedbuild.tool.gnu.c.compiler.input.72239787">
|
||||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
</scannerConfigBuildInfo>
|
</scannerConfigBuildInfo>
|
||||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.mingw.base.1031020513;cdt.managedbuild.toolchain.gnu.mingw.base.1031020513.519944638;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.base.205410786;cdt.managedbuild.tool.gnu.cpp.compiler.input.1560428812">
|
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.base.2047596104;cdt.managedbuild.toolchain.gnu.base.2047596104.1629235648;cdt.managedbuild.tool.gnu.cpp.compiler.base.1852610587;cdt.managedbuild.tool.gnu.cpp.compiler.input.1985567520">
|
||||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
|
||||||
</scannerConfigBuildInfo>
|
|
||||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.190921171;cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.190921171.;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.193772074;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.2081570054">
|
|
||||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
</scannerConfigBuildInfo>
|
</scannerConfigBuildInfo>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
|
@ -1,38 +1,55 @@
|
|||||||
#include <mission/devices/GyroL3GD20Handler.h>
|
#include "GyroL3GD20Handler.h"
|
||||||
|
#include <OBSWConfig.h>
|
||||||
|
|
||||||
#include <fsfw/datapool/PoolReadGuard.h>
|
#include <fsfw/datapool/PoolReadGuard.h>
|
||||||
|
|
||||||
GyroHandler::GyroHandler(object_id_t objectId, object_id_t deviceCommunication,
|
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,6 +197,23 @@ 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
|
||||||
|
|
||||||
PoolReadGuard readSet(&dataset);
|
PoolReadGuard readSet(&dataset);
|
||||||
if(readSet.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
|
if(readSet.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
|
||||||
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ MGMHandlerLIS3MDL::MGMHandlerLIS3MDL(object_id_t objectId,
|
|||||||
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 +44,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;
|
||||||
}
|
}
|
||||||
@ -459,7 +462,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) {
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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_ */
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
|
Loading…
Reference in New Issue
Block a user