I²C 总线支持。在开发板上配置一次总线,外设包(RTC、IMU、触摸)共用它。
仓库:github.com/dekiengine/deki-i2c · 最新版本:0.19.0 · 需要引擎 0.19.0 或更高版本
使用 DekiEditor --packages-add deki-i2c <project> 或通过包管理器安装。引擎自身的组件和 C++ API 见 Deki 文档。
在编辑器中显示为 **I2C**。
组件
组件参考
I2CBusComponent
启动时开启一条 I2C 总线。该总线上的所有芯片共用它。
检视器中的名称:I2C 总线组件 · 类别:系统 · 类型:DekiI2c::I2CBusComponent
| 属性 | 类型 | 默认值 | 约束 | 说明 |
| i2cPort | int32 | 0 | 0 到 3 | 使用芯片的哪个 I2C 控制器。大多数开发板只接了一个,所以除非原理图另有说明,否则用 0。 |
| sdaPin | int32 | 21 | 0 到 48 | I2C 数据线 (SDA) 所用的 GPIO。必须与传感器的接线一致;此总线上的所有设备共用它。 |
| sclPin | int32 | 22 | 0 到 48 | I2C 时钟线 (SCL) 所用的 GPIO。与 SDA 一样,由此总线上的所有设备共用。 |
| i2cHz | int32 | 400000 | 10000 到 1e+06 | 总线速度。100 kHz 是稳妥的标准模式,400 kHz 是常用的快速模式。接线较长或设备较多时需要较低的值;过高会导致读取时不时失败。 |
更新日志
更新日志为英文。
0.19.0
Changed
- minEngine 0.19.0: built against engine 0.19.0, whose component metadata records the package each class is in. A build of this package from before does not load and is rebuilt.
Added
- Japanese, Simplified Chinese and Korean: editor/lang/ja.json, zh.json and ko.json translate the names, tooltips and enum values this package's components show in the Inspector.
0.18.0
Changed
- minEngine 0.18.0. Reflection ABI 21: the package must be rebuilt.
- Names follow the code style (deki-engine/docs/codestyle): types, functions and enum values are PascalCase, constants kPascalCase, members m_PascalCase, locals and parameters camelCase. The code is formatted with clang-format 22.
- The functions the editor finds by name are PascalCase: DekiI2CRegisterComponents, DekiI2CGetAutoComponentCount, DekiI2CEnsureRegistered and the rest. Built against engine ABI 21; a build of this package from before does not load and is rebuilt.
Removed
- The former names from before 0.16.0 (bare class names, and deki-gpio's DekiEsp32::ESP32PinSetup). A scene that old is upgraded with 0.17 first.
更早的版本:CHANGELOG.md
由包的反射数据生成(引擎 0.19.0)。属性名就是场景文件中使用的键。重命名后会保留别名(兼容性)。