1 # SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
 
   3 # SPDX-License-Identifier: MIT
 
   4 """UART Class for NXP LPC4330"""
 
   5 from greatfet import GreatFET
 
   6 from greatfet.interfaces.uart import UART as _UART
 
  10     """Custom UART Class for NXP LPC4330"""
 
  15     PARITY_STUCK_AT_ONE = 3
 
  16     PARITY_STUCK_AT_ZERO = 4
 
  18     # pylint: disable=too-many-arguments,unused-argument
 
  40         if flow is not None:  # default None
 
  41             raise NotImplementedError(
 
  42                 "Parameter '{}' unsupported on GreatFET One".format("flow")
 
  45     # pylint: enable=too-many-arguments,unused-argument
 
  49         self._uart.initialized = False
 
  51     def read(self, nbytes=None):
 
  52         """Read data from UART and return it"""
 
  55         return self._uart.read(nbytes)
 
  57     def readinto(self, buf, nbytes=None):
 
  58         """Read data from UART and into the buffer"""
 
  61         result = self.read(nbytes)
 
  62         for _ in range(nbytes):
 
  67         """Read a single line of data from UART"""
 
  68         out = self.read(nbytes=1)
 
  71             out = self.read(nbytes=1)
 
  76         """Write data from the buffer to UART"""
 
  77         return self._uart.write(buf)