Skip to content

Commit 9f3e044

Browse files
committed
[Novatek] Allow i2c adapter selection
1 parent 4a52f26 commit 9f3e044

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/hal/novatek.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,13 @@ float novatek_get_temp() {
9292
return ret;
9393
}
9494

95-
static int novatek_open_i2c_fd() {
96-
int adapter_nr = 0;
97-
95+
static int novatek_open_i2c_fd(int i2c_adapter_nr) {
9896
if (!strncmp(chip_name, "NA51068", 7) ||
9997
!strncmp(chip_name, "NA51103", 7) || !strncmp(chip_name, "NA51090", 7))
100-
adapter_nr = 1;
98+
i2c_adapter_nr = 1;
10199
char adapter_name[FILENAME_MAX];
102100

103-
snprintf(adapter_name, sizeof(adapter_name), "/dev/i2c-%d", adapter_nr);
101+
snprintf(adapter_name, sizeof(adapter_name), "/dev/i2c-%d", i2c_adapter_nr);
104102

105103
return universal_open_sensor_fd(adapter_name);
106104
}

0 commit comments

Comments
 (0)