/* Checks if target device is ready for communication.  */
uint32_t NFC_IO_IsDeviceReady(uint16_t Addr, uint32_t Trials)
/* Checks if target device is ready for communication.  */
uint32_t NFC_IO_IsDeviceReady(uint16_t Addr, uint32_t Trials)
{
    HAL_StatusTypeDef status;
    uint32_t tickstart = 0;
    uint32_t currenttick = 0;
    tickstart = HAL_GetTick();
    do
    {
        status = HAL_I2C_IsDeviceReady(&hI2cHandler, Addr, Trials, NFC_I2C_TIMEOUT_STD);
        currenttick = HAL_GetTick();
    } while( ( (currenttick - tickstart) < NFC_I2C_TIMEOUT_MAX) && (status != HAL_OK) );
    if (status != HAL_OK)
    {
        return NFC_I2C_ERROR_TIMEOUT;
    } 
    return NFC_I2C_STATUS_SUCCESS;
}