{"id":16440296,"url":"https://github.com/soypat/cereal","last_synced_at":"2025-10-24T09:57:35.003Z","repository":{"id":183078747,"uuid":"655425859","full_name":"soypat/cereal","owner":"soypat","description":"Serial port abstraction creation for bugst, sers, goburrow and tarm serial libraries.","archived":false,"fork":false,"pushed_at":"2023-11-27T14:28:23.000Z","size":26,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-25T23:44:55.142Z","etag":null,"topics":["go","golang","hal","hardware-abstraction","serial","termios"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/soypat.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-06-18T21:13:47.000Z","updated_at":"2023-11-14T09:34:47.000Z","dependencies_parsed_at":"2024-11-10T23:41:14.248Z","dependency_job_id":"79324bbb-5fb1-4105-8b4f-41061fe1219b","html_url":"https://github.com/soypat/cereal","commit_stats":null,"previous_names":["soypat/cereal"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/soypat/cereal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soypat%2Fcereal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soypat%2Fcereal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soypat%2Fcereal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soypat%2Fcereal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/soypat","download_url":"https://codeload.github.com/soypat/cereal/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soypat%2Fcereal/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280776479,"owners_count":26388950,"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-24T02:00:06.418Z","response_time":73,"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","hal","hardware-abstraction","serial","termios"],"created_at":"2024-10-11T09:11:45.345Z","updated_at":"2025-10-24T09:57:34.974Z","avatar_url":"https://github.com/soypat.png","language":"Go","funding_links":[],"categories":["Wireless Communication"],"sub_categories":["WASI and WASM Unknown"],"readme":"# cereal\nSerial port abstraction creation for bugst, sers, goburrow and tarm serial libraries.\n\nThis allows for:\n- Easily diagnosing if a bug is an issue with a certain library or not.\n- Modularizing a program so that the underlying serial implementation can be \neasily swapped out\n\n## Example\n\nBelow is a program that writes and reads from a serial port.\n\nThe library used to access the port is selected by the program user via a flag.\n\n```sh\nprogram -seriallib=tarm\n```\n\n```go\npackage main\n\nimport (\n\t\"flag\"\n\t\"log\"\n\t\"time\"\n\n\t\"github.com/soypat/cereal\"\n)\n\nfunc main() {\n    availableLibs := map[string]cereal.Opener{\n        cereal.Bugst{}.String():    cereal.Bugst{},\n        cereal.Tarm{}.String():     cereal.Tarm{},\n        cereal.Goburrow{}.String(): cereal.Goburrow{},\n        cereal.Sers{}.String():     cereal.Sers{},\n    }\n    flagSerial := flag.String(\"seriallib\", \"bugst\", \"Serial library to use: bugst, tarm, goburrow, sers\")\n    flag.Parse()\n    serial, ok := availableLibs[*flagSerial]\n    if !ok {\n        flag.PrintDefaults()\n        log.Fatalf(\"Invalid serial library: %s\\n\", *flagSerial)\n    }\n\n    port, err := serial.OpenPort(\"/dev/ttyUSB0\", cereal.Mode{\n        BaudRate: 9600,\n        DataBits: 8,\n        Parity:   cereal.ParityNone,\n        StopBits: cereal.StopBits1,\n    })\n    if err != nil {\n        log.Fatal(err)\n    }\n    defer port.Close()\n\n    // Do something with port\n    readBuffer := make([]byte, 128)\n    for {\n        _, err := port.Write([]byte(\"Hello\\n\"))\n        if err != nil {\n            log.Fatal(err)\n        }\n        n, err := port.Read(readBuffer)\n        if err != nil {\n            log.Fatal(err)\n        }\n        log.Printf(\"Read %d bytes: %q\\n\", n, string(readBuffer[:n]))\n        time.Sleep(time.Second)\n    }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoypat%2Fcereal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoypat%2Fcereal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoypat%2Fcereal/lists"}