<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[forum.rcl-radio.ru &mdash; TDA7448]]></title>
	<link rel="self" href="http://forum.rcl-radio.ru/extern.php?action=feed&amp;tid=471&amp;type=atom" />
	<updated>2022-03-04T13:49:52Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.rcl-radio.ru/viewtopic.php?id=471</id>
		<entry>
			<title type="html"><![CDATA[TDA7448]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=5508#p5508" />
			<content type="html"><![CDATA[<p><span class="attention-yellow"></span> </p><p>TDA7448.h<br /></p><div class="codebox"><pre><code>// Александр Лиман
// liman324@yandex.ru

#ifndef TDA7448_H
#define TDA7448_H
// address 7 bit
#define TDA7448_address 0b1000100

//Sub addresses
#define TDA7448_1       0b00000000 
#define TDA7448_2       0b00000001 
#define TDA7448_3       0b00000010 
#define TDA7448_4       0b00000011 
#define TDA7448_5       0b00000100 
#define TDA7448_6       0b00000101

#include &lt;Arduino.h&gt;
class TDA7448
{
  public:
    TDA7448();        
        void setAtt(int spek, int att_spek); 

  private:
	void writeWire(char a, char b);
};
	
#endif //TDA7448_H</code></pre></div><p>TDA7448.cpp<br /></p><div class="codebox"><pre><code>#include &lt;Arduino.h&gt;
#include &lt;Wire.h&gt;
#include &quot;TDA7448.h&quot;

TDA7448::TDA7448(){
	Wire.begin();
}

void TDA7448::setAtt(int spek, int att_spek){
      switch(spek){
        case 1: spek = TDA7448_1;break;
        case 2: spek = TDA7448_2;break;
        case 3: spek = TDA7448_3;break;  
        case 4: spek = TDA7448_4;break;
        case 5: spek = TDA7448_5;break;
        case 6: spek = TDA7448_6;break;   
}
       att_spek = abs(att_spek);
  writeWire(spek, att_spek);
}



void TDA7448::writeWire(char a, char b){
  Wire.beginTransmission(TDA7448_address);
  Wire.write (a);
  Wire.write (b);
  Wire.endTransmission();
}</code></pre></div><p>test.ino<br /></p><div class="codebox"><pre><code>#include &lt;Wire.h&gt;
#include &lt;TDA7448.h&gt;
 TDA7448 tda;

 void setup(){Wire.begin();}

 void loop(){
  audio_tda();
  delay(1000);
  }
 void audio_tda(){
  tda.setAtt(1,0);// 0 макс громк, -79(79) мин громк
  tda.setAtt(2,0);
  tda.setAtt(3,0);
  tda.setAtt(4,0);
  tda.setAtt(5,0);
  tda.setAtt(6,0);
  }
 </code></pre></div>]]></content>
			<author>
				<name><![CDATA[liman324]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2</uri>
			</author>
			<updated>2022-03-04T13:49:52Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=5508#p5508</id>
		</entry>
</feed>
