{"id":15007462,"url":"https://github.com/gagath/charlcd","last_synced_at":"2025-10-30T11:31:48.445Z","repository":{"id":57548524,"uuid":"249275116","full_name":"gagath/charlcd","owner":"gagath","description":"Rust library for charlcd.c Linux driver.","archived":false,"fork":false,"pushed_at":"2024-03-11T12:02:31.000Z","size":32,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-02T08:12:04.692Z","etag":null,"topics":["linux-kernel","rust","rust-embedded"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gagath.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-03-22T21:24:21.000Z","updated_at":"2024-05-11T01:31:38.000Z","dependencies_parsed_at":"2023-07-27T21:09:51.935Z","dependency_job_id":null,"html_url":"https://github.com/gagath/charlcd","commit_stats":null,"previous_names":["gagath/charlcd","microjoe/charlcd"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gagath%2Fcharlcd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gagath%2Fcharlcd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gagath%2Fcharlcd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gagath%2Fcharlcd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gagath","download_url":"https://codeload.github.com/gagath/charlcd/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238960497,"owners_count":19559279,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["linux-kernel","rust","rust-embedded"],"created_at":"2024-09-24T19:10:08.613Z","updated_at":"2025-10-30T11:31:41.962Z","avatar_url":"https://github.com/gagath.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# charlcd\n\n[![Latest version](https://img.shields.io/crates/v/charlcd.svg)](https://crates.io/crates/charlcd)\n[![Documentation](https://docs.rs/charlcd/badge.svg)](https://docs.rs/charlcd)\n[![License](https://img.shields.io/crates/l/charlcd.svg)](https://crates.io/crates/charlcd)\n\nA rust crate to interact with the mainline Linux charlcd.c driver.\n\nOr, said boldly: _a crate to **correctly** interact with HD44780 LCD\nscreens on embedded Linux devices_.\n\n# Demo\n\n![Photo of a test on HD44780 20x4\nscreen](https://crates.microjoe.org/charlcd/media/docs/test.jpg)\n\nThe use of these kinds of photographies is used all over the\n[documentation](https://docs.rs/charlcd) to explain the before and\nafter of every available function. Be sure to check them all!\n\n# Rationale\n\nA lot of developers are relying on userspace libraries to interact with the\nvery popular HD44780 LCD screens, but these implementations are lacking\nproper abstractions and usually all reimplement the same communication\nprotocol to interact with the screen over and over.\n\nThis approach seems just wrong if you consider what the Linux kernel can\nprovide in comparison. Indeed, it is the role of device drivers to properly\nabstract the access to the hardware from userspace perspective. For this,\nthe Linux kernel uses an abstraction mechanism to declare the hardware:\nthe *device-tree*.\n\nThe *device-tree* nodes for a screen behind an I2C GPIO expander would look\nlike the following:\n\n```dts\n\u0026i2c0 {\n    status = \"okay\";\n\n    pcf8574a: i2c0@3f {\n        compatible = \"nxp,pcf8574a\";\n        reg = \u003c0x3f\u003e;\n        gpio-controller;\n        #gpio-cells = \u003c2\u003e;\n    };\n};\n\nauxdisplay: auxdisplay {\n    compatible = \"hit,hd44780\";\n\n    data-gpios = \u003c\u0026pcf8574a 4 GPIO_ACTIVE_HIGH\u003e,\n                 \u003c\u0026pcf8574a 5 GPIO_ACTIVE_HIGH\u003e,\n                 \u003c\u0026pcf8574a 6 GPIO_ACTIVE_HIGH\u003e,\n                 \u003c\u0026pcf8574a 7 GPIO_ACTIVE_HIGH\u003e;\n    rs-gpios = \u003c\u0026pcf8574a 0 GPIO_ACTIVE_HIGH\u003e;\n    rw-gpios = \u003c\u0026pcf8574a 1 GPIO_ACTIVE_HIGH\u003e;\n    enable-gpios = \u003c\u0026pcf8574a 2 GPIO_ACTIVE_HIGH\u003e;\n    backlight-gpios = \u003c\u0026pcf8574a 3 GPIO_ACTIVE_LOW\u003e;\n\n    display-height-chars = \u003c2\u003e;\n    display-width-chars = \u003c16\u003e;\n};\n```\n\nOnce the *device-tree* is correctly configured, the `charlcd` driver will\ncreate a `/dev/lcd` character device.\n\nThe role of this library is to provide an abstraction over this character\ndevice entry, while letting the kernel driver implement the communication\nwith the screen — instead of going from scratch and using ioctl over\n`/dev/i2c-*` like many other libraries do.\n\n# Known bugs\n\nThe charlcd driver is currently not able to report screen size to userspace.\nThis is mitigated in the library by having a look at the *device-tree* entries\ndirectly.\n\n# Going further\n\nFor more information about this and a demo on *real hardware*, see [this blog\narticle](https://blog.microjoe.org/2019/hd44780-lcd-i2c-screen-using-linux-mainline-charlcd-driver.html).\n\n# License\n\nApache v2.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgagath%2Fcharlcd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgagath%2Fcharlcd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgagath%2Fcharlcd/lists"}