Aurora-SDK
Development Reference for Aurora-SDK
aurora::Hardware Class Reference

Hardware support class for the Qu-Bit Aurora This should be created, and intitialized at the beginning of any program before running anything else. More...

Detailed Description

Hardware support class for the Qu-Bit Aurora This should be created, and intitialized at the beginning of any program before running anything else.

If you've used the Daisy Seed, etc. before this object takes the place of the core "DaisySeed" or other board support objects.

#include <aurora.h>

Public Member Functions

 Hardware ()
 Empty Constructor Call Init from main to initialize. More...
 
 ~Hardware ()
 Empty Destructor This object should span the life of the program. More...
 
void Init (bool boost=true)
 Initialize the hardware. Call this function at the start of main() More...
 
void StartAudio (daisy::AudioHandle::AudioCallback cb)
 Starts a specified audio callback Data is non-interleaved (i.e. {{L0, L1, ... , LN},{R0, R1, ... , RN}}) More...
 
void ChangeAudioCallback (daisy::AudioHandle::AudioCallback cb)
 Changes current callback to a new non-interleaved callback. More...
 
void StartAudio (daisy::AudioHandle::InterleavingAudioCallback cb)
 Starts a specified Interleaving audio callback. More...
 
void ChangeAudioCallback (daisy::AudioHandle::InterleavingAudioCallback cb)
 Changes current callback to a new interleaved callback. More...
 
void StartLowPriorityCallback (daisy::TimerHandle::PeriodElapsedCallback cb, uint32_t target_freq, void *data=nullptr)
 
void ChangeSampleRate (int sr)
 Updates the samplerate to one of the allowed target samplerates. This function stops the audio completely, and will cause clicks. More...
 
void StopAudio ()
 Stops Audio. More...
 
void SetAudioSampleRate (daisy::SaiHandle::Config::SampleRate samplerate)
 sets the audio sample rate. Audio must be stopped for this to work properly More...
 
void SetAudioSampleRate (int samplerate)
 sets the audio sample rate. Audio must be stopped for this to work properly More...
 
float AudioSampleRate ()
 returns the sample rate in Hz of the audio engine More...
 
void SetAudioBlockSize (size_t blocksize)
 sets the number of samples to process in each audio callback More...
 
size_t AudioBlockSize ()
 returns the number of samples to process in each audio callback More...
 
float AudioCallbackRate () const
 returns the rate in Hz that the audio callback gets called More...
 
void SetTestLed (bool state)
 sets the state of the LED on the daisy itself More...
 
void ClearLeds ()
 sets all RGB LEDs to off state This can be called from the top of wherever LEDs are periodically set or within the UI framework's Canvas descriptor via the clearFunction_ function. More...
 
void WriteLeds ()
 Writes the state of all LEDs to the hardware This can be called from a fixed interval in the main loop, or within the UI framework's Canvas descriptor via the flushFunction_ function. More...
 
void SetLed (Leds idx, float r, float g, float b)
 Sets the RGB value of a given LED. More...
 
void SetLed (Leds idx, daisy::Color c)
 Sets the Color value of an LED. More...
 
void ProcessAllControls ()
 filters and debounces all control This should be run once per audio callback. More...
 
void ProcessDigitalControls ()
 filters and debounces digital controls (switches) This is called from ProcessAllControls, and should be run once per audio callback More...
 
void ProcessAnalogControls ()
 filters all analog controls (knobs and CVs) This is called from ProcessAllControls, and should be run once per audio callback More...
 
float GetKnobValue (int ctrl) const
 returns a 0-1 value for the given knob control More...
 
const daisy::Switch & GetButton (int idx) const
 returns a reference to a given momentary switch Example Usage: bool state = hw.GetButton(SW_FREEZE).Pressed(); More...
 
bool GetGateTrig (int idx)
 returns true if the gate input just went high This is expected to be checked only once per audio callback More...
 
bool GetGateState (int idx)
 returns true if the gate input is currently high More...
 
void UpdateHidRates ()
 Update HidRates for new Callback rate when samplerate/blocksize change. More...
 
