Skip to content

Class daisy::patch_sm::DaisyPatchSM

ClassList > daisy > patch_sm > DaisyPatchSM

Board support file for DaisyPatchSM hardware.More...

  • #include <daisy_patch_sm.h>

Public Types

Type Name
enum PinBank

Public Attributes

Type Name
AdcHandle adc
AudioHandle audio
Pcm3060 codec
AnalogControl controls
DacHandle dac
GateIn gate_in_1
GateIn gate_in_2
GPIO gate_out_1
GPIO gate_out_2
QSPIHandle qspi
SdramHandle sdram
System system
UsbHandle usb
GPIO user_led

Public Static Attributes

Type Name
constexpr Pin A1 = [**Pin**](structdaisy_1_1Pin.md)(PORTX, 0)
constexpr Pin A10 = [**Pin**](structdaisy_1_1Pin.md)(PORTX, 0)
constexpr Pin A2 = [**Pin**](structdaisy_1_1Pin.md)(PORTA, 1)
constexpr Pin A3 = [**Pin**](structdaisy_1_1Pin.md)(PORTA, 0)
constexpr Pin A4 = [**Pin**](structdaisy_1_1Pin.md)(PORTX, 0)
constexpr Pin A5 = [**Pin**](structdaisy_1_1Pin.md)(PORTX, 0)
constexpr Pin A6 = [**Pin**](structdaisy_1_1Pin.md)(PORTX, 0)
constexpr Pin A7 = [**Pin**](structdaisy_1_1Pin.md)(PORTX, 0)
constexpr Pin A8 = [**Pin**](structdaisy_1_1Pin.md)(PORTB, 14)
constexpr Pin A9 = [**Pin**](structdaisy_1_1Pin.md)(PORTB, 15)
constexpr Pin B1 = [**Pin**](structdaisy_1_1Pin.md)(PORTX, 0)
constexpr Pin B10 = [**Pin**](structdaisy_1_1Pin.md)(PORTG, 13)
constexpr Pin B2 = [**Pin**](structdaisy_1_1Pin.md)(PORTX, 0)
constexpr Pin B3 = [**Pin**](structdaisy_1_1Pin.md)(PORTX, 0)
constexpr Pin B4 = [**Pin**](structdaisy_1_1Pin.md)(PORTX, 0)
constexpr Pin B5 = [**Pin**](structdaisy_1_1Pin.md)(PORTC, 14)
constexpr Pin B6 = [**Pin**](structdaisy_1_1Pin.md)(PORTC, 13)
constexpr Pin B7 = [**Pin**](structdaisy_1_1Pin.md)(PORTB, 8)
constexpr Pin B8 = [**Pin**](structdaisy_1_1Pin.md)(PORTB, 9)
constexpr Pin B9 = [**Pin**](structdaisy_1_1Pin.md)(PORTG, 14)
constexpr Pin C1 = [**Pin**](structdaisy_1_1Pin.md)(PORTA, 5)
constexpr Pin C10 = [**Pin**](structdaisy_1_1Pin.md)(PORTA, 4)
constexpr Pin C2 = [**Pin**](structdaisy_1_1Pin.md)(PORTA, 7)
constexpr Pin C3 = [**Pin**](structdaisy_1_1Pin.md)(PORTA, 2)
constexpr Pin C4 = [**Pin**](structdaisy_1_1Pin.md)(PORTA, 6)
constexpr Pin C5 = [**Pin**](structdaisy_1_1Pin.md)(PORTA, 3)
constexpr Pin C6 = [**Pin**](structdaisy_1_1Pin.md)(PORTB, 1)
constexpr Pin C7 = [**Pin**](structdaisy_1_1Pin.md)(PORTC, 4)
constexpr Pin C8 = [**Pin**](structdaisy_1_1Pin.md)(PORTC, 0)
constexpr Pin C9 = [**Pin**](structdaisy_1_1Pin.md)(PORTC, 1)
constexpr Pin D1 = [**Pin**](structdaisy_1_1Pin.md)(PORTB, 4)
constexpr Pin D10 = [**Pin**](structdaisy_1_1Pin.md)(PORTD, 3)
constexpr Pin D2 = [**Pin**](structdaisy_1_1Pin.md)(PORTC, 11)
constexpr Pin D3 = [**Pin**](structdaisy_1_1Pin.md)(PORTC, 10)
constexpr Pin D4 = [**Pin**](structdaisy_1_1Pin.md)(PORTC, 9)
constexpr Pin D5 = [**Pin**](structdaisy_1_1Pin.md)(PORTC, 8)
constexpr Pin D6 = [**Pin**](structdaisy_1_1Pin.md)(PORTC, 12)
constexpr Pin D7 = [**Pin**](structdaisy_1_1Pin.md)(PORTD, 2)
constexpr Pin D8 = [**Pin**](structdaisy_1_1Pin.md)(PORTC, 2)
constexpr Pin D9 = [**Pin**](structdaisy_1_1Pin.md)(PORTC, 3)

