├── .gitignore ├── .gitmodules ├── your_pedal ├── Makefile ├── README.md └── your_pedal.cpp ├── .github └── workflows │ └── cpp.yml ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | *.bin 3 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "libDaisy"] 2 | path = libDaisy 3 | url = https://github.com/electro-smith/libDaisy 4 | [submodule "DaisySP"] 5 | path = DaisySP 6 | url = https://github.com/electro-smith/DaisySP 7 | [submodule "Terrarium"] 8 | path = Terrarium 9 | url = https://github.com/PedalPCB/Terrarium 10 | -------------------------------------------------------------------------------- /your_pedal/Makefile: -------------------------------------------------------------------------------- 1 | # Project Name 2 | TARGET = your_pedal 3 | 4 | # Sources 5 | CPP_SOURCES = your_pedal.cpp 6 | 7 | # Library Locations 8 | LIBDAISY_DIR = ../libDaisy 9 | DAISYSP_DIR = ../DaisySP 10 | 11 | # Core location, and generic Makefile. 12 | SYSTEM_FILES_DIR = $(LIBDAISY_DIR)/core 13 | include $(SYSTEM_FILES_DIR)/Makefile 14 | 15 | # Include terrarium.h 16 | C_INCLUDES += -I../Terrarium 17 | 18 | -------------------------------------------------------------------------------- /your_pedal/README.md: -------------------------------------------------------------------------------- 1 | # Your Pedal 2 | 3 | ## Author 4 | 5 | Your name goes here. 6 | 7 | ## Description 8 | 9 | A description for your pedal for the [terrarium](https://www.pedalpcb.com/product/pcb351/) from [PedalPCB](https://www.pedalpcb.com). 10 | 11 | ## Controls 12 | 13 | | Control | Parameter | Comment | 14 | | --- | --- | --- | 15 | | Knob 1 | Volume | Overall Volume of the pedal | 16 | | Knob 2 | Function | Function for knob 2 | 17 | | Knob 3 | Function | Function for knob 3 | 18 | | Switch 1 | Bypass | Puts the pedal in bypass mode | 19 | -------------------------------------------------------------------------------- /.github/workflows/cpp.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | build: 11 | 12 | runs-on: ubuntu-latest 13 | env: 14 | PEDAL_NAME: your_pedal 15 | 16 | steps: 17 | - name: Checkout repository 18 | uses: actions/checkout@v2 19 | with: 20 | submodules: 'recursive' 21 | 22 | - name: Install arm-none-eabi-gcc toolchain 23 | uses: fiam/arm-none-eabi-gcc@v1 24 | with: 25 | release: '9-2019-q4' 26 | 27 | - name: Build Daisy libraries 28 | run: | 29 | make -C libDaisy 30 | make -C DaisySP 31 | 32 | - name: Build binary for pedal 33 | run: | 34 | make -C $PEDAL_NAME 35 | 36 | - name: Upload binary for terrarium 37 | uses: actions/upload-artifact@v2.2.1 38 | with: 39 | name: Binary for terrarium 40 | # A file, directory or wildcard pattern that describes what to upload 41 | path: ${{ env.PEDAL_NAME }}/build/${{ env.PEDAL_NAME }}.bin 42 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Felix Wiegand 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # terrarium-stand 2 | This repository works as a template for new pedals created for the [terrarium](https://www.pedalpcb.com/product/pcb351/) from [PedalPCB](https://www.pedalpcb.com). 3 | To create a new pedal, simply create a new git repository using this template and start out with the basic structure in the `your_pedal` directory. Change the name of the directory to whatever you like but make sure you also change `TARGET = your_pedal` in `your_pedal/Makefile`. If you want use the workflow file for GitHub Actions, make sure to also update the `PEDAL_NAME` variable in the workflow file. If you don't want to use GitHub Action you can simply delete the workflow file. 4 | 5 | ## Getting started 6 | Build the daisy libraries with: 7 | ``` 8 | make -C DaisySP 9 | make -C libDaisy 10 | ``` 11 | 12 | Then flash your terrarium with: 13 | ``` 14 | cd your_pedal 15 | # using USB (after entering bootloader mode) 16 | make program-dfu 17 | # using JTAG/SWD adaptor (like STLink) 18 | make program 19 | ``` 20 | 21 | Note: The template pedal only turns the LED of the terrarium on and off and does no audio processing at all. 22 | For an example with audio processing generated from this template you can checkout a [reverb](https://github.com/fxwiegand/terrarium-reverb). 23 | -------------------------------------------------------------------------------- /your_pedal/your_pedal.cpp: -------------------------------------------------------------------------------- 1 | #include "daisy_petal.h" 2 | #include "daisysp.h" 3 | #include "terrarium.h" 4 | 5 | using namespace daisy; 6 | using namespace daisysp; 7 | using namespace terrarium; 8 | 9 | // Declare a global daisy_petal for hardware access 10 | DaisyPetal hw; 11 | 12 | bool bypass, switch1; 13 | Led led1, led2; 14 | Parameter knob1; 15 | // ReverbSc verb; 16 | 17 | /* 18 | * Process terrarium knobs and switches 19 | */ 20 | void processTerrariumControls() { 21 | // update switch values 22 | // https://electro-smith.github.io/libDaisy/classdaisy_1_1_switch.html 23 | if(hw.switches[Terrarium::FOOTSWITCH_1].RisingEdge()) { 24 | bypass = !bypass; 25 | } 26 | 27 | switch1 = hw.switches[Terrarium::SWITCH_1].Pressed(); 28 | 29 | // update knob values 30 | // https://electro-smith.github.io/libDaisy/classdaisy_1_1_analog_control.html 31 | knob1.Process(); 32 | 33 | led1.Set(bypass ? 0.0f : 1.0f); 34 | } 35 | 36 | /* 37 | * This runs at a fixed rate, to prepare audio samples 38 | */ 39 | void callback( 40 | AudioHandle::InterleavingInputBuffer in, 41 | AudioHandle::InterleavingOutputBuffer out, 42 | size_t size 43 | ) 44 | { 45 | hw.ProcessAllControls(); 46 | processTerrariumControls(); 47 | led1.Update(); 48 | led2.Update(); 49 | 50 | for(size_t i = 0; i < size; i += 2) 51 | { 52 | // Process your signal here 53 | if(bypass) 54 | { 55 | out[i] = in[i]; 56 | } 57 | else 58 | { 59 | // processed signal 60 | // Using knob1 as volume here 61 | out[i] = in[i] * knob1.Value(); 62 | } 63 | } 64 | } 65 | 66 | int main(void) 67 | { 68 | // float samplerate; 69 | 70 | hw.Init(); 71 | // samplerate = hw.AudioSampleRate(); 72 | 73 | led1.Init(hw.seed.GetPin(Terrarium::LED_1), false); 74 | led2.Init(hw.seed.GetPin(Terrarium::LED_2), false); 75 | 76 | // Initialize your knobs here like so: 77 | // https://electro-smith.github.io/libDaisy/classdaisy_1_1_parameter.html 78 | knob1.Init(hw.knob[Terrarium::KNOB_1], 0.0f, 0.999f, Parameter::LINEAR); 79 | 80 | // Set samplerate for your processing like so: 81 | // verb.Init(samplerate); 82 | 83 | bypass = true; 84 | 85 | hw.StartAdc(); 86 | hw.StartAudio(callback); 87 | 88 | while(1) 89 | { 90 | // Do lower priority stuff infinitely here 91 | System::Delay(10); 92 | } 93 | } 94 | --------------------------------------------------------------------------------