7.6.2. I2C配置¶
以 D211DC-DEMO-V1.0 开发板为例,I2C 接口3用于与触摸屏设备通信,原理图如下:
 
另外根据 芯片手册 4 引脚复用 章节可知:
- 通信接口为 I2C3,Master 模式 
- PA8 为 RST 
- PA9 为 INT 
- PA10 为 I2C3_SCL 
- PA11 为 I2C3_SDA 
需配置:
- 驱动配置 
- pinmux 配置 
7.6.2.1. 驱动配置¶
7.6.2.1.1. master 驱动使能¶
Board options  --->
        [ ] Using i2c0
        [ ] Using i2c1
        [ ] Using i2c2
        [*] Using i2c3
                i2c3 parameter  --->
                        i2c3 Master && Slave  (Master)  --->
7.6.2.2. pinmux 配置¶
pinmux.c 的完整路径是 target/$(CPU)/$(BOARD)/pinmux.c,
例如 D211DC-DEMO-V1-0 开发板, demo100-nand 配置的 pinmux.c 即为 target/d21x/demo100-nand/pinmux.c
根据原理图,添加如下引脚配置
struct aic_pinmux aic_pinmux_config[] = {
...
#ifdef AIC_USING_I2C3
    {1, PIN_PULL_DIS, 3, "PA.8"},  // RST
    {1, PIN_PULL_DIS, 3, "PA.9"},  // INT
    {4, PIN_PULL_DIS, 3, "PA.10"}, // SCK
    {4, PIN_PULL_DIS, 3, "PA.11"}, // SDA
#endif
...
}