using big endian now for gyro
This commit is contained in:
@ -1,15 +1,15 @@
|
||||
#include <mission/devices/GyroL3GD20Handler.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):
|
||||
DeviceHandlerBase(objectId, deviceCommunication, comCookie),
|
||||
dataset(this) {
|
||||
}
|
||||
|
||||
GyroHandler::~GyroHandler() {}
|
||||
GyroHandlerL3GD20H::~GyroHandlerL3GD20H() {}
|
||||
|
||||
void GyroHandler::doStartUp() {
|
||||
void GyroHandlerL3GD20H::doStartUp() {
|
||||
if(internalState == InternalState::STATE_NONE) {
|
||||
internalState = InternalState::STATE_CONFIGURE;
|
||||
}
|
||||
@ -22,11 +22,11 @@ void GyroHandler::doStartUp() {
|
||||
}
|
||||
}
|
||||
|
||||
void GyroHandler::doShutDown() {
|
||||
void GyroHandlerL3GD20H::doShutDown() {
|
||||
setMode(_MODE_POWER_DOWN);
|
||||
}
|
||||
|
||||
ReturnValue_t GyroHandler::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
|
||||
ReturnValue_t GyroHandlerL3GD20H::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
|
||||
switch(internalState) {
|
||||
case(InternalState::STATE_NONE):
|
||||
case(InternalState::STATE_NORMAL): {
|
||||
@ -52,12 +52,12 @@ ReturnValue_t GyroHandler::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t GyroHandler::buildNormalDeviceCommand(DeviceCommandId_t *id) {
|
||||
ReturnValue_t GyroHandlerL3GD20H::buildNormalDeviceCommand(DeviceCommandId_t *id) {
|
||||
*id = L3GD20H::READ_REGS;
|
||||
return buildCommandFromCommand(*id, nullptr, 0);
|
||||
}
|
||||
|
||||
ReturnValue_t GyroHandler::buildCommandFromCommand(
|
||||
ReturnValue_t GyroHandlerL3GD20H::buildCommandFromCommand(
|
||||
DeviceCommandId_t deviceCommand, const uint8_t *commandData,
|
||||
size_t commandDataLen) {
|
||||
switch(deviceCommand) {
|
||||
@ -120,7 +120,7 @@ ReturnValue_t GyroHandler::buildCommandFromCommand(
|
||||
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) {
|
||||
// SPI, ID will always be the one of the last sent command.
|
||||
*foundId = this->getPendingCommand();
|
||||
@ -133,7 +133,7 @@ ReturnValue_t GyroHandler::scanForReply(const uint8_t *start, size_t len,
|
||||
return DeviceHandlerIF::INVALID_DATA;
|
||||
}
|
||||
|
||||
ReturnValue_t GyroHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||
ReturnValue_t GyroHandlerL3GD20H::interpretDeviceReply(DeviceCommandId_t id,
|
||||
const uint8_t *packet) {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
switch(id) {
|
||||
@ -189,11 +189,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 20000;
|
||||
}
|
||||
|
||||
ReturnValue_t GyroHandler::initializeLocalDataPool(
|
||||
ReturnValue_t GyroHandlerL3GD20H::initializeLocalDataPool(
|
||||
localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) {
|
||||
localDataPoolMap.emplace(L3GD20H::ANG_VELOC_X,
|
||||
new PoolEntry<float>({0.0}));
|
||||
@ -206,12 +206,12 @@ ReturnValue_t GyroHandler::initializeLocalDataPool(
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
void GyroHandler::fillCommandAndReplyMap() {
|
||||
void GyroHandlerL3GD20H::fillCommandAndReplyMap() {
|
||||
insertInCommandAndReplyMap(L3GD20H::READ_REGS, 1, &dataset);
|
||||
insertInCommandAndReplyMap(L3GD20H::CONFIGURE_CTRL_REGS, 1);
|
||||
insertInCommandAndReplyMap(L3GD20H::READ_CTRL_REGS, 1);
|
||||
}
|
||||
|
||||
void GyroHandler::modeChanged() {
|
||||
void GyroHandlerL3GD20H::modeChanged() {
|
||||
internalState = InternalState::STATE_NONE;
|
||||
}
|
||||
|
Reference in New Issue
Block a user