Skip to content
Snippets Groups Projects
Commit e585d524 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Allow software and hardware i2c to be used together (e.g. on different pins)

parent ea1f28f5
No related branches found
No related tags found
No related merge requests found
......@@ -273,6 +273,10 @@ ifdef CONFIG_driver_softi2c
COMMON_FLAGS += -DDRIVER_SOFTI2C
endif
ifdef CONFIG_meta_driver_hardware_i2c
COMMON_FLAGS += -DDRIVER_HARDWARE_I2C
endif
ifdef CONFIG_lib_inflate
CXX_TARGETS += src/lib/inflate.cc
endif
......
......@@ -35,6 +35,8 @@ class SoftI2C {
unsigned char rx_len, unsigned char *rx_buf);
};
#ifndef DRIVER_HARDWARE_I2C
extern SoftI2C i2c;
#endif
#endif
......@@ -6,9 +6,10 @@
#include "arch.h"
#include "driver/gpio.h"
#include "driver/stdout.h"
#if defined(MULTIPASS_ARCH_HAS_I2C) && !defined(DRIVER_SOFTI2C)
#ifdef DRIVER_HARDWARE_I2C
#include "driver/i2c.h"
#else
#endif
#ifdef DRIVER_SOFTI2C
#include "driver/soft_i2c.h"
#endif
......
......@@ -16,7 +16,7 @@ select meta_driver_adc
config arch_arduino_nano_driver_i2c
bool "I2C"
depends on !driver_softi2c
select meta_driver_hardware_i2c
select meta_driver_i2c
config arch_arduino_nano_driver_neopixel
......
......@@ -3,7 +3,7 @@
# SPDX-License-Identifier: CC0-1.0
config arch_blinkenrocket_driver_i2c
bool "I2C"
depends on !driver_softi2c
select meta_driver_hardware_i2c
select meta_driver_i2c
config arch_blinkenrocket_driver_uptime
......
......@@ -11,7 +11,7 @@ select meta_driver_counter
config arch_msp430fr5969lp_driver_i2c
bool "I2C on eUSCI_B0"
depends on !driver_softi2c
select meta_driver_hardware_i2c
select meta_driver_i2c
## broken
......
......@@ -11,7 +11,7 @@ select meta_driver_counter
config arch_msp430fr5994lp_driver_i2c
bool "I2C on eUSCI_B1"
depends on !driver_softi2c
select meta_driver_hardware_i2c
select meta_driver_i2c
## broken
......
......@@ -6,6 +6,8 @@ config meta_driver_adc
bool
config meta_driver_counter
bool
config meta_driver_hardware_i2c
bool
config meta_driver_i2c
bool
config meta_driver_neopixel
......
......@@ -235,6 +235,8 @@ ON_TIMER_INTERRUPT_head
ON_TIMER_INTERRUPT_tail
#endif
#ifndef DRIVER_HARDWARE_I2C
#if SOFTI2C_PULLUP_EXTERNAL
#ifdef MULTIPASS_ARCH_msp430fr5969lp
SoftI2C i2c(GPIO::p1_6, GPIO::p1_7, GPIO::p1_4, GPIO::p1_5);
......@@ -258,3 +260,5 @@ SoftI2C i2c(GPIO::p5_0, GPIO::p5_1);
SoftI2C i2c(GPIO::px00, GPIO::px01);
#endif /* MULTIPASS_ARCH_* */
#endif /* !SOFTI2C_PULLUP_EXTERNAL */
#endif /* !DRIVER_HARDWARE_I2C */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment