![]() |
Linduino
1.3.0
Linear Technology Arduino-Compatible Demonstration Board
|
Library for LT_I2C: Routines to Communicate With ATmega328P's hardware I2C port. More...
Library for LT_I2C: Routines to Communicate With ATmega328P's hardware I2C port.
Definition in file LT_I2C.cpp.
Go to the source code of this file.
Functions | |
| int8_t | i2c_read_byte (uint8_t address, uint8_t *value) |
| Read a byte, store in "value". More... | |
| int8_t | i2c_write_byte (uint8_t address, uint8_t value) |
| Write "value" byte to device at "address". More... | |
| 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". More... | |
| 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". More... | |
| 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". More... | |
| 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". More... | |
| 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) More... | |
| int8_t | i2c_read_block_data (uint8_t address, uint8_t length, uint8_t *values) |
| Read a block of data, no command byte, reads length number of bytes and stores it in values. More... | |
| 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 - 1) More... | |
| 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. More... | |
| void | quikeval_I2C_init (void) |
| Initializes Linduino I2C port. More... | |
| void | quikeval_I2C_connect (void) |
| Switch MUX to connect I2C pins to QuikEval connector. More... | |
| void | i2c_enable () |
| i2c_enable or quikeval_I2C_init must be called before using any of the other I2C routines. More... | |
| int8_t | i2c_start () |
| Write start bit to the hardware I2C port. More... | |
| int8_t | i2c_repeated_start () |
| Write a repeat start bit to the hardware I2C port. More... | |
| void | i2c_stop () |
| Write stop bit to the hardware I2C port. More... | |
| int8_t | i2c_write (uint8_t data) |
| Send a data byte to hardware I2C port. More... | |
| uint8_t | i2c_read (int8_t ack) |
| Read a data byte from the hardware I2C port. More... | |
| int8_t | i2c_poll (uint8_t i2c_address) |
| Poll the I2C port and look for an acknowledge. More... | |
Macros | |
| #define | F_CPU 16000000UL |
| CPU master clock frequency. More... | |
| void i2c_enable | ( | void | ) |
i2c_enable or quikeval_I2C_init must be called before using any of the other I2C routines.
Definition at line 414 of file LT_I2C.cpp.
| int8_t i2c_poll | ( | uint8_t | i2c_address | ) |
Poll the I2C port and look for an acknowledge.
| i2c_address | i2c_address is the address of the slave being polled. |
Definition at line 526 of file LT_I2C.cpp.
| uint8_t i2c_read | ( | int8_t | ack | ) |
Read a data byte from the hardware I2C port.
If ack is 0 then an acknowledge (ACK) is generated, else a NACK is generated.
| ack | If ACK is 0 then an acknowledge is generated, else a NACK is generated. |
Definition at line 491 of file LT_I2C.cpp.
| 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)
| address | 7-bit I2C address |
| command | Command byte |
| length | Length of array |
| values | Byte array to be read |
Definition at line 244 of file LT_I2C.cpp.
| int8_t i2c_read_block_data | ( | uint8_t | address, |
| uint8_t | length, | ||
| uint8_t * | values | ||
| ) |
Read a block of data, no command byte, reads length number of bytes and stores it in values.
| address | 7-bit I2C address |
| length | Length of array |
| values | Byte array to be read |
Definition at line 291 of file LT_I2C.cpp.
| int8_t i2c_read_byte | ( | uint8_t | address, |
| uint8_t * | value | ||
| ) |
Read a byte, store in "value".
| address | 7-bit I2C address |
| value | Byte to be read |
Definition at line 93 of file LT_I2C.cpp.
| 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".
| address | 7-bit I2C address |
| command | Command byte |
| value | Byte to be read |
Definition at line 124 of file LT_I2C.cpp.
| 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".
| address | 7-bit I2C address |
| command | Command byte |
| value | Word to be read |
Definition at line 172 of file LT_I2C.cpp.
| int8_t i2c_repeated_start | ( | ) |
Write a repeat start bit to the hardware I2C port.
Definition at line 444 of file LT_I2C.cpp.
| int8_t i2c_start | ( | ) |
Write start bit to the hardware I2C port.
Definition at line 425 of file LT_I2C.cpp.
| void i2c_stop | ( | ) |
Write stop bit to the hardware I2C port.
Definition at line 462 of file LT_I2C.cpp.
| 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.
| address | 7-bit I2C address |
| command | Command word |
| length | Length of array |
| values | Byte array to be read |
Definition at line 345 of file LT_I2C.cpp.
| int8_t i2c_write | ( | uint8_t | data | ) |
Send a data byte to hardware I2C port.
| data | byte that will be written to hardware I2C port. |
Definition at line 470 of file LT_I2C.cpp.
| 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 - 1)
| address | 7-bit I2C address |
| command | Command byte |
| length | Length of array |
| values | Byte array to be written |
Definition at line 321 of file LT_I2C.cpp.
| int8_t i2c_write_byte | ( | uint8_t | address, |
| uint8_t | value | ||
| ) |
Write "value" byte to device at "address".
| address | 7-bit I2C address |
| value | Byte to be written |
Definition at line 109 of file LT_I2C.cpp.
| 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".
| address | 7-bit I2C address |
| command | Command byte |
| value | Byte to be written |
Definition at line 155 of file LT_I2C.cpp.
| 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".
| address | 7-bit I2C address |
| command | Command byte |
| value | Word to be written |
Definition at line 216 of file LT_I2C.cpp.
| void quikeval_I2C_connect | ( | void | ) |
Switch MUX to connect I2C pins to QuikEval connector.
This will disconnect SPI pins.
Definition at line 401 of file LT_I2C.cpp.
| void quikeval_I2C_init | ( | void | ) |
Initializes Linduino I2C port.
Before communicating to the I2C port through the QuikEval connector, you must also run quikeval_I2C_connect to connect the I2C port to the QuikEval connector through the QuikEval MUX (and disconnect SPI).
Definition at line 394 of file LT_I2C.cpp.
| #define F_CPU 16000000UL |
CPU master clock frequency.
Definition at line 89 of file LT_I2C.cpp.