def write(self, buffer): """Write raw bytes to the serial port. :param buffer: The buffer of bytes to write. :param count: The maximum number of bytes to write. :returns: The number of bytes actually written into the port. """ return hal.writeSerial(self.port, buffer)
def write(self, buffer: bytes, count: int) -> int: """Write raw bytes to the serial port. :param buffer: The buffer of bytes to write. :returns: The number of bytes actually written into the port. """ if len(buffer) < count: raise ValueError("buffer is too small, must be at least %d" % count) return hal.writeSerial(self.port, buffer)
def write(self, buffer: bytes) -> int: """Write raw bytes to the serial port. :param buffer: The buffer of bytes to write. :returns: The number of bytes actually written into the port. """ # Python-Specific: No count parameter needed return hal.writeSerial(self.port, buffer)