Skip to content

Commit

Permalink
lichen-community-systemsgh-22: Updates Lichen Medium device to ADCCon…
Browse files Browse the repository at this point in the history
…troller API.
  • Loading branch information
colinbdclark committed Jun 29, 2024
1 parent ee219cd commit da32804
Showing 1 changed file with 17 additions and 42 deletions.
59 changes: 17 additions & 42 deletions hosts/daisy/include/lichen-medium-device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,45 +44,20 @@ namespace medium {

// These pins are ordered based on the panel:
// knobs first in labelled order, then CV jacks in labelled order.
/*
static ADCChannelSpec ADC_CHANNEL_SPECS[NUM_ADC_CHANNELS] = {
// Freq Knob/POT_2_CV_7/Pin C8 - Unipolar
{patchsm::PIN_CV_7, UNI_TO_BIPOLAR},
// Reso Knob/CV_IN_5/Pin C6
{patchsm::PIN_CV_5, UNI_TO_BIPOLAR},
// Gain Knob/POT_1_CV_6/Pin C7
{patchsm::PIN_CV_6, UNI_TO_BIPOLAR},
// Knob four/POT_4_CV_9/Pin A2
{patchsm::PIN_ADC_9, NO_NORMALIZATION},
// Knob five/POT_5_CV_10/Pin A3
{patchsm::PIN_ADC_10, NO_NORMALIZATION},
// Shape CV/CV_IN_1/Pin C5
{patchsm::PIN_CV_1, NO_NORMALIZATION},
// Frequency CV/CV_IN_2/Pin C4
{patchsm::PIN_CV_2, NO_NORMALIZATION},
// Reso CV/CV_IN_3/Pin C3
{patchsm::PIN_CV_3, NO_NORMALIZATION},
// Gain CV/CV_IN_4/Pin C2
{patchsm::PIN_CV_4, NO_NORMALIZATION},
// Skew CV/POT_3_CV_8/Pin C9
{patchsm::PIN_CV_5, NO_NORMALIZATION}
};
*/
static dsy_gpio_pin ADC_PINS[NUM_ADC_CHANNELS] = {
patchsm::PIN_CV_5, // Knob one/POT_CV_1/Pin C8
patchsm::PIN_CV_6, // Knob two/POT_CV_2/Pin C9
patchsm::PIN_ADC_9, // Knob three/POT_CV_3/Pin A2
patchsm::PIN_ADC_11, // Knob four/POT_CV_4/Pin A3
patchsm::PIN_ADC_10, // Knob five/POT_CV_5/Pin D9
patchsm::PIN_ADC_12, // Knob six/POT_CV_6/Pin D8

patchsm::PIN_CV_1, // CV1 ("seven")/CV_IN_1/Pin C5
patchsm::PIN_CV_2, // CV2 ("eight")/CV_IN_2Pin C4
patchsm::PIN_CV_3, // CV3 ("nine")/CV_IN_3/Pin C3
patchsm::PIN_CV_7, // CV6 ("ten")/CV_IN_6/Pin C7
patchsm::PIN_CV_8, // CV5 ("eleven")/CV_IN_5/Pin C6
patchsm::PIN_CV_4 // CV4 ("twelve")/CV_IN_4/Pin C2
{patchsm::PIN_CV_5, INVERT}, // Knob one/POT_CV_1/Pin C8
{patchsm::PIN_CV_6, INVERT}, // Knob two/POT_CV_2/Pin C9
{patchsm::PIN_ADC_9, BI_TO_UNIPOLAR}, // Knob three/POT_CV_3/Pin A2
{patchsm::PIN_ADC_11, BI_TO_UNIPOLAR}, // Knob four/POT_CV_4/Pin A3
{patchsm::PIN_ADC_10, BI_TO_UNIPOLAR}, // Knob five/POT_CV_5/Pin D9
{patchsm::PIN_ADC_12, BI_TO_UNIPOLAR}, // Knob six/POT_CV_6/Pin D8

{patchsm::PIN_CV_1, INVERT}, // CV1 ("seven")/CV_IN_1/Pin C5
{patchsm::PIN_CV_2, INVERT}, // CV2 ("eight")/CV_IN_2Pin C4
{patchsm::PIN_CV_3, INVERT}, // CV3 ("nine")/CV_IN_3/Pin C3
{patchsm::PIN_CV_7, INVERT}, // CV6 ("ten")/CV_IN_6/Pin C7
{patchsm::PIN_CV_8, INVERT}, // CV5 ("eleven")/CV_IN_5/Pin C6
{patchsm::PIN_CV_4, INVERT} // CV4 ("twelve")/CV_IN_4/Pin C2
};

static const size_t NUM_GATES = 1;
Expand All @@ -109,15 +84,15 @@ namespace medium {
class MediumDevice {
public:
patchsm::PatchSMBoard board;
ADCController<InvertedAnalogInput, NUM_ADC_CHANNELS> adcController;
ADCController<AnalogInput, NUM_ADC_CHANNELS> adcController;
GateInput gates[NUM_GATES];
InputBank<GateInput, NUM_GATES> gateBank;
TriSwitch triSwitches[NUM_TRISWITCHES];
InputBank<TriSwitch, NUM_TRISWITCHES> switchBank;
Toggle buttons[NUM_BUTTONS];
InputBank<Toggle, NUM_BUTTONS> buttonBank;
AnalogOutput dacChannels[NUM_DAC_CHANNELS];
OutputBank<AnalogOutput, NUM_DAC_CHANNELS> dacOutputBank;
DMAAnalogOutput dacChannels[NUM_DAC_CHANNELS];
OutputBank<DMAAnalogOutput, NUM_DAC_CHANNELS> dacOutputBank;
struct sig_host_HardwareInterface hardware;

static void onEvaluateSignals(size_t size,
Expand Down Expand Up @@ -165,7 +140,7 @@ namespace medium {
}

void InitADCController() {
adcController.Init(&board.adc, ADC_PINS);
adcController.Init(&board.adc, ADC_CHANNEL_SPECS);
}

void InitDAC() {
Expand Down

0 comments on commit da32804

Please sign in to comment.