diff options
author | ishtob <ishtob@gmail.com> | 2017-03-22 15:50:18 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-22 15:50:18 -0400 |
commit | bb413383eecbeaf1174668415bd25ee4150963f5 (patch) | |
tree | bdacf1fbecf37b7a52a84e671a68ca1509990c1a /keyboards/lets_split/i2c.c | |
parent | 092416325b165ab0521fa746c91d393994b6c609 (diff) |
Update i2c.c
Diffstat (limited to 'keyboards/lets_split/i2c.c')
-rw-r--r-- | keyboards/lets_split/i2c.c | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/keyboards/lets_split/i2c.c b/keyboards/lets_split/i2c.c index 755038f5e2..fbf2f3b767 100644 --- a/keyboards/lets_split/i2c.c +++ b/keyboards/lets_split/i2c.c @@ -161,94 +161,4 @@ ISR(TWI_vect) { TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN); } -// from SSD1306 -/* -void i2c_start_wait(unsigned char address) -{ - uint8_t twst; - - - while ( 1 ) - { - // send START condition - TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN); - - // wait until transmission completed - while(!(TWCR & (1<<TWINT))); - - // check value of TWI Status Register. Mask prescaler bits. - twst = TW_STATUS & 0xF8; - if ( (twst != TW_START) && (twst != TW_REP_START)) continue; - - // send device address - TWDR = address; - TWCR = (1<<TWINT) | (1<<TWEN); - - // wail until transmission completed - while(!(TWCR & (1<<TWINT))); - - // check value of TWI Status Register. Mask prescaler bits. - twst = TW_STATUS & 0xF8; - if ( (twst == TW_MT_SLA_NACK )||(twst ==TW_MR_DATA_NACK) ) - { - // device busy, send stop condition to terminate write operation - TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO); - - // wait until stop condition is executed and bus released - while(TWCR & (1<<TWSTO)); - - continue; - } - //if( twst != TW_MT_SLA_ACK) return 1; - break; - } - -}// i2c_start_wait -*/ -/************************************************************************* - Issues a repeated start condition and sends address and transfer direction - - Input: address and transfer direction of I2C device - - Return: 0 device accessible - 1 failed to access device -*************************************************************************/ -/* -unsigned char i2c_rep_start(unsigned char address) -{ - return i2c_master_start( address ); - -}/* i2c_rep_start */ -/************************************************************************* - Read one byte from the I2C device, request more data from device - - Return: byte read from I2C device -*************************************************************************/ -/* -unsigned char i2c_readAck(void) -{ - TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWEA); - while(!(TWCR & (1<<TWINT))); - - return TWDR; - -}/* i2c_readAck */ - - -/************************************************************************* - Read one byte from the I2C device, read is followed by a stop condition - - Return: byte read from I2C device -************************************************************************* -unsigned char i2c_readNak(void) -{ - TWCR = (1<<TWINT) | (1<<TWEN); - while(!(TWCR & (1<<TWINT))); - - return TWDR; - -}/* i2c_readNak */ - - - #endif |