M051的库函数特别简单,只要写入寄存器就没了
uint8_t I2C_GetData(I2C_T *i2c)
{
return (i2c->I2CDAT);
}
/**
* [url=home.php?mod=space&uid=247401]@brief[/url] Send a byte to I2C bus
*
* @param[in] i2c I2C port
* @param[in] u8Data The data to send to I2C bus
*
* [url=home.php?mod=space&uid=266161]@return[/url] None
*
* [url=home.php?mod=space&uid=1543424]@Details[/url] This function is used to write a byte to specified I2C port
*/
void I2C_SetData(I2C_T *i2c, uint8_t u8Data)
{
i2c->I2CDAT = u8Data;
}
|