<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[forum.rcl-radio.ru &mdash; 5-и полосный эквалайзер TEA6360]]></title>
	<link rel="self" href="http://forum.rcl-radio.ru/extern.php?action=feed&amp;tid=56&amp;type=atom" />
	<updated>2019-09-04T08:17:58Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.rcl-radio.ru/viewtopic.php?id=56</id>
		<entry>
			<title type="html"><![CDATA[5-и полосный эквалайзер TEA6360]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=64#p64" />
			<content type="html"><![CDATA[<p><span class="postimg"><img src="http://forum.rcl-radio.ru/uploads/images/2019/09/15182fe9a5ba3c6cfc7e1dee52054140.png" alt="http://forum.rcl-radio.ru/uploads/images/2019/09/15182fe9a5ba3c6cfc7e1dee52054140.png" /></span> <br /><a href="http://rcl-radio.ru/wp-content/uploads/2014/11/TEA6360.pdf">http://rcl-radio.ru/wp-content/uploads/ … EA6360.pdf</a></p><p>FEATURES<br />• Monolithic integrated 5-band stereo equalizer circuit<br />• Five filters for each channel<br />• Centre frequency, bandwidth and maximum boost/cut<br />defined by external components<br />• Choise for variable or constant Q-factor via I2C software<br />• Defeat mode<br />• All stages are DC-coupled<br />• I<br />2C-bus control for all functions<br />• Two different modul addresses programmable.</p><p>1. Filter control with variable quality factor<br />2. Filter control with constant quality factor<br />3. Filter control with quasi-constant quality factor</p><p>test.ino</p><div class="codebox"><pre><code>// pin 18 == GND
#include &lt;TEA6360.h&gt;
#include &lt;Wire.h&gt;
 TEA6360 tea;

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

void loop(){}

void audio(){
 // НОМЕР ПОЛОСЫ int 1...5, РЕЖИМ ФИЛЬТРА int 1...3, УСИЛЕНИЕ/ОСЛАБЛЕНИЕ 12 дБ шаг 2.4 дБ int -5...5 
  tea.setFilter(1,1,5);// 12 kHz
  tea.setFilter(2,1,5);// 2,95 kHz
  tea.setFilter(3,1,1);// 790 Hz
  tea.setFilter(4,1,3);// 205 Hz
  tea.setFilter(5,1,3);// 59 Hz
}</code></pre></div><p>TEA6360.h</p><div class="codebox"><pre><code>#ifndef TEA6360_H
#define TEA6360_H


#define TEA6360_address 0b1000010 // pin 18 gnd 

#define F_1        0b00000000
#define F_2        0b00000001
#define F_3        0b00000010
#define F_4        0b00000011
#define F_5        0b00000100

#include &lt;Arduino.h&gt;
class TEA6360
{
  public:
    TEA6360();
        void setFilter(int f, int filter, int gain); //1...5, 1...3, -5...0...+5
    
  private:
        void writeWire(char a, char b);
};
    
#endif //TEA6360_H</code></pre></div><p>TEA6360.cp</p><div class="codebox"><pre><code>#include &lt;Arduino.h&gt;
#include &lt;Wire.h&gt;
#include &quot;TEA6360.h&quot;

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

void TEA6360::setFilter(int f, int filter ,int gain){
           switch(f){
               case 1: f = F_1;break;
               case 2: f = F_2;break;
               case 3: f = F_3;break;
               case 4: f = F_4;break;
               case 5: f = F_5;break;
   }
   if(filter==3){
           switch(gain){
               case 5: gain = 0b01010000;break;
               case 4: gain = 0b01010001;break;
               case 3: gain = 0b01010010;break;
               case 2: gain = 0b01000010;break;
               case 1: gain = 0b00110010;break;
               
               case 0: gain = 0b00000000;break;
               
               case -1: gain = 0b00100011;break;
               case -2: gain = 0b00100100;break;
               case -3: gain = 0b00100101;break;
               case -4: gain = 0b00010101;break;
               case -5: gain = 0b00000101;break;     
   }}
     if(filter==2){
           switch(gain){
               case 5: gain = 0b01010000;break;
               case 4: gain = 0b01010001;break;
               case 3: gain = 0b01010010;break;
               case 2: gain = 0b01010011;break;
               case 1: gain = 0b01010100;break;
               
               case 0: gain = 0b00000000;break;
               
               case -1: gain = 0b01000101;break;
               case -2: gain = 0b00110101;break;
               case -3: gain = 0b00100101;break;
               case -4: gain = 0b00010101;break;
               case -5: gain = 0b00000101;break;     
   }}
    if(filter==1){
           switch(gain){
               case 5: gain = 0b01010000;break;
               case 4: gain = 0b01000000;break;
               case 3: gain = 0b00110000;break;
               case 2: gain = 0b00010000;break;
               case 1: gain = 0b00010000;break;
               
               case 0: gain = 0b00000000;break;
               
               case -1: gain = 0b00000001;break;
               case -2: gain = 0b00000010;break;
               case -3: gain = 0b00000011;break;
               case -4: gain = 0b00000100;break;
               case -5: gain = 0b00000101;break;     
   }}
           
           writeWire(f, gain); 
   }


void TEA6360::writeWire(char a, char b){
  Wire.beginTransmission(TEA6360_address);
  Wire.write (a);
  Wire.write (b);
  Wire.endTransmission();
}</code></pre></div><p>Библиотека протестирована</p>]]></content>
			<author>
				<name><![CDATA[liman324]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2</uri>
			</author>
			<updated>2019-09-04T08:17:58Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=64#p64</id>
		</entry>
</feed>
