This repo contains a template for creating a new peripheral to use with Jumper Virtual Lab.
For more information, visit the docs.
- Ubuntu 16.04
- GCC and Make:
apt install build-essential
- Jumper Virtual Lab
or
- Jumper's Docker image, pull it with -
docker pull jumperio/jumper-vlab
-
Fork this repository on GitHub and clone the new repository onto your Linux machine.
-
Make sure you have the build prerequisites by running the following (either from Ubuntu 16.04 or Jumper's Docker image):
cd /PATH/TO/YOUR/NEW/REPO python create_peripheral.py
-
After entering your peripheral name and choosing your peripheral's serial interface type, you should see the following files in your local library:
- Makefile
- board.json
- YOUR_PERIPHERAL_NAME.cpp
- YOUR_PERIPHERAL_NAME.h
- YOUR_PERIPHERAL_NAME.so in the _build folder.
- You can find your peripheral component template in the board.json file with the following key fields:
- id - needs to be a unique number across all the peripherals in the board.json.
- type - no need to change this one.
- file - this tells the Virtual Lab where to find the shared object file for the peripheral. The default points to the YOUR_PERIPHERAL_NAME.so file in the _build folder.
- config: pins - this is where you can add pins. To add pins according to the peripheral's data sheet, just add pins to this list with the field name as the pin name and the value as the board's wire number.
{
"name": "YOUR_PERIPHERAL_NAME",
"id": 1,
"type": "Peripheral",
"file": "_build/YOUR_PERIPHERAL_NAME.so",
"config": {
"pins": {
}
}
}
-
Add the device logic to the Main() function in the YOUR_PERIPHERAL_NAME.cpp. You can also add more methods, members and global variables as needed.
-
When you want to run Jumper Virtual Lab with your peripheral:
- Run
make
- Copy the .so file from the "_build/" directory to your Jumper Virtual Lab working directory. (same one as the "board.json" file)
- Add the component to your "board.json" file.
- Run Jumper Virtual Lab, for more information head to the https://docs.jumper.io/
Licensed under the Apache License, Version 2.0. See the LICENSE file for more information