squashed EIVE software
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
#include "PtmeConfig.h"
|
||||
|
||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||
|
||||
PtmeConfig::PtmeConfig(object_id_t objectId, AxiPtmeConfig* axiPtmeConfig)
|
||||
: SystemObject(objectId), axiPtmeConfig(axiPtmeConfig) {}
|
||||
|
||||
PtmeConfig::~PtmeConfig() {}
|
||||
|
||||
ReturnValue_t PtmeConfig::initialize() {
|
||||
if (axiPtmeConfig == nullptr) {
|
||||
sif::warning << "PtmeConfig::initialize: Invalid AxiPtmeConfig object" << std::endl;
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PtmeConfig::setRate(uint32_t bitRate) {
|
||||
if (bitRate == 0) {
|
||||
return BAD_BIT_RATE;
|
||||
}
|
||||
uint32_t rateVal = BIT_CLK_FREQ / bitRate - 1;
|
||||
if (rateVal > 0xFF) {
|
||||
return RATE_NOT_SUPPORTED;
|
||||
}
|
||||
return axiPtmeConfig->writeCaduRateReg(static_cast<uint8_t>(rateVal));
|
||||
}
|
||||
|
||||
uint32_t PtmeConfig::getRate() {
|
||||
uint8_t rateReg = axiPtmeConfig->readCaduRateReg();
|
||||
return (BIT_CLK_FREQ / (rateReg + 1));
|
||||
}
|
||||
|
||||
void PtmeConfig::invertTxClock(bool invert) {
|
||||
if (invert) {
|
||||
axiPtmeConfig->enableTxclockInversion();
|
||||
} else {
|
||||
axiPtmeConfig->disableTxclockInversion();
|
||||
}
|
||||
}
|
||||
|
||||
void PtmeConfig::configTxManipulator(bool enable) {
|
||||
if (enable) {
|
||||
axiPtmeConfig->enableTxclockManipulator();
|
||||
} else {
|
||||
axiPtmeConfig->disableTxclockManipulator();
|
||||
}
|
||||
}
|
||||
|
||||
void PtmeConfig::enableBatPriorityBit(bool enable) {
|
||||
if (enable) {
|
||||
axiPtmeConfig->enableBatPriorityBit();
|
||||
} else {
|
||||
axiPtmeConfig->disableBatPriorityBit();
|
||||
}
|
||||
}
|
||||
|
||||
void PtmeConfig::setPollThreshold(AxiPtmeConfig::IdlePollThreshold pollThreshold) {
|
||||
axiPtmeConfig->writePollThreshold(pollThreshold);
|
||||
}
|
||||
Reference in New Issue
Block a user