1 # SPDX-FileCopyrightText: 2024 Brent Rubell for Adafruit Industries
3 # SPDX-License-Identifier: MIT
4 """SPI class for a generic agnostic board."""
5 # from .rp2040_u2if import rp2040_u2if
8 # pylint: disable=protected-access, no-self-use
10 """SPI Base Class for a generic agnostic board."""
14 def __init__(self, index, *, baudrate=100000):
16 self._frequency = baudrate
18 # pylint: disable=too-many-arguments,unused-argument
30 """Initialize the Port"""
31 self._frequency = baudrate
33 # pylint: enable=too-many-arguments
37 """Return the current frequency"""
38 return self._frequency
40 def write(self, buf, start=0, end=None):
41 """Write data from the buffer to SPI"""
44 def readinto(self, buf, start=0, end=None, write_value=0):
45 """Read data from SPI and into the buffer"""
48 # pylint: disable=too-many-arguments
50 self, buffer_out, buffer_in, out_start=0, out_end=None, in_start=0, in_end=None
52 """Perform a half-duplex write from buffer_out and then
53 read data into buffer_in