Browse Source

AIC3206: rename channel macros, add comments

dds
Chip Audette 6 years ago
parent
commit
58bebdab44
2 changed files with 10 additions and 10 deletions
  1. +3
    -3
      control_tlv320aic3206.cpp
  2. +7
    -7
      control_tlv320aic3206.h

+ 3
- 3
control_tlv320aic3206.cpp View File

coeff[0] = 0x7FFFFFFF; coeff[1] = 0; coeff[2]=0; coeff[0] = 0x7FFFFFFF; coeff[1] = 0; coeff[2]=0;
} }
setIIRCoeffOnADC(BOTH_CHAN, coeff); //needs twos-compliment
setIIRCoeffOnADC(AIC3206_BOTH_CHAN, coeff); //needs twos-compliment
} }




uint32_t prev_state = aic_readPage(0x00,0x51); uint32_t prev_state = aic_readPage(0x00,0x51);
aic_writePage(0x00,0x51,prev_state & (0b00111111)); //clear first two bits aic_writePage(0x00,0x51,prev_state & (0b00111111)); //clear first two bits
if (chan == BOTH_CHAN) {
if (chan == AIC3206_BOTH_CHAN) {
setIIRCoeffOnADC_Left(coeff); setIIRCoeffOnADC_Left(coeff);
setIIRCoeffOnADC_Right(coeff); setIIRCoeffOnADC_Right(coeff);
} else if (chan == LEFT_CHAN) {
} else if (chan == AIC3206_LEFT_CHAN) {
setIIRCoeffOnADC_Left(coeff); setIIRCoeffOnADC_Left(coeff);
} else { } else {
setIIRCoeffOnADC_Right(coeff); setIIRCoeffOnADC_Right(coeff);

+ 7
- 7
control_tlv320aic3206.h View File

#define AIC3206_MIC_BIAS_VSUPPLY 4 #define AIC3206_MIC_BIAS_VSUPPLY 4
#define AIC3206_DEFAULT_MIC_BIAS AIC3206_MIC_BIAS_2_5 #define AIC3206_DEFAULT_MIC_BIAS AIC3206_MIC_BIAS_2_5


#define BOTH_CHAN 0
#define LEFT_CHAN 1
#define RIGHT_CHAN 2
#define AIC3206_BOTH_CHAN 0
#define AIC3206_LEFT_CHAN 1
#define AIC3206_RIGHT_CHAN 2


class AudioControlTLV320AIC3206: public AudioControl class AudioControlTLV320AIC3206: public AudioControl
{ {
AudioControlTLV320AIC3206(int _resetPin, bool _debugToSerial) { resetPinAIC = _resetPin; debugToSerial = _debugToSerial; }; AudioControlTLV320AIC3206(int _resetPin, bool _debugToSerial) { resetPinAIC = _resetPin; debugToSerial = _debugToSerial; };
bool enable(void); bool enable(void);
bool disable(void); bool disable(void);
bool outputSelect(int n);
bool outputSelect(int n); //use AIC3206_OUTPUT_HEADPHONE_JACK_OUT or one of other choices defined earlier
bool volume(float n); bool volume(float n);
bool volume_dB(float n); bool volume_dB(float n);
bool inputLevel(float n); //dummy to be compatible with Teensy Audio Library bool inputLevel(float n); //dummy to be compatible with Teensy Audio Library
bool inputSelect(int n);
bool inputSelect(int n); //use AIC3206_INPUT_IN1 or one of other choices defined earlier
bool setInputGain_dB(float n); bool setInputGain_dB(float n);
bool setMicBias(int n);
bool setMicBias(int n); //use AIC3206_MIC_BIAS_OFF or AIC3206_MIC_BIAS_2_5 or one of other choices defined earlier
bool updateInputBasedOnMicDetect(int setting = AIC3206_INPUT_IN1); //which input to monitor bool updateInputBasedOnMicDetect(int setting = AIC3206_INPUT_IN1); //which input to monitor
bool enableMicDetect(bool); bool enableMicDetect(bool);
int readMicDetect(void); int readMicDetect(void);
void setHPFonADC(bool enable, float cutoff_Hz, float fs_Hz); void setHPFonADC(bool enable, float cutoff_Hz, float fs_Hz);
float getHPCutoff_Hz(void) { return HP_cutoff_Hz; } float getHPCutoff_Hz(void) { return HP_cutoff_Hz; }
float getSampleRate_Hz(void) { return sample_rate_Hz; } float getSampleRate_Hz(void) { return sample_rate_Hz; }
void setIIRCoeffOnADC(int chan, uint32_t *coeff);
void setIIRCoeffOnADC(int chan, uint32_t *coeff); //for chan, use AIC3206_BOTH_CHAN or AIC3206_LEFT_CHAN or AIC3206_RIGHT_CHAN
bool enableAutoMuteDAC(bool, uint8_t); bool enableAutoMuteDAC(bool, uint8_t);
private: private:
void aic_reset(void); void aic_reset(void);

Loading…
Cancel
Save