CC26xx Driver Library
i2c.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include "../inc/hw_types.h"
#include "../inc/hw_ints.h"
#include "../inc/hw_memmap.h"
#include "../inc/hw_i2c.h"
#include "../inc/hw_sysctl.h"
#include "debug.h"
#include "interrupt.h"
#include "cpu.h"

Macros

#define I2C_MASTER_CMD_SINGLE_SEND   0x00000007
 
#define I2C_MASTER_CMD_SINGLE_RECEIVE   0x00000007
 
#define I2C_MASTER_CMD_BURST_SEND_START   0x00000003
 
#define I2C_MASTER_CMD_BURST_SEND_CONT   0x00000001
 
#define I2C_MASTER_CMD_BURST_SEND_FINISH   0x00000005
 
#define I2C_MASTER_CMD_BURST_SEND_ERROR_STOP   0x00000004
 
#define I2C_MASTER_CMD_BURST_RECEIVE_START   0x0000000b
 
#define I2C_MASTER_CMD_BURST_RECEIVE_CONT   0x00000009
 
#define I2C_MASTER_CMD_BURST_RECEIVE_FINISH   0x00000005
 
#define I2C_MASTER_CMD_BURST_RECEIVE_ERROR_STOP   0x00000004
 
#define I2C_MASTER_ERR_NONE   0
 
#define I2C_MASTER_ERR_ADDR_ACK   0x00000004
 
#define I2C_MASTER_ERR_DATA_ACK   0x00000008
 
#define I2C_MASTER_ERR_ARB_LOST   0x00000010
 
#define I2C_SLAVE_ACT_NONE   0
 
#define I2C_SLAVE_ACT_RREQ   0x00000001
 
#define I2C_SLAVE_ACT_TREQ   0x00000002
 
#define I2C_SLAVE_ACT_RREQ_FBR   0x00000005
 
#define I2C_SLAVE_INT_STOP   0x00000004
 
#define I2C_SLAVE_INT_START   0x00000002
 
#define I2C_SLAVE_INT_DATA   0x00000001
 

Functions

void I2CMasterInitExpClk (uint32_t ui32Base, uint32_t ui32I2CClk, bool bFast)
 Initializes the I2C Master block. More...
 
static void I2CMasterControl (uint32_t ui32Base, uint32_t ui32Cmd)
 Controls the state of the I2C Master module. More...
 
static void I2CMasterSlaveAddrSet (uint32_t ui32Base, uint8_t ui8SlaveAddr, bool bReceive)
 Sets the address that the I2C Master will place on the bus. More...
 
static void I2CMasterEnable (uint32_t ui32Base)
 Enables the I2C Master block. More...
 
static void I2CMasterDisable (uint32_t ui32Base)
 Disables the I2C master block. More...
 
static bool I2CMasterBusy (uint32_t ui32Base)
 Indicates whether or not the I2C Master is busy. More...
 
static bool I2CMasterBusBusy (uint32_t ui32Base)
 Indicates whether or not the I2C bus is busy. More...
 
static uint32_t I2CMasterDataGet (uint32_t ui32Base)
 Receives a byte that has been sent to the I2C Master. More...
 
static void I2CMasterDataPut (uint32_t ui32Base, uint8_t ui8Data)
 Transmits a byte from the I2C Master. More...
 
uint32_t I2CMasterErr (uint32_t ui32Base)
 Gets the error status of the I2C Master module. More...
 
static void I2CMasterIntEnable (uint32_t ui32Base)
 Enables the I2C Master interrupt. More...
 
static void I2CMasterIntDisable (uint32_t ui32Base)
 Disables the I2C Master interrupt. More...
 
static void I2CMasterIntClear (uint32_t ui32Base)
 Clears I2C Master interrupt sources. More...
 
static bool I2CMasterIntStatus (uint32_t ui32Base, bool bMasked)
 Gets the current I2C Master interrupt status. More...
 
static void I2CSlaveEnable (uint32_t ui32Base)
 Enables the I2C Slave block. More...
 
static void I2CSlaveInit (uint32_t ui32Base, uint8_t ui8SlaveAddr)
 Initializes the I2C Slave block. More...
 
static void I2CSlaveAddressSet (uint32_t ui32Base, uint8_t ui8SlaveAddr)
 Sets the I2C slave address. More...
 
static void I2CSlaveDisable (uint32_t ui32Base)
 Disables the I2C slave block. More...
 
static uint32_t I2CSlaveStatus (uint32_t ui32Base)
 Gets the I2C Slave module status. More...
 
static uint32_t I2CSlaveDataGet (uint32_t ui32Base)
 Receives a byte that has been sent to the I2C Slave. More...
 
static void I2CSlaveDataPut (uint32_t ui32Base, uint8_t ui8Data)
 Transmits a byte from the I2C Slave. More...
 
static void I2CSlaveIntEnable (uint32_t ui32Base, uint32_t ui32IntFlags)
 Enables individual I2C Slave interrupt sources. More...
 
static void I2CSlaveIntDisable (uint32_t ui32Base, uint32_t ui32IntFlags)
 Disables individual I2C Slave interrupt sources. More...
 
static void I2CSlaveIntClear (uint32_t ui32Base, uint32_t ui32IntFlags)
 Clears I2C Slave interrupt sources. More...
 
static uint32_t I2CSlaveIntStatus (uint32_t ui32Base, bool bMasked)
 Gets the current I2C Slave interrupt status. More...
 
void I2CIntRegister (uint32_t ui32Base, void(*pfnHandler)(void))
 Registers an interrupt handler for the I2C module in the dynamic interrupt table. More...
 
void I2CIntUnregister (uint32_t ui32Base)
 Unregisters an interrupt handler for the I2C module in the dynamic interrupt table. More...