{"id":31286931,"url":"https://github.com/danielgatis/go-sh1106","last_synced_at":"2026-04-19T07:33:43.787Z","repository":{"id":315649405,"uuid":"1060368694","full_name":"danielgatis/go-sh1106","owner":"danielgatis","description":"SH1106 driver 1.3 OLED","archived":false,"fork":false,"pushed_at":"2025-09-19T19:52:24.000Z","size":4053,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-02T08:45:02.950Z","etag":null,"topics":["go","golang","peripheral-drivers","raspberry","raspberry-pi","sh1106","sh1106-driver","sh1106-oled"],"latest_commit_sha":null,"homepage":"","language":"Go","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/danielgatis.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-19T19:47:26.000Z","updated_at":"2025-09-19T19:55:41.000Z","dependencies_parsed_at":"2025-09-19T22:00:53.916Z","dependency_job_id":"b8987dee-bed8-44db-b34f-b5bda18cb458","html_url":"https://github.com/danielgatis/go-sh1106","commit_stats":null,"previous_names":["danielgatis/go-sh1106"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/danielgatis/go-sh1106","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielgatis%2Fgo-sh1106","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielgatis%2Fgo-sh1106/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielgatis%2Fgo-sh1106/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielgatis%2Fgo-sh1106/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielgatis","download_url":"https://codeload.github.com/danielgatis/go-sh1106/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielgatis%2Fgo-sh1106/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278671745,"owners_count":26025745,"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","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["go","golang","peripheral-drivers","raspberry","raspberry-pi","sh1106","sh1106-driver","sh1106-oled"],"created_at":"2025-09-24T10:58:05.429Z","updated_at":"2026-04-19T07:33:43.773Z","avatar_url":"https://github.com/danielgatis.png","language":"Go","funding_links":["https://www.buymeacoffee.com/danielgatis"],"categories":[],"sub_categories":[],"readme":"# SH1106 Go Driver\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/danielgatis/go-sh1106?style=flat-square)](https://goreportcard.com/report/github.com/danielgatis/go-sh1106)\n[![License MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/danielgatis/go-sh1106/master/LICENSE)\n[![Go Doc](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](https://godoc.org/github.com/danielgatis/go-sh1106)\n[![Release](https://img.shields.io/github/release/danielgatis/go-sh1106.svg?style=flat-square)](https://github.com/danielgatis/go-sh1106/releases/latest)\n\n\n\nA Go library for controlling SH1106 OLED displays with text rendering capabilities.\n\n[\u003cvideo src=\"demo.mp4\" controls width=\"600\"\u003e\u003c/video\u003e](https://github.com/user-attachments/assets/6c657a5c-2fcd-41a2-b957-916cb8a23586)\n\nhttps://www.waveshare.com/1.3inch-oled-hat.htm\n\n## Features\n\n- **SH1106 Display Driver**: Full support for SH1106 OLED displays via SPI\n- **Text Rendering**: BDF font support with embedded font option\n- **Joystick Support**: Complete joystick/button handling with callbacks\n- **Easy Integration**: Simple API for quick integration\n- **Examples**: Complete examples showing different usage patterns\n\n## Installation\n\n```bash\ngo get github.com/danielgatis/go-sh1106\n```\n\n## Quick Start\n\n```go\npackage main\n\nimport (\n    \"log\"\n    \n    \"github.com/danielgatis/go-sh1106/pkg/display\"\n    \"github.com/danielgatis/go-sh1106/pkg/text\"\n    \n    \"periph.io/x/conn/v3/gpio/gpioreg\"\n    \"periph.io/x/conn/v3/spi/spireg\"\n    \"periph.io/x/host/v3\"\n)\n\nfunc main() {\n    // Initialize periph.io\n    host.Init()\n    \n    // Open SPI bus\n    bus, _ := spireg.Open(\"\")\n    \n    // Configure GPIO pins\n    dc := gpioreg.ByName(\"GPIO24\")\n    rst := gpioreg.ByName(\"GPIO25\")\n    cs := gpioreg.ByName(\"GPIO8\")\n    \n    // Create display\n    dev, _ := display.NewSH1106SPI(bus, dc, rst, cs, \u0026display.Options{\n        Width:  128,\n        Height: 64,\n    })\n    defer dev.Halt()\n    \n    // Create text renderer with embedded font\n    textRenderer, _ := text.NewRendererWithEmbeddedFont(\u0026text.Config{\n        Width:     128,\n        Height:    64,\n        LineCount: 6,\n    })\n    \n    // Set text and display\n    textRenderer.SetTexts([]string{\n        \"Hello World!\",\n        \"SH1106 Display\",\n        \"Go Library\",\n    })\n    \n    dev.Draw(textRenderer.Bounds(), textRenderer.Image(), image.Point{})\n}\n```\n\n### Enable SPI on Raspberry Pi\n\n```bash\nsudo raspi-config\n# Navigate to: Interfacing Options \u003e SPI \u003e Enable\n```\n\n## Packages\n\n### Display Package (`pkg/display`)\nSH1106 OLED display driver with SPI support.\n\n### Text Package (`pkg/text`)\nText rendering with BDF font support and embedded font option.\n\n```go\n// With embedded font (no external file needed)\nrenderer, _ := text.NewRendererWithEmbeddedFont(\u0026text.Config{\n    Width:     128,\n    Height:    64,\n    LineCount: 6,\n})\n\n// Or with custom BDF font file\nrenderer, _ := text.NewRenderer(\"path/to/font.bdf\", \u0026text.Config{\n    Width:     128,\n    Height:    64,\n    LineCount: 6,\n})\n```\n\n### Joystick Package (`pkg/joystick`)\nComplete joystick/button event handling with multiple callback support.\n\n```go\nimport \"github.com/danielgatis/go-sh1106/pkg/joystick\"\n\n// Create joystick\njoy := joystick.NewJoystick(upPin, downPin, leftPin, rightPin, btn1, btn2, btn3)\n\n// Register multiple callbacks (returns remove function)\nremove1 := joy.OnClickUp(func() {\n    fmt.Println(\"UP clicked - Callback 1\")\n})\n\nremove2 := joy.OnClickUp(func() {\n    fmt.Println(\"UP clicked - Callback 2\")\n})\n\n// Configure\njoy.SetHoldDuration(500 * time.Millisecond)\njoy.SetPollInterval(50 * time.Millisecond)\n\n// Start polling\njoy.Start()\ndefer joy.Stop()\n\n// Remove specific callback\nremove1()\n```\n\n**Supported Events:**\n- `OnClick[Button]()` - Triggered on button press\n- `OnHold[Button]()` - Triggered when button held (default 500ms)\n- `OnRelease[Button]()` - Triggered on button release\n\n**Available Buttons:** `Up`, `Down`, `Left`, `Right`, `Button1`, `Button2`, `Button3`\n\n## Examples\n\n### Basic Display Example\n```bash\ncd examples/basic\ngo run main.go \"YOUR MESSAGE\"\n```\n\n### Animation Example\n```bash\ncd examples/animation\ngo run main.go\n```\n\n### Joystick Example\n```bash\ncd examples/joystick\ngo run main.go\n```\n\n### Interactive Menu Example\nComplete example combining display, text rendering, and joystick navigation:\n```bash\ncd examples/interactive\ngo run main.go\n```\n\nThis example demonstrates:\n- Interactive menu navigation with joystick\n- Real-time display updates\n- Multiple callback handling\n- State management\n\n## Building for Raspberry Pi\n\n```bash\n# Build for Raspberry Pi\nGOOS=linux GOARCH=arm go build -o basic examples/basic/main.go\n\n# Copy to Raspberry Pi\nscp basic pi@raspberrypi.local:.\n```\n\n### License\n\nCopyright (c) 2025-present [Daniel Gatis](https://github.com/danielgatis)\n\nLicensed under [MIT License](./LICENSE)\n\n### Buy me a coffee\nLiked some of my work? Buy me a coffee (or more likely a beer)\n\n\u003ca href=\"https://www.buymeacoffee.com/danielgatis\" target=\"_blank\"\u003e\u003cimg src=\"https://bmc-cdn.nyc3.digitaloceanspaces.com/BMC-button-images/custom_images/orange_img.png\" alt=\"Buy Me A Coffee\" style=\"height: auto !important;width: auto !important;\"\u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielgatis%2Fgo-sh1106","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielgatis%2Fgo-sh1106","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielgatis%2Fgo-sh1106/lists"}