Mercurial > hg > beaglert
annotate include/I2c_Codec.h @ 96:ef9392d077a4
Added methods to I2c_Codec to interact with the PLL
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Thu, 23 Jul 2015 02:36:49 +0100 |
parents | 8a575ba3ab52 |
children | e24c531220ee |
rev | line source |
---|---|
andrewm@0 | 1 /* |
andrewm@0 | 2 * I2c_Codec.h |
andrewm@0 | 3 * |
andrewm@0 | 4 * Handle writing the registers to the TLV320AIC310x |
andrewm@0 | 5 * series audio codecs, used on the BeagleBone Audio Cape. |
andrewm@0 | 6 * This code is designed to bypass the ALSA driver and |
andrewm@0 | 7 * configure the codec directly in a sensible way. It |
andrewm@0 | 8 * is complemented by code running on the PRU which uses |
andrewm@0 | 9 * the McASP serial port to transfer audio data. |
andrewm@0 | 10 * |
andrewm@0 | 11 * Created on: May 25, 2014 |
andrewm@0 | 12 * Author: Andrew McPherson |
andrewm@0 | 13 */ |
andrewm@0 | 14 |
andrewm@0 | 15 |
andrewm@0 | 16 #ifndef I2CCODEC_H_ |
andrewm@0 | 17 #define I2CCODEC_H_ |
andrewm@0 | 18 |
andrewm@0 | 19 #include "I2c.h" |
andrewm@0 | 20 |
andrewm@0 | 21 |
andrewm@0 | 22 class I2c_Codec : public I2c |
andrewm@0 | 23 { |
andrewm@0 | 24 public: |
andrewm@0 | 25 int writeRegister(unsigned int reg, unsigned int value); |
andrewm@0 | 26 |
andrewm@0 | 27 int initCodec(); |
andrewm@0 | 28 int startAudio(int dual_rate); |
andrewm@0 | 29 int stopAudio(); |
andrewm@0 | 30 |
giuliomoro@96 | 31 int setPllJ(short unsigned int j); |
giuliomoro@96 | 32 int setPllD(unsigned int d); |
giuliomoro@96 | 33 int setPllK(float k); |
andrewm@0 | 34 int setDACVolume(int halfDbSteps); |
andrewm@0 | 35 int writeDACVolumeRegisters(bool mute); |
andrewm@0 | 36 int setADCVolume(int halfDbSteps); |
andrewm@0 | 37 int writeADCVolumeRegisters(bool mute); |
andrewm@0 | 38 int setHPVolume(int halfDbSteps); |
andrewm@0 | 39 int writeHPVolumeRegisters(); |
andrewm@0 | 40 |
andrewm@0 | 41 int readI2C(); |
andrewm@0 | 42 |
andrewm@0 | 43 I2c_Codec(); |
andrewm@0 | 44 ~I2c_Codec(); |
andrewm@0 | 45 |
andrewm@0 | 46 private: |
andrewm@0 | 47 bool running; |
andrewm@0 | 48 int dacVolumeHalfDbs; |
andrewm@0 | 49 int adcVolumeHalfDbs; |
andrewm@0 | 50 int hpVolumeHalfDbs; |
andrewm@0 | 51 }; |
andrewm@0 | 52 |
andrewm@0 | 53 |
andrewm@0 | 54 #endif /* I2CCODEC_H_ */ |