From 31f7f1776648ef76ba9d211e857fd385dc828529 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Sun, 4 Apr 2021 11:21:17 +0200 Subject: [PATCH] smart, loop 5 times, and shorten delay instead --- armsrc/i2c.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/armsrc/i2c.c b/armsrc/i2c.c index 162126d76..2b9bac13a 100644 --- a/armsrc/i2c.c +++ b/armsrc/i2c.c @@ -219,7 +219,7 @@ static bool I2C_WaitForSim(void) { // 8051 speaks with smart card. // 1000*50*3.07 = 153.5ms // 1byte transfer == 1ms with max frame being 256bytes - if (!WaitSCL_H_delay(10 * 1000 * 50)) + if (!WaitSCL_H_delay(10 * 1000 * 30)) return false; return true; @@ -626,7 +626,7 @@ int I2C_get_version(uint8_t *maj, uint8_t *min) { // Will read response from smart card module, retries 3 times to get the data. bool sc_rx_bytes(uint8_t *dest, uint8_t *destlen) { - uint8_t i = 3; + uint8_t i = 5; int16_t len = 0; while (i--) { @@ -634,7 +634,6 @@ bool sc_rx_bytes(uint8_t *dest, uint8_t *destlen) { len = I2C_BufferRead(dest, *destlen, I2C_DEVICE_CMD_READ, I2C_DEVICE_ADDRESS_MAIN); - LED_C_ON(); if (len > 1) {