I2c_Codec.h
1 /*
2  * I2c_Codec.h
3  *
4  * Handle writing the registers to the TLV320AIC310x
5  * series audio codecs, used on the BeagleBone Audio Cape.
6  * This code is designed to bypass the ALSA driver and
7  * configure the codec directly in a sensible way. It
8  * is complemented by code running on the PRU which uses
9  * the McASP serial port to transfer audio data.
10  *
11  * Created on: May 25, 2014
12  * Author: Andrew McPherson
13  */
14 
15 
16 #ifndef I2CCODEC_H_
17 #define I2CCODEC_H_
18 
19 #include "I2c.h"
20 
21 
22 class I2c_Codec : public I2c
23 {
24  short unsigned int pllJ;
25  short unsigned int pllD;
26  short unsigned int pllP;
27  short unsigned int pllR;
28 public:
29  int writeRegister(unsigned int reg, unsigned int value);
30 
31  int initCodec();
32  int startAudio(int dual_rate);
33  int stopAudio();
34 
35  int setPllJ(short unsigned int j);
36  int setPllD(unsigned int d);
37  int setPllP(short unsigned int p);
38  int setPllR(unsigned int r);
39  int setPllK(float k);
40  int setAudioSamplingRate(float newSamplingRate);
41  short unsigned int getPllJ();
42  unsigned int getPllD();
43  unsigned int getPllP();
44  unsigned int getPllR();
45  float getPllK();
46  float getAudioSamplingRate();
47  int setPga(float newGain, unsigned short int channel);
48  int setDACVolume(int halfDbSteps);
49  int writeDACVolumeRegisters(bool mute);
50  int setADCVolume(int halfDbSteps);
51  int writeADCVolumeRegisters(bool mute);
52  int setHPVolume(int halfDbSteps);
53  int writeHPVolumeRegisters();
54 
55  int readI2C();
56 
57  I2c_Codec();
58  ~I2c_Codec();
59 
60 private:
61  bool running;
62  int dacVolumeHalfDbs;
63  int adcVolumeHalfDbs;
64  int hpVolumeHalfDbs;
65 };
66 
67 
68 #endif /* I2CCODEC_H_ */
Definition: I2c.h:28
Definition: I2c_Codec.h:22