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.
Diff: PreampTDA7419.h
- Revision:
- 1:69c37f1ab7df
- Parent:
- 0:86ea14016b10
- Child:
- 2:34a58356394c
--- a/PreampTDA7419.h Sun Oct 19 04:30:22 2014 +0000
+++ b/PreampTDA7419.h Mon Oct 20 05:54:52 2014 +0000
@@ -7,8 +7,8 @@
#include "mbed.h"
#include <inttypes.h>
-
- ///////////////////////////
+
+///////////////////////////
// Variables for TDA7419 //
///////////////////////////
// I2C address for TDA7419
@@ -44,12 +44,64 @@
*
*/
void initialize();
- int i2c_write(char command, char value);
-
+ 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();
};