def METHOD_NAME(self, command):
    """Write a command to the device.
    :param str command: comma separated string of:
        - the function: read ('R') or write ('W') or 'echo',
        - the address to write to (e.g. '0x106' or '262'),
        - the values (comma separated) to write
        - or the number of elements to read (defaults to 1).
    """
    function, address, *values = command.split(",")
    function = Functions[function]
    data = [self.address]  # 1B device address
    data.append(function)  # 1B function code
    address = int(address, 16) if "x" in address else int(address)
    data.extend(address.to_bytes(2, "big"))  # 2B register address
    if function == Functions.W:
        elements = len(values) * self.byteMode // 2
        data.extend(elements.to_bytes(2, "big"))  # 2B number of elements
        data.append(elements * 2)  # 1B number of bytes to write
        for element in values:
            data.extend(int(element).to_bytes(self.byteMode, "big", signed=True))
    elif function == Functions.R:
        count = int(values[0]) * self.byteMode // 2 if values else self.byteMode // 2
        data.extend(count.to_bytes(2, "big"))  # 2B number of elements to read
    elif function == Functions.ECHO:
        data[-2:] = [0, 0]
        if values:
            data.extend(int(values[0]).to_bytes(2, "big"))  # 2B test data
    data += CRC16(data)
    self.write_bytes(bytes(data))