generated from electro-smith/DaisyBlinkProject
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from electro-smith/more-isolated-examples
Additional hardware-specific examples
- Loading branch information
Showing
10 changed files
with
407 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Project Name | ||
TARGET = PassthruAndBypass | ||
|
||
# Configure for debugging | ||
# common configurations: | ||
# use DEBUG = 1 and OPT = -Og for debugging | ||
# or DEBUG = 0 and OPT = -O3 for performance | ||
DEBUG = 0 | ||
OPT = -O3 | ||
|
||
# Sources | ||
CPP_SOURCES = main.cpp | ||
|
||
LIBDAISY_DIR = ../libs/libDaisy | ||
DAISYSP_DIR = ../libs/DaisySP | ||
|
||
# (optional) Includes FatFS source files within project. | ||
#USE_FATFS = 1 | ||
|
||
# Core location, and generic Makefile. | ||
SYSTEM_FILES_DIR = $(LIBDAISY_DIR)/core | ||
include $(SYSTEM_FILES_DIR)/Makefile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/** Daisy Seed2 DFM Pedal Dev Kit Basic Example | ||
* | ||
* This example does a few things that can serve as a great jumping off | ||
* point for new effects pedal projects. | ||
* | ||
* 1. Initializes Switch and GPIO for control of the true-bypass relays | ||
* 2. Initializes an LED to indicate bypass state (illuminate RED when audio runs through software) | ||
* 3. Sets up basic audio passthru | ||
*/ | ||
#include "daisy_seed.h" | ||
|
||
using namespace daisy; | ||
|
||
/** Global objects that need to be accessed in both main() and the audio callback */ | ||
DaisySeed hardware; | ||
|
||
/** The audio callback that fires whenever new audio samples can be prepared */ | ||
void AudioCallback(AudioHandle::InputBuffer in, | ||
AudioHandle::OutputBuffer out, | ||
size_t size) | ||
{ | ||
for (size_t i = 0; i < size; i++) | ||
{ | ||
/** For each sample in the loop we'll multiply the input by our volume control | ||
* OUT_x and IN_x are macros that access the out, and in buffers respectively. | ||
* This would be equivalent to: out[0][i] = in[0][i] * volume;, etc. | ||
*/ | ||
OUT_L[i] = IN_L[i]; | ||
OUT_R[i] = IN_R[i]; | ||
|
||
/** Due to minor errata on the Rev4 hardware we need to phase invert the | ||
* left channel so both outputs have the same phase */ | ||
OUT_L[i] *= -1.f; | ||
} | ||
} | ||
|
||
int main() | ||
{ | ||
|
||
/** Initialize the Daisy Seed at maximum clock speed */ | ||
hardware.Init(true); | ||
|
||
/** Relay Control/UI init */ | ||
GPIO relay_left, relay_right; | ||
Switch relay_control; | ||
Led relay_led; | ||
relay_left.Init(seed::D20, GPIO::Mode::OUTPUT); | ||
relay_right.Init(seed::D21, GPIO::Mode::OUTPUT); | ||
relay_control.Init(seed::D23, hardware.AudioCallbackRate()); | ||
relay_led.Init(seed::D11, true); | ||
|
||
/** Start the Audio */ | ||
hardware.StartAudio(AudioCallback); | ||
|
||
while (true) | ||
{ | ||
/** Debounce the toggle */ | ||
relay_control.Debounce(); | ||
|
||
/** Update the relay states based on the toggle position */ | ||
bool bypass_state = relay_control.Pressed(); | ||
relay_left.Write(bypass_state); | ||
relay_right.Write(bypass_state); | ||
|
||
/** Update the LED brightness based on true bypass state */ | ||
if (bypass_state) | ||
relay_led.Set(1); | ||
else | ||
relay_led.Set(0); | ||
/** Update the LED (required in case of software PWM for values between 0-1)*/ | ||
relay_led.Update(); | ||
|
||
/** We'll delay for one millisecond before looping back over to keep everything nice, and predictable | ||
* The hardware control work could be moved to the audio callback as well. | ||
*/ | ||
System::Delay(1); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Project Name | ||
TARGET = SimplePotReading | ||
|
||
# Configure for debugging | ||
# common configurations: | ||
# use DEBUG = 1 and OPT = -Og for debugging | ||
# or DEBUG = 0 and OPT = -O3 for performance | ||
DEBUG = 0 | ||
OPT = -O3 | ||
|
||
# Sources | ||
CPP_SOURCES = main.cpp | ||
|
||
LIBDAISY_DIR = ../libs/libDaisy | ||
DAISYSP_DIR = ../libs/DaisySP | ||
|
||
# (optional) Includes FatFS source files within project. | ||
#USE_FATFS = 1 | ||
|
||
# Core location, and generic Makefile. | ||
SYSTEM_FILES_DIR = $(LIBDAISY_DIR)/core | ||
include $(SYSTEM_FILES_DIR)/Makefile |
Oops, something went wrong.