I2C时钟使能-->选择IO作为I2C功能引脚-->I2C端口功能配置-->使用
/* Enable I2C0 clock */
CLK_EnableModuleClock(I2C0_MODULE);
/* Set I2C0 multi-function pins */
SYS->GPA_MFPL = (SYS->GPA_MFPL & ~(SYS_GPA_MFPL_PA4MFP_Msk | SYS_GPA_MFPL_PA5MFP_Msk)) |
(SYS_GPA_MFPL_PA4MFP_I2C0_SDA | SYS_GPA_MFPL_PA5MFP_I2C0_SCL);
/* Open I2C0 and set clock to 100k */
I2C_Open(I2C0, 100000);
除了以上内容,还有哪些必须操作的步骤?
|