Skip to content

Commit a6642ac

Browse files
committed
Add warnings for pin conflicts in AudioKit
1 parent dbf6d6c commit a6642ac

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ void loop(){
8181
8282
```
8383
Each stream has it's own configuration object that should be passed to the begin method. The defaultConfig() method is providing a default proposal which will usually "just work". Please consult
84-
the class documentation for the available configuration parameters.
84+
the class documentation for the available configuration parameters. You can also easily adapt any provided examples: If you e.g. replace the I2SStream with the AnalogAudioStream class, you will get analog instead of digital output.
8585

8686
Further examples can be found in the [Wiki](https://github.com/pschatzmann/arduino-audio-tools/wiki/Examples). The library also provides a versatile [AudioPlayer](https://github.com/pschatzmann/arduino-audio-tools/wiki/The-Audio-Player-Class).
8787

src/AudioLibs/AudioKit.h

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -536,16 +536,26 @@ class AudioKitStream : public AudioStreamX {
536536
/// Setup the supported default actions
537537
void setupActions() {
538538
LOGI(LOG_METHOD);
539-
actions.add(kit.pinHeadphoneDetect(), actionHeadphoneDetection);
540-
// This clashes with the SD CS pin for AIThinker
541-
if (!cfg.sd_active && (AUDIOKIT_BOARD!=5 && AUDIOKIT_BOARD!=6)){
539+
// pin conflicts with AIThinker A101 and headphone detection
540+
if (! (cfg.sd_active && AUDIOKIT_BOARD==6)) {
541+
actions.add(kit.pinHeadphoneDetect(), actionHeadphoneDetection);
542+
} else {
543+
LOGW("Headphone detection ignored because of conflict: %d ",kit.pinHeadphoneDetect());
544+
}
545+
546+
// pin conflicts with the SD CS pin for AIThinker and buttons
547+
if (! (cfg.sd_active && (AUDIOKIT_BOARD==5 || AUDIOKIT_BOARD==6))){
542548
addAction(kit.pinInputMode(), actionStartStop);
549+
} else {
550+
LOGW("Mode Button ignored because of conflict: %d ",kit.pinInputMode());
543551
}
544552

545-
// conflicts with SD Lyrat SD CS Pin
546-
if (!cfg.sd_active && (AUDIOKIT_BOARD==5 || AUDIOKIT_BOARD==6)){
553+
// pin conflicts with SD Lyrat SD CS Pin and buttons
554+
if (! (cfg.sd_active && AUDIOKIT_BOARD==1)){
547555
addAction(kit.pinVolumeDown(), actionVolumeDown);
548556
addAction(kit.pinVolumeUp(), actionVolumeUp);
557+
} else {
558+
LOGW("Volume Buttons ignored because of conflict: %d ",kit.pinVolumeDown());
549559
}
550560
}
551561
};

0 commit comments

Comments
 (0)