def __init__(self, button_pins=[], **kwargs): """Initialises the ``InputDevice`` object. Kwargs: * ``button_pins``: GPIO mubers which to treat as buttons (GPIO.BCM numbering) * ``debug``: enables printing button press and release events when set to True """ self.button_pins = button_pins self.init_hw() InputSkeleton.__init__(self, **kwargs)
def __init__(self, cols=[5, 6, 13], rows=[12, 16, 20, 21], **kwargs): """Initialises the ``InputDevice`` object. Kwargs: * ``button_pins``: GPIO mubers which to treat as buttons (GPIO.BCM numbering) * ``debug``: enables printing button press and release events when set to True """ self.cols = cols self.rows = rows InputSkeleton.__init__(self, **kwargs)
def __init__(self, button_pins=[], **kwargs): """Initialises the ``InputDevice`` object. Kwargs: * ``button_pins``: GPIO mubers which to treat as buttons (GPIO.BCM numbering) * ``debug``: enables printing button press and release events when set to True """ self.button_pins = button_pins self.init_hw() InputSkeleton.__init__(self, **kwargs)
def __init__(self, button_pins=[], pullups=True, **kwargs): """Initialises the ``InputDevice`` object. Kwargs: * ``button_pins``: GPIO numbers which to treat as buttons (GPIO.BCM numbering) * ``pullups``: if True, enables pullups on all pins, if False, doesn't. Default: True * ``debug``: enables printing button press and release events when set to True """ self.button_pins = button_pins self.pullups = pullups InputSkeleton.__init__(self, **kwargs)
def __init__(self, addr = 0x20, bus = 1, **kwargs): """Initialises the ``InputDevice`` object. Kwargs: * ``bus``: I2C bus number. * ``addr``: I2C address of the expander. """ self.bus_num = bus self.bus = smbus.SMBus(self.bus_num) if type(addr) in [str, unicode]: addr = int(addr, 16) self.addr = addr self.init_expander() InputSkeleton.__init__(self, **kwargs)
def __init__(self, addr = 0x20, bus = 1, **kwargs): """Initialises the ``InputDevice`` object. Kwargs: * ``bus``: I2C bus number. * ``addr``: I2C address of the expander. """ self.bus_num = bus self.bus = smbus.SMBus(self.bus_num) if type(addr) in [str, unicode]: addr = int(addr, 16) self.addr = addr self.init_expander() InputSkeleton.__init__(self, **kwargs)
def __init__(self, addr=0x12, bus=1, int_pin=16, **kwargs): """Initialises the ``InputDevice`` object. Kwargs: * ``bus``: I2C bus number. * ``addr``: I2C address of the device. * ``int_pin``: GPIO pin for interrupt mode. """ self.bus_num = bus if isinstance(addr, basestring): addr = int(addr, 16) self.addr = addr self.int_pin = int_pin InputSkeleton.__init__(self, **kwargs)
def __init__(self, path=None, name=None, **kwargs): """Initialises the ``InputDevice`` object. Kwargs: * ``path``: path to the input device. If not specified, you need to specify ``name``. * ``name``: input device name """ if not name and not path: #No necessary arguments supplied raise TypeError( "HID device driver: expected at least path or name; got nothing. =(" ) self.path = path self.name = name InputSkeleton.__init__(self, mapping=[], **kwargs) self.hid_device_error_filter = False
def __init__(self, addr=0x12, bus=1, int_pin=16, **kwargs): """Initialises the ``InputDevice`` object. Kwargs: * ``bus``: I2C bus number. * ``addr``: I2C address of the device. * ``int_pin``: GPIO pin for interrupt mode. """ self.bus_num = bus self.bus = smbus.SMBus(self.bus_num) if type(addr) in [str, unicode]: addr = int(addr, 16) self.addr = addr self.int_pin = int_pin InputSkeleton.__init__(self, **kwargs)
def __init__(self, addr=0x20, bus=1, int_pin=None, **kwargs): """Initialises the ``InputDevice`` object. Kwargs: * ``bus``: I2C bus number. * ``addr``: I2C address of the expander. * ``int_pin``: GPIO pin to which INT pin of the expander is connected. If supplied, interrupt-driven mode is used, otherwise, library reverts to polling mode. """ self.bus_num = bus self.bus = smbus.SMBus(self.bus_num) if type(addr) in [str, unicode]: addr = int(addr, 16) self.addr = addr self.int_pin = int_pin self.init_expander() InputSkeleton.__init__(self, **kwargs)
def __init__(self, addr = 0x20, bus = 1, int_pin = None, **kwargs): """Initialises the ``InputDevice`` object. Kwargs: * ``bus``: I2C bus number. * ``addr``: I2C address of the expander. * ``int_pin``: GPIO pin to which INT pin of the expander is connected. If supplied, interrupt-driven mode is used, otherwise, library reverts to polling mode. """ self.bus_num = bus self.bus = smbus.SMBus(self.bus_num) if type(addr) in [str, unicode]: addr = int(addr, 16) self.addr = addr self.int_pin = int_pin self.init_expander() InputSkeleton.__init__(self, **kwargs)
def __init__(self, addr = 0x12, bus = 1, int_pin = 21, **kwargs): """Initialises the ``InputDevice`` object. Kwargs: * ``bus``: I2C bus number. * ``addr``: I2C address of the device. * ``int_pin``: GPIO pin for interrupt mode. """ self.bus_num = bus self.bus = smbus.SMBus(self.bus_num) if type(addr) in [str, unicode]: addr = int(addr, 16) self.addr = addr self.int_pin = int_pin self.init_expander() InputSkeleton.__init__(self, **kwargs)
def __init__(self, path=None, name=None, **kwargs): """Initialises the ``InputDevice`` object. Kwargs: * ``path``: path to the input device. If not specified, you need to specify ``name``. * ``name``: input device name """ if not name and not path: #No necessary arguments supplied raise TypeError("Expected at least path or name; got nothing. =(") if not path: path = get_path_by_name(name) if not name: name = get_name_by_path(path) if not name and not path: #Seems like nothing was found by get_input_devices raise IOError("Device not found") self.path = path self.name = name InputSkeleton.__init__(self, mapping=[], **kwargs)
def __init__(self, path=None, name=None, **kwargs): """Initialises the ``InputDevice`` object. Kwargs: * ``path``: path to the input device. If not specified, you need to specify ``name``. * ``name``: input device name """ if not name and not path: #No necessary arguments supplied raise TypeError("Expected at least path or name; got nothing. =(") if not path: path = get_path_by_name(name) if not name: name = get_name_by_path(path) if not name and not path: #Seems like nothing was found by get_input_devices raise IOError("Device not found") self.path = path self.name = name self.init_hw() InputSkeleton.__init__(self, mapping = [], **kwargs)
def atexit(self): InputSkeleton.atexit(self)
def __init__(self, **kwargs): InputSkeleton.__init__(self, mapping=[], **kwargs)
def __init__(self, **kwargs): """Initialises the ``InputDevice`` object - basically, does nothing. """ InputSkeleton.__init__(self, **kwargs)
def atexit(self): InputSkeleton.atexit(self) try: self.device.ungrab() except: pass
def atexit(self): InputSkeleton.atexit(self) try: self.device.ungrab() except: pass