Write data to an i2c device.

        :param address: i2c device address

        :param args: A variable number of bytes to be sent to the device
                     passed in as a list

        :returns: No return value.
350748
async def i2c_write_request(self, address, args):
        
        data = [address, Constants.I2C_WRITE]
        for item in args:
            item_lsb = item & 0x7f
            data.append(item_lsb)
            item_msb = (item >> 7) & 0x7f
            data.append(item_msb)
        await self._send_sysex(PrivateConstants.I2C_REQUEST, data)
979802
def _set_address(self, address, force=None):
        
        force = force if force is not None else self.force
        if self.address != address or self._force_last != force:
            if force is True:
                ioctl(self.fd, I2C_SLAVE_FORCE, address)
            else:
                ioctl(self.fd, I2C_SLAVE, address)
            self.address = address
            self._force_last = force
90349
def _write_gppu(self, gppu=None):
        
        if gppu is not None:
            self.gppu = gppu
        self.i2c.write_list(self.GPPU, self.gppu)
1157297
def connect(self, address):
        ''
        tout = _timeout(self.gettimeout())
        while 1:
            self._wait_event(tout.now, write=True)
            err = self._connect(address, tout.now)
            if err in (errno.EINPROGRESS, errno.EALREADY, errno.EWOULDBLOCK):
                continue
            if err:
                raise socket.error(err, errno.errorcode[err])
            return 0
999408
def write_data(self, buf):
        
        result = self.devh.controlMsg(
            usb.ENDPOINT_OUT + usb.TYPE_CLASS + usb.RECIP_INTERFACE,
            usb.REQ_SET_CONFIGURATION, buf, value=0x200, timeout=50)
        if result != len(buf):
            raise IOError('pywws.device_libusb.USBDevice.write_data failed')
        return True
1355682
def read_byte(self, i2c_addr, force=None):
        
        self._set_address(i2c_addr, force=force)
        msg = i2c_smbus_ioctl_data.create(
            read_write=I2C_SMBUS_READ, command=0, size=I2C_SMBUS_BYTE
        )
        ioctl(self.fd, I2C_SMBUS, msg)
        return msg.data.contents.byte
798623
def write_byte(self, address, data):
        
        buf = [
            self.WriteCommandWord,
            address // 256,
            address % 256,
            self.EndMark,
            self.WriteCommandWord,
            data,
            0,
            self.EndMark,
            ]
        if not self.dev.write_data(buf):
            return False
        buf = self.dev.read_data(8)
        if buf is None:
            return False
        for byte in buf:
            if byte != 0xA5:
                return False
        return True
1098865
def write(self, data):
        '''
        
        '''
        if not hasattr(self, '_sock'):
            return None

        try:
            self._sock.sendall(data)

            if self.connection.debug > 1:
                self.connection.logger.debug(
                    'sent %d bytes to %s' % (len(data), self._host))

            return
        except EnvironmentError:
            # sockets raise this type of error, and since if sendall() fails
            # we're left in an indeterminate state, assume that any error we
            # catch means that the connection is dead. Note that this
            # assumption requires this to be a blocking socket; if we ever
            # support non-blocking in this class then this whole method has
            # to change a lot.
            self.connection.logger.exception(
                'error writing to %s' % (self._host))

        self.connection.transport_closed(
            msg='error writing to %s' % (self._host))
226471
def create(cls, interface_id, address, network_value,
               nodeid=1, **kwargs):
        
        data = {'address': address,
                'network_value': network_value,
                'nicid': str(interface_id),
                'auth_request': False,
                'backup_heartbeat': False,
                'nodeid': nodeid,
                'outgoing': False,
                'primary_mgt': False,
                'primary_heartbeat': False}

        for k, v in kwargs.items():
            data.update({k: v})

        return cls(data)
763476
def devop_write(self, args, bustype):
        ''''''
        usage = "Usage: devop write <spi|i2c> name bus address regstart count <bytes>"
        if len(args) < 5:
            print(usage)
            return
        name = args[0]
        bus = int(args[1],base=0)
        address = int(args[2],base=0)
        reg = int(args[3],base=0)
        count = int(args[4],base=0)
        args = args[5:]
        if len(args) < count:
            print(usage)
            return
        bytes = [0]*128
        for i in range(count):
            bytes[i] = int(args[i],base=0)
        self.master.mav.device_op_write_send(self.target_system,
                                             self.target_component,
                                             self.request_id,
                                             bustype,
                                             bus,
                                             address,
                                             name,
                                             reg,
                                             count,
                                             bytes)
        self.request_id += 1
798816
def write(self, data):
        
        try:
            # Hack to support unicode under Python 2.x
            if isinstance(data, str) or (sys.version_info < (3,) and isinstance(data, unicode)):
                data = data.encode('utf-8')

            self._device.write(data)

        except serial.SerialTimeoutException:
            pass

        except serial.SerialException as err:
            raise CommError('Error writing to device.', err)

        else:
            self.on_write(data=data)
668737
def write(self, buffer):
        
        if type(buffer) == type(0):
            buffer = chr(buffer)
        elif not isinstance(buffer, bytes):
            buffer = buffer.encode(self.encoding)
        if IAC in buffer:
            buffer = buffer.replace(IAC, IAC+IAC)
        self.msg("send %s", repr(buffer))
        self.sock.send(buffer)
364818
def write(self, offset, value):
		
		if(not self.mode & 0b10):
			raise ReadOnlyError("Device is Read-Only")
		if(offset >= self.size):
			raise AddressError("Offset({}) not in address space({})".format(offset, self.size))
		self.repr_[offset].setvalue(value)
345615
def write_memory(self, addr, value, transfer_size=32):
        
        self.ap.write_memory(addr, value, transfer_size)
1188295
def append_to_arg_count(self, data):
        
        assert data in '-0123456789'
        current = self._arg

        if data == '-':
            assert current is None or current == '-'
            result = data
        elif current is None:
            result = data
        else:
            result = "%s%s" % (current, data)

        self.input_processor.arg = result
180267
def write_memory(self, addr, data, transfer_size=32):
        
        assert transfer_size in (8, 16, 32)
        if transfer_size == 32:
            self._link.write_mem32(addr, conversion.u32le_list_to_byte_list([data]), self._apsel)
        elif transfer_size == 16:
            self._link.write_mem16(addr, conversion.u16le_list_to_byte_list([data]), self._apsel)
        elif transfer_size == 8:
            self._link.write_mem8(addr, [data], self._apsel)
689963
def write(self, fptr):
        
        length = 4 + 4 + 16 + len(self.raw_data)
        write_buffer = struct.pack('>I4s', length, b'uuid')
        fptr.write(write_buffer)
        fptr.write(self.uuid.bytes)
        fptr.write(self.raw_data)