syrlinks handler wip
This commit is contained in:
parent
9138b98878
commit
89d0427437
@ -12,6 +12,7 @@ target_sources(${TARGET_NAME} PUBLIC
|
||||
ACUHandler.cpp
|
||||
HeaterHandler.cpp
|
||||
SolarArrayDeploymentHandler.cpp
|
||||
SyrlinksHkHandler.cpp
|
||||
)
|
||||
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include <mission/devices/SyrlinksHkHandler.h>
|
||||
#include <mission/devices/devicedefinitions/Tmp1075Definitions.h>
|
||||
#include <fsfwconfig/OBSWConfig.h>
|
||||
|
||||
SyrlinksHkHandler::SyrlinksHkHandler(object_id_t objectId, object_id_t comIF,
|
||||
@ -27,19 +26,9 @@ void SyrlinksHkHandler::doShutDown(){
|
||||
|
||||
ReturnValue_t SyrlinksHkHandler::buildNormalDeviceCommand(
|
||||
DeviceCommandId_t * id) {
|
||||
|
||||
if(communicationStep == CommunicationStep::START_ADC_CONVERSION) {
|
||||
*id = TMP1075::START_ADC_CONVERSION;
|
||||
communicationStep = CommunicationStep::GET_TEMPERATURE;
|
||||
*id = READ_RX_STATUS_REGISTERS;
|
||||
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(
|
||||
DeviceCommandId_t * id){
|
||||
@ -50,19 +39,29 @@ ReturnValue_t SyrlinksHkHandler::buildCommandFromCommand(
|
||||
DeviceCommandId_t deviceCommand, const uint8_t * commandData,
|
||||
size_t commandDataLen) {
|
||||
switch(deviceCommand) {
|
||||
case(TMP1075::START_ADC_CONVERSION): {
|
||||
std::memset(cmdBuffer, 0, sizeof(cmdBuffer));
|
||||
prepareAdcConversionCommand();
|
||||
rawPacket = cmdBuffer;
|
||||
rawPacketLen = TMP1075::CFGR_CMD_SIZE;
|
||||
case(RESET_UNIT): {
|
||||
resetCommand.copy(rawPacket, resetCommand.size(), 0);
|
||||
rawPacketLen = resetCommand.size();
|
||||
return RETURN_OK;
|
||||
}
|
||||
case(TMP1075::GET_TEMP): {
|
||||
std::memset(cmdBuffer, 0, sizeof(cmdBuffer));
|
||||
prepareGetTempCommand();
|
||||
rawPacket = cmdBuffer;
|
||||
rawPacketLen = TMP1075::POINTER_REG_SIZE;
|
||||
rememberCommandId = TMP1075::GET_TEMP;
|
||||
case(SET_TX_MODE_STANDBY): {
|
||||
setTxModeStandby.copy(rawPacket, setTxModeStandby.size(), 0);
|
||||
rawPacketLen = setTxModeStandby.size();
|
||||
return RETURN_OK;
|
||||
}
|
||||
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;
|
||||
}
|
||||
default:
|
||||
@ -72,8 +71,11 @@ ReturnValue_t SyrlinksHkHandler::buildCommandFromCommand(
|
||||
}
|
||||
|
||||
void SyrlinksHkHandler::fillCommandAndReplyMap(){
|
||||
this->insertInCommandMap(TMP1075::START_ADC_CONVERSION);
|
||||
this->insertInCommandAndReplyMap(TMP1075::GET_TEMP, 1, &dataset,
|
||||
this->insertInCommandAndReplyMap(RESET_UNIT);
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define MISSION_DEVICES_SYRLINKSHKHANDLER_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
|
||||
@ -38,6 +38,29 @@ protected:
|
||||
|
||||
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
|
||||
* conversion for a new temperature value.
|
||||
|
15
mission/devices/devicedefinitions/SyrlinksDefinitions.h
Normal file
15
mission/devices/devicedefinitions/SyrlinksDefinitions.h
Normal 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_ */
|
Loading…
Reference in New Issue
Block a user