From b6f44f98befa7943871de38d2e3c077e5979c13f Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Thu, 6 Jan 2022 17:44:27 -0800 Subject: [PATCH] [hal] Add warning about onboard I2C (#3871) Adds HAL layer warning for #3842. This is needed in the case when a vendor uses the HAL directly rather than using the WPILib I2C class. This should not result in a duplicate warning for WPILib I2C users due to the duplicate message checking performed in HAL_SendError(). We don't want to remove the WPILib I2C warning because it gives stack trace information while the HAL layer one can't. --- hal/src/main/native/athena/I2C.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hal/src/main/native/athena/I2C.cpp b/hal/src/main/native/athena/I2C.cpp index 93e280efc6..479f6463ca 100644 --- a/hal/src/main/native/athena/I2C.cpp +++ b/hal/src/main/native/athena/I2C.cpp @@ -54,6 +54,10 @@ void HAL_InitializeI2C(HAL_I2CPort port, int32_t* status) { } if (port == HAL_I2C_kOnboard) { + HAL_SendError(0, 0, 0, + "Onboard I2C port is subject to system lockups. See Known " + "Issues page for details", + "", "", true); std::scoped_lock lock(digitalI2COnBoardMutex); i2COnboardObjCount++; if (i2COnboardObjCount > 1) {