Skip to content

Fix PCA9548ACom not restoring address when the underlying I2C call fails

Karol Krizka requested to merge PCA9548AComfix into devel

The PCA9548ACom works as follows, with com pointing to the PCA9548A device.

  1. Enable only PCA9548A's channel output
  2. Change com target device address to deviceAddr
  3. Perform requested I2C operation using com
  4. Restore com target device address to PCA9548A

If step 3 fails, then the function aborts and the PCA9548A address is never restored to the internal com object. This fixes it by catching the step 3 exception and restoring the mux address before throwing it again.

Also adds documentation on how the class works.

Merge request reports