Rename i2c_slave functions so it can coexist with i2c_master (#4875)
Also merges tx/rx buffers, as only one is necessary.
This commit is contained in:
		
							parent
							
								
									127ec5f1e3
								
							
						
					
					
						commit
						8cf7265f8f
					
				
					 5 changed files with 36 additions and 38 deletions
				
			
		| 
						 | 
				
			
			@ -195,14 +195,14 @@ uint8_t matrix_scan(void)
 | 
			
		|||
            debouncing = false;
 | 
			
		||||
        }
 | 
			
		||||
#   endif
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        if (USB_DeviceState != DEVICE_STATE_Configured){
 | 
			
		||||
            txbuffer[1] = 0x55;
 | 
			
		||||
            i2c_slave_reg[1] = 0x55;
 | 
			
		||||
            for (uint8_t i = 0; i < MATRIX_ROWS; i++){
 | 
			
		||||
                txbuffer[i+2] = matrix[i]; //send matrix over i2c
 | 
			
		||||
                i2c_slave_reg[i+2] = matrix[i]; //send matrix over i2c
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    matrix_scan_quantum();
 | 
			
		||||
    return 1;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -396,9 +396,9 @@ static void unselect_cols(void)
 | 
			
		|||
 | 
			
		||||
//this replases tmk code
 | 
			
		||||
void matrix_setup(void){
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    if (USB_DeviceState != DEVICE_STATE_Configured){
 | 
			
		||||
        i2c_init(SLAVE_I2C_ADDRESS); //setup address of slave i2c
 | 
			
		||||
        i2c_slave_init(SLAVE_I2C_ADDRESS); //setup address of slave i2c
 | 
			
		||||
        sei(); //enable interupts
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue