61 #if defined(ARDUINO_ARCH_AVR) 62 #include <util/delay.h> 63 #elif defined(ARDUINO_ARCH_SAM) 65 #define _delay_us delayMicroseconds 66 #elif defined(ARDUINO_ARCH_SAMD) 68 #define _delay_us delayMicroseconds 77 Wire.requestFrom((uint8_t)address, (uint8_t)1, (uint8_t)
true);
78 while (Wire.available())
93 Wire.beginTransmission(address);
94 Wire.write(byte(value));
95 if (Wire.endTransmission())
107 Wire.beginTransmission(address);
108 Wire.write(byte(command));
109 if (Wire.endTransmission())
114 ret = Wire.requestFrom((uint8_t)address, (uint8_t)1, (uint8_t)
true);
115 while (Wire.available())
117 *value = Wire.read();
129 Wire.beginTransmission(address);
130 Wire.write(byte(command));
131 Wire.write(byte(value));
132 if (Wire.endTransmission())
151 Wire.beginTransmission(address);
152 Wire.write(byte(command));
153 if (Wire.endTransmission())
158 ret = Wire.requestFrom((uint8_t)address, (uint8_t)2, (uint8_t)
true);
160 while (Wire.available())
162 data.b[
i] = Wire.read();
187 Wire.beginTransmission(address);
188 Wire.write(byte(command));
189 Wire.write(byte(
data.b[1]));
190 Wire.write(byte(
data.b[0]));
191 if (Wire.endTransmission())
202 uint8_t
i = (length-1);
205 Wire.beginTransmission(address);
206 Wire.write(byte(command));
207 if (Wire.endTransmission())
212 ret = Wire.requestFrom((uint8_t)address, (uint8_t)length, (uint8_t)
true);
214 while (Wire.available())
216 values[
i] = Wire.read();
232 uint8_t
i = (length-1);
235 ret = Wire.requestFrom((uint8_t)address, (uint8_t)length, (uint8_t)
true);
237 while (Wire.available())
239 values[
i] = Wire.read();
258 Wire.beginTransmission(address);
259 Wire.write(byte(command));
262 Wire.write(byte(values[i]));
265 if (Wire.endTransmission())
283 uint8_t
i = (length-1);
284 uint8_t readBack = 0;
286 #if defined(ARDUINO_ARCH_SAM) 288 readBack = Wire.requestFrom((uint8_t)address, (uint8_t)length, (uint32_t)command, (uint8_t)2, (uint8_t)
false);
289 #elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_AVR) 290 Wire.beginTransmission(address);
291 Wire.write(byte(comm.b[1]));
292 Wire.write(byte(comm.b[0]));
294 if (Wire.endTransmission(
false))
297 Wire.endTransmission();
300 readBack = Wire.requestFrom((uint8_t)address, (uint8_t)length, (uint8_t)
true);
303 if (readBack == length)
305 while (Wire.available())
307 values[
i] = Wire.read();
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_write_word_data(uint8_t address, uint8_t command, uint16_t value)
Write a 16-bit word of data to register specified by "command".
void quikeval_I2C_connect(void)
Switch MUX to connect I2C pins to QuikEval connector.
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.
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_read_byte(uint8_t address, uint8_t *value)
LT_I2C_Wire: I2C Routines based on Wire library to communicate with Arduino based boards...
void i2c_enable()
i2c_enable or quikeval_I2C_init must be called before using any of the other I2C routines.
union LT_union_int32_4bytes data
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".
LT_I2C: Routines to communicate with ATmega328P's hardware I2C port.
void quikeval_I2C_init(void)
Initializes Linduino 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".
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_write_byte(uint8_t address, uint8_t value)
Write "value" byte to device at "address".
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".