annotate include/I2c_Codec.h @ 134:09a32ca96255

Fixed and improved I2c_codec. Copied from the scope-refactoring branch
author Giulio Moro <giuliomoro@yahoo.it>
date Thu, 27 Aug 2015 03:39:11 +0100
parents ef9392d077a4
children d064234468cd
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 {
giuliomoro@134 24 short unsigned int pllJ;
giuliomoro@134 25 short unsigned int pllD;
andrewm@0 26 public:
andrewm@0 27 int writeRegister(unsigned int reg, unsigned int value);
andrewm@0 28
andrewm@0 29 int initCodec();
andrewm@0 30 int startAudio(int dual_rate);
andrewm@0 31 int stopAudio();
andrewm@0 32
giuliomoro@96 33 int setPllJ(short unsigned int j);
giuliomoro@96 34 int setPllD(unsigned int d);
giuliomoro@96 35 int setPllK(float k);
giuliomoro@134 36 int setAudioSamplingRate(float newSamplingRate);
giuliomoro@134 37 short unsigned int getPllJ();
giuliomoro@134 38 unsigned int getPllD();
giuliomoro@134 39 float getPllK();
giuliomoro@134 40 float getAudioSamplingRate();
andrewm@0 41 int setDACVolume(int halfDbSteps);
andrewm@0 42 int writeDACVolumeRegisters(bool mute);
andrewm@0 43 int setADCVolume(int halfDbSteps);
andrewm@0 44 int writeADCVolumeRegisters(bool mute);
andrewm@0 45 int setHPVolume(int halfDbSteps);
andrewm@0 46 int writeHPVolumeRegisters();
andrewm@0 47
andrewm@0 48 int readI2C();
andrewm@0 49
andrewm@0 50 I2c_Codec();
andrewm@0 51 ~I2c_Codec();
andrewm@0 52
andrewm@0 53 private:
andrewm@0 54 bool running;
andrewm@0 55 int dacVolumeHalfDbs;
andrewm@0 56 int adcVolumeHalfDbs;
andrewm@0 57 int hpVolumeHalfDbs;
andrewm@0 58 };
andrewm@0 59
andrewm@0 60
andrewm@0 61 #endif /* I2CCODEC_H_ */