{"id":13894061,"url":"https://github.com/neildavis/lib_tm1637_rpi","last_synced_at":"2025-04-10T01:05:57.624Z","repository":{"id":146251635,"uuid":"557555229","full_name":"neildavis/lib_tm1637_rpi","owner":"neildavis","description":"A library for using the TM1637 LED driver control IC on Raspberry Pi OS (Raspbian)","archived":false,"fork":false,"pushed_at":"2025-03-24T11:13:03.000Z","size":44,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-10T01:05:49.604Z","etag":null,"topics":["cplusplus","cplusplus-11","dynamic-loading","gpio","gpiod","libgpiod","pigpio","pigpiod","raspberry-pi","raspberry-pi-os","raspberrypi","raspberrypios","raspbian","seven-segment","seven-segment-display","tm1637","tm1637display","wiringpi"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neildavis.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-25T22:32:18.000Z","updated_at":"2025-03-24T11:13:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"a99fdfc1-370a-4dc3-84a6-89dafe0043a9","html_url":"https://github.com/neildavis/lib_tm1637_rpi","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neildavis%2Flib_tm1637_rpi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neildavis%2Flib_tm1637_rpi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neildavis%2Flib_tm1637_rpi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neildavis%2Flib_tm1637_rpi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neildavis","download_url":"https://codeload.github.com/neildavis/lib_tm1637_rpi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248137888,"owners_count":21053775,"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":["cplusplus","cplusplus-11","dynamic-loading","gpio","gpiod","libgpiod","pigpio","pigpiod","raspberry-pi","raspberry-pi-os","raspberrypi","raspberrypios","raspbian","seven-segment","seven-segment-display","tm1637","tm1637display","wiringpi"],"created_at":"2024-08-06T18:01:22.890Z","updated_at":"2025-04-10T01:05:57.617Z","avatar_url":"https://github.com/neildavis.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"# lib_tm1637_rpi\n\nA library for using the [TM1637](https://datasheetspdf.com/pdf-file/788613/TitanMicro/TM1637/1)\nLED driver control IC to drive a 4 x 7-segment display from Raspberry Pi OS (Raspbian). Includes a small [`say`](./say/) utility to scroll some text.\n\nThis library does not access the GPIO pins itself. Instead, it has been designed to allow the use of\ndifferent 'backend' GPIO libraries through the use of\n[polymorphism](https://en.wikipedia.org/wiki/Polymorphism_(computer_science)) and\n[dynamic loading](https://en.wikipedia.org/wiki/Dynamic_loading)\nto provide a ***runtime choice*** of GPIO library.\nThe currently supported GPIO libraries include:\n\n* [`libgpiod`](https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/)\n* [`pigpio`](https://abyz.me.uk/rpi/pigpio/) (Both 'library' and '[`pigpiod`](https://abyz.me.uk/rpi/pigpio/pigpiod.html)' interfaces)\n* [`wiringPi`](https://github.com/WiringPi/WiringPi)\n\nBy default, `libgpiod` will be used.\n\nYou must ensure you have installed the GPIO library that you wish to use\n(see [instructions](#install-supported-gpio-libraries) below), but your program **does not** have to link\nto any GPIO library at build time. The GPIO library is dynamically loaded at runtime using\n[`dlopen()`](https://tldp.org/HOWTO/Program-Library-HOWTO/dl-libraries.html).\n\n## Features\n\n* Show any combination of segments on up to four digits controlled by the TM1637.\n* Independent control over the 'colon' character.\n* Independent control over the display brightness.\n* APIs to show numerical literals in both decimal (e.g. `1234`) \u0026 hexadecimal (e.g. `0xabcd`).\n\n## Installation\n\nWith [releases](https://github.com/neildavis/lib_tm1637_rpi/releases) from **v1.4.0** onwards\nI am making available prebuilt Debian (`.deb`) packages for both 32-bit (`armhf`) \u0026 64-bit (`arm64`/`aarch64`) versions of Raspberry Pi OS ('Bookworm').\n\nGrab them from [here]([releases](https://github.com/neildavis/lib_tm1637_rpi/releases)) and install using `dpkg -i`: e.g.\n\n```sh\n# 64-bit\nsudo dpkpg -i  libtm1637pi_1.4_arm64.deb`\n```\n\nOR\n\n```sh\n# 32-bit\nsudo dpkpg -i  libtm1637pi_1.4_armhf.deb`\n```\n\nAlternatively, you can follow the instructions in this README to\n[Build \u0026 Install From Source](#build--install-from-source)\n\n\n## Install Supported GPIO libraries \n\n### libgpiod\n\nIf you wish to use `libgpiod` for GPIO access, you will need to install the `gpiod` package:\n\n```sh\nsudo apt install gpiod\n```\n\n### pigpio / pigpiod\n\n#### \\*\\* IMPORTANT - Raspberry Pi 5 \\*\\*\n\nDue to hardware architecture changes in the Raspberry Pi 5, ***`pigpio`*** \n**does not currently wok on the Raspberry Pi 5**. See / track\n[these](https://github.com/joan2937/pigpio/issues/586)\n[issues](https://github.com/joan2937/pigpio/issues/589)\nfor more details.\n\n\nIf you wish to use the `pigpio` library and/or `pigpiod` for GPIO access, you may need to install the `pigpiod` package\n(although it may already be included by default in your OS image):\n\n```sh\nsudo apt install pigpiod\n```\n\nWhen using the `pigpio` 'library interface' your app will need to run as the '`root`' user (or under '`sudo`')\nto have permission to access the GPIO pins. You must also ensure that `pigpiod` is **NOT** currently running.\n\nWhen using the `pigpiod` daemon, the library will connect to the daemon on `localhost` by default.\nIf you wish to connect to a daemon on a different interface (or machine) you can do this by setting\nthe `PIGPIO_ADDR` and `PIGPIO_PORT` environment variables as described in the documentation for\n[`pigpio_start()`](https://abyz.me.uk/rpi/pigpio/pdif2.html#pigpio_start)\n\n### WiringPi\n\n`wiringPi` was [removed from v11 ('Bullseye')](https://github.com/RPi-Distro/repo/issues/214#issuecomment-1016542851) of Raspberry Pi OS packages. If you wish to use `wiringPi` for GPIO access you will need to build and/or install it manually by following the instructions in [WiringPi's README](https://github.com/WiringPi/WiringPi/blob/master/README.md#installing)\n\n## Build \u0026 Install From Source\n\n### Prerequisites\n\nYou will need [cmake](https://cmake.org/) v3.9 or higher and the necessary C++ development tools\ninstalled in order to build and install the library.\nIn addition, the `say` utility requires the development files for the `program_options`\ncomponent from Boost:\n\n```sh\nsudo apt install build-essential cmake libboost-program-options-dev\n```\n\n### Configure the build\n\nFrom this repo's root directory, create and change to a new `build` directory:\n\n```sh\nmkdir build\ncd build\n```\n\n#### Shared vs Static Library\n\nBy default the library will be configured to build as a [shared library](https://en.wikipedia.org//wiki/Library_(computing)#Shared_libraries) (.so) which is the recommended usage:\n\n```sh\ncmake -G\"Unix Makefiles\" ..\n```\n\n***OR*** if you prefer to configure the library to build as a [static library](https://en.wikipedia.org/wiki/Static_library) (.a) then you must declare `BUILD_SHARED_LIBS` as `OFF` when calling `cmake`. e.g.\n\n```sh\ncmake -DBUILD_SHARED_LIBS=OFF -G\"Unix Makefiles\" ..\n```\n\n### **IMPORTANT**: Changing configuration\n\nIf you wish to change between the configuration options above, be sure to delete the `CMakeCache.txt` file **before** calling `cmake` again. It's also wise to perform a '`make clean`' before rebuilding:\n\n```sh\nmake clean\nrm CMakeCache.txt\n```\n\n### Building \u0026 Install\n\nAfter [configuring](#configure-the-build) the build, you can build and install the library by simply invoking\n[`make`](https://www.gnu.org/software/make/) from the `build` directory:\n\n```sh\nsudo make install\nsudo ldconfig\n```\n\n## Usage\n\n### pkg-config\n\nFor ease of use the library installs with [`pkg-config`](https://www.freedesktop.org/wiki/Software/pkg-config/) support.\nThis means you can automatically find all the required compiler command line options for using the library by issuing the command:\n\n```sh\npkg-config --libs --cflags libTM1637Pi\n```\n\nAn example of how to compile \u0026 link your program against the library:\n\n```sh\ng++ -Wall -std=c++11 myprogram.cpp -o myprogram $(pkg-config --libs --cflags libTM1637Pi)\n```\n\n### API\n\nThe public API is included in the public header file [`tm1637.h`](./inc/tm1637.h)\nwhich will be installed into the system default includes directory (e.g. `/usr/local/include`).\n\n### Example\n\nSee the [example](./example/tm1637_example.cpp) code in the `example` directory for a demonstration of the library's features. The example can be built and run with the following commands from the top level dir of this repo:\n\n```sh\ncd example\n./build_for_gpiod.sh\n# or ./build_for_wiringpi.sh \n# or ./build_for_pigpio_interface.sh \n# or ./build_for_pigpio_daemon.sh \n./tm1637_example \n```\n\n## tm1637_say utility\n\nA simple utility using `lib_tm1637_rpi` to scroll some text on a [TM1637](https://datasheetspdf.com/pdf-file/788613/TitanMicro/TM1637/1) display is included as part of the build. The cmake `install` action will also install it into the default binary installation directory which should be already included in your `$PATH`\n\n### tm1637_say usage\n\nRunning `tm1637_say` without any arguments, or with `--help` will display help \u0026 usage information:\n\n```none\n$ tm1637_say \ntm1637_say utility - © 2023 Neil Davis\nSee LICENSE at https://github.com/neildavis/lib_tm1637_rpi/blob/main/LICENSE\n\nUsage: tm1637_say [OPTIONS] \u003cmessage\u003e\n\nAvailable OPTIONS:\n  -h [ --help ]                      Show usage information\n  -c [ --scl ] arg (=3)              GPIO pin to use for clock\n  -d [ --sda ] arg (=2)              GPIO pin to use for data\n  -g [ --gpio-lib ] arg (=GpioGPIOD) GPIO library\n  -t [ --delay-time ] arg (=250)     Delay time between characters (ms)\n  -n [ --count ] arg (=1)            Repeat the message \u003carg\u003e number of times\n  -v [ --verbose ] [=arg(=1)] (=0)   Enable/Disable verbose output\n```\n\ne.g. the following invocation uses the wiringPi library with BCM pin numbering, pins 23 \u0026 24 for `SCL` \u0026 `SDA` respectively, and displays a message faster than the default three times over :\n\n```sh\ntm1637_say -c 23 -d 24 -g GpioWiringPiBCM -t 100 -n 3 \"HELLO WORLD\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneildavis%2Flib_tm1637_rpi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneildavis%2Flib_tm1637_rpi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneildavis%2Flib_tm1637_rpi/lists"}