From: Scott Shawcroft Date: Thu, 14 Sep 2023 16:28:24 +0000 (-0700) Subject: Merge pull request #708 from makermelissa/i2c-freq-message X-Git-Tag: 8.22.2 X-Git-Url: https://git.ayoreis.com/Adafruit_Blinka-hackapet.git/commitdiff_plain/2d884df4fa01bad807a0db9a8623f7f2a6fa7115?hp=7fdba4a9dd49125e50bcf76266eb337f6ef93c2e Merge pull request #708 from makermelissa/i2c-freq-message Display a message if user tries to set freq on linux --- diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 3e24c9c..2408b00 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -3,7 +3,7 @@ # SPDX-License-Identifier: MIT name: 🐞 Bug Report -description: Create a bug report to help us improve +description: Create a bug report to help us improve. Use New Board Request if your board isn't being detected. labels: - bug body: diff --git a/.github/ISSUE_TEMPLATE/new_board_request.md b/.github/ISSUE_TEMPLATE/new_board_request.md index 6190a2c..02ff515 100644 --- a/.github/ISSUE_TEMPLATE/new_board_request.md +++ b/.github/ISSUE_TEMPLATE/new_board_request.md @@ -1,5 +1,5 @@ --- -name: 🚀 New Board Request +name: 📟 New Board Request about: Request Support for a New Board title: '' labels: 'New Board Request' diff --git a/src/adafruit_blinka/microcontroller/generic_linux/i2c.py b/src/adafruit_blinka/microcontroller/generic_linux/i2c.py index f6bee20..b6f2fa3 100644 --- a/src/adafruit_blinka/microcontroller/generic_linux/i2c.py +++ b/src/adafruit_blinka/microcontroller/generic_linux/i2c.py @@ -2,11 +2,17 @@ # # SPDX-License-Identifier: MIT """Generic Linux I2C class using PureIO's smbus class""" + +import warnings from Adafruit_PureIO import smbus class I2C: - """I2C class""" + """ + I2C class + + Baudrate has no effect on Linux systems. The argument is only there for compatibility. + """ MASTER = 0 SLAVE = 1 @@ -20,8 +26,10 @@ class I2C: raise NotImplementedError("Only I2C Master supported!") _mode = self.MASTER - # if baudrate != None: - # print("I2C frequency is not settable in python, ignoring!") + if baudrate is not None: + warnings.warn( + "I2C frequency is not settable in python, ignoring!", RuntimeWarning + ) try: self._i2c_bus = smbus.SMBus(bus_num) diff --git a/src/busio.py b/src/busio.py index 2de9e60..e3770a4 100644 --- a/src/busio.py +++ b/src/busio.py @@ -29,6 +29,8 @@ class I2C(Lockable): """ Busio I2C Class for CircuitPython Compatibility. Used for both MicroPython and Linux. + + NOTE: Frequency has no effect on Linux systems. The argument is only there for compatibility. """ def __init__(self, scl, sda, frequency=100000):