Skip to content

daisy::DaisyPetal

Module: LIBDAISY / BOARDS

Helpers and hardware definitions for daisy petal.

#include <daisy_petal.h>

Public Types

Name
enum Sw
enum Knob
enum RingLed
enum FootswitchLed

Public Functions

Name
DaisyPetal()
~DaisyPetal()
void Init(bool boost =false)
void DelayMs(size_t del)
void StartAudio(AudioHandle::InterleavingAudioCallback cb)
void StartAudio(AudioHandle::AudioCallback cb)
void ChangeAudioCallback(AudioHandle::InterleavingAudioCallback cb)
void ChangeAudioCallback(AudioHandle::AudioCallback cb)
void StopAudio()
void SetAudioSampleRate(SaiHandle::Config::SampleRate samplerate)
float AudioSampleRate()
void SetAudioBlockSize(size_t size)
size_t AudioBlockSize()
float AudioCallbackRate()
void StartAdc()
void StopAdc()
void ProcessAnalogControls()
void ProcessAllControls()
float GetKnobValue(Knob k)
float GetExpression()
void ProcessDigitalControls()
void ClearLeds()
void UpdateLeds()
void SetRingLed(RingLed idx, float r, float g, float b)
void SetFootswitchLed(FootswitchLed idx, float bright)

Public Attributes

Name
DaisySeed seed
Encoder encoder
AnalogControl[KNOB_LAST] knob
AnalogControl expression
Switch[SW_LAST] switches
RgbLed[8] ring_led
Led[4] footswitch_led

Public Types Documentation

enum Sw

Enumerator Value Description
SW_1 Footswitch
SW_2 Footswitch
SW_3 Footswitch
SW_4 Footswitch
SW_5 Toggle
SW_6 Toggle
SW_7 Toggle
SW_LAST Last enum item

Switches

enum Knob

Enumerator Value Description
KNOB_1 &
KNOB_2 &
KNOB_3 &
KNOB_4 &
KNOB_5 &
KNOB_6 &
KNOB_LAST &

Knobs

enum RingLed

Enumerator Value Description
RING_LED_1 &
RING_LED_2 &
RING_LED_3 &
RING_LED_4 &
RING_LED_5 &
RING_LED_6 &
RING_LED_7 &
RING_LED_8 &
RING_LED_LAST &

Leds in ringled

enum FootswitchLed

Enumerator Value Description
FOOTSWITCH_LED_1 &
FOOTSWITCH_LED_2 &
FOOTSWITCH_LED_3 &
FOOTSWITCH_LED_4 &
FOOTSWITCH_LED_LAST &

footswitch leds

Public Functions Documentation

function DaisyPetal

inline DaisyPetal()

Constructor


function ~DaisyPetal

inline ~DaisyPetal()

Destructor


function Init

void Init(
    bool boost =false
)

Initialize daisy petal


function DelayMs

void DelayMs(
    size_t del
)

Parameters:

  • del Delay time in ms.

Wait before moving on.


function StartAudio

void StartAudio(
    AudioHandle::InterleavingAudioCallback cb
)

Parameters:

  • cb Interleaved callback function

Starts the callback


function StartAudio

void StartAudio(
    AudioHandle::AudioCallback cb
)

Parameters:

  • cb multichannel callback function

Starts the callback


function ChangeAudioCallback

void ChangeAudioCallback(
    AudioHandle::InterleavingAudioCallback cb
)

Parameters:

  • cb New interleaved callback function.

Switch callback functions


function ChangeAudioCallback

void ChangeAudioCallback(
    AudioHandle::AudioCallback cb
)

Parameters:

  • cb New multichannel callback function.

Switch callback functions


function StopAudio

void StopAudio()

Stops the audio if it is running.


function SetAudioSampleRate

void SetAudioSampleRate(
    SaiHandle::Config::SampleRate samplerate
)

Updates the Audio Sample Rate, and reinitializes. Audio must be stopped for this to work.


function AudioSampleRate

float AudioSampleRate()

Returns the audio sample rate in Hz as a floating point number.


function SetAudioBlockSize

void SetAudioBlockSize(
    size_t size
)

Parameters:

  • size Audio block size

Sets the number of samples processed per channel by the audio callback.


function AudioBlockSize

size_t AudioBlockSize()

Returns the number of samples per channel in a block of audio.


function AudioCallbackRate

float AudioCallbackRate()

Returns the rate in Hz that the Audio callback is called


function StartAdc

void StartAdc()

Start analog to digital conversion.


function StopAdc

void StopAdc()

Stops Transfering data from the ADC


function ProcessAnalogControls

void ProcessAnalogControls()

Call at the same frequency as controls are read for stable readings.


function ProcessAllControls

inline void ProcessAllControls()

Process Analog and Digital Controls


function GetKnobValue

float GetKnobValue(
    Knob k
)

Parameters:

  • k Which knob to get

Return: Floating point knob position.

Get value per knob.


function GetExpression

float GetExpression()

&


function ProcessDigitalControls

void ProcessDigitalControls()

Process digital controls


function ClearLeds

void ClearLeds()

Turn all leds off


function UpdateLeds

void UpdateLeds()

Update Leds to values you had set.


function SetRingLed

void SetRingLed(
    RingLed idx,
    float r,
    float g,
    float b
)

Parameters:

  • idx Index to set
  • r Red value
  • g Green value
  • b Blue value

Set ring LED colors


function SetFootswitchLed

void SetFootswitchLed(
    FootswitchLed idx,
    float bright
)

Parameters:

  • idx Led Index
  • bright Brightness

Set footswitch LED


Public Attributes Documentation

variable seed

DaisySeed seed;

&

variable encoder

Encoder encoder;

&

variable knob

AnalogControl[KNOB_LAST] knob;

&

variable expression

AnalogControl expression;

&

variable switches

Switch[SW_LAST] switches;

< &

variable ring_led

RgbLed[8] ring_led;

&

variable footswitch_led

Led[4] footswitch_led;

&


Updated on 2024-01-03 at 19:41:01 +0000