smart, loop 5 times, and shorten delay instead

This commit is contained in:
iceman1001 2021-04-04 11:21:17 +02:00
parent ce9a6930c9
commit 31f7f17766

View file

@ -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) {