瀏覽代碼

Merge pull request #334 from jurgenbelien/master

Switch headphone source between input and DAC
dds
Paul Stoffregen 3 年之前
父節點
當前提交
8bc5b0cfb7
沒有連結到貢獻者的電子郵件帳戶。
共有 1 個檔案被更改,包括 13 行新增0 行删除
  1. +13
    -0
      control_sgtl5000.h

+ 13
- 0
control_sgtl5000.h 查看文件

@@ -30,6 +30,10 @@
#include <AudioStream.h>
#include "AudioControl.h"

// SGTL5000-specific defines for headphones
#define AUDIO_HEADPHONE_DAC 0
#define AUDIO_HEADPHONE_LINEIN 1

class AudioControlSGTL5000 : public AudioControl
{
public:
@@ -56,6 +60,15 @@ public:
return false;
}
}
bool headphoneSelect(int n) {
if (n == AUDIO_HEADPHONE_DAC) {
return write(0x0024, ana_ctrl | (1<<6)); // route DAC to headphones out
} else if (n == AUDIO_HEADPHONE_LINEIN) {
return write(0x0024, ana_ctrl & ~(1<<6)); // route linein to headphones out
} else {
return false;
}
}
bool volume(float left, float right);
bool micGain(unsigned int dB);
bool lineInLevel(uint8_t n) { return lineInLevel(n, n); }

Loading…
取消
儲存