//***************************************************************************** // //! 从I2C接收一个已发送的字节。 //! //! \param base 是使用的I2C实例的基地址。 //! //! 此函数从I2C数据接收寄存器中读取一个字节的数据。 //! //! \return 返回从I2C接收到的字节,强制转换为uint16_t类型。 // //***************************************************************************** static inline uint16_t I2C_getData(uint32_t base) { // // 检查参数。 // ASSERT(I2C_isBaseValid(base));

//
// 返回接收寄存器的内容。
//
return(HWREGH(base + I2C_O_DRR));

}

//***************************************************************************** // //! 从I2C传输一个字节。 //! //! \param base 是使用的I2C实例的基地址。 //! \param data 是从I2C主机要传输的数据。 //! //! 此函数将提供的数据放入I2C数据传输寄存器中。 //! //! \return 无。 // //***************************************************************************** static inline void I2C_putData(uint32_t base, uint16_t data) { // // 检查参数。 // ASSERT(I2C_isBaseValid(base));

//
// 将数据放入传输寄存器中。
//
HWREGH(base + I2C_O_DXR) = data;

}

! Receives a byte that has been sent to the I2C!! param base is the base address of the I2C instance used!! This function reads a byte of data from the I2C Data Receive Register!! return Returns the b