This library controls a ST TDA7419 audio control IC. This is part of a project to implement an mbed controlled car stereo. The TDA7419 will take in stereo and output four channels of audio plus a subwoofer channel.
PreampTDA7419.h
- Committer:
- danielashercohen
- Date:
- 2014-10-20
- Revision:
- 1:69c37f1ab7df
- Parent:
- 0:86ea14016b10
- Child:
- 2:34a58356394c
File content as of revision 1:69c37f1ab7df:
/** TDA7419 PreAmp library, I2C * * @Author: Dan Cohen */ #ifndef DigoleSerialDisp_h #define DigoleSerialDisp_h #include "mbed.h" #include <inttypes.h> /////////////////////////// // Variables for TDA7419 // /////////////////////////// // I2C address for TDA7419 #define TDA7419_ADDRESS 0x44 #define DEC 10 #define HEX 16 #define OCT 8 #define BIN 2 /** TDA7419 PreAmp library * * Includes the commands for volume, fader, subwoofer and tone controls * */ class PreampTDA7419 { public: /** Create a new Digole Serial Display interface * * @param sda is the pin for I2C SDA * @param scl is the pin for I2C SCL * @param address is the 7-bit address (default is 0x27 for the device) */ PreampTDA7419(PinName sda, PinName scl); /** Sets a new I2C address for the Preamp board (perhaps not useful as it is fixed for the TDA4719) * @param address is the the new address */ void setI2CAddress(uint8_t add); /** Set up the TDA7419 to default values that will allow audio to pass through the device * */ void initialize(); int i2c_write(int command, int value); /** Set up the TDA7419 to default values that will allow audio to pass through the device * */ void setVolume (int volume); int readVolume (); int increaseVolume(); int decreaseVolume(); void setInput (int input); int readInput (); int increaseTreble(); int decreaseTreble(); int readTreble (); private: // Signals related to I2C communication I2C _device; uint8_t _address; uint8_t _Comdelay; //////////////////////////////////// // register addresses for TDA7419 // //////////////////////////////////// int _volume; int _input; int _mute; int _mix; // for register 4 Treble Filter int _referenceInE; int _trebleCenterFreq; int _treble; // for middle frequecy filter int _middleSoftStep; int _middleQ; int _middle; // for bass frequecy filter int _bassSoftStep; int _bassQ; int _bass; // for output attenuators int _atten_lf; int _atten_rf; int _atten_lr; int _atten_rr; int _atten_mix; int _atten_sub; void writeToTDA7419 (int address, int value); int calcAttenuationReg (int attenuation); int calcToneAttenuationReg(int attenuation); void updateTDA7419Reg(); }; #endif