syrlinks handler wip

This commit is contained in:
Jakob Meier 2021-02-18 16:16:38 +01:00
parent 3bc5d1abce
commit effb703d14
4 changed files with 68 additions and 27 deletions

View File

@ -12,6 +12,7 @@ target_sources(${TARGET_NAME} PUBLIC
ACUHandler.cpp ACUHandler.cpp
HeaterHandler.cpp HeaterHandler.cpp
SolarArrayDeploymentHandler.cpp SolarArrayDeploymentHandler.cpp
SyrlinksHkHandler.cpp
) )

View File

@ -1,5 +1,4 @@
#include <mission/devices/SyrlinksHkHandler.h> #include <mission/devices/SyrlinksHkHandler.h>
#include <mission/devices/devicedefinitions/Tmp1075Definitions.h>
#include <fsfwconfig/OBSWConfig.h> #include <fsfwconfig/OBSWConfig.h>
SyrlinksHkHandler::SyrlinksHkHandler(object_id_t objectId, object_id_t comIF, SyrlinksHkHandler::SyrlinksHkHandler(object_id_t objectId, object_id_t comIF,
@ -27,18 +26,8 @@ void SyrlinksHkHandler::doShutDown(){
ReturnValue_t SyrlinksHkHandler::buildNormalDeviceCommand( ReturnValue_t SyrlinksHkHandler::buildNormalDeviceCommand(
DeviceCommandId_t * id) { DeviceCommandId_t * id) {
*id = READ_RX_STATUS_REGISTERS;
if(communicationStep == CommunicationStep::START_ADC_CONVERSION) { return buildCommandFromCommand(*id, NULL, 0);
*id = TMP1075::START_ADC_CONVERSION;
communicationStep = CommunicationStep::GET_TEMPERATURE;
return buildCommandFromCommand(*id, NULL, 0);
}
else {
*id = TMP1075::GET_TEMP;
communicationStep = CommunicationStep::START_ADC_CONVERSION;
return buildCommandFromCommand(*id, NULL, 0);
}
return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t SyrlinksHkHandler::buildTransitionDeviceCommand( ReturnValue_t SyrlinksHkHandler::buildTransitionDeviceCommand(
@ -50,19 +39,29 @@ ReturnValue_t SyrlinksHkHandler::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(TMP1075::START_ADC_CONVERSION): { case(RESET_UNIT): {
std::memset(cmdBuffer, 0, sizeof(cmdBuffer)); resetCommand.copy(rawPacket, resetCommand.size(), 0);
prepareAdcConversionCommand(); rawPacketLen = resetCommand.size();
rawPacket = cmdBuffer;
rawPacketLen = TMP1075::CFGR_CMD_SIZE;
return RETURN_OK; return RETURN_OK;
} }
case(TMP1075::GET_TEMP): { case(SET_TX_MODE_STANDBY): {
std::memset(cmdBuffer, 0, sizeof(cmdBuffer)); setTxModeStandby.copy(rawPacket, setTxModeStandby.size(), 0);
prepareGetTempCommand(); rawPacketLen = setTxModeStandby.size();
rawPacket = cmdBuffer; return RETURN_OK;
rawPacketLen = TMP1075::POINTER_REG_SIZE; }
rememberCommandId = TMP1075::GET_TEMP; case(SET_TX_MODE_MODULATION): {
setTxModeModulation.copy(rawPacket, setTxModeModulation.size(), 0);
rawPacketLen = setTxModeModulation.size();
return RETURN_OK;
}
case(SET_TX_MODE_CW): {
setTxModeCw.copy(rawPacket, setTxModeCw.size(), 0);
rawPacketLen = setTxModeCw.size();
return RETURN_OK;
}
case(READ_RX_STATUS_REGISTERS): {
readRxStatusRegCommand.copy(rawPacket, readRxStatusRegCommand.size(), 0);
rawPacketLen = readRxStatusRegCommand.size();
return RETURN_OK; return RETURN_OK;
} }
default: default:
@ -72,8 +71,11 @@ ReturnValue_t SyrlinksHkHandler::buildCommandFromCommand(
} }
void SyrlinksHkHandler::fillCommandAndReplyMap(){ void SyrlinksHkHandler::fillCommandAndReplyMap(){
this->insertInCommandMap(TMP1075::START_ADC_CONVERSION); this->insertInCommandAndReplyMap(RESET_UNIT);
this->insertInCommandAndReplyMap(TMP1075::GET_TEMP, 1, &dataset, this->insertInCommandAndReplyMap(SET_TX_MODE_STANDBY);
this->insertInCommandAndReplyMap(SET_TX_MODE_MODULATION);
this->insertInCommandAndReplyMap(SET_TX_MODE_CW);
this->insertInCommandAndReplyMap(READ_RX_STATUS_REGISTERS, 1, &rxStatusRegiserSet,
TMP1075::GET_TEMP_REPLY_SIZE); TMP1075::GET_TEMP_REPLY_SIZE);
} }

View File

@ -2,7 +2,7 @@
#define MISSION_DEVICES_SYRLINKSHKHANDLER_H_ #define MISSION_DEVICES_SYRLINKSHKHANDLER_H_
#include <fsfw/devicehandlers/DeviceHandlerBase.h> #include <fsfw/devicehandlers/DeviceHandlerBase.h>
#include <mission/devices/devicedefinitions/Tmp1075Definitions.h> #include <cstring.h>
/** /**
* @brief This is the device handler for the syrlinks transceiver. It handles the command * @brief This is the device handler for the syrlinks transceiver. It handles the command
@ -38,6 +38,29 @@ protected:
private: private:
static const DeviceCommandId_t RESET_UNIT = 0x01;
/** Reads out all status registers */
static const DeviceCommandId_t READ_RX_STATUS_REGISTERS = 0x02;
/** Sets Tx mode to standby */
static const DeviceCommandId_t SET_TX_MODE_STANDBY = 0x03;
/** Starts transmission mode. Only reached when clock signal is applying to the data tx input */
static const DeviceCommandId_t SET_TX_MODE_MODULATION = 0x04;
/** Sends out a single carrier wave for testing purpose */
static const DeviceCommandId_t SET_TX_MODE_CW = 0x05;
/** Size of a simple transmission success response */
static const uint8_t REQUEST_STATUS_REPLY_SIZE = 11;
/** Size of reply to an rx status registers request */
static const uint8_t RX_STATUS_REGISTERS_REPLY_SIZE = 39;
std::string resetCommand = "<C04:5A5A:FF41>";
std::string readRxStatusRegCommand = "<E00::825B>";
std::string setTxModeStandby = "<W04:0040:2B9E>";
/** W - write, 04 - 4 bytes in data field, 01 - value, 40 register to write value */
std::string setTxModeModulation = "<W04:0140:5D2A>";
std::string setTxModeCw = "<W04:1040:81CF>";
/** /**
* @brief Function fills cmdBuffer with command to start the adc * @brief Function fills cmdBuffer with command to start the adc
* conversion for a new temperature value. * conversion for a new temperature value.

View File

@ -0,0 +1,15 @@
/*
* SyrlinksDefinitions.h
*
* Created on: 18.02.2021
* Author: jakob
*/
#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_SYRLINKSDEFINITIONS_H_
#define MISSION_DEVICES_DEVICEDEFINITIONS_SYRLINKSDEFINITIONS_H_
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_SYRLINKSDEFINITIONS_H_ */