Bmp280 Driver TivaC
Driver for weather sensor BMP280 for TivaC MCU
Macros | Functions
TivaC_I2C.c File Reference

Contain main I2C functions for TIvaC. More...

#include "include/TivaC_I2C.h"
#include <stdbool.h>
#include "external/TivaC_Utils/include/tm4c123gh6pm.h"
Include dependency graph for TivaC_I2C.c:

Macros

#define SCL_LP   6
 
#define SCL_HP   4
 
#define I2C0_TIMEOUT_LIMIT   10000
 

Functions

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...
 

Detailed Description

Contain main I2C functions for TIvaC.

Author
Khoi Trinh
Date
2018-08-25

Function Documentation

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_ackwhether to generate ack signal
no_stopwhether to generate stop signal
no_startwhether 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_stopwhether 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