libDaisy
Hardware Library for Daisy
Loading...
Searching...
No Matches
daisy_seed.h
Go to the documentation of this file.
1#pragma once
2#ifndef DSY_SEED_H
3#define DSY_SEED_H
4
5#include "daisy.h"
6
7//Uncomment this out if you're still using the rev2 hardware
8//#define SEED_REV2
9
10namespace daisy
11{
19{
20 public:
23
27 void Configure();
28
38 void Init(bool boost = false);
39
43 void DeInit();
44
49 void DelayMs(size_t del);
50
55 static Pin GetPin(uint8_t pin_idx);
56
62
69
73
77
79 void StopAudio();
80
85
89
92 void SetAudioBlockSize(size_t blocksize);
93
96
98 float AudioCallbackRate() const;
99
105 const SaiHandle& AudioSaiHandle() const;
106
109 void SetLed(bool state);
110
113 void SetTestPoint(bool state);
114
117 template <typename... VA>
118 static void Print(const char* format, VA... va)
119 {
120 Log::Print(format, va...);
121 }
122
125 template <typename... VA>
126 static void PrintLine(const char* format, VA... va)
127 {
128 Log::PrintLine(format, va...);
129 }
130
133 static void StartLog(bool wait_for_pc = false)
134 {
135 Log::StartLog(wait_for_pc);
136 }
137
138
139 // While the library is still in heavy development, most of the
140 // configuration handles will remain public.
151
157 enum class BoardVersion
158 {
171 };
172
175
176
177 private:
181
182 void ConfigureQspi();
183 void ConfigureAudio();
184 void ConfigureAdc();
185 void ConfigureDac();
186 //void ConfigureI2c();
187 float callback_rate_;
188
189 SaiHandle sai_1_handle_;
190};
191
195namespace seed
196{
198 constexpr Pin D0 = Pin(PORTB, 12);
199 constexpr Pin D1 = Pin(PORTC, 11);
200 constexpr Pin D2 = Pin(PORTC, 10);
201 constexpr Pin D3 = Pin(PORTC, 9);
202 constexpr Pin D4 = Pin(PORTC, 8);
203 constexpr Pin D5 = Pin(PORTD, 2);
204 constexpr Pin D6 = Pin(PORTC, 12);
205 constexpr Pin D7 = Pin(PORTG, 10);
206 constexpr Pin D8 = Pin(PORTG, 11);
207 constexpr Pin D9 = Pin(PORTB, 4);
208 constexpr Pin D10 = Pin(PORTB, 5);
209 constexpr Pin D11 = Pin(PORTB, 8);
210 constexpr Pin D12 = Pin(PORTB, 9);
211 constexpr Pin D13 = Pin(PORTB, 6);
212 constexpr Pin D14 = Pin(PORTB, 7);
213 constexpr Pin D15 = Pin(PORTC, 0);
214 constexpr Pin D16 = Pin(PORTA, 3);
215 constexpr Pin D17 = Pin(PORTB, 1);
216 constexpr Pin D18 = Pin(PORTA, 7);
217 constexpr Pin D19 = Pin(PORTA, 6);
218 constexpr Pin D20 = Pin(PORTC, 1);
219 constexpr Pin D21 = Pin(PORTC, 4);
220 constexpr Pin D22 = Pin(PORTA, 5);
221 constexpr Pin D23 = Pin(PORTA, 4);
222 constexpr Pin D24 = Pin(PORTA, 1);
223 constexpr Pin D25 = Pin(PORTA, 0);
224 constexpr Pin D26 = Pin(PORTD, 11);
225 constexpr Pin D27 = Pin(PORTG, 9);
226 constexpr Pin D28 = Pin(PORTA, 2);
227 constexpr Pin D29 = Pin(PORTB, 14);
228 constexpr Pin D30 = Pin(PORTB, 15);
229
231 constexpr Pin A0 = D15;
232 constexpr Pin A1 = D16;
233 constexpr Pin A2 = D17;
234 constexpr Pin A3 = D18;
235 constexpr Pin A4 = D19;
236 constexpr Pin A5 = D20;
237 constexpr Pin A6 = D21;
238 constexpr Pin A7 = D22;
239 constexpr Pin A8 = D23;
240 constexpr Pin A9 = D24;
241 constexpr Pin A10 = D25;
242 constexpr Pin A11 = D28;
243
245 constexpr Pin D31 = Pin(PORTC, 2);
246 constexpr Pin D32 = Pin(PORTC, 3);
247
249 constexpr Pin A12 = D31;
250 constexpr Pin A13 = D32;
251} // namespace seed
252
253} // namespace daisy
254
255#endif
Definition sdram.h:84
Interface for initializing and using the USB Peripherals on the daisy.
Definition usb.h:19
Handler for analog to digital conversion.
Definition adc.h:91
Definition codec_ak4556.h:18
Audio Engine Handle.
Definition audio.h:23
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
DAC handle for Built-in DAC Peripheral.
Definition dac.h:22
This is the higher-level interface for the Daisy board. All basic peripheral configuration/initiali...
Definition daisy_seed.h:19
QSPIHandle::Config qspi_config
Definition daisy_seed.h:142
void DelayMs(size_t del)
static void StartLog(bool wait_for_pc=false)
Definition daisy_seed.h:133
void SetTestPoint(bool state)
void Init(bool boost=false)
static void PrintLine(const char *format, VA... va)
Definition daisy_seed.h:126
const SaiHandle & AudioSaiHandle() const
void StartAudio(AudioHandle::AudioCallback cb)
void ChangeAudioCallback(AudioHandle::InterleavingAudioCallback cb)
void SetAudioBlockSize(size_t blocksize)
float AudioCallbackRate() const
size_t AudioBlockSize()
SdramHandle sdram_handle
Definition daisy_seed.h:143
float AudioSampleRate()
BoardVersion
Definition daisy_seed.h:158
AudioHandle audio_handle
Definition daisy_seed.h:144
BoardVersion CheckBoardVersion()
QSPIHandle qspi
Definition daisy_seed.h:141
AdcHandle adc
Definition daisy_seed.h:145
GPIO testpoint
Definition daisy_seed.h:148
DaisySeed()
Definition daisy_seed.h:21
DacHandle dac
Definition daisy_seed.h:146
~DaisySeed()
Definition daisy_seed.h:22
static void Print(const char *format, VA... va)
Definition daisy_seed.h:118
void StartAudio(AudioHandle::InterleavingAudioCallback cb)
void SetAudioSampleRate(SaiHandle::Config::SampleRate samplerate)
System system
Definition daisy_seed.h:149
GPIO led
Definition daisy_seed.h:148
void ChangeAudioCallback(AudioHandle::AudioCallback cb)
static Pin GetPin(uint8_t pin_idx)
void SetLed(bool state)
UsbHandle usb_handle
Definition daisy_seed.h:147
Ak4556 codec
Definition daisy_seed.h:150
General Purpose I/O control.
Definition gpio.h:22
Interface for simple USB logging.
Definition logger.h:72
static void StartLog(bool wait_for_pc=false)
static void Print(const char *format,...)
static void PrintLine(const char *format,...)
Definition qspi.h:32
Definition sai.h:44
Definition system.h:19
constexpr Pin D9
Definition daisy_seed.h:207
constexpr Pin D4
Definition daisy_seed.h:202
constexpr Pin A12
Definition daisy_seed.h:249
constexpr Pin D30
Definition daisy_seed.h:228
constexpr Pin D31
Definition daisy_seed.h:245
constexpr Pin D0
Definition daisy_seed.h:198
constexpr Pin A1
Definition daisy_seed.h:232
constexpr Pin A2
Definition daisy_seed.h:233
constexpr Pin D21
Definition daisy_seed.h:219
constexpr Pin D27
Definition daisy_seed.h:225
constexpr Pin A4
Definition daisy_seed.h:235
constexpr Pin D3
Definition daisy_seed.h:201
constexpr Pin A7
Definition daisy_seed.h:238
constexpr Pin A6
Definition daisy_seed.h:237
constexpr Pin D10
Definition daisy_seed.h:208
constexpr Pin D24
Definition daisy_seed.h:222
constexpr Pin D19
Definition daisy_seed.h:217
constexpr Pin D32
Definition daisy_seed.h:246
constexpr Pin D13
Definition daisy_seed.h:211
constexpr Pin A10
Definition daisy_seed.h:241
constexpr Pin D11
Definition daisy_seed.h:209
constexpr Pin D20
Definition daisy_seed.h:218
constexpr Pin A8
Definition daisy_seed.h:239
constexpr Pin A9
Definition daisy_seed.h:240
constexpr Pin D23
Definition daisy_seed.h:221
constexpr Pin D8
Definition daisy_seed.h:206
constexpr Pin D25
Definition daisy_seed.h:223
constexpr Pin D18
Definition daisy_seed.h:216
constexpr Pin D12
Definition daisy_seed.h:210
constexpr Pin D7
Definition daisy_seed.h:205
constexpr Pin D15
Definition daisy_seed.h:213
constexpr Pin D22
Definition daisy_seed.h:220
constexpr Pin D28
Definition daisy_seed.h:226
constexpr Pin D17
Definition daisy_seed.h:215
constexpr Pin A11
Definition daisy_seed.h:242
constexpr Pin D26
Definition daisy_seed.h:224
constexpr Pin D6
Definition daisy_seed.h:204
constexpr Pin D2
Definition daisy_seed.h:200
constexpr Pin A5
Definition daisy_seed.h:236
constexpr Pin A3
Definition daisy_seed.h:234
constexpr Pin D14
Definition daisy_seed.h:212
constexpr Pin A13
Definition daisy_seed.h:250
constexpr Pin D5
Definition daisy_seed.h:203
constexpr Pin A0
Definition daisy_seed.h:231
constexpr Pin D16
Definition daisy_seed.h:214
constexpr Pin D1
Definition daisy_seed.h:199
constexpr Pin D29
Definition daisy_seed.h:227
Hardware defines and helpers for daisy field platform.
Definition index.h:2
@ PORTA
Definition daisy_core.h:177
@ PORTB
Definition daisy_core.h:178
@ PORTC
Definition daisy_core.h:179
@ PORTD
Definition daisy_core.h:180
@ PORTG
Definition daisy_core.h:183
representation of hardware port/pin combination
Definition daisy_core.h:193
Definition qspi.h:59
SampleRate
Definition sai.h:58