Skip to content

Commit c64cfb5

Browse files
committed
[I2C] Harden init
Signed-off-by: Frederic.Pillon <[email protected]>
1 parent d6b8f16 commit c64cfb5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

cores/arduino/stm32/twi.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,11 @@ void i2c_custom_init(i2c_t *obj, i2c_timing_e timing, uint32_t addressingMode, u
205205
HAL_NVIC_EnableIRQ(obj->irqER);
206206
#endif // !defined(STM32F0xx) && !defined(STM32L0xx)
207207

208-
// Init the I2C
209-
HAL_I2C_Init(handle);
208+
/* Init the I2C */
209+
if (HAL_I2C_Init(handle) != HAL_OK) {
210+
/* Initialization Error */
211+
Error_Handler();
212+
}
210213

211214
obj->isMaster = master;
212215
/* Initialize default values */

0 commit comments

Comments
 (0)