Skip to content

Commit bab12c9

Browse files
author
Melissa LeBlanc-Williams
committed
Removed Shared I2C bus from featherwings
1 parent d960c75 commit bab12c9

7 files changed

+30
-56
lines changed

adafruit_featherwing/alphanum_featherwing.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,18 @@
3131
__version__ = "0.0.0-auto.0"
3232
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_FeatherWing.git"
3333

34+
import board
3435
import adafruit_ht16k33.segments as segments
35-
from adafruit_featherwing import shared
3636
from adafruit_featherwing.led_segments import Segments
3737

3838
class AlphaNumFeatherWing(Segments):
3939
"""Class representing an `Adafruit 14-segment AlphaNumeric FeatherWing
4040
<https://www.adafruit.com/product/3139>`_.
4141
4242
Automatically uses the feather's I2C bus."""
43-
def __init__(self, address=0x70):
43+
def __init__(self, address=0x70, i2c=None):
4444
super().__init__()
45-
self._segments = segments.Seg14x4(shared.I2C_BUS, address)
45+
if i2c is None:
46+
i2c = board.I2C()
47+
self._segments = segments.Seg14x4(i2c, address)
4648
self._segments.auto_write = False

adafruit_featherwing/ina219_featherwing.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,18 @@
3131
__version__ = "0.0.0-auto.0"
3232
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_FeatherWing.git"
3333

34+
import board
3435
import adafruit_ina219
35-
from adafruit_featherwing import shared
36-
3736

3837
class INA219FeatherWing:
3938
"""Class representing an `Adafruit INA219 FeatherWing
4039
<https://www.adafruit.com/product/3650>`_.
4140
4241
Automatically uses the feather's I2C bus."""
43-
def __init__(self):
44-
self._ina219 = adafruit_ina219.INA219(shared.I2C_BUS)
42+
def __init__(self, i2c=None):
43+
if i2c is None:
44+
i2c = board.I2C()
45+
self._ina219 = adafruit_ina219.INA219(i2c)
4546

4647
@property
4748
def bus_voltage(self):

adafruit_featherwing/joy_featherwing.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
__version__ = "0.0.0-auto.0"
3232
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_FeatherWing.git"
3333

34+
import board
3435
from micropython import const
3536
import adafruit_seesaw.seesaw
36-
from adafruit_featherwing import shared
3737

3838
BUTTON_A = const(1 << 6)
3939
BUTTON_B = const(1 << 7)
@@ -46,8 +46,10 @@ class JoyFeatherWing:
4646
"""Class representing an `Adafruit Joy FeatherWing <https://www.adafruit.com/product/3632>`_.
4747
4848
Automatically uses the feather's I2C bus."""
49-
def __init__(self):
50-
self._seesaw = adafruit_seesaw.seesaw.Seesaw(shared.I2C_BUS)
49+
def __init__(self, i2c=None):
50+
if i2c is None:
51+
i2c = board.I2C()
52+
self._seesaw = adafruit_seesaw.seesaw.Seesaw(i2c)
5153
self._seesaw.pin_mode_bulk(BUTTON_A | BUTTON_B | BUTTON_Y | BUTTON_X | BUTTON_SELECT,
5254
self._seesaw.INPUT_PULLUP)
5355

adafruit_featherwing/matrix_featherwing.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,18 @@
3232
__version__ = "0.0.0-auto.0"
3333
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_FeatherWing.git"
3434

35+
import board
3536
import adafruit_ht16k33.matrix as matrix
36-
from adafruit_featherwing import shared
3737

3838
class MatrixFeatherWing:
3939
"""Class representing an `Adafruit 8x16 LED Matrix FeatherWing
4040
<https://www.adafruit.com/product/3155>`_.
4141
4242
Automatically uses the feather's I2C bus."""
43-
def __init__(self, address=0x70):
44-
self._matrix = matrix.Matrix16x8(shared.I2C_BUS, address)
43+
def __init__(self, address=0x70, i2c=None):
44+
if i2c is None:
45+
i2c = board.I2C()
46+
self._matrix = matrix.Matrix16x8(i2c, address)
4547
self._matrix.auto_write = False
4648
self.columns = 16
4749
self.rows = 8

adafruit_featherwing/rtc_featherwing.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,18 @@
3434

3535
import time
3636
from collections import namedtuple
37+
import board
3738
import adafruit_ds3231
38-
from adafruit_featherwing import shared
3939

4040
class RTCFeatherWing:
4141
"""Class representing an `DS3231 Precision RTC FeatherWing
4242
<https://www.adafruit.com/product/3028>`_.
4343
4444
Automatically uses the feather's I2C bus."""
45-
def __init__(self):
46-
self._rtc = adafruit_ds3231.DS3231(shared.I2C_BUS)
45+
def __init__(self, i2c=None):
46+
if i2c is None:
47+
i2c = board.I2C()
48+
self._rtc = adafruit_ds3231.DS3231(i2c)
4749

4850
def __setitem__(self, index, value):
4951
"""

adafruit_featherwing/sevensegment_featherwing.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,18 @@
3131
__version__ = "0.0.0-auto.0"
3232
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_FeatherWing.git"
3333

34+
import board
3435
import adafruit_ht16k33.segments as segments
35-
from adafruit_featherwing import shared
3636
from adafruit_featherwing.led_segments import Segments
3737

3838
class SevenSegmentFeatherWing(Segments):
3939
"""Class representing an `Adafruit 7-Segment LED HT16K33 FeatherWing
4040
<https://www.adafruit.com/product/3140>`_.
4141
4242
Automatically uses the feather's I2C bus."""
43-
def __init__(self, address=0x70):
43+
def __init__(self, address=0x70, i2c=None):
4444
super().__init__()
45-
self._segments = segments.Seg7x4(shared.I2C_BUS, address)
45+
if i2c is None:
46+
i2c = board.I2C()
47+
self._segments = segments.Seg7x4(i2c, address)
4648
self._segments.auto_write = False

adafruit_featherwing/shared.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)