Skip to content

Commit 066e956

Browse files
committed
small corrections
1 parent be45172 commit 066e956

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

adafruit_mcp2515/__init__.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@
2525
"""
2626

2727
from collections import namedtuple
28-
29-
try:
30-
from typing_extensions import Literal
31-
except ImportError:
32-
pass
3328
from struct import unpack_from, pack_into
3429
from time import sleep
3530
from micropython import const
3631
from adafruit_bus_device import spi_device
3732
from .canio import *
3833
from .timer import Timer
3934

35+
try:
36+
from typing_extensions import Literal
37+
except ImportError:
38+
pass
39+
4040
__version__ = "0.0.0+auto.0"
4141
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_MCP2515.git"
4242

@@ -250,7 +250,7 @@ def __init__(
250250
loopback: bool = False,
251251
silent: bool = False,
252252
auto_restart: bool = False,
253-
debug: bool = False
253+
debug: bool = False,
254254
):
255255
"""A common shared-bus protocol.
256256
@@ -638,7 +638,9 @@ def _get_tx_buffer(self):
638638
def _set_baud_rate(self):
639639
# ******* set baud rate ***********
640640
if self._crystal_freq not in (16000000, 8000000):
641-
raise RuntimeError("Incorrect xtal frequency")
641+
raise ValueError(
642+
f"Incorrect crystal frequency - must be one of: {tuple(_BAUD_RATES.keys())}"
643+
)
642644

643645
cnf1, cnf2, cnf3 = _BAUD_RATES[self._crystal_freq][self.baudrate]
644646

0 commit comments

Comments
 (0)