File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 25
25
"""
26
26
27
27
from collections import namedtuple
28
-
29
- try :
30
- from typing_extensions import Literal
31
- except ImportError :
32
- pass
33
28
from struct import unpack_from , pack_into
34
29
from time import sleep
35
30
from micropython import const
36
31
from adafruit_bus_device import spi_device
37
32
from .canio import *
38
33
from .timer import Timer
39
34
35
+ try :
36
+ from typing_extensions import Literal
37
+ except ImportError :
38
+ pass
39
+
40
40
__version__ = "0.0.0+auto.0"
41
41
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_MCP2515.git"
42
42
@@ -250,7 +250,7 @@ def __init__(
250
250
loopback : bool = False ,
251
251
silent : bool = False ,
252
252
auto_restart : bool = False ,
253
- debug : bool = False
253
+ debug : bool = False ,
254
254
):
255
255
"""A common shared-bus protocol.
256
256
@@ -638,7 +638,9 @@ def _get_tx_buffer(self):
638
638
def _set_baud_rate (self ):
639
639
# ******* set baud rate ***********
640
640
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
+ )
642
644
643
645
cnf1 , cnf2 , cnf3 = _BAUD_RATES [self ._crystal_freq ][self .baudrate ]
644
646
You can’t perform that action at this time.
0 commit comments