From 11533e773394511215bfebdf413a1139cddb150d Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Fri, 9 Jan 2026 23:06:32 +0100 Subject: softi2c: use "softi2c" global name if i2c is already active --- include/driver/soft_i2c.h | 2 ++ src/driver/soft_i2c.cc | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/include/driver/soft_i2c.h b/include/driver/soft_i2c.h index a5da1f6..15784d9 100644 --- a/include/driver/soft_i2c.h +++ b/include/driver/soft_i2c.h @@ -37,6 +37,8 @@ class SoftI2C { #ifndef DRIVER_HARDWARE_I2C extern SoftI2C i2c; +#else +extern SoftI2C softi2c; #endif #endif diff --git a/src/driver/soft_i2c.cc b/src/driver/soft_i2c.cc index 7369b2d..7bf030f 100644 --- a/src/driver/soft_i2c.cc +++ b/src/driver/soft_i2c.cc @@ -239,4 +239,8 @@ ON_TIMER_INTERRUPT_tail SoftI2C i2c(GPIO::CONFIG_driver_softi2c_sda, GPIO::CONFIG_driver_softi2c_scl); +#else + +SoftI2C softi2c(GPIO::CONFIG_driver_softi2c_sda, GPIO::CONFIG_driver_softi2c_scl); + #endif /* !DRIVER_HARDWARE_I2C */ -- cgit v1.2.3