libDaisy
Hardware Library for Daisy
Loading...
Searching...
No Matches
daisy_field.h
Go to the documentation of this file.
1#pragma once
2#ifndef DSY_FIELD_BSP_H
3#define DSY_FIELD_BSP_H
4#include "daisy_seed.h"
5#include "dev/oled_ssd130x.h"
6
10namespace daisy
11{
16{
17 public:
20 enum
21 {
25 };
26
30 enum
31 {
41 };
42
43 enum
44 {
50 };
51
52 enum
53 {
81 };
82
85
87 void Init(bool boost = false);
88
93 void DelayMs(size_t del);
94
99
104
106 void StopAudio();
107
113
119
124
128
131 void SetAudioBlockSize(size_t blocksize);
132
135
138
140 void StartAdc();
141
143 void StopAdc();
144
148 void StartDac();
149
152
155
157 inline void ProcessAllControls()
158 {
161 }
162
164 void SetCvOut1(uint16_t val);
165
167 void SetCvOut2(uint16_t val);
168
172 bool KeyboardState(size_t idx) const;
173
177 bool KeyboardRisingEdge(size_t idx) const;
178
182 bool KeyboardFallingEdge(size_t idx) const;
183
187 float GetKnobValue(size_t idx) const;
188
192 float GetCvValue(size_t idx) const;
193
197 Switch* GetSwitch(size_t idx);
198
202 AnalogControl* GetKnob(size_t idx);
203
207 AnalogControl* GetCv(size_t idx);
208
211 void VegasMode();
212
222
223 private:
225 void SetHidUpdateRates();
226 void InitMidi();
227
228 ShiftRegister4021<2> keyboard_sr_;
229 uint8_t keyboard_state_[16];
230 uint32_t last_led_update_; // for vegas mode
231 bool gate_in_trig_; // True when triggered.
232};
233
236} // namespace daisy
237
238#endif
Hardware Interface for control inputs Primarily designed for ADC input controls such as potentiomet...
Definition ctrl.h:18
void(* AudioCallback)(InputBuffer in, OutputBuffer out, size_t size)
Definition audio.h:65
void(* InterleavingAudioCallback)(InterleavingInputBuffer in, InterleavingOutputBuffer out, size_t size)
Definition audio.h:83
Definition daisy_field.h:16
size_t AudioBlockSize()
void Init(bool boost=false)
float AudioCallbackRate()
void ProcessAnalogControls()
DaisySeed seed
Definition daisy_field.h:213
@ SW_1
Definition daisy_field.h:22
@ SW_LAST
Definition daisy_field.h:24
@ SW_2
Definition daisy_field.h:23
~DaisyField()
Definition daisy_field.h:84
void ChangeAudioCallback(AudioHandle::AudioCallback cb)
void StartAudio(AudioHandle::AudioCallback cb)
void SetCvOut2(uint16_t val)
@ KNOB_5
Definition daisy_field.h:36
@ KNOB_7
Definition daisy_field.h:38
@ KNOB_LAST
Definition daisy_field.h:40
@ KNOB_1
Definition daisy_field.h:32
@ KNOB_8
Definition daisy_field.h:39
@ KNOB_6
Definition daisy_field.h:37
@ KNOB_3
Definition daisy_field.h:34
@ KNOB_2
Definition daisy_field.h:33
@ KNOB_4
Definition daisy_field.h:35
GateIn gate_in
Definition daisy_field.h:216
MidiUartHandler midi
Definition daisy_field.h:221
GPIO gate_out
Definition daisy_field.h:215
OledDisplay< SSD130x4WireSpi128x64Driver > display
Definition daisy_field.h:214
bool KeyboardFallingEdge(size_t idx) const
void ProcessAllControls()
Definition daisy_field.h:157
AnalogControl cv[CV_LAST]
Definition daisy_field.h:220
bool KeyboardState(size_t idx) const
void SetCvOut1(uint16_t val)
void SetAudioSampleRate(SaiHandle::Config::SampleRate samplerate)
@ CV_2
Definition daisy_field.h:46
@ CV_1
Definition daisy_field.h:45
@ CV_LAST
Definition daisy_field.h:49
@ CV_3
Definition daisy_field.h:47
@ CV_4
Definition daisy_field.h:48
DaisyField()
Definition daisy_field.h:83
@ LED_KNOB_5
Definition daisy_field.h:74
@ LED_SW_2
Definition daisy_field.h:79
@ LED_KEY_B7
Definition daisy_field.h:60
@ LED_KNOB_4
Definition daisy_field.h:73
@ LED_KEY_B2
Definition daisy_field.h:55
@ LED_KNOB_3
Definition daisy_field.h:72
@ LED_KEY_A2
Definition daisy_field.h:68
@ LED_KNOB_2
Definition daisy_field.h:71
@ LED_KEY_A4
Definition daisy_field.h:66
@ LED_KEY_A5
Definition daisy_field.h:65
@ LED_KEY_B4
Definition daisy_field.h:57
@ LED_KNOB_1
Definition daisy_field.h:70
@ LED_KEY_B3
Definition daisy_field.h:56
@ LED_KEY_A3
Definition daisy_field.h:67
@ LED_KEY_B5
Definition daisy_field.h:58
@ LED_KEY_B6
Definition daisy_field.h:59
@ LED_KNOB_8
Definition daisy_field.h:77
@ LED_LAST
Definition daisy_field.h:80
@ LED_KEY_B8
Definition daisy_field.h:61
@ LED_KNOB_6
Definition daisy_field.h:75
@ LED_KEY_A7
Definition daisy_field.h:63
@ LED_KEY_A1
Definition daisy_field.h:69
@ LED_KEY_A6
Definition daisy_field.h:64
@ LED_KEY_A8
Definition daisy_field.h:62
@ LED_KEY_B1
Definition daisy_field.h:54
@ LED_SW_1
Definition daisy_field.h:78
@ LED_KNOB_7
Definition daisy_field.h:76
float AudioSampleRate()
void SetAudioBlockSize(size_t blocksize)
bool KeyboardRisingEdge(size_t idx) const
float GetCvValue(size_t idx) const
void StartAudio(AudioHandle::InterleavingAudioCallback cb)
LedDriverPca9685< 2, true > led_driver
Definition daisy_field.h:217
void DelayMs(size_t del)
Switch sw[SW_LAST]
Definition daisy_field.h:218
AnalogControl knob[KNOB_LAST]
Definition daisy_field.h:219
AnalogControl * GetKnob(size_t idx)
Switch * GetSwitch(size_t idx)
void ChangeAudioCallback(AudioHandle::InterleavingAudioCallback cb)
float GetKnobValue(size_t idx) const
AnalogControl * GetCv(size_t idx)
void ProcessDigitalControls()
This is the higher-level interface for the Daisy board. All basic peripheral configuration/initiali...
Definition daisy_seed.h:19
General Purpose I/O control.
Definition gpio.h:22
Generic Class for handling gate inputs through GPIO.
Definition gatein.h:15
Definition leddriver.h:33
Definition oled_display.h:15
Device Driver for CD4021 shift register.
Definition sr_4021.h:38
Definition switch.h:18
Hardware defines and helpers for daisy field platform.
Definition index.h:2
SampleRate
Definition sai.h:58