void PrepareMedia (daisy::USBHostHandle::ConnectCallback connect_cb=nullptr, daisy::USBHostHandle::DisconnectCallback disconnect_cb=nullptr, daisy::USBHostHandle::ClassActiveCallback class_active_cb=nullptr, daisy::USBHostHandle::ErrorCallback error_cb=nullptr, void *userdata=nullptr)
 starts the mounting process for USB Drive use if it is present More...
 
float GetWarpVoct ()
 Return a MIDI note number value from -60 to 60 corresponding to the -5V to 5V input range of the Warp CV input. More...
 
float GetCvValue (int cv_idx)
 gets calibrated offset-adjusted CV Value from the hardware. More...
 
void DelayMs (size_t del)
 delay function; same as System::Delay(), and should not be called from any interrupt callbacks (LowPriorityCallback/AudioCallback). More...
 
void CalibrateV1 (float v1)
 called during a customized calibration UI to record the 1V value More...
 
void CalibrateV3 (float v3)
 called during a customized calibration UI to record the 3V value and set that calibraiton has completed and can be saved. More...
 
void SetWarpCalData (float scale, float offset)
 Sets the calibration data for 1V/Octave over Warp CV typically set after reading stored data from external memory. More...
 
void GetWarpCalData (float &scale, float &offset)
 Gets the current calibration data for 1V/Octave over Warp CV typically used to prepare data for storing after successful calibration. More...
 
void SetCvOffsetData (float *data)
 Sets the cv offset from an externally array of data. More...
 
void GetCvOffsetData (float *data)
 Fills an array with the offset data currently being used. More...
 
bool ReadyToSaveCal () const
 Checks to see if calibration has been completed and needs to be saved. More...
 
void ClearSaveCalFlag ()
 signal the cal-save flag to clear once calibration data has been written to ext. flash memory More...
 

Public Attributes

daisy::AnalogControl cv [CV_LAST]
 
daisy::Switch switches [SW_LAST]
 
daisy::GateIn gates [GATE_LAST]
 
daisy::AnalogControl controls [KNOB_LAST]
 
daisy::DaisySeed seed
 

Constructor & Destructor Documentation

◆ Hardware()

aurora::Hardware::Hardware ( )
inline

Empty Constructor Call Init from main to initialize.

◆ ~Hardware()

aurora::Hardware::~Hardware ( )
inline

Empty Destructor This object should span the life of the program.

Member Function Documentation

◆ AudioBlockSize()

size_t aurora::Hardware::AudioBlockSize ( )
inline

returns the number of samples to process in each audio callback

◆ AudioCallbackRate()

float aurora::Hardware::AudioCallbackRate ( ) const
inline

returns the rate in Hz that the audio callback gets called

◆ AudioSampleRate()

float aurora::Hardware::AudioSampleRate ( )
inline

returns the sample rate in Hz of the audio engine

◆ CalibrateV1()

void aurora::Hardware::CalibrateV1 ( float  v1)
inline

called during a customized calibration UI to record the 1V value

◆ CalibrateV3()

void aurora::Hardware::CalibrateV3 ( float  v3)
inline

called during a customized calibration UI to record the 3V value and set that calibraiton has completed and can be saved.

◆ ChangeAudioCallback() [1/2]

void aurora::Hardware::ChangeAudioCallback ( daisy::AudioHandle::AudioCallback  cb)
inline

Changes current callback to a new non-interleaved callback.

◆ ChangeAudioCallback() [2/2]

void aurora::Hardware::ChangeAudioCallback ( daisy::AudioHandle::InterleavingAudioCallback  cb)
inline

Changes current callback to a new interleaved callback.

◆ ChangeSampleRate()

void aurora::Hardware::ChangeSampleRate ( int  sr)
inline

Updates the samplerate to one of the allowed target samplerates. This function stops the audio completely, and will cause clicks.

Parameters
srtarget samplerate in Hz. Allowed values are 16000, 32000, 48000, 96000 any other value will fallback to 48kHz

◆ ClearLeds()

void aurora::Hardware::ClearLeds ( )
inline

sets all RGB LEDs to off state This can be called from the top of wherever LEDs are periodically set or within the UI framework's Canvas descriptor via the clearFunction_ function.

