Skip to main content

Peripheral Codegen

This project is an example of how to describe peripherals with an intermediary layer (YAML files) which can be used to generate library files for a peripheral.

It can also generate reference documentation for a peripheral, useful for embedding into datasheets.

The tool works well for I2C devices, while SPI support is in alpha.

This is not an official Google product.

Setup

Note: This project requires Python3. You can install using pip

pip install cyanobyte

Run Codegen

cyanobyte-codegen -t templates/doc.md -o ./build peripherals/MCP4725.yaml

Options

  • -t - A template file. You can provide multiple template files.
  • -o - The output directory where files will be generated.
  • -e - The directory that emboss folder is stored.
  • -d - Debug flag to print out additional information.
  • -c - Clean the output directory before generating files.

One or multiple files can be passed as an argument.

Clean

rm -rf ./build

Run Validator

cyanobyte-validator peripherals/MCP9808.yaml

One or multiple files can be passed as an argument.

Peripheral YAML file

The current spec is described in docs/cyanobyte.md. You can find all examples in the peripherals/ directory.

Test

Lint

python3 -m pylint --rcfile=test/pylintrc cyanobyte/*.py
python3 -m pylint --rcfile=test/pylintrc test/sampleData/*.py

Unit test

python3 -m unittest test.test_codegen

Templates

The templates directory includes a set of canonical templates which can be used with this codegen tool.

The peripherals directory includes a set of peripheral description files that have been created along with the project. It is not an exhaustive list.

Development setup

pip install -r requirements.txt --user

For more advanced development, also install the dev list. pip install -r requirements-dev.txt --user

Contributors

Contributions are welcome! See CONTRIBUTING.md for more information.

When a pull request is submitted, a continuous integration task is run. The CI task must be completed successfully before a patch is merged. You can see the specific rules run in cloudbuild.yaml.

License

See LICENSE

Metadata

Release files for cyanobyte 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cyanobyte 0.0.2
File Size Uploaded
cyanobyte-0.0.2.tar.gz 1.9 MB Details

Release files / cyanobyte-0.0.2.tar.gz

Download URL cyanobyte-0.0.2.tar.gz
Size 1.9 MB
Tags Source
SHA-256 checksum
How to use checksums
d6c698aca4796fe5f13723a615e2bbe33d980a45cd61894093f47791dd40d2d3
BLAKE2b-256 checksum
How to use checksums
6fd3fd2e622b2a7309d4b6ef7c126f17d22fbe2fbf313a9359c75a09e688a0a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1

Release history Release notifications | RSS feed

This release

0.0.2 This release

1 release file

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page