瀏覽代碼

Fix ADC input with various clock speeds

fixes #96
dds
PaulStoffregen 8 年之前
父節點
當前提交
982426cf6b
共有 1 個檔案被更改,包括 4 行新增0 行删除
  1. +4
    -0
      input_adc.cpp

+ 4
- 0
input_adc.cpp 查看文件

@@ -46,7 +46,11 @@ void AudioInputAnalog::init(uint8_t pin)
// leaves the ADC in a state that's mostly ready to use
analogReadRes(16);
analogReference(INTERNAL); // range 0 to 1.2 volts
#if F_BUS == 96000000 || F_BUS == 48000000 || F_BUS == 24000000
analogReadAveraging(8);
#else
analogReadAveraging(4);
#endif
// Actually, do many normal reads, to start with a nice DC level
for (i=0; i < 1024; i++) {
sum += analogRead(pin);

Loading…
取消
儲存