fix issue of i2c bus failover loop
This commit is contained in:
parent
4725a97d34
commit
5c2b059eab
Binary file not shown.
|
@ -141,20 +141,28 @@ static void _I2cFailRecover(){
|
|||
if( HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_11) == 0 ){
|
||||
__GPIOB_CLK_ENABLE();
|
||||
//We are still in bad i2c state warm user by blinking led but stay here
|
||||
/*
|
||||
GPIO_InitStruct.Pin = LED1_Pin ;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(LED3_GPIO_Port, &GPIO_InitStruct);
|
||||
*/
|
||||
nRetry = 0;
|
||||
do{
|
||||
HAL_GPIO_WritePin(LED3_GPIO_Port, LED3_Pin, GPIO_PIN_SET);
|
||||
// HAL_GPIO_WritePin(LED3_GPIO_Port, LED3_Pin, GPIO_PIN_SET);
|
||||
LED_RED_ON;
|
||||
HAL_Delay(33);
|
||||
HAL_GPIO_WritePin(LED3_GPIO_Port, LED3_Pin, GPIO_PIN_RESET);
|
||||
// HAL_GPIO_WritePin(LED3_GPIO_Port, LED3_Pin, GPIO_PIN_RESET);
|
||||
LED_RED_OFF;
|
||||
HAL_Delay(33);
|
||||
HAL_GPIO_WritePin(LED3_GPIO_Port, LED3_Pin, GPIO_PIN_SET);
|
||||
// HAL_GPIO_WritePin(LED3_GPIO_Port, LED3_Pin, GPIO_PIN_SET);
|
||||
LED_RED_ON;
|
||||
HAL_Delay(33);
|
||||
HAL_GPIO_WritePin(LED3_GPIO_Port, LED3_Pin, GPIO_PIN_RESET);
|
||||
HAL_Delay(33*20);
|
||||
}while(1);
|
||||
// HAL_GPIO_WritePin(LED3_GPIO_Port, LED3_Pin, GPIO_PIN_RESET);
|
||||
LED_RED_OFF;
|
||||
HAL_Delay(33*4);
|
||||
nRetry++;
|
||||
}while(nRetry < 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue