{ "info": { "author": "Julian Metzler", "author_email": "contact@mezgrman.de", "bugtrack_url": null, "classifiers": [], "description": "HD44780 \u2013 A library for controlling HD44780 compatible character LCDs\n=====================================================================\n\nLicense\n-------\nThis program is licensed under the AGPLv3. See the `LICENSE` file for more information.\n\nInstallation\n------------\nYou can easily install the HD44780 lib using the Python Package Index. Just type:\n\n\tsudo pip install hd44780\n\nHardware support\n----------------\nThis library supports multiple hardware platforms for input and output.\n\nCurrently available output backends:\n* Velleman K8055 USB Experiment Interface Board\n* Raspberry Pi GPIO pins\n* Arduino pins using serial communication (Still in development)\n* Debug output showing the states of the interface pins\n* Dummy output that does nothing\n\nCurrently available input backends:\n* System standard input (e.g. Keyboard)\n* Raspberry Pi GPIO pins\n* No input\n\nSee the usage examples below for examples on how to use them.\n\nOutput pinmaps\n--------------\nWhen instantiating a display, you need to pass it a dictionary containing a mapping from pin names on the LCD to output numbers on the device you're connecting the LCD to.\nFor a K8055, you might want to use this pinmap:\n\n```python\nPINMAP = {\n\t'RS': 1,\n\t'RW': 2,\n\t'E': 3,\n\t'D4': 4,\n\t'D5': 5,\n\t'D6': 6,\n\t'D7': 7,\n\t'LED': 9,\n}\n```\n\nNote that the backlight LED pin is numbered 9 here, even though the K8055 only has 8 digital outputs. But since there are two additional analog outputs, I numbered them 9 and 10 to avoid confusion.\nUsing an analog output for backlight control enables you to dim the backlight by using PWM!\n\nFor a Raspberry Pi, you need to use WiringPi's `WPI_MODE_GPIO` pin numbering scheme. I connected my LCD as follows:\n\n```python\nPINMAP = {\n\t'RS': 2,\n\t'RW': 3,\n\t'E': 4,\n\t'D4': 22,\n\t'D5': 10,\n\t'D6': 9,\n\t'D7': 11,\n\t'LED': 18,\n}\n```\n\nBy using pin 18 for the backlight control, it's once again possible to dim the backlight since this pin is the only available hardware PWM pin of the Pi, so I recommend using this one.\nIf you are using the `DebugBackend` backend, the pin numbers don't matter.\n\nInput pinmaps\n-------------\nIf you are using an input module that uses I/O pins, you need to specify a pinmap for that module as well.\nCurrently, only five keys are supported: Up, Left, OK, Right and Down, as well as two LEDs: Ready and Error.\nMy pinmap looks like this:\n\n```python\nINPUT_PINMAP = {\n\t'UP': 23,\n\t'LEFT': 7,\n\t'OK': 8,\n\t'RIGHT': 24,\n\t'DOWN': 25,\n\t'READY': 27,\n\t'ERROR': 22,\n}\n```\n\nCharacter maps\n--------------\nYou can also specify a character map to use for defining custom characters. This is a dictionary in the following format:\n\n```python\nCHARMAP = {\n\t0: (\n\t\t0b10101,\n\t\t0b01010,\n\t\t0b10101,\n\t\t0b01010,\n\t\t0b10101,\n\t\t0b01010,\n\t\t0b10101,\n\t\t0b01010,\n\t),\n}\n```\n\nThe keys should be integers from 0 to 7, since the HD44780 can store up to 8 custom characters.\nThe values should be tuples or lists of 8 integers, where each integer represents a line of the custom character. I recommend writing these integers in binary notation, since it's easy to see which pixels will be active and which won't if you do it this way.\n\nYou can also specify a single key, `dir`, to load custom characters from image files:\n\n```python\nCHARMAP = {\n\t'dir': \"/path/to/directory\",\n}\n```\n\nThe specified directory should contain up to 8 image files (preferably in PNG format) numbered `0.` to `7.`. Each of these files must be 5 pixels wide and 8 pixels tall and should consist of black and white pixels, where a black pixel will translate into an active pixel on the display.\nTo use this feature, you need to have the Python Imaging Library (PIL) installed.\n\nUser Interface\n--------------\nThis library comes with a `DisplayUI` class which allows you to create simple text-based user interfaces with just a few lines of code!\nSee the usage examples below. Have a look at the `lcd.py` file to see what is possible.\n\nUsage examples\n--------------\nTo initialize a standard 16x2 character LCD with a blinking cursor on a Raspberry Pi, you would do:\n\n```python\nimport hd44780\nPINMAP = {} # Your pinmap here\ndisplay = hd44780.Display(backend = hd44780.GPIOBackend, pinmap = PINMAP, lines = 2, columns = 16)\ndisplay.set_display_enable(cursor = True, cursor_blink = True)\ndisplay.clear()\ndisplay.home()\n```\n\nTo display a Yes / No dialog and react to the user's choice on said display, using physical keys attached to the Pi, do the following:\n\n```python\nINPUT_PINMAP = {} # Your pinmap here\nui = hd44780.DisplayUI(display, hd44780.GPIOInput, input_kwargs = {'pinmap': INPUT_PINMAP})\nselected_index, selected_text = ui.dialog(\"Proceed?\", buttons = (\"Yes\", \"No\"))\nif selected_index == 0:\n\tui.message(\"Doing stuff...\")\nelse:\n\tui.message(\"Aborted.\")\n```\n\nNote that if you are using the `SystemInput` input backend you need to be able to send keypresses to the terminal running the script, or else it won't be able to react to your input.\nFor more examples I would suggest looking at the included example scripts.\n", "description_content_type": null, "docs_url": null, "download_url": null, "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Mezgrman/HD44780", "keywords": "library lcd display hd44780 interface", "license": "AGPLv3", "maintainer": null, "maintainer_email": null, "name": "HD44780", "package_url": "https://pypi.org/project/HD44780/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/HD44780/", "project_urls": { "Homepage": "https://github.com/Mezgrman/HD44780" }, "release_url": "https://pypi.org/project/HD44780/1.1.2/", "requires_dist": null, "requires_python": null, "summary": "A library for controlling HD44780 compatible character LCDs", "version": "1.1.2" }, "last_serial": 784474, "releases": { "1.1.2": [ { "comment_text": "", "digests": { "md5": "9ce2f7bf791cc29ced68529536f32ea1", "sha256": "6297bc4dbad486b050125ba8648dca22949452f5ecfadb2201330f4c2e70f6e1" }, "downloads": -1, "filename": "HD44780-1.1.2.tar.gz", "has_sig": false, "md5_digest": "9ce2f7bf791cc29ced68529536f32ea1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 28280, "upload_time": "2013-05-13T07:31:27", "url": "https://files.pythonhosted.org/packages/bf/34/9c1731acbf391680c8c1506018c48c0c5976e35363a9651ec47200478bb0/HD44780-1.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9ce2f7bf791cc29ced68529536f32ea1", "sha256": "6297bc4dbad486b050125ba8648dca22949452f5ecfadb2201330f4c2e70f6e1" }, "downloads": -1, "filename": "HD44780-1.1.2.tar.gz", "has_sig": false, "md5_digest": "9ce2f7bf791cc29ced68529536f32ea1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 28280, "upload_time": "2013-05-13T07:31:27", "url": "https://files.pythonhosted.org/packages/bf/34/9c1731acbf391680c8c1506018c48c0c5976e35363a9651ec47200478bb0/HD44780-1.1.2.tar.gz" } ] }