Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Cleveland Music Co Hothouse #61

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 56 additions & 6 deletions src/DaisyDuino.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ void DaisyHardware::Init(float control_update_rate, DaisyDuinoDevice device) {
case DAISY_PATCH_SM:
InitPatchSM(control_update_rate);
break;
case CLEVELAND_HOTHOUSE:
InitHothouse(control_update_rate);
break;
default:
break;
}
Expand All @@ -46,8 +49,8 @@ void DaisyHardware::InitPod(float control_update_rate) {

controls[0].Init(PIN_POD_POT_1, control_update_rate);
controls[1].Init(PIN_POD_POT_2, control_update_rate);

numSwitches = numLeds = numControls = 2;

}

void DaisyHardware::InitPatch(float control_update_rate) {
Expand Down Expand Up @@ -171,6 +174,44 @@ void DaisyHardware::InitPatchSM(float control_update_rate) {
#endif
}

void DaisyHardware::InitHothouse(float control_update_rate) {
numSwitches = 8; // 3 up-mid-down switches (ie, 6 switches) plus 2 footswitches
numLeds = 2;
num_channels = 2;
numControls = 6; // 6 potentiometers

// init the led driver...no LED driver on hothouse
uint8_t addr[2] = {0x00, 0x01};
led_driver_.Init(addr, petal_led_dma_buffer_a, petal_led_dma_buffer_b);
ClearLeds();
UpdateLeds();

// init the potentiometers
controls[0].Init(PIN_HOTHOUSE_POT_1, control_update_rate);
controls[1].Init(PIN_HOTHOUSE_POT_2, control_update_rate);
controls[2].Init(PIN_HOTHOUSE_POT_3, control_update_rate);
controls[3].Init(PIN_HOTHOUSE_POT_4, control_update_rate);
controls[4].Init(PIN_HOTHOUSE_POT_5, control_update_rate);
controls[5].Init(PIN_HOTHOUSE_POT_6, control_update_rate);

// no expression input on Hothouse
//expression.Init(PIN_PETAL_EXPRESSION, control_update_rate);

// Init the buttons
buttons[0].Init(control_update_rate, true, PIN_HOTHOUSE_SWITCH_1, INPUT_PULLUP);
buttons[1].Init(control_update_rate, true, PIN_HOTHOUSE_SWITCH_2, INPUT_PULLUP);
buttons[2].Init(control_update_rate, true, PIN_HOTHOUSE_SWITCH_3, INPUT_PULLUP);
buttons[3].Init(control_update_rate, true, PIN_HOTHOUSE_SWITCH_4, INPUT_PULLUP);
buttons[4].Init(control_update_rate, true, PIN_HOTHOUSE_SWITCH_5, INPUT_PULLUP);
buttons[5].Init(control_update_rate, true, PIN_HOTHOUSE_SWITCH_6, INPUT_PULLUP);
buttons[6].Init(control_update_rate, true, PIN_HOTHOUSE_SWITCH_7, INPUT_PULLUP);
buttons[7].Init(control_update_rate, true, PIN_HOTHOUSE_SWITCH_8, INPUT_PULLUP);

// Init the LED pins
pinMode(PIN_HOTHOUSE_LED_1, OUTPUT);
pinMode(PIN_HOTHOUSE_LED_2, OUTPUT);
}

float DaisyHardware::GetKnobValue(uint8_t idx) {
uint8_t pots[8] = {0, 3, 1, 4, 2, 5, 6, 7};
digitalWrite(PIN_FIELD_MUX_SEL_0, pots[idx] & 1);
Expand Down Expand Up @@ -257,13 +298,18 @@ void DaisyHardware::SetRingLed(uint8_t idx, float r, float g, float b) {
}

void DaisyHardware::SetFootswitchLed(uint8_t idx, float bright) {
if (idx < 0 || idx > 3 || device_ != DAISY_PETAL) {
if (idx < 0 || idx > 3 || ((device_ != DAISY_PETAL) && (device_ != CLEVELAND_HOTHOUSE))) {
return;
}

uint8_t fs_addr[4] = {PETAL_LED_FS_1, PETAL_LED_FS_2, PETAL_LED_FS_3,
PETAL_LED_FS_4};
led_driver_.SetLed(fs_addr[idx], bright);
if (device_ == DAISY_PETAL) {
uint8_t fs_addr[4] = {PETAL_LED_FS_1, PETAL_LED_FS_2, PETAL_LED_FS_3,
PETAL_LED_FS_4};
led_driver_.SetLed(fs_addr[idx], bright);
} else {
if (idx == 0) digitalWrite(PIN_HOTHOUSE_LED_1, (int)(bright+0.5f)); //set HIGH or LOW
if (idx == 1) digitalWrite(PIN_HOTHOUSE_LED_2, (int)(bright+0.5f)); //set HIGH or LOW
}
}

// field led setters
Expand Down Expand Up @@ -304,7 +350,11 @@ void DaisyHardware::ClearLeds() {
SetKeyboardLed(1, i, 0.f);
SetKnobLed(i, 0.f);
}
}
} else if (device_ == CLEVELAND_HOTHOUSE) {
for (size_t i = 0; i < numLeds; i++) {
SetFootswitchLed(i, LOW);
}
}
}

