{"id":21028039,"url":"https://github.com/d2r2/go-i2c","last_synced_at":"2025-10-05T23:12:34.115Z","repository":{"id":35202896,"uuid":"39461575","full_name":"d2r2/go-i2c","owner":"d2r2","description":"Implementation of I2C-bus written in Golang. Forked from davecheney/i2c.","archived":false,"fork":false,"pushed_at":"2024-03-07T12:01:06.000Z","size":31,"stargazers_count":185,"open_issues_count":10,"forks_count":60,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-08-13T21:35:32.571Z","etag":null,"topics":["embedded-linux","golang","gpio","i2c","i2c-bus","i2c-sensors","raspberry-pi"],"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":"Unmaintained","scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/d2r2.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":"2015-07-21T18:03:39.000Z","updated_at":"2025-08-10T21:52:41.000Z","dependencies_parsed_at":"2024-12-23T18:11:33.390Z","dependency_job_id":null,"html_url":"https://github.com/d2r2/go-i2c","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/d2r2/go-i2c","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d2r2%2Fgo-i2c","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d2r2%2Fgo-i2c/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d2r2%2Fgo-i2c/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d2r2%2Fgo-i2c/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/d2r2","download_url":"https://codeload.github.com/d2r2/go-i2c/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d2r2%2Fgo-i2c/sbom","scorecard":{"id":315638,"data":{"date":"2025-08-11","repo":{"name":"github.com/d2r2/go-i2c","commit":"73a8a799d6bcdcb945bf5494585aff8dc44b9636"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 1/26 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 8 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T00:07:47.305Z","repository_id":35202896,"created_at":"2025-08-18T00:07:47.305Z","updated_at":"2025-08-18T00:07:47.305Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278532352,"owners_count":26002346,"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-05T02:00:06.059Z","response_time":54,"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":["embedded-linux","golang","gpio","i2c","i2c-bus","i2c-sensors","raspberry-pi"],"created_at":"2024-11-19T11:53:40.775Z","updated_at":"2025-10-05T23:12:34.080Z","avatar_url":"https://github.com/d2r2.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"I2C-bus interaction of peripheral sensors with Raspberry PI embedded linux or respective clones\n==============================================================================================\n\n[![Build Status](https://travis-ci.org/d2r2/go-i2c.svg?branch=master)](https://travis-ci.org/d2r2/go-i2c)\n[![Go Report Card](https://goreportcard.com/badge/github.com/d2r2/go-i2c)](https://goreportcard.com/report/github.com/d2r2/go-i2c)\n[![GoDoc](https://godoc.org/github.com/d2r2/go-i2c?status.svg)](https://godoc.org/github.com/d2r2/go-i2c)\n[![MIT License](http://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)\n\nThis library written in [Go programming language](https://golang.org/) intended to activate and interact with the I2C bus by reading and writing data.\n\nCompatibility\n-------------\n\nTested on Raspberry Pi 1 (model B), Raspberry Pi 3 B+, Banana Pi (model M1), Orange Pi Zero, Orange Pi One.\n\nGolang usage\n------------\n\n```go\nfunc main() {\n  // Create new connection to I2C bus on 2 line with address 0x27\n  i2c, err := i2c.NewI2C(0x27, 2)\n  if err != nil { log.Fatal(err) }\n  // Free I2C connection on exit\n  defer i2c.Close()\n  ....\n  // Here goes code specific for sending and reading data\n  // to and from device connected via I2C bus, like:\n  _, err := i2c.Write([]byte{0x1, 0xF3})\n  if err != nil { log.Fatal(err) }\n  ....\n}\n```\n\nTutorial\n--------\n\nMy [repositories](https://github.com/d2r2?tab=repositories) contain quite a lot projects, which use i2c library as a starting point to interact with various peripheral devices and sensors for use on embedded Linux devices. All these libraries start with a standard call to open I2C-connection to specific bus line and address, than pass i2c instance to device.\n\nIn its turn, go-i2c use [go-logger](https://github.com/d2r2/go-logger) library to output debug and other notification's lines which produce all necessary levels of logging. You can manage what level of verbosity you would like to see, by adding call:\n```go\n// Uncomment/comment next line to suppress/increase verbosity of output\nlogger.ChangePackageLogLevel(\"i2c\", logger.InfoLevel)\n```\nOnce you put this call, it will decrease verbosity from default \"Debug\" up to next \"Info\" level, reducing the number of low-level console outputs that occur during interaction with the I2C bus. Please, find examples in corresponding I2C-driven sensors among my projects.\n\nYou will find here the list of all devices and sensors supported by me, that reference this library:\n\n- [Liquid-crystal display driven by Hitachi HD44780 IC](https://github.com/d2r2/go-hd44780).\n- [BMP180/BMP280/BME280 temperature and pressure sensors](https://github.com/d2r2/go-bsbmp).\n- [DHT12/AM2320 humidity and temperature sensors](https://github.com/d2r2/go-aosong).\n- [Si7021 relative humidity and temperature sensor](https://github.com/d2r2/go-si7021).\n- [SHT3x humidity and temperature sensor](https://github.com/d2r2/go-sht3x).\n- [VL53L0X time-of-flight ranging sensor](https://github.com/d2r2/go-vl53l0x).\n- [BH1750 ambient light sensor](https://github.com/d2r2/go-bh1750).\n- [MPL3115A2 pressure and temperature sensor](https://github.com/d2r2/go-mpl3115a2).\n\n\nGetting help\n------------\n\nGoDoc [documentation](http://godoc.org/github.com/d2r2/go-i2c)\n\nTroubleshooting\n--------------\n\n- *How to obtain fresh Golang installation to RPi device (either any RPi clone):*\nIf your RaspberryPI golang installation taken by default from repository is outdated, you may consider\nto install actual golang manually from official Golang [site](https://golang.org/dl/). Download\ntar.gz file containing armv6l in the name. Follow installation instructions.\n\n- *How to enable I2C bus on RPi device:*\nIf you employ RaspberryPI, use raspi-config utility to activate i2c-bus on the OS level.\nGo to \"Interfacing Options\" menu, to active I2C bus.\nProbably you will need to reboot to load i2c kernel module.\nFinally you should have device like /dev/i2c-1 present in the system.\n\n- *How to find I2C bus allocation and device address:*\nUse i2cdetect utility in format \"i2cdetect -y X\", where X may vary from 0 to 5 or more,\nto discover address occupied by peripheral device. To install utility you should run\n`apt install i2c-tools` on debian-kind system. `i2cdetect -y 1` sample output:\n\t```\n\t     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f\n\t00:          -- -- -- -- -- -- -- -- -- -- -- -- --\n\t10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --\n\t20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --\n\t30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --\n\t40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --\n\t50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --\n\t60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --\n\t70: -- -- -- -- -- -- 76 --    \n\t```\n\nLicense\n-------\n\nGo-i2c is licensed under MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd2r2%2Fgo-i2c","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fd2r2%2Fgo-i2c","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd2r2%2Fgo-i2c/lists"}