Public Functions

Type Name
size_t AudioBlockSize ()
float AudioCallbackRate ()
float AudioSampleRate ()
void ChangeAudioCallback (AudioHandle::AudioCallback cb)
void ChangeAudioCallback (AudioHandle::InterleavingAudioCallback cb)
DaisyPatchSM ()
void Delay (uint32_t milliseconds)
float GetAdcValue (int idx)
Pin GetPin (const PinBank bank, const int idx)
float GetRandomFloat (float min=0.f, float max=1.f)
uint32_t GetRandomValue ()
void Init ()
void ProcessAllControls ()
void ProcessAnalogControls ()
void ProcessDigitalControls ()
void SetAudioBlockSize (size_t size)
void SetAudioSampleRate (float sr)
void SetAudioSampleRate (SaiHandle::Config::SampleRate sample_rate)
void SetLed (bool state)
void StartAdc ()
void StartAudio (AudioHandle::AudioCallback cb)
void StartAudio (AudioHandle::InterleavingAudioCallback cb)
void StartDac (DacHandle::DacCallback callback=nullptr)
void StopAdc ()
void StopAudio ()
void StopDac ()
bool ValidateQSPI (bool quick=true)
Tests the QSPI for validity This will wipe contents of QSPI when testing.
bool ValidateSDRAM ()
Tests entirety of SDRAM for validity This will wipe contents of SDRAM when testing.
void WriteCvOut (const int channel, float voltage)
~DaisyPatchSM ()

Public Static Functions

Type Name
void Print (const char * format, VA... va)
void PrintLine (const char * format, VA... va)
void StartLog (bool wait_for_pc=false)

Detailed Description

Author:

shensley

Daisy Patch SM is a complete Eurorack module DSP engine. Based on the Daisy Seed, with circuits added for interfacing directly with eurorack modular synthesizers.

Public Types Documentation

enum PinBank

enum daisy::patch_sm::DaisyPatchSM::PinBank {
    A,
    B,
    C,
    D
};

Helper for mapping pins, and accessing them using the GetPin function


Public Attributes Documentation

variable adc

AdcHandle daisy::patch_sm::DaisyPatchSM::adc;

variable audio

AudioHandle daisy::patch_sm::DaisyPatchSM::audio;

variable codec

Pcm3060 daisy::patch_sm::DaisyPatchSM::codec;

variable controls

AnalogControl daisy::patch_sm::DaisyPatchSM::controls[ADC_LAST];

variable dac

DacHandle daisy::patch_sm::DaisyPatchSM::dac;

variable gate_in_1

GateIn daisy::patch_sm::DaisyPatchSM::gate_in_1;

variable gate_in_2

GateIn daisy::patch_sm::DaisyPatchSM::gate_in_2;

variable gate_out_1

GPIO daisy::patch_sm::DaisyPatchSM::gate_out_1;

variable gate_out_2

GPIO daisy::patch_sm::DaisyPatchSM::gate_out_2;

variable qspi

QSPIHandle daisy::patch_sm::DaisyPatchSM::qspi;

variable sdram

SdramHandle daisy::patch_sm::DaisyPatchSM::sdram;

variable system

System daisy::patch_sm::DaisyPatchSM::system;

Direct Access Structs/Classes


