Contain main I2C functions for TIvaC.
More...
#include "include/TivaC_I2C.h"
#include <stdbool.h>
#include "external/TivaC_Utils/include/tm4c123gh6pm.h"
|
#define | SCL_LP 6 |
|
#define | SCL_HP 4 |
|
#define | I2C0_TIMEOUT_LIMIT 10000 |
|
|
I2c0ErrCode | i2c0_open (void) |
| enable clocks, I2C pins and calculate the appropriate clock period This function should be called first b4 any I2C operations
|
|
I2c0ErrCode | i2c0_close (void) |
| Disable clock as well as the I2C pins.
|
|
I2c0ErrCode | i2c0_single_data_read (const uint8_t slave_address, uint8_t *returnData, const bool no_ack, const bool no_stop, const bool no_start) |
| read one byte of data More...
|
|
I2c0ErrCode | i2c0_single_data_write (const uint8_t slave_address, const uint8_t data_byte, const bool no_end_stop) |
| write a single byte using I2C More...
|
|
I2c0ErrCode | i2c0_stop (void) |
| used to generate I2C stop signal
|
|
I2c0ErrCode | i2c0_keep_state (void) |
| used to maintain current I2C state
|
|
I2c0ErrCode | i2c0_multiple_data_byte_write (const uint8_t slave_address, const uint8_t *output_buffer, const uint8_t output_buffer_length) |
| write byte one by one until done
|
|
I2c0ErrCode | i2c0_multiple_data_byte_read (const uint8_t slave_address, uint8_t *input_buffer, const uint8_t input_buffer_length) |
|
I2c0ErrCode | i2c0_error_check (void) |
| check i2c error register for any problems
|
|
I2c0ErrCode | i2c0_check_master_enabled (void) |
| check i2c config register to see if the master functionality is enabled
|
|
I2c0ErrCode | i2c0_wait_bus (void) |
| used for waiting till the bus stops being busy More...
|
|
Contain main I2C functions for TIvaC.
- Author
- Khoi Trinh
- Date
- 2018-08-25
I2c0ErrCode i2c0_single_data_read |
( |
const uint8_t |
slave_address, |
|
|
uint8_t * |
returnData, |
|
|
const bool |
no_ack, |
|
|
const bool |
no_stop, |
|
|
const bool |
no_start |
|
) |
| |
read one byte of data
- Parameters
-
no_ack | whether to generate ack signal |
no_stop | whether to generate stop signal |
no_start | whether to generate start(or repeated start) signal |
I2c0ErrCode i2c0_single_data_write |
( |
const uint8_t |
slave_address, |
|
|
const uint8_t |
data_byte, |
|
|
const bool |
no_end_stop |
|
) |
| |
write a single byte using I2C
- Parameters
-
no_end_stop | whether to generate stop at the end of the write |
I2c0ErrCode i2c0_wait_bus |
( |
void |
| ) |
|
used for waiting till the bus stops being busy
- Returns
- whether the bus is idle now or timeout happened