Library to automatically generate firmware, interface and documentation for harp devices
- Install Visual Studio Code
- Install YAML extension
- Install Git
- Clone this repository
- In VSCode, open the repository as your project (e.g.
Open Folder...
) - Target this repository as the schema source (
./device.json
) by adding the following line to the top of the file:
# yaml-language-server: $schema=./device.json
- Follow step 4 of the Using a remote schema section
- In VSCode, open the repository as your project (e.g.
Open Folder...
) - Create a new .yml file (e.g.
device.yml
). - Add the following line to the top of the file:
# yaml-language-server: $schema=https://harp-tech.org/draft-02/schema/device.json
You should now be able to access the fields of the schema by pressing Ctrl+Space
in the file.
- Start adding the fields of the schema to your file.
- Add
device
and fill in the respective fields; - Add
registers
, and start adding all the registers you need by filling in, at least, the obligatory fields.
- Add
- Download the Harp Viewer Extension VSIX file
- Open VSCode
- Click F1 and search for
Extensions: Install from VSIX...
- Once installed, you can run the extension by opening a valid
.yml
device file, and clickingDevice Preview
at the top right corner of the VSCode window.
- Install Bonsai in your system. You can find the instructions here.
- install DotNet >6 in your system. You can find the instructions here.
- Open a command-line and run
dotnet new --install Harp.Templates
to installHarp.Templates
package that contains the template. (Or install it from a local package:dotnet new --install ./local/path/to/Harp.Templates.nupkg
). - Confirm the package has been installed by running
dotnet new --list
. - To create a new project, run
dotnet new harpdevice -n <project-name>
. We strongly advise you to follow the conventionHarp.Device
for<project-name>
. - Open the project folder in VSCode. (
cd project-name
&code .
). - The project template should create a file with instructions (
README.md
) to generate the Bonsai interface and Device firmware. - Install the code generator:
dotnet tool install -g dotnet-t4
- Go into the folder
Generators
and rundotnet build
. - Confirm that a solution has been created inside
Firmware
andInterface
folders. Importantly, each time you runbuild
, it will override any automatically generated code currently present in the folders. - Simply replace the relevant
.yml
files necessary to generate the firmware and try to build the solution.