def configureKeyboard(self, currentDevice):
        menus.clearPreviousMenu()

        print('Configuring {0}'.format(currentDevice['name']))
        device = []  # Append new controls to this list
        deviceName = currentDevice[
            'name']  # Current controller being configured

        # Second, Configure Buttons
        for button in currentDevice['buttons']:
            cmdName = button[0]
            command = button[1]
            unit = pcolor('cyan', cmdName)
            print('Press and hold GPIO pin(s) to map {0}'.format(unit),
                  end=' ')
            sys.stdout.flush()
            pressed = self.wait_for_pin()
            pressed = ', '.join(map(str, pressed))
            print('- Pins(s):', pressed)
            self.waitForButtonRelease()
            device.append((deviceName, cmdName, 'KEY', command, pressed))

        # Save to Database
        print('Saving Configuration!')
        # Delete Old Entries
        SQL.deleteDevice(deviceName)

        # Create New Entries
        SQL.createDevice(device)
        time.sleep(1)
        self.getControllerType()
    def configureJoypad(self, currentDevice):
        menus.clearPreviousMenu()

        print('Configuring {0}'.format(currentDevice['name']))
        device = []  # Append new controls to this list
        deviceName = currentDevice[
            'name']  # Current controller being configured

        # First, Configure Joysticks
        for dpad in range(currentDevice['axisCount']):
            # Define Axes
            device.append(self.defineAxis("UP", dpad, deviceName, offset=1))
            device.append(self.defineAxis("DOWN", dpad, deviceName, offset=1))
            device.append(self.defineAxis("LEFT", dpad, deviceName))
            device.append(self.defineAxis("RIGHT", dpad, deviceName))

        # Second, Configure Buttons
        for button in currentDevice['buttons']:
            cmdName = button[0]
            command = button[1]
            unit = pcolor('cyan', cmdName)
            print('Hold {0}'.format(unit), end=' ')
            sys.stdout.flush()
            pressed = self.wait_for_pin()
            pressed = ', '.join(map(str, pressed))
            print('- Pins(s):', pressed)
            self.waitForButtonRelease()
            device.append((deviceName, cmdName, 'BUTTON', command, pressed))

        # Save to Database
        print('Saving Configuration!')
        # Delete Old Entries
        SQL.deleteDevice(deviceName)

        # Create New Entries
        SQL.createDevice(device)
        time.sleep(1)

        self.getControllerType()