This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

cc2541 i2c configuration not in protocol stack

Other Parts Discussed in Thread: CC2541

i wrote some code about i2c configuration  and it's  not  in  protocol stack ,but i can't sure if it's right. and this is for SSD1306  OLED,is there some wrong,please.

void i2c_Init(i2cClock_t clockRate)
{
I2CWC = 0x00;
I2CADDR = 0;
I2CCFG &= ~I2C_CLOCK_MASK;
I2CCFG |= clockRate;
I2CCFG |= (I2C_ENS1);
}

uint8 I2C_write(uint8 mcmd)
{

I2CDATA = (mcmd);
I2CCFG &= ~I2C_SI;
while ((I2CCFG & I2C_SI) == 0);

}

uint8 I2C_Start()
{
I2CCFG &= ~I2C_SI;
I2CCFG |= I2C_STA;
while ((I2CCFG & I2C_SI) == 0);
I2CCFG &= ~I2C_STA;
I2C_write(0x78);

}

void I2C_Stop()
{
I2CCFG |= I2C_STO;
I2CCFG &= ~I2C_SI;
while ((I2CCFG & I2C_STO) != 0);
}

void Write_Command(uint8 Data)
{
I2C_Start();
I2C_write(0x00);
I2C_write(Data);
I2C_Stop();
}

void Write_Data(uint8 Data)
{
I2C_Start();
I2C_write(0x40);
I2C_write(Data);
I2C_Stop();
}