mirror of
				https://github.com/RfidResearchGroup/proxmark3.git
				synced 2025-11-04 03:27:48 +08:00 
			
		
		
		
	chg: i2c - adjustments
This commit is contained in:
		
							parent
							
								
									c8e1eb11f2
								
							
						
					
					
						commit
						0d8e3160f8
					
				
					 1 changed files with 9 additions and 8 deletions
				
			
		
							
								
								
									
										17
									
								
								common/i2c.c
									
										
									
									
									
								
							
							
						
						
									
										17
									
								
								common/i2c.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -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) {
 | 
			
		||||
| 
						 | 
				
			
			@ -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");
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -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();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -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:	
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue