Skip to content

Commit 8d44763

Browse files
nkpro2000srbessman
authored andcommitted
Refactor SPI
1 parent f81ed36 commit 8d44763

File tree

5 files changed

+666
-194
lines changed

5 files changed

+666
-194
lines changed

pslab/bus/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
"""Contains modules for interfacing with the PSLab's I2C, SPI, and UART buses.
22
3-
(SPI and UART still TODO)
3+
(UART still TODO)
44
"""
55

66
from pslab.bus.i2c import I2CMaster, I2CSlave
7+
from pslab.bus.spi import SPIMaster, SPISlave
78

89
__all__ = (
910
"I2CMaster",
1011
"I2CSlave",
12+
"SPIMaster",
13+
"SPISlave",
1114
)

pslab/bus/busio.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@
3030

3131
from typing import List, Union
3232

33-
from pslab.bus.i2c import I2CPrimitive
33+
from pslab.bus.i2c import _I2CPrimitive
3434
from pslab.serial_handler import SerialHandler
3535

3636
__all__ = "I2C"
3737
ReadableBuffer = Union[bytes, bytearray, memoryview]
3838
WriteableBuffer = Union[bytearray, memoryview]
3939

4040

41-
class I2C(I2CPrimitive):
41+
class I2C(_I2CPrimitive):
4242
"""Busio I2C Class for CircuitPython Compatibility.
4343
4444
Parameters

pslab/bus/i2c.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
logger = logging.getLogger(__name__)
3333

3434

35-
class I2CPrimitive:
35+
class _I2CPrimitive:
3636
"""I2C primitive commands.
3737
3838
Handles all the I2C subcommands coded in pslab-firmware.
@@ -429,7 +429,7 @@ def _read_bulk(
429429
return bytearray(data)
430430

431431

432-
class I2CMaster(I2CPrimitive):
432+
class I2CMaster(_I2CPrimitive):
433433
"""I2C bus controller.
434434
435435
Handles slave independent functionality with the I2C port.
@@ -480,7 +480,7 @@ def scan(self) -> List[int]:
480480
return addrs
481481

482482

483-
class I2CSlave(I2CPrimitive):
483+
class I2CSlave(_I2CPrimitive):
484484
"""I2C slave device.
485485
486486
Parameters

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy