Q群:
电话:
邮箱:
地址:
目前使用软件模拟I2C驱动进行I2C设备的控制,在使用时需进行I2C驱动的配置。
如下图示,通过空格或向右方向键选择 (Top) → Drivers→ I2C 选择使用的模拟I2C通道,如 Enable I2C1 BUS (software simulation) 选项;
[*] Using I2C device drivers
[*] Use GPIO to simulate I2C
(10) simulate I2C bus delay(us)
[*] Enable I2C1 BUS (software simulation) --->
[ ] Enable I2C2 BUS (software simulation) (NEW) ----
[ ] Enable I2C3 BUS (software simulation) (NEW) ----
[ ] Enable I2C4 BUS (software simulation) (NEW) ----
[ ] Use at24cxx eeprom
进入Enable I2C1 BUS (software simulation),根据实际情况选择配置I2C的scl和sda引脚;
(32) i2c1 scl pin number (NEW)
(33) I2C1 sda pin number (NEW)
注意事项:
由于I2C总线需要依赖于具体设备进行使用,可以打开Drivers→ Sensors中使用了I2C总线的传感器,进入传感器后选择为已经打开的I2C,并配置器件地址,注意硬件连接是否正确。
[*] Using SENSOR device drivers
[ ] Enable sht20 (NEW) ----
[*] Enable aht10 --->
[ ] Enable adxl345 (NEW) ----
[ ] Enable bh1750 (NEW) ----
[ ] Enable bmp180 (NEW) ----
[ ] Enable mpu6xxx (NEW) ----
[ ] Enable ak8963 (NEW) ----
[ ] Enable lsm6dsl (NEW) ----
[ ] Enable ap3216c (NEW) ----
(i2c1) aht10 i2c bus name (NEW)
(0x38) aht10 i2c addr(7bit) (NEW)
通过Esc退出配置界面,退出时选择保存。
在命令行输入 scons --ide=mdk5 构建工程;