Mercurial > hg > beaglert
annotate include/I2c_Codec.h @ 39:638bc1ae2500 staging
Improved readibility of the DIGITAL code in the PRU, using register names instead of aliases and expanding some of the macros, removing unused macros. Binaries were not modified
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Wed, 13 May 2015 12:18:10 +0100 |
parents | 8a575ba3ab52 |
children | ef9392d077a4 |
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 |
andrewm@0 | 31 int setDACVolume(int halfDbSteps); |
andrewm@0 | 32 int writeDACVolumeRegisters(bool mute); |
andrewm@0 | 33 int setADCVolume(int halfDbSteps); |
andrewm@0 | 34 int writeADCVolumeRegisters(bool mute); |
andrewm@0 | 35 int setHPVolume(int halfDbSteps); |
andrewm@0 | 36 int writeHPVolumeRegisters(); |
andrewm@0 | 37 |
andrewm@0 | 38 int readI2C(); |
andrewm@0 | 39 |
andrewm@0 | 40 I2c_Codec(); |
andrewm@0 | 41 ~I2c_Codec(); |
andrewm@0 | 42 |
andrewm@0 | 43 private: |
andrewm@0 | 44 bool running; |
andrewm@0 | 45 int dacVolumeHalfDbs; |
andrewm@0 | 46 int adcVolumeHalfDbs; |
andrewm@0 | 47 int hpVolumeHalfDbs; |
andrewm@0 | 48 }; |
andrewm@0 | 49 |
andrewm@0 | 50 |
andrewm@0 | 51 #endif /* I2CCODEC_H_ */ |