Hey! I’m currently working on moving a project to the patch submodule. I’m currently unable to read floats from a mux attached to the ADC on my desired pin.
I can see all of the pot values on my oscilloscope on pin C9, as well as the select lines all firing correctly. However, I am reading ~0.5 on all mux pins. I will attach the code and terminal output below.
Am I missing something in the initialization of C9? Thanks in advance <3
#include "daisy_patch_sm.h"
#include "daisysp.h"
using namespace daisy;
using namespace patch_sm;
using namespace daisysp;
DaisyPatchSM hw;
void AudioCallback(AudioHandle::InputBuffer in, AudioHandle::OutputBuffer out, size_t size)
{
for (size_t i = 0; i < size; i++)
{
OUT_L[i] = IN_L[i];
OUT_R[i] = IN_R[i];
}
}
int main(void)
{
hw.Init();
hw.StartLog();
System::Delay(100);
hw.adc.Stop();
AdcChannelConfig adc[1];
adc[0].InitMux(
DaisyPatchSM::C9,
8,
DaisyPatchSM::D5,
DaisyPatchSM::D4,
DaisyPatchSM::D3
);
hw.adc.Init(adc, 1);
hw.adc.Start();
hw.SetAudioBlockSize(4); // number of samples handled per callback
hw.SetAudioSampleRate(SaiHandle::Config::SampleRate::SAI_48KHZ);
hw.StartAudio(AudioCallback);
while (1)
{
System::Delay(200);
for(int i = 0; i < 8; i++) {
hw.Print("%f\t", hw.adc.GetMuxFloat(0, i));
}
hw.PrintLine("");
}
}
I’ve also added the following to my makefile:
LDFLAGS += -u _printf_float