◆ ClearSaveCalFlag()

void aurora::Hardware::ClearSaveCalFlag ( )
inline

signal the cal-save flag to clear once calibration data has been written to ext. flash memory

◆ DelayMs()

void aurora::Hardware::DelayMs ( size_t  del)
inline

delay function; same as System::Delay(), and should not be called from any interrupt callbacks (LowPriorityCallback/AudioCallback).

Parameters
delnumber of milliseconds to delay

◆ GetButton()

const daisy::Switch & aurora::Hardware::GetButton ( int  idx) const
inline

returns a reference to a given momentary switch Example Usage: bool state = hw.GetButton(SW_FREEZE).Pressed();

Parameters
idxone of the Switches enum values

◆ GetCvOffsetData()

void aurora::Hardware::GetCvOffsetData ( float *  data)
inline

Fills an array with the offset data currently being used.

◆ GetCvValue()

float aurora::Hardware::GetCvValue ( int  cv_idx)
inline

gets calibrated offset-adjusted CV Value from the hardware.

Parameters
cv_idxindex of the CV to read from.
Returns
offset adjusted output (except for warp which is v/oct calibrated)
Note
when returning warp CV from this function it will be with no calibrated offset, and is identical to reading from the AnalogControl itself.

◆ GetGateState()

bool aurora::Hardware::GetGateState ( int  idx)
inline

returns true if the gate input is currently high

Parameters
idxone of the Gates enum values

◆ GetGateTrig()

bool aurora::Hardware::GetGateTrig ( int  idx)
inline

returns true if the gate input just went high This is expected to be checked only once per audio callback

Parameters
idxone of the Gates enum values

◆ GetKnobValue()

float aurora::Hardware::GetKnobValue ( int  ctrl) const
inline

returns a 0-1 value for the given knob control

Parameters
ctrlknob index to read from. Should be one of ControlKnob (i.e. KNOB_TIME)

◆ GetWarpCalData()

void aurora::Hardware::GetWarpCalData ( float &  scale,
float &  offset 
)
inline

Gets the current calibration data for 1V/Octave over Warp CV typically used to prepare data for storing after successful calibration.

◆ GetWarpVoct()

float aurora::Hardware::GetWarpVoct ( )
inline

Return a MIDI note number value from -60 to 60 corresponding to the -5V to 5V input range of the Warp CV input.

◆ Init()

void aurora::Hardware::Init ( bool  boost = true)
inline

Initialize the hardware. Call this function at the start of main()

Parameters
boosttrue sets the processor to run at the maximum 480MHz, false sets the processor to run at 400MHz. Defaults to true (480MHz).

◆ PrepareMedia()

void aurora::Hardware::PrepareMedia ( daisy::USBHostHandle::ConnectCallback  connect_cb = nullptr,
daisy::USBHostHandle::DisconnectCallback  disconnect_cb = nullptr,
daisy::USBHostHandle::ClassActiveCallback  class_active_cb = nullptr,
daisy::USBHostHandle::ErrorCallback  error_cb = nullptr,
void *  userdata = nullptr 
)
inline

starts the mounting process for USB Drive use if it is present

To access files from a USB drive: the connect, class_active, and disconnect callbacks can be used to update an external state machine that can be used to trigger interactions with the filesystem.

This process should be done within the main() while loop, and usb.Process() should be called once per loop.

Initialize hardware and set user callbacks

Prepare FatFS – fmount will defer until first attempt to read/write

◆ ProcessAllControls()

void aurora::Hardware::ProcessAllControls ( )
inline

filters and debounces all control This should be run once per audio callback.

◆ ProcessAnalogControls()

void aurora::Hardware::ProcessAnalogControls ( )
inline

filters all analog controls (knobs and CVs) This is called from ProcessAllControls, and should be run once per audio callback

◆ ProcessDigitalControls()

void aurora::Hardware::ProcessDigitalControls ( )
inline

filters and debounces digital controls (switches) This is called from ProcessAllControls, and should be run once per audio callback

◆ ReadyToSaveCal()

