syrlinks handler ready for testing

This commit is contained in:
2021-02-22 09:24:42 +01:00
parent 13c75ed9c2
commit 9bdc2096b0
18 changed files with 842 additions and 247 deletions

View File

@ -1,10 +1,3 @@
/*
* SyrlinksDefinitions.h
*
* Created on: 18.02.2021
* Author: jakob
*/
#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_SYRLINKSDEFINITIONS_H_
#define MISSION_DEVICES_DEVICEDEFINITIONS_SYRLINKSDEFINITIONS_H_
@ -21,34 +14,57 @@ namespace SYRLINKS {
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;
static const DeviceCommandId_t ACK_REPLY = 0x06;
static const DeviceCommandId_t READ_TX_STATUS = 0x07;
/** Size of a simple transmission success response */
static const uint8_t REQUEST_STATUS_REPLY_SIZE = 11;
static const uint8_t ACK_SIZE = 11;
static const uint8_t SIZE_CRC_AND_TERMINATION = 5;
/** The size of the header with the message identifier and the payload size field */
static const uint8_t MESSAGE_HEADER_SIZE = 5;
/** Size of reply to an rx status registers request */
static const uint8_t RX_STATUS_REGISTERS_REPLY_SIZE = 39;
static const uint8_t RX_STATUS_REGISTERS_REPLY_SIZE = 30;
static const uint8_t READ_TX_STATUS_REPLY_SIZE = 13;
static const uint8_t RX_STATUS_REGISTERS_SET_ID = READ_RX_STATUS_REGISTERS;
static const uint8_t RX_DATASET_ID = READ_RX_STATUS_REGISTERS;
static const uint8_t TX_DATASET_ID = READ_TX_STATUS;
class RxStatusRegistersDataset: public StaticLocalDataSet<sizeof(float)> {
static const size_t MAX_REPLY_SIZE = RX_STATUS_REGISTERS_REPLY_SIZE;
static const size_t MAX_COMMAND_SIZE = 15;
static const size_t CRC_FIELD_SIZE = 4;
static const uint8_t RX_DATASET_SIZE = 8;
static const uint8_t TX_DATASET_SIZE = 1;
enum SyrlinksPoolIds: lp_id_t {
RX_STATUS,
RX_SENSITIVITY,
RX_FREQUENCY_SHIFT,
RX_IQ_POWER,
RX_AGC_VALUE,
RX_DEMOD_EB,
RX_DEMOD_N0,
RX_DATA_RATE,
TX_STATUS,
TX_CONV_DIFF,
TX_CONV_FILTER,
TX_WAVEFORM,
TX_PCM_INDEX,
TX_AGC_VALUE,
};
class RxDataset: public StaticLocalDataSet<RX_DATASET_SIZE> {
public:
RxStatusRegistersDataset(HasLocalDataPoolIF* owner) :
StaticLocalDataSet(owner, RX_STATUS_REGISTERS_SET_ID) {
RxDataset(HasLocalDataPoolIF* owner) :
StaticLocalDataSet(owner, RX_DATASET_ID) {
}
RxStatusRegistersDataset(object_id_t objectId) :
StaticLocalDataSet(sid_t(objectId, RX_STATUS_REGISTERS_SET_ID)) {
RxDataset(object_id_t objectId) :
StaticLocalDataSet(sid_t(objectId, RX_DATASET_ID)) {
}
lp_var_t<uint8_t> fpgaVersion = lp_var_t<uint8_t>(sid.objectId, FPGA_VERSION, this);
lp_var_t<uint8_t> fpgaBuild = lp_var_t<uint8_t>(sid.objectId, FPGA_BUILD, this);
lp_var_t<uint32_t> hardwareId = lp_var_t<uint32_t>(sid.objectId, HARDWARE_ID, this);
lp_var_t<uint8_t> fpgaType = lp_var_t<uint8_t>(sid.objectId, FPGA_TYPE, this);
lp_var_t<uint8_t> lclStatus = lp_var_t<uint8_t>(sid.objectId, LCL_STATUS, this);
lp_var_t<uint8_t> fpgaOption = lp_var_t<uint8_t>(sid.objectId, FPGA_OPTION, this);
lp_var_t<uint8_t> rxStatus = lp_var_t<uint8_t>(sid.objectId, RX_STATUS, this);
lp_var_t<uint32_t> rxSensitivity = lp_var_t<uint32_t>(sid.objectId, RX_SENSITIVITY, this);
lp_var_t<uint32_t> rxFrequencyShift = lp_var_t<uint32_t>(sid.objectId, RX_FREQUENCY_SHIFT, this);
@ -56,13 +72,22 @@ public:
lp_var_t<uint16_t> rxAgcValue = lp_var_t<uint16_t>(sid.objectId, RX_AGC_VALUE, this);
lp_var_t<uint32_t> rxDemodEb = lp_var_t<uint32_t>(sid.objectId, RX_DEMOD_EB, this);
lp_var_t<uint32_t> rxDemodN0 = lp_var_t<uint32_t>(sid.objectId, RX_DEMOD_N0, this);
lp_var_t<uint8_t> rxDataRate = lp_var_t<uint8_t>(sid.objectId, RX_DEMOD_N0, this);
lp_var_t<uint8_t> rxDataRate = lp_var_t<uint8_t>(sid.objectId, RX_DATA_RATE, this);
};
class TxDataset: public StaticLocalDataSet<TX_DATASET_SIZE> {
public:
TxDataset(HasLocalDataPoolIF* owner) :
StaticLocalDataSet(owner, TX_DATASET_ID) {
}
TxDataset(object_id_t objectId) :
StaticLocalDataSet(sid_t(objectId, TX_DATASET_ID)) {
}
lp_var_t<uint8_t> txStatus = lp_var_t<uint8_t>(sid.objectId, TX_STATUS, this);
lp_var_t<uint8_t> txConvDiff = lp_var_t<uint8_t>(sid.objectId, TX_CONV_DIFF, this);
lp_var_t<uint16_t> txConvFilter = lp_var_t<uint16_t>(sid.objectId, TX_CONV_FILTER, this);
lp_var_t<uint8_t> txWaveform = lp_var_t<uint8_t>(sid.objectId, TX_WAVEFORM, this);
lp_var_t<uint8_t> txPcmIndex = lp_var_t<uint8_t>(sid.objectId, TX_PCM_INDEX, this);
lp_var_t<uint16_t> txAgcValue = lp_var_t<uint16_t>(sid.objectId, TX_AGC_VALUE, this);
};
}