Example #1
0
    def __init__(self, pin, params):
        """Initialize the pin."""
        self._pin = pin
        self._name = params.get(CONF_NAME) or DEVICE_DEFAULT_NAME
        self._state = params.get(CONF_INITIAL)
        self._invert_logic = params.get(CONF_INVERT_LOGIC)

        bbb_gpio.setup_output(self._pin)

        if self._state is False:
            bbb_gpio.write_output(self._pin, 1 if self._invert_logic else 0)
        else:
            bbb_gpio.write_output(self._pin, 0 if self._invert_logic else 1)
Example #2
0
    def __init__(self, pin, params):
        """Initialize the pin."""
        self._pin = pin
        self._name = params.get(CONF_NAME) or DEVICE_DEFAULT_NAME
        self._state = params.get(CONF_INITIAL)
        self._invert_logic = params.get(CONF_INVERT_LOGIC)

        bbb_gpio.setup_output(self._pin)

        if self._state is False:
            bbb_gpio.write_output(self._pin, 1 if self._invert_logic else 0)
        else:
            bbb_gpio.write_output(self._pin, 0 if self._invert_logic else 1)