1 """SPI Class for Generic MicroPython"""
 
   2 from machine import SPI as _SPI
 
   4 # pylint: disable=protected-access, no-self-use
 
   6     """SPI Class for Generic MicroPython"""
 
  11     def __init__(self, portId, baudrate=100000):
 
  12         self._frequency = baudrate
 
  13         self._spi = _SPI(portId)
 
  15     # pylint: disable=too-many-arguments,unused-argument
 
  24         """Initialize the Port"""
 
  25         self._frequency = baudrate
 
  35     # pylint: enable=too-many-arguments
 
  39         """Return the current frequency"""
 
  40         return self._frequency
 
  42     def write(self, buf, start=0, end=None):
 
  43         """Write data from the buffer to SPI"""
 
  46     def readinto(self, buf, start=0, end=None, write_value=0):
 
  47         """Read data from SPI and into the buffer"""
 
  48         self._spi.readinto(buf)
 
  50     # pylint: disable=too-many-arguments
 
  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
 
  57         self._spi.write_readinto(
 
  66     # pylint: enable=too-many-arguments