Skip to content

Commit

Permalink
Merge pull request #708 from makermelissa/i2c-freq-message
Browse files Browse the repository at this point in the history
Display a message if user tries to set freq on linux
  • Loading branch information
tannewt authored Sep 14, 2023
2 parents 7fdba4a + 356c590 commit 2d884df
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/new_board_request.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: 🚀 New Board Request
name: 📟 New Board Request
about: Request Support for a New Board
title: ''
labels: 'New Board Request'
Expand Down
14 changes: 11 additions & 3 deletions src/adafruit_blinka/microcontroller/generic_linux/i2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -20,8 +26,10 @@ def __init__(self, bus_num, mode=MASTER, baudrate=None):
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)
Expand Down
2 changes: 2 additions & 0 deletions src/busio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 2d884df

Please sign in to comment.