Commit cf3ba89c authored by Daniel Friesel's avatar Daniel Friesel
Browse files

softi2c driver: move to kconfig-first approach

parent 060efcf5
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -279,7 +279,7 @@ endif

ifdef CONFIG_driver_softi2c
	CXX_TARGETS += src/driver/soft_i2c.cc
	COMMON_FLAGS += -DDRIVER_SOFTI2C
	COMMON_FLAGS += -DCONFIG_driver_softi2c
endif

ifdef CONFIG_meta_driver_hardware_i2c
@@ -318,25 +318,25 @@ ifdef CONFIG_driver_softi2c_pullup_dynamic_internal
	softi2c_pullup=internal
endif
ifeq (${softi2c_pullup}, internal)
	COMMON_FLAGS += -DSOFTI2C_PULLUP_INTERNAL
	COMMON_FLAGS += -DCONFIG_driver_softi2c_pullup_dynamic_internal
endif

ifdef CONFIG_driver_softi2c_pullup_dynamic_external
	softi2c_pullup=external
endif
ifeq (${softi2c_pullup}, external)
	COMMON_FLAGS += -DSOFTI2C_PULLUP_EXTERNAL
	COMMON_FLAGS += -DCONFIG_driver_softi2c_pullup_dynamic_external
endif

ifdef CONFIG_driver_softi2c_pullup_external
	softi2c_pullup=gpio
endif
ifeq (${softi2c_pullup}, gpio)
	COMMON_FLAGS += -DSOFTI2C_PULLUP_FIXED_GPIO
	COMMON_FLAGS += -DCONFIG_driver_softi2c_pullup_external
endif

ifeq (${i2c_pullup}, gpio)
	COMMON_FLAGS += -DI2C_PULLUP_FIXED_GPIO
	COMMON_FLAGS += -DCONFIG_I2C_PULLUP_FIXED_GPIO
endif

ifeq (${softi2c_timer}, 1)
+2 −2
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ class SoftI2C {
		SoftI2C(const SoftI2C &copy);

		unsigned char sda, scl;
#if SOFTI2C_PULLUP_EXTERNAL
#if CONFIG_driver_softi2c_pullup_dynamic_external
		unsigned char sda_pull, scl_pull;
#endif

@@ -21,7 +21,7 @@ class SoftI2C {
		unsigned char rx(bool send_ack);

	public:
#if SOFTI2C_PULLUP_EXTERNAL
#if CONFIG_driver_softi2c_pullup_dynamic_external
		SoftI2C(unsigned char sda, unsigned char scl,
				unsigned char sda_pull, unsigned char scl_pull) :
			sda(sda), scl(scl), sda_pull(sda_pull), scl_pull(scl_pull) {}
+1 −1
Original line number Diff line number Diff line
/*
 * Copyright 2020 Daniel Friesel
 * Copyright 2021 Daniel Friesel
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@
#include "arch.h"
#include "driver/gpio.h"
#include "driver/stdout.h"
#if defined(MULTIPASS_ARCH_HAS_I2C) && !defined(DRIVER_SOFTI2C)
#if defined(MULTIPASS_ARCH_HAS_I2C) && !defined(CONFIG_driver_softi2c)
#include "driver/i2c.h"
#else
#include "driver/soft_i2c.h"
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@
#include "arch.h"
#include "driver/gpio.h"
#include "driver/stdout.h"
#if defined(MULTIPASS_ARCH_HAS_I2C) && !defined(DRIVER_SOFTI2C)
#if defined(MULTIPASS_ARCH_HAS_I2C) && !defined(CONFIG_driver_softi2c)
#include "driver/i2c.h"
#else
#include "driver/soft_i2c.h"
Loading