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     # pylint: disable=unnecessary-pass
 
  41     def write(self, buf, start=0, end=None):
 
  42         """Write data from the buffer to SPI"""
 
  45     # pylint: disable=unnecessary-pass
 
  46     def readinto(self, buf, start=0, end=None, write_value=0):
 
  47         """Read data from SPI and into the buffer"""
 
  50     # pylint: disable=too-many-arguments, unnecessary-pass
 
  52         self, buffer_out, buffer_in, out_start=0, out_end=None, in_start=0, in_end=None
 
  54         """Perform a half-duplex write from buffer_out and then
 
  55         read data into buffer_in