variable usb

UsbHandle daisy::patch_sm::DaisyPatchSM::usb;

variable user_led

GPIO daisy::patch_sm::DaisyPatchSM::user_led;

Dedicated Function Pins


Public Static Attributes Documentation

variable A1

constexpr Pin daisy::patch_sm::DaisyPatchSM::A1;

Pin Accessors for the DaisyPatchSM hardware Used for initializing various GPIO, etc. A1 - -12V Power Input


variable A10

constexpr Pin daisy::patch_sm::DaisyPatchSM::A10;

A10 - +3V3 Power Out


variable A2

constexpr Pin daisy::patch_sm::DaisyPatchSM::A2;

A2 - UART1 Rx


variable A3

constexpr Pin daisy::patch_sm::DaisyPatchSM::A3;

A3 - UART1 Tx


variable A4

constexpr Pin daisy::patch_sm::DaisyPatchSM::A4;

A4 - GND


variable A5

constexpr Pin daisy::patch_sm::DaisyPatchSM::A5;

A5 - +12V Power Input


variable A6

constexpr Pin daisy::patch_sm::DaisyPatchSM::A6;

A6 - +5V Power Output


variable A7

constexpr Pin daisy::patch_sm::DaisyPatchSM::A7;

A7 - GND


variable A8

constexpr Pin daisy::patch_sm::DaisyPatchSM::A8;

A8 - USB DM


variable A9

constexpr Pin daisy::patch_sm::DaisyPatchSM::A9;

A9 - USB DP


variable B1

constexpr Pin daisy::patch_sm::DaisyPatchSM::B1;

B1 - Audio Out Right


variable B10

constexpr Pin daisy::patch_sm::DaisyPatchSM::B10;

B10 - GATE IN 1


variable B2

constexpr Pin daisy::patch_sm::DaisyPatchSM::B2;

B2 - Audio Out Left


variable B3

constexpr Pin daisy::patch_sm::DaisyPatchSM::B3;

B3 - Audio In Right


variable B4

constexpr Pin daisy::patch_sm::DaisyPatchSM::B4;

B4 - Audio In Left


variable B5

constexpr Pin daisy::patch_sm::DaisyPatchSM::B5;

B5 - GATE OUT 1


variable B6

constexpr Pin daisy::patch_sm::DaisyPatchSM::B6;

B6 - GATE OUT 2


variable B7

constexpr Pin daisy::patch_sm::DaisyPatchSM::B7;

B7 - I2C1 SCL


variable B8

constexpr Pin daisy::patch_sm::DaisyPatchSM::B8;

B8 - I2C1 SDA


variable B9

constexpr Pin daisy::patch_sm::DaisyPatchSM::B9;

B9 - GATE IN 2


variable C1

constexpr Pin daisy::patch_sm::DaisyPatchSM::C1;

C1 - CV Out 2


variable C10

constexpr Pin daisy::patch_sm::DaisyPatchSM::C10;

C10 - CV Out 1


variable C2

constexpr Pin daisy::patch_sm::DaisyPatchSM::C2;

C2 - CV In 4


variable C3

constexpr Pin daisy::patch_sm::DaisyPatchSM::C3;

C3 - CV In 3


variable C4

constexpr Pin daisy::patch_sm::DaisyPatchSM::C4;

C4 - CV In 2


variable C5

constexpr Pin daisy::patch_sm::DaisyPatchSM::C5;

C5 - CV In 1


variable C6

constexpr Pin daisy::patch_sm::DaisyPatchSM::C6;

C6 - CV In 5


variable C7

constexpr Pin daisy::patch_sm::DaisyPatchSM::C7;

C7 - CV In 6


variable C8

constexpr Pin daisy::patch_sm::DaisyPatchSM::C8;

C8 - CV In 7


variable C9

constexpr Pin daisy::patch_sm::DaisyPatchSM::C9;

C9 - CV In 8


variable D1

constexpr Pin daisy::patch_sm::DaisyPatchSM::D1;

D1 - SPI2 CS


variable D10

constexpr Pin daisy::patch_sm::DaisyPatchSM::D10;

D10 - SPI2 SCK


