Bakelite
Documentation | Protocol Spec | Arduino Example
Bakelite is a utility that makes it simple to communicate with your firmware. Bakelite uses a code generator to automate the tedious process of hand-building your own protocol. It includes features like framing, error detection, and a lightweight C++ implementation suitable for small microcontrollers.
Features
- Compact, easy to understand data serialization format
- Simple message passing
- Built in framing and error detection
- Easy to integrate with Serial, USB, TCP, I2C, etc...
- Use only the parts you need
- Code generators for:
- C++ (header only, no STL or memory allocation)
- Python
A more formal overview of the protocol can be found here, and examples can be found here.
Status
This project is in early development. The C++ implementation is currently WIP. The API and data format are not stable, and will change without notice.
How Does it Work?
You 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.
Here's an example:
struct TestMessage {
message: string[128]
}
struct Ack {
code: uint8
}
protocol {
maxLength = 256
framing = COBS
crc = CRC8
messageIds {
TestMessage = 1
Ack = 2
}
}
Now that you've created the definition file, we can generate some code:
bakelite gen -l python -i my_proto.bakelite -o my_proto.py
And then use it to send a message over a serial port:
from proto import Protocol, TestMessage, Ack
import serial
# Open a serial port and send an Ack message
with serial.Serial(':COM1', 9600) as port:
proto = Protocol(stream=port)
proto.send(Ack(code=123))
Message serialization, framing, and error detection are all taken care of. If you need something more customized, you can use any of the components independently. Drop-in your own CRC algorithm, use the framer with your own message format, or just use the serializer on its own.
For a more complete example, have a look at the Python/Arduino Example.
Metadata
Release files for bakelite 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bakelite-0.3.0.tar.gz | 92.0 kB | Without provenance | Details for bakelite-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bakelite-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for bakelite-0.3.0-py3-none-any.whl |
Total release size: 191.8 kB
Release files / bakelite-0.3.0.tar.gz
| Download URL | bakelite-0.3.0.tar.gz |
|---|---|
| Size | 92.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ca3905d718939e6f8164045702d8f23ea748218d627c9befbafc741bfb302dc4
|
|
BLAKE2b-256 checksum How to use checksums |
70d5bf0869bb568d9dc0ec259a5ae5c659dfe7f706efd5cb974c91922151843b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.1 CPython/3.9.12 Darwin/21.1.0
|
Release files / bakelite-0.3.0-py3-none-any.whl
| Download URL | bakelite-0.3.0-py3-none-any.whl |
|---|---|
| Size | 99.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
445e647cc1d436d7e8995f12a65fe326ecf89b1b8c0cb38e0f4b252ad95d8a6e
|
|
BLAKE2b-256 checksum How to use checksums |
333378d217c2951fc41bb410fe51164e9a85bd87334941d93bad27b31a7155aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.1 CPython/3.9.12 Darwin/21.1.0
|
Security for bakelite 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.