Cyanobyte: An intermediate representation for hardware peripheral I/O

Cyanobyte logo
Learn More View Source

Automatically generate peripheral drivers without writing code!

Cyanobyte goals:

  • Open source
  • Standarized core specification
  • Support any embedded platforms
  • Easily extensible

TL,DR;

Cyanobyte is a specification that defines the types of hardware configurations and functions that a hardware peripheral can have.

With a standardized representation, a codegen tool can read the intermediate representation and convert it into an executable driver in the language and platform of your choice.

Open Spec

Think of it as a machine-readable datasheet. By placing not just registers, but logic into a static configration, you don’t need to worry about converting a temperature sensor into Celsius, or finding the exact register values to initialize your device. All the logic is handled for you.

This is an open spec, and we’re looking for more feedback.

Bright idea!

Just import the library and use an API. Now that’s a bright idea.

Contributions welcome!

We do a Pull Request contributions workflow on GitHub. New users are always welcome!

Read more …

Follow me on Twitter!

For announcement of latest features etc.

Read more …

How it works

Peripherals are defined in yaml files. We've chosen yaml for the ease of readability. These peripheral specification files provide metadata, along with list of registers, fields, and relevant computational operations.

Code generation tools can take these machine-readable files and interpret them in many ways. They can be used to generate source code, documentation, or other applications.

This project includes a series of platform template files based around Python and Jinja2. Different groups may decide to use a different templating engine, but should ensure it is compatible with the peripheral spec files.

Benefits

  • Datasheet errata can now be represented with a file diff
  • Reduce time in porting for embedded platforms
  • Continuous deployment systems can patch libraries straight from source

Current Status

At the moment Cyanobyte has support for I2C peripherals across many peripherals and embedded platforms. There is early support for other serialization protocols like SPI. As Cyanobyte provides code generation support, there is support for each peripheral on every platform.

Supported Peripherals

- ADS1015 A2D Converter
- BH1750FVI Light Sensor
- BMP180 Temperature Sensor
- BMP280 Temperature/Pressure Sensor
- LSM303D IMU
- MCP4725 D2A Converter
- MCP9808 Temperature Sensor
- TCS3472 Light Sensor

Embedded Platforms

- Arduino
- ESP32
- Espruino (Javascript)
- KubOS
- CircuitPython
- Micropython
- Pimoroni I2C Device
- Raspberry Pi
- Miscellaneous embedded C
- CMSIS
- LaTeX Datasheets
- Markdown documentation
- Instructional webpage

Next Goals

- Investigate other I2C peripherals like displays
- Investigate support for new programming languages
- Improve support for other serial peripherals like SPI

Help Wanted!

Do you want to volunteer to help make this project come to life? There are many technologies we need help with.
  • Several embedded platforms are written in C
  • Several embedded platforms are written in Python
  • Tests are written in Python
  • Documentation is written in Markdown
  • We're always exploring new avenues of exploration
Check out our issues list to see areas we may be exploring

Projects using Cyanobyte

File an issue or pull request to add your project to the list.