Get a gpio pin setting.
358316
def get_gpio_pin(self, pin_number, dest_addr_long=None):
        
        frame = self._send_and_wait(
            command=const.IO_PIN_COMMANDS[pin_number],
            dest_addr_long=dest_addr_long
        )
        value = frame["parameter"]
        return const.GPIO_SETTINGS[value]
858509
async def set_pin_mode(self, command):
        
        pin = int(command[0])
        mode = int(command[1])
        if mode == Constants.INPUT:
            cb = self.digital_callback
        elif mode == Constants.ANALOG:
            cb = self.analog_callback
        else:
            cb = None

        await self.core.set_pin_mode(pin, mode, cb)
444299
def _write_gpio(self, gpio=None):
        
        if gpio is not None:
            self.gpio = gpio
        self.i2c.write_list(self.GPIO, self.gpio)
921821
def pin_command(self):
        """"""
        parts = [
            'pip-compile',
            '--no-header',
            '--verbose',
            '--rebuild',
            '--no-index',
            '--output-file', self.outfile,
            self.infile,
        ]
        if OPTIONS['upgrade']:
            parts.insert(3, '--upgrade')
        if self.add_hashes:
            parts.insert(1, '--generate-hashes')
        return parts
1013386
def value(self):
        """"""
        return self._ads.read(self._pin_setting, is_differential=self.is_differential)
713700
def pullup(self, pin, enabled):
        
        self._validate_channel(pin)
        if enabled:
            self.gppu[int(pin/8)] |= 1 << (int(pin%8))
        else:
            self.gppu[int(pin/8)] &= ~(1 << (int(pin%8)))
        self._write_gppu()
309676
def create_switch(type, settings, pin):
	

	switch = None
	if type == "A":
		group, device = settings.split(",")
		switch = pi_switch.RCSwitchA(group, device)

	elif type == "B":
		addr, channel = settings.split(",")
		addr = int(addr)
		channel = int(channel)
		switch = pi_switch.RCSwitchB(addr, channel)

	elif type == "C":
		family, group, device = settings.split(",")
		group = int(group)
		device = int(device)
		switch = pi_switch.RCSwitchC(family, group, device)

	elif type == "D":
		group, device = settings.split(",")
		device = int(device)
		switch = pi_switch.RCSwitchD(group, device)

	else:
		print "Type %s is not supported!" % type
		sys.exit()

	switch.enableTransmit(pin)
	return switch
817793
def _set_pwm(self, raw_values):
        
        for i in range(len(self._pins)):
            self._device.set_pwm(self._pins[i], 0, raw_values[i])
623491
def set(pin, value):
    ''''''
    if value is LOW:
        value = 0
    value = int(bool(value))
    log.debug("Write {0}: {1}".format(pin, value))
    f = _open[pin].value
    _write(f, value)
923605
public void setPin(int pin, boolean active) {
        Buffer buffer = new Buffer();
        buffer.writeIntLe(pin);
        buffer.writeByte(active ? 1 : 0);
        sendMessage(BeanMessageID.BT_SET_PIN, buffer);
    }
614495
def get_pwm(self, led_num):
        """"""
        self.__check_range('led_number', led_num)
        register_low = self.calc_led_register(led_num)
        return self.__get_led_value(register_low)
1042431
def read(self):
        
        # Read value
        try:
            buf = os.read(self._fd, 2)
        except OSError as e:
            raise GPIOError(e.errno, "Reading GPIO: " + e.strerror)

        # Rewind
        try:
            os.lseek(self._fd, 0, os.SEEK_SET)
        except OSError as e:
            raise GPIOError(e.errno, "Rewinding GPIO: " + e.strerror)

        if buf[0] == b"0"[0]:
            return False
        elif buf[0] == b"1"[0]:
            return True

        raise GPIOError(None, "Unknown GPIO value: \"%s\"" % buf[0])
1025452
def change_digital(self, pin_nr, value):
        
        if not self._board:
            return
        with self._lock:
            self._act_digital[pin_nr].pin.write(value)
947114
def get_pin_state(self, pin, cb=None):
        
        task = asyncio.ensure_future(self.core.get_pin_state(pin))
        report = self.loop.run_until_complete(task)

        if cb:
            cb(report)
        else:
            return report
207998
def get_gpio_mode(self, gpio_id):
        
        if not self._connected:
            return
        return self._protocol.status.get("OTGW_GPIO_{}".format(gpio_id))
482433
def parse_port_pin(name_str):
    """"""
    if len(name_str) < 3:
        raise ValueError("Expecting pin name to be at least 3 charcters.")
    if name_str[0] != 'P':
        raise ValueError("Expecting pin name to start with P")
    if name_str[1] < 'A' or name_str[1] > 'K':
        raise ValueError("Expecting pin port to be between A and K")
    port = ord(name_str[1]) - ord('A')
    pin_str = name_str[2:]
    if not pin_str.isdigit():
        raise ValueError("Expecting numeric pin number.")
    return (port, int(pin_str))
1244831
def GPIO_read(self):
        ''
        self.bus.write_byte_data(self.address, 0xF5, 0x0f)
        status = self.bus.read_byte(self.address)
        bits_values = dict([('SS0',status & 0x01 == 0x01),('SS1',status & 0x02 == 0x02),('SS2',status & 0x04 == 0x04),('SS3',status & 0x08 == 0x08)])
        return bits_values