File tree Expand file tree Collapse file tree 3 files changed +15
-23
lines changed
examples/examples-custom-boards/lyrat-mini Expand file tree Collapse file tree 3 files changed +15
-23
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ void setup(void) {
15
15
16
16
auto cfg = i2s.defaultConfig (RX_MODE);
17
17
cfg.copyFrom (info);
18
- // cfg.input_device = ADC_INPUT_LINE2;
18
+ // cfg.i2s_function = CODEC; // or CODEC_ADC
19
19
i2s.begin (cfg);
20
20
21
21
// make sure that we have the correct number of channels set up
Original file line number Diff line number Diff line change 9
9
#define PIN_SD_CARD_MISO 2
10
10
#define PIN_SD_CARD_MOSI 15
11
11
#define PIN_SD_CARD_CLK 14
12
+ #define PIN_SD_CARD_DET 34
13
+
12
14
13
15
// Arduino Setup
14
16
void setup (void ) {
15
17
Serial.begin (115200 );
16
18
17
19
// setup SPI
18
- SPI.begin (PIN_SD_CARD_CLK, PIN_SD_CARD_MISO, PIN_SD_CARD_MOSI, PIN_SD_CARD_CLK);
20
+ SPI.begin (PIN_SD_CARD_CLK, PIN_SD_CARD_MISO, PIN_SD_CARD_MOSI, PIN_SD_CARD_CS);
21
+
22
+ // Determin if there is an SD card
23
+ pinMode (PIN_SD_CARD_DET, INPUT);
24
+ if (digitalRead (PIN_SD_CARD_DET)!=0 ){
25
+ Serial.println (" No SD Card detected" );
26
+ }
19
27
20
28
// Setup SD and open file
21
- if (!SD.begin (PIN_SD_CARD_CLK, SPI )){
29
+ if (!SD.begin (PIN_SD_CARD_CS )){
22
30
Serial.println (" SD.begin failed" );
23
31
while (true );
24
32
}
@@ -33,5 +41,4 @@ void setup(void) {
33
41
}
34
42
35
43
// Arduino loop - repeated processing
36
- void loop () {
37
- }
44
+ void loop () {}
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ struct I2SCodecConfig : public I2SConfig {
26
26
output_device_t output_device = DAC_OUTPUT_ALL;
27
27
// to be compatible with the AudioKitStream -> do not activate SD spi if false
28
28
bool sd_active = true ;
29
-
29
+ PinFunction i2s_function = PinFunction::CODEC;
30
30
bool operator ==(I2SCodecConfig alt) {
31
31
return input_device == alt.input_device &&
32
32
output_device == alt.output_device && *((AudioInfo *)this ) == alt;
@@ -253,23 +253,8 @@ class I2SCodecStream : public AudioStream, public VolumeSupport {
253
253
audio_driver_local::Optional<PinsI2S> getI2SPins (){
254
254
TRACED ();
255
255
audio_driver_local::Optional<PinsI2S> i2s;
256
- // special logic if we have a board which has a dedicated microphone I2S port
257
- if (cfg.rx_tx_mode == RX_MODE){
258
- i2s = p_board->getPins ().getI2SPins (PinFunction::CODEC_ADC);
259
- #ifdef ESP32
260
- if (i2s){
261
- cfg.port_no = i2s.value ().port ;
262
- LOGI (" Using port %d for input" , cfg.port_no );
263
- }
264
- #endif
265
- }
266
-
267
- // Deterine regular I2S pins
268
- if (!i2s){
269
- // setup pins in i2s config
270
- i2s = p_board->getPins ().getI2SPins ();
271
- }
272
- return i2s;
256
+ // Deterine I2S pins
257
+ return p_board->getPins ().getI2SPins (cfg.i2s_function );
273
258
}
274
259
275
260
bool beginCodec (I2SCodecConfig info) {
You can’t perform that action at this time.
0 commit comments