]> Repositories - Adafruit_Blinka-hackapet.git/commitdiff
Merge pull request #708 from makermelissa/i2c-freq-message 8.22.2
authorScott Shawcroft <scott@adafruit.com>
Thu, 14 Sep 2023 16:28:24 +0000 (09:28 -0700)
committerGitHub <noreply@github.com>
Thu, 14 Sep 2023 16:28:24 +0000 (09:28 -0700)
Display a message if user tries to set freq on linux

.github/ISSUE_TEMPLATE/bug_report.yml
.github/ISSUE_TEMPLATE/new_board_request.md
src/adafruit_blinka/microcontroller/generic_linux/i2c.py
src/busio.py

index 3e24c9c8091ccde3ca2742e98f415a64a239a9dd..2408b00b33384334054f511874be861a1c89ed5a 100644 (file)
@@ -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:
index 6190a2c02310a97c2b91d7a0a3a5aa1b1a16c4eb..02ff5150c5a76d3ffb9388817a69cc83eb229dbe 100644 (file)
@@ -1,5 +1,5 @@
 ---
-name: ð\9f\9a\80 New Board Request
+name: ð\9f\93\9f New Board Request
 about: Request Support for a New Board
 title: ''
 labels: 'New Board Request'
index f6bee20c8f878ab18fbbb08fb620594556dc2cd5..b6f2fa36885c46a6f53c3aaceff0af42f0b7833d 100644 (file)
@@ -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)
index 2de9e60a69137419a5c734f00d9e179cf27f14c5..e3770a475fefea7da508c5056cfc602c414ff1c9 100644 (file)
@@ -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):