variable D2

constexpr Pin daisy::patch_sm::DaisyPatchSM::D2;

D2 - SDMMC D3


variable D3

constexpr Pin daisy::patch_sm::DaisyPatchSM::D3;

D3 - SDMMC D2


variable D4

constexpr Pin daisy::patch_sm::DaisyPatchSM::D4;

D4 - SDMMC D1


variable D5

constexpr Pin daisy::patch_sm::DaisyPatchSM::D5;

D5 - SDMMC D0


variable D6

constexpr Pin daisy::patch_sm::DaisyPatchSM::D6;

D6 - SDMMC CK


variable D7

constexpr Pin daisy::patch_sm::DaisyPatchSM::D7;

D7 - SDMMC CMD


variable D8

constexpr Pin daisy::patch_sm::DaisyPatchSM::D8;

D8 - SPI2 MISO


variable D9

constexpr Pin daisy::patch_sm::DaisyPatchSM::D9;

D9 - SPI2 MOSI


Public Functions Documentation

function AudioBlockSize

size_t daisy::patch_sm::DaisyPatchSM::AudioBlockSize () 

Returns the number of samples processed in an audio callback


function AudioCallbackRate

float daisy::patch_sm::DaisyPatchSM::AudioCallbackRate () 

Returns the rate at which the audio callback will be called in Hz


function AudioSampleRate

float daisy::patch_sm::DaisyPatchSM::AudioSampleRate () 

Returns the audio engine's samplerate in Hz


function ChangeAudioCallback [½]

void daisy::patch_sm::DaisyPatchSM::ChangeAudioCallback (
    AudioHandle::AudioCallback cb
) 

Changes the callback that is executing. This may cause clicks if done while audio is processing.


function ChangeAudioCallback [2/2]

void daisy::patch_sm::DaisyPatchSM::ChangeAudioCallback (
    AudioHandle::InterleavingAudioCallback cb
) 

Changes the callback that is executing. This may cause clicks if done while audio is processing.


function DaisyPatchSM

inline daisy::patch_sm::DaisyPatchSM::DaisyPatchSM () 

function Delay

inline void daisy::patch_sm::DaisyPatchSM::Delay (
    uint32_t milliseconds
) 

Here are some wrappers around libDaisy Static functions to provide simpler syntax to those who prefer it. Delays for a specified number of milliseconds


function GetAdcValue

float daisy::patch_sm::DaisyPatchSM::GetAdcValue (
    int idx
) 

Returns the current value for one of the ADCs


function GetPin

Pin daisy::patch_sm::DaisyPatchSM::GetPin (
    const  PinBank bank,
    const  int idx
) 

Returns the STM32 port/pin combo for the desired pin (or an invalid pin for HW only pins)

Macros at top of file can be used in place of separate arguments (i.e. GetPin(A4), etc.)

Parameters:

  • bank should be one of the PinBank options above
  • idx pin number between 1 and 10 for each of the pins on each header.

Deprecated

please use the Pin definitions in daisy::patch_sm instead


function GetRandomFloat

inline float daisy::patch_sm::DaisyPatchSM::GetRandomFloat (
    float min=0. f,
    float max=1. f
) 

Gets a random floating point value between the specified minimum, and maxmimum


function GetRandomValue

inline uint32_t daisy::patch_sm::DaisyPatchSM::GetRandomValue () 

Gets a random 32-bit value


function Init

void daisy::patch_sm::DaisyPatchSM::Init () 

Initializes the memories, and core peripherals for the Daisy Patch SM


function ProcessAllControls

inline void daisy::patch_sm::DaisyPatchSM::ProcessAllControls () 

Does both of the above


function ProcessAnalogControls

void daisy::patch_sm::DaisyPatchSM::ProcessAnalogControls () 

Reads and filters all of the analog control inputs


function ProcessDigitalControls

void daisy::patch_sm::DaisyPatchSM::ProcessDigitalControls () 

Reads and debounces any of the digital control inputs This does nothing on this board at this time.


function SetAudioBlockSize

void daisy::patch_sm::DaisyPatchSM::SetAudioBlockSize (
    size_t size
) 

