[wpilib] Add warning about onboard I2C (#3842)

This commit is contained in:
Kevin-OConnor
2021-12-30 16:13:03 -05:00
committed by GitHub
parent eee29daaf9
commit b85c24a79c
2 changed files with 14 additions and 0 deletions

View File

@@ -16,6 +16,14 @@ using namespace frc;
I2C::I2C(Port port, int deviceAddress)
: m_port(static_cast<HAL_I2CPort>(port)), m_deviceAddress(deviceAddress) {
int32_t status = 0;
if (port == I2C::Port::kOnboard) {
FRC_ReportError(warn::Warning, "{}",
"Onboard I2C port is subject to system lockups. See Known "
"Issues page for "
"details");
}
HAL_InitializeI2C(m_port, &status);
FRC_CheckErrorStatus(status, "Port {}", port);