StdPJ/Core/Src/APP/BSP/ug96/ug96.c
/**
  * @brief  Synchronize the modem uart with the STM32 uart (autobauding)
  * @param  Obj: pointer to module handle
  * @retval Operation status.
  */
@brief  Synchronize the modem uart with the STM32 uart (autobauding)
@param  Obj: pointer to module handle
@retval Operation status.
@brief Synchronize the modem uart with the STM32 uart ( autobauding ) @param Obj : pointer to module handle @retval Operation status .
static int32_t  AT_Synchro(Ug96Object_t *Obj)
{
  int32_t ret;
  int8_t atSync = 0;
  uint32_t tickstart;
  tickstart = Obj->GetTickCb();
  do {
    if (TimeLeftFromExpiration(tickstart, Obj->GetTickCb(), UG96_TOUT_ATSYNC) < 0) {
      ret = AT_ExecuteCommand(Obj, UG96_TOUT_SHORT, (uint8_t *)"AT\r\n", RET_OK | RET_ERROR);
      atSync++;
      tickstart = Obj->GetTickCb();
    }
  }
  while ((atSync < 10) && (ret != RET_OK));
  return ret;
}
static int32_t AT_Synchro ( Ug96Object_t * Obj ) { int32_t ret ; int8_t atSync = 0 ; uint32_t tickstart ; tickstart = Obj -> GetTickCb ( ) ; do { if ( TimeLeftFromExpiration ( tickstart , Obj -> GetTickCb ( ) , UG96_TOUT_ATSYNC ) < 0 ) { ret = AT_ExecuteCommand ( Obj , UG96_TOUT_SHORT , ( uint8_t * ) " \r \n " , RET_OK | RET_ERROR ) ; atSync ++ ; tickstart = Obj -> GetTickCb ( ) ; } } while ( ( atSync < 10 ) && ( ret != RET_OK ) ) ; return ret ; }
@brief  Synchronize the modem uart with the STM32 uart (autobauding)
 @param  Obj: pointer to module handle
 @retval Operation status.
@brief Synchronize the modem uart with the STM32 uart ( autobauding ) @param Obj : pointer to module handle @retval Operation status .
/* Init tickstart for timeout management */ /* Start AT SYNC: Send AT every 500ms,
  if receive OK, SYNC success,
  if no OK return after sending AT 10 times, SYNC fail */