Sets the number of samples processed in an audio callback. This will only take effect on the next invocation of StartAudio


function SetAudioSampleRate [½]

void daisy::patch_sm::DaisyPatchSM::SetAudioSampleRate (
    float sr
) 

Sets the samplerate for the audio engine This will set it to the closest valid samplerate. Options being: 8kHz, 16kHz, 32kHz, 48kHz, and 96kHz


function SetAudioSampleRate [2/2]

void daisy::patch_sm::DaisyPatchSM::SetAudioSampleRate (
    SaiHandle::Config::SampleRate sample_rate
) 

function SetLed

void daisy::patch_sm::DaisyPatchSM::SetLed (
    bool state
) 

function StartAdc

void daisy::patch_sm::DaisyPatchSM::StartAdc () 

Starts the Control ADCs

This is started automatically when Init() is called.


function StartAudio [½]

void daisy::patch_sm::DaisyPatchSM::StartAudio (
    AudioHandle::AudioCallback cb
) 

Starts a non-interleaving audio callback


function StartAudio [2/2]

void daisy::patch_sm::DaisyPatchSM::StartAudio (
    AudioHandle::InterleavingAudioCallback cb
) 

Starts an interleaving audio callback


function StartDac

void daisy::patch_sm::DaisyPatchSM::StartDac (
    DacHandle::DacCallback callback=nullptr
) 

Starts the DAC for the CV Outputs

By default this starts by running the internal callback at 48kHz, which will update the values based on the SetCvOut function.

This is started automatically when Init() is called.


function StopAdc

void daisy::patch_sm::DaisyPatchSM::StopAdc () 

Stops the Control ADCs


function StopAudio

void daisy::patch_sm::DaisyPatchSM::StopAudio () 

Stops the transmission of audio.


function StopDac

void daisy::patch_sm::DaisyPatchSM::StopDac () 

Stop the DAC from updating. This will suspend the CV Outputs from changing


function ValidateQSPI

Tests the QSPI for validity This will wipe contents of QSPI when testing.

bool daisy::patch_sm::DaisyPatchSM::ValidateQSPI (
    bool quick=true
) 

Note:

If called with quick = false, this will erase all memory the "quick" test starts 0x400000 bytes into the memory and test 16kB of data

Parameters:

  • quick if this is true the test will only test a small piece of the QSPI checking the entire 8MB can take roughly over a minute.

Return value:

  • returns true if SDRAM is okay, otherwise false

function ValidateSDRAM

Tests entirety of SDRAM for validity This will wipe contents of SDRAM when testing.

bool daisy::patch_sm::DaisyPatchSM::ValidateSDRAM () 

Note:

If using the SDRAM for the default bss, or heap, and using constructors as initializers do not call this function. Otherwise, it could overwrite changes performed by constructors.

Return value:

  • returns true if SDRAM is okay, otherwise false

function WriteCvOut

void daisy::patch_sm::DaisyPatchSM::WriteCvOut (
    const  int channel,
    float voltage
) 

Sets specified DAC channel to the target voltage. This may not be 100% accurate without calibration.

Todo

Add Calibration to CV Outputs

Parameters:

  • channel desired channel to update. 0 is both, otherwise 1 or 2 are valid.
  • voltage value in Volts that you'd like to write to the DAC. The valid range is 0-5V.

function ~DaisyPatchSM

inline daisy::patch_sm::DaisyPatchSM::~DaisyPatchSM () 

Public Static Functions Documentation

function Print

template<typename... VA>
static inline void daisy::patch_sm::DaisyPatchSM::Print (
    const  char * format,
    VA... va
) 

Print formatted debug log message


function PrintLine

template<typename... VA>
static inline void daisy::patch_sm::DaisyPatchSM::PrintLine (
    const  char * format,
    VA... va
) 

Print formatted debug log message with automatic line termination


function StartLog

static inline void daisy::patch_sm::DaisyPatchSM::StartLog (
    bool wait_for_pc=false
) 

Start the logging session. Optionally wait for terminal connection before proceeding.



The documentation for this class was generated from the following file external-docs/libDaisy/src/daisy_patch_sm.h