Skip to content
This repository has been archived by the owner on Feb 24, 2021. It is now read-only.

Commit

Permalink
chg: i2c - adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris committed Jul 8, 2018
1 parent c8e1eb1 commit 0d8e316
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions common/i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,9 @@ void I2C_Stop(void) {
SCL_L; I2C_DELAY_2CLK;
SDA_L; I2C_DELAY_2CLK;
SCL_H; I2C_DELAY_2CLK;
WaitSCL_H();
if (!WaitSCL_H()) return;
SDA_H;
I2C_DELAY_2CLK;
I2C_DELAY_2CLK;
I2C_DELAY_2CLK;
I2C_DELAY_2CLK;
I2C_DELAY_XCLK(8);
}
// Send i2c ACK
void I2C_Ack(void) {
Expand Down Expand Up @@ -533,10 +530,10 @@ void I2C_print_status(void) {
I2C_Reset_EnterMainProgram();
uint8_t len = I2C_BufferRead(resp, sizeof(resp), I2C_DEVICE_CMD_GETVERSION, I2C_DEVICE_ADDRESS_MAIN);
if ( len > 0 ) {
Dbprintf(" FW version..............v%x.%02x", resp[0], resp[1]);
Dbprintf(" version.................v%x.%02x", resp[0], resp[1]);
LogTrace(resp, len, 0, 0, NULL, false);
} else {
DbpString(" FW version..............FAILED");
DbpString(" version.................FAILED");
}
}

Expand Down Expand Up @@ -588,6 +585,8 @@ void SmartCardRaw( uint64_t arg0, uint64_t arg1, uint8_t *data ) {
clear_trace();
set_tracing(true);

//uint64_t flags = arg0;

#define ISO7618_MAX_FRAME 255
I2C_Reset_EnterMainProgram();

Expand Down Expand Up @@ -617,7 +616,9 @@ void SmartCardRaw( uint64_t arg0, uint64_t arg1, uint8_t *data ) {
// start [C0 03 start C1 len aa bb cc stop]
len = I2C_BufferRead(resp, ISO7618_MAX_FRAME, I2C_DEVICE_CMD_READ, I2C_DEVICE_ADDRESS_MAIN);


if ( len == 0)
isOK = false;

if ( MF_DBGLEVEL > 3 ) Dbprintf("counter %d", len);

out:
Expand Down

0 comments on commit 0d8e316

Please sign in to comment.