Skip to main content

Bakelite is a utility that automates the tedious tasks involved in communicating with hardware. You define your protocol defenition, and Bakelite will generate source code for you. Common tasks such as framing and error detection are handled out of the box.

Project description

Bakelite

Bakelite is a utility that automates the tedious tasks involved in communicating with hardware. You define your protocol defenition, and Bakelite will generate source code for you. Common tasks such as framing and error detection are handled out of the box.

Features

  • Supported languages:
    • C++
    • Python
  • Protocol supports:
    • Enums, Structs, strings, binary data, integers and floating point numbers of varying widths.
    • Variable length strings and binary data.
  • Framing (COBS)
  • Error checking (CRC 8/16/32)

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.

Usage

Installation

Bakelite requires Python 3.8 or above.

Install it via pip.

$ pip install bakelite

Code Generation

After installation, a new CLI tool bakelite is now available.

Craete a protocol defenition file my_proto.bakelite.

struct TestMessage {
  message: string[128]
}

struct Ack {
  code: uint8
}

protocol {
  maxLength = 256
  framing = COBS
  crc = CRC8

  messageIds {
    TestMessage = 1
    Ack = 2
  }
}

Then generate bindings for the languages you use.

# Generate C++ Bindings
$ bakelite runtime -l cpptiny -o bakelite.h
$ bakelite gen -l cpptiny -i my_proto.bakelite -o my_proto.h

# Generate Python Bindings
$ bakelite gen -l python -i my_proto.bakelite -o my_proto.py

A more full features example can be found here.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bakelite-0.1.tar.gz (80.2 kB view hashes)

Uploaded Source

Built Distribution

bakelite-0.1-py3-none-any.whl (86.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page