eive-obsw/mission/devices/devicedefinitions/SyrlinksDefinitions.h

122 lines
4.9 KiB
C
Raw Normal View History

2021-02-18 16:16:38 +01:00
#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_SYRLINKSDEFINITIONS_H_
#define MISSION_DEVICES_DEVICEDEFINITIONS_SYRLINKSDEFINITIONS_H_
2022-04-28 15:25:03 +02:00
#include <commonSubsystemIds.h>
namespace syrlinks {
2021-02-18 16:16:38 +01:00
2022-04-28 15:25:03 +02:00
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SYRLINKS;
static constexpr Event FDIR_REACTION_IGNORED = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
2022-03-31 09:11:01 +02:00
static const DeviceCommandId_t NONE = 0;
static const DeviceCommandId_t RESET_UNIT = 1;
2022-01-17 15:58:27 +01:00
/** Reads out all status registers */
2022-03-31 09:11:01 +02:00
static const DeviceCommandId_t READ_RX_STATUS_REGISTERS = 2;
2022-01-17 15:58:27 +01:00
/** Sets Tx mode to standby */
2022-03-31 09:11:01 +02:00
static const DeviceCommandId_t SET_TX_MODE_STANDBY = 3;
2022-01-17 15:58:27 +01:00
/** Starts transmission mode. Only reached when clock signal is applying to the data tx input */
2022-03-31 09:11:01 +02:00
static const DeviceCommandId_t SET_TX_MODE_MODULATION = 4;
2022-01-17 15:58:27 +01:00
/** Sends out a single carrier wave for testing purpose */
2022-03-31 09:11:01 +02:00
static const DeviceCommandId_t SET_TX_MODE_CW = 5;
static const DeviceCommandId_t ACK_REPLY = 6;
static const DeviceCommandId_t READ_TX_STATUS = 7;
static const DeviceCommandId_t READ_TX_WAVEFORM = 8;
static const DeviceCommandId_t READ_TX_AGC_VALUE_HIGH_BYTE = 9;
static const DeviceCommandId_t READ_TX_AGC_VALUE_LOW_BYTE = 10;
2022-03-30 16:29:58 +02:00
static const DeviceCommandId_t WRITE_LCL_CONFIG = 11;
static const DeviceCommandId_t READ_LCL_CONFIG = 12;
2022-03-31 09:11:01 +02:00
static const DeviceCommandId_t TEMP_POWER_AMPLIFIER_HIGH_BYTE = 13;
static const DeviceCommandId_t TEMP_POWER_AMPLIFIER_LOW_BYTE = 14;
static const DeviceCommandId_t TEMP_BASEBAND_BOARD_HIGH_BYTE = 15;
static const DeviceCommandId_t TEMP_BASEBAND_BOARD_LOW_BYTE = 16;
2022-04-04 14:58:35 +02:00
static const DeviceCommandId_t CONFIG_OQPSK = 17;
// After startup syrlinks always in BSPK configuration
static const DeviceCommandId_t CONFIG_BPSK = 18;
2022-04-01 14:15:42 +02:00
static const DeviceCommandId_t ENABLE_DEBUG = 20;
2022-04-04 14:58:35 +02:00
static const DeviceCommandId_t DISABLE_DEBUG = 21;
2022-01-17 15:58:27 +01:00
/** Size of a simple transmission success response */
static const uint8_t ACK_SIZE = 12;
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 = 49;
static const uint8_t READ_ONE_REGISTER_REPLY_SIE = 13;
static const uint8_t RX_DATASET_ID = 0x1;
static const uint8_t TX_DATASET_ID = 0x2;
static const uint8_t TEMPERATURE_SET_ID = 0x3;
2022-01-17 15:58:27 +01:00
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 = 3;
static const uint8_t TEMPERATURE_SET_SIZE = 3;
2022-01-17 15:58:27 +01:00
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,
TEMP_POWER_AMPLIFIER,
TEMP_BASEBAND_BOARD
2021-02-22 09:24:42 +01:00
};
2022-01-17 15:58:27 +01:00
class RxDataset : public StaticLocalDataSet<RX_DATASET_SIZE> {
public:
RxDataset(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, RX_DATASET_ID) {}
RxDataset(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, RX_DATASET_ID)) {}
2021-02-22 09:24:42 +01:00
2022-01-17 15:58:27 +01:00
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);
lp_var_t<uint16_t> rxIqPower = lp_var_t<uint16_t>(sid.objectId, RX_IQ_POWER, this);
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_DATA_RATE, this);
};
2021-02-22 09:24:42 +01:00
2022-01-17 15:58:27 +01:00
class TxDataset : public StaticLocalDataSet<TX_DATASET_SIZE> {
public:
TxDataset(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, TX_DATASET_ID) {}
2021-02-22 09:24:42 +01:00
2022-01-17 15:58:27 +01:00
TxDataset(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, TX_DATASET_ID)) {}
2021-02-22 09:24:42 +01:00
2022-01-17 15:58:27 +01:00
lp_var_t<uint8_t> txStatus = lp_var_t<uint8_t>(sid.objectId, TX_STATUS, this);
lp_var_t<uint8_t> txWaveform = lp_var_t<uint8_t>(sid.objectId, TX_WAVEFORM, this);
lp_var_t<uint16_t> txAgcValue = lp_var_t<uint16_t>(sid.objectId, TX_AGC_VALUE, this);
2021-02-19 11:02:27 +01:00
};
class TemperatureSet : public StaticLocalDataSet<TEMPERATURE_SET_SIZE> {
public:
TemperatureSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, TEMPERATURE_SET_ID) {}
TemperatureSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, TEMPERATURE_SET_ID)) {}
lp_var_t<float> temperaturePowerAmplifier =
lp_var_t<float>(sid.objectId, TEMP_POWER_AMPLIFIER, this);
lp_var_t<float> temperatureBasebandBoard =
lp_var_t<float>(sid.objectId, TEMP_BASEBAND_BOARD, this);
};
} // namespace syrlinks
2021-02-18 16:16:38 +01:00
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_SYRLINKSDEFINITIONS_H_ */