{"id":24917995,"url":"https://github.com/brendan0powers/bakelite","last_synced_at":"2025-04-09T16:23:17.483Z","repository":{"id":45112864,"uuid":"294167075","full_name":"brendan0powers/bakelite","owner":"brendan0powers","description":"Bakelite is a utility that makes it simple to communicate with your firmware.","archived":false,"fork":false,"pushed_at":"2024-06-12T02:13:56.000Z","size":379,"stargazers_count":19,"open_issues_count":3,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-23T18:39:05.958Z","etag":null,"topics":["cpp","embedded-systems","firmware","format","protocol","python","serialization"],"latest_commit_sha":null,"homepage":"https://bakelite.readthedocs.io/en/latest/","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/brendan0powers.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-09T16:21:23.000Z","updated_at":"2024-01-21T18:18:42.000Z","dependencies_parsed_at":"2022-09-02T22:40:34.697Z","dependency_job_id":null,"html_url":"https://github.com/brendan0powers/bakelite","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brendan0powers%2Fbakelite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brendan0powers%2Fbakelite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brendan0powers%2Fbakelite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brendan0powers%2Fbakelite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brendan0powers","download_url":"https://codeload.github.com/brendan0powers/bakelite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247866115,"owners_count":21009238,"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":["cpp","embedded-systems","firmware","format","protocol","python","serialization"],"created_at":"2025-02-02T09:17:16.896Z","updated_at":"2025-04-09T16:23:17.460Z","avatar_url":"https://github.com/brendan0powers.png","language":"C++","readme":"# Bakelite\n\n[![Tests](https://github.com/brendan0powers/bakelite/actions/workflows/test.yaml/badge.svg)](https://github.com/brendan0powers/bakelite/actions/workflows/test.yaml)\n[![Lint](https://github.com/brendan0powers/bakelite/actions/workflows/lint.yaml/badge.svg)](https://github.com/brendan0powers/bakelite/actions/workflows/lint.yaml)\n[![Documentation Status](https://readthedocs.org/projects/bakelite/badge/?version=latest)](https://bakelite.readthedocs.io/en/latest/?badge=latest)\n\n\n[Documentation](https://bakelite.readthedocs.io/en/latest/) | \n[Protocol Spec](https://bakelite.readthedocs.io/en/latest/protocol/) |\n[Arduino Example](https://github.com/brendan0powers/bakelite/tree/master/examples/arduino)\n\n\u003chr/\u003e\n\nBakelite is a utility that makes it simple to communicate with your firmware.\nBakelite uses a code generator to automate the tedious process of hand-building your own protocol.\nIt includes features like framing, error detection, and a lightweight C++ implementation suitable for small microcontrollers.\n\n\n\n## Features\n* Compact, easy to understand data serialization format\n* Simple message passing\n* Built in framing and error detection\n* Easy to integrate with Serial, USB, TCP, I2C, etc...\n* Use only the parts you need\n* Code generators for:\n    * C++ (header only, no STL or memory allocation)\n    * Python\n\nA more formal overview of the protocol can be found\n[here](./docs/protocol.md), and examples can be found [here](./examples).\n\n## Status\nThis project is in early development. The C++ implementation is currently WIP.\nThe API and data format are not stable, and will change without notice.\n\n## How Does it Work?\n![Overview](docs/img/overview.svg)\nYou start by creating a protocol definition file that describes the messages and fields you'd like to send. It also includes information about the protocol itself, like what kind of framing to use and the maximum message length.\n\nHere's an example:\n```proto\nstruct TestMessage {\n  message: string[128]\n}\n\nstruct Ack {\n  code: uint8\n}\n\nprotocol {\n  maxLength = 256\n  framing = COBS\n  crc = CRC8\n\n  messageIds {\n    TestMessage = 1\n    Ack = 2\n  }\n}\n```\n\nNow that you've created the definition file, we can generate some code:\n```bash\nbakelite gen -l python -i my_proto.bakelite -o my_proto.py\n```\n\nAnd then use it to send a message over a serial port:\n```python3\nfrom proto import Protocol, TestMessage, Ack\nimport serial\n\n# Open a serial port and send an Ack message\nwith serial.Serial(':COM1', 9600) as port:\n  proto = Protocol(stream=port)\n  proto.send(Ack(code=123))\n```\n\nMessage serialization, framing, and error detection are all taken care of.\nIf you need something more customized, you can use any of the components independently.\nDrop-in your own CRC algorithm, use the framer with your own message format, or just use the serializer on its own.\n\nFor a more complete example, have a look at the [Python/Arduino Example](./examples/arduino).","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrendan0powers%2Fbakelite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrendan0powers%2Fbakelite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrendan0powers%2Fbakelite/lists"}