{"id":15172763,"url":"https://github.com/digitalsmile/gpio","last_synced_at":"2025-10-26T04:30:29.879Z","repository":{"id":214832983,"uuid":"737472179","full_name":"DigitalSmile/gpio","owner":"DigitalSmile","description":"Java 22+ library for interacting with GPIO and hardware interfaces","archived":false,"fork":false,"pushed_at":"2024-06-27T06:48:16.000Z","size":173,"stargazers_count":7,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-31T14:17:42.786Z","etag":null,"topics":["gpio","i2c","java","pwm","raspberry","raspberry-pi","raspberry-pi-4","raspberrypi","spi"],"latest_commit_sha":null,"homepage":"","language":"Java","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/DigitalSmile.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":"2023-12-31T06:45:11.000Z","updated_at":"2025-01-12T09:21:38.000Z","dependencies_parsed_at":"2024-01-15T13:54:38.466Z","dependency_job_id":"2dcc94f9-f4b4-48fd-957a-05dbed328bf6","html_url":"https://github.com/DigitalSmile/gpio","commit_stats":null,"previous_names":["digitalsmile/ffm-io"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DigitalSmile%2Fgpio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DigitalSmile%2Fgpio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DigitalSmile%2Fgpio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DigitalSmile%2Fgpio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DigitalSmile","download_url":"https://codeload.github.com/DigitalSmile/gpio/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238258908,"owners_count":19442498,"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":["gpio","i2c","java","pwm","raspberry","raspberry-pi","raspberry-pi-4","raspberrypi","spi"],"created_at":"2024-09-27T10:04:17.259Z","updated_at":"2025-10-26T04:30:24.427Z","avatar_url":"https://github.com/DigitalSmile.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![](https://jitpack.io/v/DigitalSmile/gpio.svg)](https://jitpack.io/#DigitalSmile/gpio)\n![](https://img.shields.io/badge/Java-22+-success)\n![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/digitalsmile/gpio/gradle.yml)\n---\n# Java GPIO library\nThis Java library is intended to be used with any kind of hardware, that exposes GPIO interface to user (e.g. RaspberryPi, OrangePi, etc.). \nWith new [FFM API](https://openjdk.org/jeps/442) that were released in a recent versions of Java, you can work with low level stuff (like linux kernel syscalls) within your app. It is fast and reliable native interface provided by JVM. No more JNI and JNA!\n\n## Features\n1) Zero dependencies (except SLF4J for logging)\n2) Modern! Java 22+ with full language feature support\n3) Full usage of FFM API, direct work with native memory and linux syscalls (libc)\n4) Supports individual GPIO Pins, with edge event detection\n5) Supports SPI interface\n6) Supports I2C / SMBus interface\n7) Supports hardware PWM interface\n8) Tested on RaspberryPi 3/4, OrangePi,\n9) UART/TTL is coming soon\n\n## Usage\n1) Add a dependency.\n```groovy\nallprojects {\n    repositories {\n        ...\n        maven { url 'https://jitpack.io' }\n    }\n}\n\ndependencies {\n    implementation 'com.github.DigitalSmile:gpio:{version}'\n}\n```\n2) Add to your code:\n\n```java\nvar spiBus = GPIOBoard.ofSPI(0, SPIMode.MODE_0, 20_000_000);\n\nvar rst = GPIOBoard.ofPin(17, Direction.OUTPUT);\nvar busy = GPIOBoard.ofPin(24, Direction.INPUT);\nvar dc = GPIOBoard.ofPin(25, Direction.OUTPUT);\nvar pwr = GPIOBoard.ofPin(18, Direction.OUTPUT);\n\npwr.write(State.HIGH);\n// direct lookup for state change\nwhile(busy.read().equals(State.HIGH)){\n        Thread.sleep(10);\n}\n// or usage of edge event detection\npwr.startEventDetection(PinEvent.FALLING, (eventList -\u003e{\n    // do stuff on events captured            \n}));\ndc.write(State.LOW);\n\nspiBus.sendByteData(new byte[] { 1 },false);\n\nvar i2c = GPIOBoard.ofI2C(0);\nvar scanned = i2c.scan();\nvar status = scanned.get(0x55);\nif (status.equals(I2CStatus.AVAILABLE)) {\n    i2c.selectAddress(0x55);\n    var read = i2c.read(0x55);\n    //do stuff with data read\n}\n\nvar pwmPin = GPIOBoard.ofPWMBus(0);\npwmPin.configure(25_000, 40, PWMPolarity.NORMAL);\npwmPin.enable();\n// set rotation speed, e.g. fan\nvar percentages = new int[]{100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0};\nfor (int percent : percentages) {\n    pwmPin.setSpeed(percent);\n    Thread.sleep(1_000);\n}\n```\n4) Enjoy! :)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalsmile%2Fgpio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdigitalsmile%2Fgpio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalsmile%2Fgpio/lists"}