Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions adafruit_ina219.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,9 @@
from micropython import const

try:
import typing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think having this attempt at importing typing or something from it is still necessary for our purposes to prevent imports used only for typing from actually getting imported on microcontrollers in order to save RAM.


from busio import I2C
except ImportError:
# define I2C to avoid the error:
# def __init__(self, i2c_bus: I2C, addr: int = 0x40) -> None:
# NameError: name 'I2C' is not defined
I2C = None
pass

__version__ = "0.0.0+auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_INA219.git"
Expand Down Expand Up @@ -153,7 +148,7 @@ class INA219:
# raw_current RO : Current register (not scaled)
# calibration RW : calibration register (note: value is cached)

def __init__(self, i2c_bus: I2C, addr: int = 0x40) -> None:
def __init__(self, i2c_bus: "I2C", addr: int = 0x40) -> None:
self.i2c_device = I2CDevice(i2c_bus, addr)
self.i2c_addr = addr

Expand Down