bool aurora::Hardware::ReadyToSaveCal ( ) const
inline

Checks to see if calibration has been completed and needs to be saved.

◆ SetAudioBlockSize()

void aurora::Hardware::SetAudioBlockSize ( size_t  blocksize)
inline

sets the number of samples to process in each audio callback

◆ SetAudioSampleRate() [1/2]

void aurora::Hardware::SetAudioSampleRate ( daisy::SaiHandle::Config::SampleRate  samplerate)
inline

sets the audio sample rate. Audio must be stopped for this to work properly

Parameters
sampleratetarget samplerate in in daisy::SaiHandle::Config::SampleRate

◆ SetAudioSampleRate() [2/2]

void aurora::Hardware::SetAudioSampleRate ( int  samplerate)
inline

sets the audio sample rate. Audio must be stopped for this to work properly

Parameters
sampleratetarget samplerate in Hz. Allowed values are 16000, 32000, 48000, 96000 any other value will fallback to 48kHz

◆ SetCvOffsetData()

void aurora::Hardware::SetCvOffsetData ( float *  data)
inline

Sets the cv offset from an externally array of data.

◆ SetLed() [1/2]

void aurora::Hardware::SetLed ( Leds  idx,
daisy::Color  c 
)
inline

Sets the Color value of an LED.

Parameters
idxLED index (on of Leds enum above)
cColor object containing desired RGB values

◆ SetLed() [2/2]

void aurora::Hardware::SetLed ( Leds  idx,
float  r,
float  g,
float  b 
)
inline

Sets the RGB value of a given LED.

Parameters
idxLED index (one of Leds enum above)
r0- 1 red value
g0- 1 green value
b0- 1 blue value

◆ SetTestLed()

void aurora::Hardware::SetTestLed ( bool  state)
inline

sets the state of the LED on the daisy itself

◆ SetWarpCalData()

void aurora::Hardware::SetWarpCalData ( float  scale,
float  offset 
)
inline

Sets the calibration data for 1V/Octave over Warp CV typically set after reading stored data from external memory.

◆ StartAudio() [1/2]

void aurora::Hardware::StartAudio ( daisy::AudioHandle::AudioCallback  cb)
inline

Starts a specified audio callback Data is non-interleaved (i.e. {{L0, L1, ... , LN},{R0, R1, ... , RN}})

◆ StartAudio() [2/2]

void aurora::Hardware::StartAudio ( daisy::AudioHandle::InterleavingAudioCallback  cb)
inline

Starts a specified Interleaving audio callback.

◆ StartLowPriorityCallback()

void aurora::Hardware::StartLowPriorityCallback ( daisy::TimerHandle::PeriodElapsedCallback  cb,
uint32_t  target_freq,
void *  data = nullptr 
)
inline

This starts up a callback that is on the lowest priority interrupt level This provides an area for non-background tasks that should interrupt low level activity like diskio.

Parameters
cbcallback to take place at target frequency
target_freqfreq in hz that the callback should take place.
dataany data to send through callback; this defaults to nullptr

Start Audio

◆ StopAudio()

void aurora::Hardware::StopAudio ( )
inline

Stops Audio.

◆ UpdateHidRates()

void aurora::Hardware::UpdateHidRates ( )
inline

Update HidRates for new Callback rate when samplerate/blocksize change.

◆ WriteLeds()

void aurora::Hardware::WriteLeds ( )
inline

Writes the state of all LEDs to the hardware This can be called from a fixed interval in the main loop, or within the UI framework's Canvas descriptor via the flushFunction_ function.

Member Data Documentation

◆ controls

daisy::AnalogControl aurora::Hardware::controls[KNOB_LAST]

Array of knob controls

◆ cv

daisy::AnalogControl aurora::Hardware::cv[CV_LAST]

Array of CV inputs

◆ gates

daisy::GateIn aurora::Hardware::gates[GATE_LAST]

Array of gate inputs

◆ seed

daisy::DaisySeed aurora::Hardware::seed

Daisy Seed base object

◆ switches

daisy::Switch aurora::Hardware::switches[SW_LAST]

Array of momentary switches


The documentation for this class was generated from the following file: