I2C Mux - #121
Open
kshxtij wants to merge 8 commits into
Open
Conversation
ishmis
approved these changes
May 31, 2023
| // TODOLater: Figure out how to not hardcode this | ||
| std::array<std::unique_ptr<sensors::II2cMuxSensor<core::RawAccelerationData>>, 4> | ||
| accelerometers; | ||
| for (int i = 0; i < channels.size(); i++) { |
| accelerometers[i] | ||
| = std::make_unique<sensors::Accelerometer>(std::move(*optional_accelerometer)); | ||
| } | ||
| // sensors::I2cMux<core::RawAccelerationData, 4> mux(logger_, i2c, mux_address, accelerometers); |
maxguy2001
requested changes
May 31, 2023
| = std::make_unique<sensors::Accelerometer>(std::move(*optional_accelerometer)); | ||
| } | ||
| // sensors::I2cMux<core::RawAccelerationData, 4> mux(logger_, i2c, mux_address, accelerometers); | ||
| std::shared_ptr<sensors::I2cMux<core::RawAccelerationData, 4>> mux_ptr |
| logger_.log(core::LogLevel::kFatal, "Failed to read the mux from bus %d", bus); | ||
| } else { | ||
| const std::array<core::RawAccelerationData, 4> mux_result = *value; | ||
| for (int i = 0; i < mux_result.size(); i++) { |
| logger_.log(core::LogLevel::kFatal, "Failure, mismatched device ID for accelerometer"); | ||
| return std::nullopt; | ||
| } | ||
| const auto ctrl1_result = i2c_->writeByteToRegister(device_address_, kCtrl1Address, kCtrl1Value); |
Member
There was a problem hiding this comment.
Why is this auto when we directly check it against failure state 2 lines later? Especially since we wouldn't fail if the return type got changed for whatever reason but would still compile?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added to debug binary and works with hardware now.
