83 #include <util/delay.h> 89 #define F_CPU 16000000UL 246 uint8_t
i = (length-1);
293 uint8_t
i = (length-1);
357 uint8_t
i = (length-1);
429 TWCR=(1<<TWINT) | (1<<TWSTA) | (1<<TWEN);
433 if (TWCR & (1 << TWINT))
break;
435 result=(TWSR & 0xF8);
448 TWCR=(1<<TWINT) | (1<<TWSTA) | (1<<TWEN);
452 if (TWCR & (1 << TWINT))
break;
454 result=(TWSR & 0xF8);
464 TWCR=(1<<TWINT) | (1<<TWEN) | (1<<TWSTO);
465 while (TWCR & (1<<TWSTO));
475 TWCR =(1<<TWINT) | (1<<TWEN);
479 if (TWCR & (1 << TWINT))
break;
481 result=(TWSR & 0xF8);
494 uint8_t return_value = 1;
499 TWCR=(1<<TWINT) | (1<<TWEN) | (1<<TWEA);
503 if (TWCR & (1 << TWINT))
break;
506 result = TWSR & 0xF8;
511 TWCR=(1<<TWINT) | (1<<TWEN);
515 if (TWCR & (1 << TWINT))
break;
518 result = TWSR & 0xF8;
int8_t i2c_write_byte(uint8_t address, uint8_t value)
Write "value" byte to device at "address".
int8_t i2c_read_block_data(uint8_t address, uint8_t command, uint8_t length, uint8_t *values)
Read a block of data, starting at register specified by "command" and ending at (command + length - 1...
int8_t i2c_read_byte_data(uint8_t address, uint8_t command, uint8_t *value)
Read a byte of data at register specified by "command", store in "value".
Header File for Linduino Libraries and Demo Code.
#define QUIKEVAL_MUX_MODE_PIN
QUIKEVAL_MUX_MODE_PIN defines the control pin for the QuikEval MUX.
void i2c_stop()
Write stop bit to the hardware I2C port.
#define HARDWARE_I2C_PRESCALER_4
void i2c_enable()
i2c_enable or quikeval_I2C_init must be called before using any of the other I2C routines.
int8_t i2c_start()
Write start bit to the hardware I2C port.
union LT_union_int32_4bytes data
#define WITH_NACK
Use with i2c_read(WITH_NACK) to read without an acknowledge.
int8_t i2c_two_byte_command_read_block(uint8_t address, uint16_t command, uint8_t length, uint8_t *values)
Write a two command bytes, then receive a block of data.
int8_t i2c_write_word_data(uint8_t address, uint8_t command, uint16_t value)
Write a 16-bit word of data to register specified by "command".
int8_t i2c_write(uint8_t data)
Send a data byte to hardware I2C port.
int8_t i2c_write_byte_data(uint8_t address, uint8_t command, uint8_t value)
Write a byte of data to register specified by "command".
#define STATUS_ADDRESS_READ_ACK
#define STATUS_ADDRESS_WRITE_ACK
int8_t i2c_read_word_data(uint8_t address, uint8_t command, uint16_t *value)
Read a 16-bit word of data from register specified by "command".
LT_I2C: Routines to communicate with ATmega328P's hardware I2C port.
int8_t i2c_write_block_data(uint8_t address, uint8_t command, uint8_t length, uint8_t *values)
Write a block of data, starting at register specified by "command" and ending at (command + length - ...
int8_t i2c_repeated_start()
Write a repeat start bit to the hardware I2C port.
uint8_t i2c_read(int8_t ack)
Read a data byte from the hardware I2C port.
void quikeval_I2C_init(void)
Initializes Linduino I2C port.
void quikeval_I2C_connect(void)
Switch MUX to connect I2C pins to QuikEval connector.
#define WITH_ACK
Use with i2c_read(WITH_ACK) to read with an acknowledge.
#define STATUS_REPEATED_START
int8_t i2c_read_byte(uint8_t address, uint8_t *value)
Read a byte, store in "value".
int8_t i2c_poll(uint8_t i2c_address)
Poll the I2C port and look for an acknowledge.