From 5dd4ee17675c8c6c32a745606468fa24189d566f Mon Sep 17 00:00:00 2001 From: gaoyang3513 Date: Sun, 11 Jan 2026 21:31:38 +0800 Subject: [PATCH] =?UTF-8?q?[Mod]=20AHT10=E9=A9=B1=E5=8A=A8=20=E8=AE=BF?= =?UTF-8?q?=E9=97=AEi2c1=E8=8A=82=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/drivers/i2c/aht10/aht10.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/drivers/i2c/aht10/aht10.c b/src/drivers/i2c/aht10/aht10.c index c13af8a..0ed857f 100644 --- a/src/drivers/i2c/aht10/aht10.c +++ b/src/drivers/i2c/aht10/aht10.c @@ -1,6 +1,33 @@ #include +#include +#include +#include +#include +#include int main() { - printf("Hello QNX!\n"); + int ret = 0, fd_i2c_s = 0; + i2c_driver_info_t info = {0}; + + fd_i2c_s = open ("/dev/i2c1", O_RDWR); + if (fd_i2c_s < 0) { + printf("ErrNo(%d) %s, failed to open I2C device\n", errno, strerror(errno)); + return -1; + } + + ret = ioctl(fd_i2c_s, DCMD_I2C_DRIVER_INFO, &info); + if (ret < 0) { + printf("ErrNo(%d) %s, failed to read from I2C device\n", errno, strerror(errno)); + close(fd_i2c_s); + return -1; + } + + printf("I2C Driver Info:\n"); + printf(" Speed : %#X\n", info.speed_mode); /* supported speeds: I2C_SPEED_* */ + printf(" Mode-Addr: %#X\n", info.addr_mode); /* supported address fmts: I2C_ADDRFMT_* */ + printf(" Verbosity: %#X\n", info.verbosity); /* Driver verbosity level */ + + close(fd_i2c_s); + return 0; } \ No newline at end of file