From 2203b8ed53a71e6da44ca54acaaf9764a05898a5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 22 Dec 2020 13:41:01 +0100 Subject: [PATCH] started gyro handler, renamed --- .../{GyroHandler.cpp => GyroL3GD20Handler.cpp} | 13 +++++++++++-- .../devices/{GyroHandler.h => GyroL3GD20Handler.h} | 14 +++++++++++--- .../devicedefinitions/GyroL3GD20Definitions.h | 11 +++++++++++ 3 files changed, 33 insertions(+), 5 deletions(-) rename mission/devices/{GyroHandler.cpp => GyroL3GD20Handler.cpp} (79%) rename mission/devices/{GyroHandler.h => GyroL3GD20Handler.h} (82%) create mode 100644 mission/devices/devicedefinitions/GyroL3GD20Definitions.h diff --git a/mission/devices/GyroHandler.cpp b/mission/devices/GyroL3GD20Handler.cpp similarity index 79% rename from mission/devices/GyroHandler.cpp rename to mission/devices/GyroL3GD20Handler.cpp index f3064ebc..772d0263 100644 --- a/mission/devices/GyroHandler.cpp +++ b/mission/devices/GyroL3GD20Handler.cpp @@ -1,4 +1,4 @@ -#include "GyroHandler.h" +#include GyroHandler::GyroHandler(object_id_t objectId, object_id_t deviceCommunication, CookieIF *comCookie): @@ -8,11 +8,20 @@ GyroHandler::GyroHandler(object_id_t objectId, object_id_t deviceCommunication, GyroHandler::~GyroHandler() {} void GyroHandler::doStartUp() { + if(internalState == InternalState::STATE_NONE) { + internalState = InternalState::STATE_CONFIGURE; + } + if(internalState == InternalState::STATE_CONFIGURE) { + if(commandExecuted) { + internalState = InternalState::STATE_NORMAL; + commandExecuted = false; + } + } } void GyroHandler::doShutDown() { - + setMode(_MODE_POWER_DOWN); } ReturnValue_t GyroHandler::buildTransitionDeviceCommand(DeviceCommandId_t *id) { diff --git a/mission/devices/GyroHandler.h b/mission/devices/GyroL3GD20Handler.h similarity index 82% rename from mission/devices/GyroHandler.h rename to mission/devices/GyroL3GD20Handler.h index 5ced880e..e1ced8d7 100644 --- a/mission/devices/GyroHandler.h +++ b/mission/devices/GyroL3GD20Handler.h @@ -1,5 +1,5 @@ -#ifndef MISSION_DEVICES_GYROHANDLER_H_ -#define MISSION_DEVICES_GYROHANDLER_H_ +#ifndef MISSION_DEVICES_GYROL3GD20HANDLER_H_ +#define MISSION_DEVICES_GYROL3GD20HANDLER_H_ #include @@ -41,8 +41,16 @@ protected: private: + enum InternalState { + STATE_NONE, + STATE_CONFIGURE, + STATE_NORMAL + }; + InternalState internalState = InternalState::STATE_NONE; + bool commandExecuted = false; + }; -#endif /* MISSION_DEVICES_GYROHANDLER_H_ */ +#endif /* MISSION_DEVICES_GYROL3GD20HANDLER_H_ */ diff --git a/mission/devices/devicedefinitions/GyroL3GD20Definitions.h b/mission/devices/devicedefinitions/GyroL3GD20Definitions.h new file mode 100644 index 00000000..598803fa --- /dev/null +++ b/mission/devices/devicedefinitions/GyroL3GD20Definitions.h @@ -0,0 +1,11 @@ +#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_GYROL3GD20DEFINITIONS_H_ +#define MISSION_DEVICES_DEVICEDEFINITIONS_GYROL3GD20DEFINITIONS_H_ + +namespace L3GD20H { + + +} + + + +#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_GYROL3GD20DEFINITIONS_H_ */