29I2C9546SwitchSlave::~I2C9546SwitchSlave() {}
34I2C9546SwitchSlave::ensure_valid_channel(uint8_t channel)
const
39 throw I2C9546SwitchSlaveChannelError(
ERS_HERE, std::to_string(channel));
46I2C9546SwitchSlave::enable_channel(uint8_t channel)
const
48 this->ensure_valid_channel(channel);
49 std::vector<uint8_t> enable_byte = this->read_i2cPrimitive(1);
50 uint8_t new_enable_byte = enable_byte.at(0) | (1UL <<
channel);
51 this->write_i2cPrimitive({new_enable_byte});
57I2C9546SwitchSlave::disable_channel(uint8_t channel)
const
59 this->ensure_valid_channel(channel);
60 std::vector<uint8_t> enable_byte = this->read_i2cPrimitive(1);
61 uint8_t new_enable_byte = enable_byte.at(0) & ~(1UL <<
channel);
62 this->write_i2cPrimitive({new_enable_byte});
68I2C9546SwitchSlave::read_channels_states()
const
70 std::vector<uint8_t> enable_byte = this->read_i2cPrimitive(1);
71 return enable_byte.at(0);
77I2C9546SwitchSlave::set_channels_states(uint8_t channels)
const
79 this->write_i2cPrimitive({channels});
OpenCode I2C interface to a ipbus node.
Class to provide OpenCode I2C interface to a ipbus node.