28 lines
724 B
C++
28 lines
724 B
C++
#include "PtmeRateSetter.h"
|
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
|
|
|
PtmeRateSetter::PtmeRateSetter(gpioId_t bitrateSel, GpioIF* gpioif) :
|
|
bitrateSel(bitrateSel), gpioif(gpioif) {
|
|
}
|
|
|
|
PtmeRateSetter::~PtmeRateSetter() {
|
|
}
|
|
|
|
ReturnValue_t PtmeRateSetter::setRate(BitRates rate) {
|
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
|
switch(rate) {
|
|
case RATE_2000KHZ:
|
|
result = gpioif->pullHigh(bitrateSel);
|
|
break;
|
|
case RATE_400KHZ:
|
|
result = gpioif->pullLow(bitrateSel);
|
|
break;
|
|
default:
|
|
sif::debug << "PtmeRateSetter::setRate: Invalid rate" << std::endl;
|
|
result = HasReturnvaluesIF::RETURN_FAILED;
|
|
break;
|
|
}
|
|
return result;
|
|
}
|
|
|