1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

Dino: overload operator>> for IoextPorts

Signed-off-by: Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de>
This commit is contained in:
Niklas Eiling 2024-01-09 13:34:26 +01:00 committed by Niklas Eiling
parent 60c65c2880
commit db062f08bd
2 changed files with 19 additions and 0 deletions

View file

@ -30,6 +30,23 @@ public:
bool gain_msb : 1;
} fields;
uint8_t raw;
friend std::ostream &operator<<(std::ostream &stream,
const IoextPorts &ports) {
return stream << "IoextPorts [clk_dir=" << ports.fields.clk_dir
<< ", data_dir=" << ports.fields.data_dir
<< ", status_led=" << ports.fields.status_led
<< ", n_we=" << ports.fields.n_we
<< ", input_zero=" << ports.fields.input_zero
<< ", sat_detect=" << ports.fields.sat_detect
<< ", gain_lsb=" << ports.fields.gain_lsb
<< ", gain_msb=" << ports.fields.gain_msb << "]";
}
std::string toString() {
std::stringstream s;
s << *this;
return s.str();
}
};
enum Gain { GAIN_1 = 0, GAIN_2 = 1, GAIN_5 = 2, GAIN_10 = 3 };

View file

@ -108,6 +108,7 @@ void DinoAdc::configureHardware() {
throw RuntimeError("Failed to set IOEXT output register");
}
i2cdev->getSwitch().unlockChannel();
logger->debug("ADC configured: {}", readback);
}
DinoDac::DinoDac() : Dino() {}
@ -139,6 +140,7 @@ void DinoDac::configureHardware() {
throw RuntimeError("Failed to set IOEXT output register");
}
i2cdev->getSwitch().unlockChannel();
logger->debug("DAC configured: {}", readback);
}
void DinoDac::setGain(Gain gain) {