void DaisyHardware::UpdateLeds() {
Expand Down
5 changes: 4 additions & 1 deletion src/DaisyDuino.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "daisy_petal.h"
#include "daisy_pod.h"
#include "daisy_patch_sm.h"
#include "cleveland_hothouse.h"
#include "PersistentStorage.h"

#include "utility/ctrl.h"
Expand All @@ -37,6 +38,7 @@ enum DaisyDuinoDevice : short {
DAISY_FIELD,
DAISY_PATCH,
DAISY_PATCH_SM,
CLEVELAND_HOTHOUSE,
DAISY_LAST,
};

Expand All @@ -46,7 +48,7 @@ class DaisyHardware {
public:
DaisyHardware() {}

Switch buttons[7];
Switch buttons[8]; //increase to 8 for Cleveland Music Co Hothouse
AnalogControl controls[12];
AnalogControl cv[4]; // for use with field

Expand Down Expand Up @@ -132,6 +134,7 @@ class DaisyHardware {
void InitPetal(float control_update_rate);
void InitField(float control_update_rate);
void InitPatchSM(float control_update_rate);
void InitHothouse(float control_update_rate);

DaisyDuinoDevice device_;

Expand Down
39 changes: 39 additions & 0 deletions src/cleveland_hothouse.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

//Pins for the "Hothouse" pedal from the Cleveland Music Co.
//https://clevelandmusicco.com/hothouse-diy-digital-signal-processing-platform-kit/
//This has a Daisy Seed at its heart and adds:
// * 6 potentiometers
// * 3 toggle switches up-middle-down (on-off-on)
// * 2 momentary footswitches
// * 2 LEDs, one over each footswtich

#define PIN_HOTHOUSE_FSW_1 25
#define PIN_HOTHOUSE_FSW_2 26
#define PIN_HOTHOUSE_SW_1_UP 9
#define PIN_HOTHOUSE_SW_1_DOWN 10
#define PIN_HOTHOUSE_SW_2_UP 7
#define PIN_HOTHOUSE_SW_2_DOWN 8
#define PIN_HOTHOUSE_SW_3_UP 5
#define PIN_HOTHOUSE_SW_3_DOWN 6

#define PIN_HOTHOUSE_SWITCH_1 PIN_HOTHOUSE_FSW_1
#define PIN_HOTHOUSE_SWITCH_2 PIN_HOTHOUSE_FSW_2
#define PIN_HOTHOUSE_SWITCH_3 PIN_HOTHOUSE_SW_1_UP
#define PIN_HOTHOUSE_SWITCH_4 PIN_HOTHOUSE_SW_1_DOWN
#define PIN_HOTHOUSE_SWITCH_5 PIN_HOTHOUSE_SW_2_UP
#define PIN_HOTHOUSE_SWITCH_6 PIN_HOTHOUSE_SW_2_DOWN
#define PIN_HOTHOUSE_SWITCH_7 PIN_HOTHOUSE_SW_3_UP
#define PIN_HOTHOUSE_SWITCH_8 PIN_HOTHOUSE_SW_3_DOWN

#define PIN_HOTHOUSE_POT_1 A1
#define PIN_HOTHOUSE_POT_2 A2
#define PIN_HOTHOUSE_POT_3 A3
#define PIN_HOTHOUSE_POT_4 A4
#define PIN_HOTHOUSE_POT_5 A5
#define PIN_HOTHOUSE_POT_6 A6

#define PIN_HOTHOUSE_LED_1 22
#define PIN_HOTHOUSE_LED_2 23