New Peripheral Guide

Adding a new peripheral is a great way to contribute. The steps below will guide you through the process. For more information on community contributions, see the contributions guide.

Before You Begin

To get set up, first create a new issue for the peripheral you want to add. Include the name, a short description, and a link to the datasheet. To avoidi duplicates, check if there are any open issues with the same peripheral before creating a new issue. With this done, fork the repo and begin working on your addition. Be sure to keep your branch up to date with the main branch of the repository.

Registers

The first step is to add your peripheral to the main registers spreadsheet. Add a new page to the spreadsheet with the name of your peripheral and fill in the information for its internal registers. For more information, see the register index guide.

Interfaces

Add a class for your peripheral to the peripherals subpackage in a new module. If your peripheral uses an I2C or SPI interface, you may consider extending the I2CController, SPIController, or SPIFifoDriven class. Your class should include a create_chips() method for creating several instances of the new peripheral at once. Write and read commands are commonly useful methods that, if applicable, should be included, but remaining functionality will likely be specific to your peripheral. Add what will be useful.

Sandbox/Test File

Once your peripheral is functional, create an example script or test file to show its use. Any test files should be written using pytest.

Documentation

The last requirement of your addition is documentation. Please add class and method docstrings to your code in numpy format. See the DAC80508 class for an example. Please also add a docstring to your exampe/test file explaining what it does.

Pull Request

With the above steps complete, create a pull request, linking the issue you created, for your peripheral. Be sure to watch your pull request for any comments on questions or additions that may be needed.