<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[forum.rcl-radio.ru &mdash; PT2348 4.1-Channel Audio Processor with Subwoofer]]></title>
		<link>http://forum.rcl-radio.ru/viewtopic.php?id=82</link>
		<atom:link href="http://forum.rcl-radio.ru/extern.php?action=feed&amp;tid=82&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «PT2348 4.1-Channel Audio Processor with Subwoofer».]]></description>
		<lastBuildDate>Sun, 14 Feb 2021 21:41:15 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: PT2348 4.1-Channel Audio Processor with Subwoofer]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=3093#p3093</link>
			<description><![CDATA[<p>Переписываю код под OLED i2C 1306 экраны, для проекта. Выложу здесь наработки.</p>]]></description>
			<author><![CDATA[null@example.com (fcustoms)]]></author>
			<pubDate>Sun, 14 Feb 2021 21:41:15 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=3093#p3093</guid>
		</item>
		<item>
			<title><![CDATA[Re: PT2348 4.1-Channel Audio Processor with Subwoofer]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=3038#p3038</link>
			<description><![CDATA[<p>К +5 В</p>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Fri, 05 Feb 2021 13:02:22 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=3038#p3038</guid>
		</item>
		<item>
			<title><![CDATA[Re: PT2348 4.1-Channel Audio Processor with Subwoofer]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=3037#p3037</link>
			<description><![CDATA[<p>SW энкодера нужно поддягивать на 10к к земле? Разобрался у меня на плате нет его, стоят только 2.</p>]]></description>
			<author><![CDATA[null@example.com (fcustoms)]]></author>
			<pubDate>Fri, 05 Feb 2021 12:39:49 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=3037#p3037</guid>
		</item>
		<item>
			<title><![CDATA[Re: PT2348 4.1-Channel Audio Processor with Subwoofer]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=3036#p3036</link>
			<description><![CDATA[<p>Без энкодера работать не будет</p>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Fri, 05 Feb 2021 02:41:26 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=3036#p3036</guid>
		</item>
		<item>
			<title><![CDATA[Re: PT2348 4.1-Channel Audio Processor with Subwoofer]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=3035#p3035</link>
			<description><![CDATA[<p>Всё отключено, подключён только дисплей. Пробовал на nano и mega. Везде одинаково.</p>]]></description>
			<author><![CDATA[null@example.com (fcustoms)]]></author>
			<pubDate>Fri, 05 Feb 2021 02:22:18 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=3035#p3035</guid>
		</item>
		<item>
			<title><![CDATA[Re: PT2348 4.1-Channel Audio Processor with Subwoofer]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=3034#p3034</link>
			<description><![CDATA[<p>Проверьте энкодер, на плате энкодера должны стоять 3 подтягивающих резистора по 10 К на +Uпитания. Кнопка энкодера инверсная, нажатие = GND</p>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Fri, 05 Feb 2021 00:15:12 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=3034#p3034</guid>
		</item>
		<item>
			<title><![CDATA[Re: PT2348 4.1-Channel Audio Processor with Subwoofer]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=3031#p3031</link>
			<description><![CDATA[<p>Собрал схему, почему то у меня сам переключает бесконечно по кругу bass treble volume? даже при отключенных энкодере и pt2348. <br />Подскажите в чем проблема.</p>]]></description>
			<author><![CDATA[null@example.com (fcustoms)]]></author>
			<pubDate>Thu, 04 Feb 2021 23:14:54 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=3031#p3031</guid>
		</item>
		<item>
			<title><![CDATA[Re: PT2348 4.1-Channel Audio Processor with Subwoofer]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=444#p444</link>
			<description><![CDATA[<p>Пример использования PT2348</p><p>В примере используется LCD1602 (I2C), энкодер и две кнопки управления</p><p>Дополнительные библиотеки:<br /><a href="http://rcl-radio.ru/wp-content/uploads/2019/05/Encoder.zip">http://rcl-radio.ru/wp-content/uploads/ … ncoder.zip</a><br /><a href="http://rcl-radio.ru/wp-content/uploads/2018/11/MsTimer2.zip">http://rcl-radio.ru/wp-content/uploads/ … Timer2.zip</a><br /><a href="http://rcl-radio.ru/wp-content/uploads/2019/06/IRremote.zip">http://rcl-radio.ru/wp-content/uploads/ … remote.zip</a><br /><a href="http://forum.rcl-radio.ru/misc.php?action=pan_download&amp;item=45&amp;download=1">http://forum.rcl-radio.ru/misc.php?acti … download=1</a></p><div class="codebox"><pre><code>#define IR_1 0x2FDD02F // Кнопка вверх
#define IR_2 0x2FD32CD // Кнопка вниз
#define IR_3 0x2FD906F // Кнопка &gt;
#define IR_4 0x2FDF20D // Кнопка &lt;
#define IR_5 0x2FD708F // Кнопка IN

#include &lt;Wire.h&gt; 
#include &lt;PT2348.h&gt;
#include &lt;LiquidCrystal_I2C.h&gt;
#include &lt;Encoder.h&gt;
#include &lt;EEPROM.h&gt;
#include &lt;MsTimer2.h&gt;
#include &lt;boarddefs.h&gt;
#include &lt;IRremote.h&gt;
  PT2348 pt; 
  LiquidCrystal_I2C lcd(0x27,16,2);  // Устанавливаем дисплей
  IRrecv irrecv(12); // указываем вывод модуля IR приемника
  Encoder myEnc(9, 8);// DT, CLK
  decode_results ir; 
   byte a1[8] = {0b00000,0b10101,0b10101,0b10101,0b10101,0b10101,0b10101,0b00000};
   byte a2[8] = {0b00000,0b10100,0b10100,0b10100,0b10100,0b10100,0b10100,0b00000};
   byte a3[8] = {0b00000,0b10000,0b10000,0b10000,0b10000,0b10000,0b10000,0b00000};  
   unsigned long time,oldPosition  = -999,newPosition; 
   int vol,vol_d,z,z0,z1,w,w2,menu,bass,bass_d,treb,treb_d,in,www,menu2;
   int gain0,gain1,gain2,gain3,gain_d,lon,lon_d;
   int rf,lf,rt,lt,sab,vol_out,out,sab_f;
   byte gr1,gr2;

void setup(){
   Wire.begin();irrecv.enableIRIn();lcd.init();lcd.backlight();
  lcd.setCursor(0,0);lcd.print(&quot;     PT2348     &quot;);delay(2000);
  Serial.begin(9600); lcd.createChar(0,a1);lcd.createChar(1,a2);lcd.createChar(2,a3);
   pinMode(10,INPUT);  // МЕНЮ КНОПКА SW энкодера
   pinMode(2,INPUT);   // ВЫБОР ВХОДА КНОПКА IN
   pinMode(3,INPUT);   // КНОПКА MENU_2
   MsTimer2::set(3, to_Timer);MsTimer2::start();
  if(EEPROM.read(100)!=0){for(int i=0;i&lt;101;i++){EEPROM.update(i,0);}}// очистка памяти при первом включении 
   vol = EEPROM.read(0)-79;bass = EEPROM.read(1)-15;treb = EEPROM.read(2)-15;in = EEPROM.read(3);
   gain1 = EEPROM.read(5);gain2 = EEPROM.read(6);gain3 = EEPROM.read(7);lon = EEPROM.read(8);
   rf = EEPROM.read(10)-15;lf = EEPROM.read(11)-15;rt = EEPROM.read(12)-15;lt = EEPROM.read(13)-15;sab = EEPROM.read(14)-15;
   sab_f = EEPROM.read(18);
   cl();audio();
}

void loop(){
  if(digitalRead(10)==LOW&amp;&amp;menu2==0){menu++;cl();time=millis();w=1;w2=1;if(menu&gt;2){menu=0;}}// меню
  if(digitalRead(2)==HIGH&amp;&amp;menu2!=3){in++;cl();time=millis();w=1;w2=1;www=1;if(in&gt;3){in=1;};lcd.setCursor(0,0);lcd.print(&quot;    INPUT &quot;);lcd.print(in);audio();delay(2000);}// КНОПКА ВЫБОРА ВХОДА IN
  
  if(digitalRead(3)==HIGH){menu2++;menu=100;cl();time=millis();w=1;w2=1;lcd.setCursor(0,0);lcd.print(&quot;     MENU 2   &quot;);delay(2000);}
  if(digitalRead(10)==LOW&amp;&amp;menu2&gt;0){menu2++;cl();time=millis();w=1;w2=1;if(menu2&gt;4){menu2=0;menu=0;}}// меню

    ////////////////////// IR /////////////////////////////////////////////////
  if ( irrecv.decode( &amp;ir )) {Serial.print(&quot;0x&quot;);Serial.println( ir.value,HEX);irrecv.resume();time=millis();w=1;}// IR приемник - чтение, в мониторе порта отображаются коды кнопок
  if(ir.value==0){gr1=0;gr2=0;}// запрет нажатий не активных кнопок пульта

  if(ir.value==IR_1&amp;&amp;menu2==0){menu++;gr1=0;gr2=0;cl();time=millis();w=1;w2=1;if(menu&gt;2){menu=0;}}// меню кнопка вверх 
  if(ir.value==IR_2&amp;&amp;menu2==0){menu--;gr1=0;gr2=0;cl();time=millis();w=1;w2=1;if(menu&lt;0){menu=2;}}// меню кнопка вниз
  if(ir.value==IR_5&amp;&amp;menu2!=3){in++;gr1=0;gr2=0;cl();time=millis();w=1;w2=1;www=1;if(in&gt;3){in=1;};lcd.setCursor(0,0);lcd.print(&quot;    INPUT &quot;);lcd.print(in);audio();delay(2000);}// КНОПКА ВЫБОРА ВХОДА IN
  
   /////////////////////////////// VOLUME -79 ... +15 дБ ////////////////////////////////////////////////
 if(menu==0){
     if(ir.value==IR_3){vol++;gr1=1;gr2=0;cl1();w2=1;vol_func();audio();}// кнопка &gt; 
     if(ir.value==0xFFFFFFFF and gr1==1){vol++;gr2=0;cl1();w2=1;vol_func();audio();}// кнопка &gt;&gt;&gt;&gt;&gt;&gt;
     if(ir.value==IR_4){vol--;gr1=0;gr2=1;cl1();w2=1;vol_func();audio();}// кнопка &lt;
     if(ir.value==0xFFFFFFFF and gr2==1){vol--;gr1=0;cl1();w2=1;vol_func();audio();}// кнопка &lt;&lt;&lt;&lt;&lt;&lt;
   
   if (newPosition != oldPosition){oldPosition = newPosition;
     vol=vol+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;vol_func();audio();} 
     lcd.setCursor(0,0);lcd.print(&quot;VOLUME  &quot;);
     lcd.print(&quot; &quot;);lcd.print(vol);lcd.print(&quot; &quot;);lcd.setCursor(13,0);lcd.print(&quot;dB&quot;);vol_d=vol/2+40;
   if(w2==1){
   for(z=0,z0=0,z1=0;z&lt;=vol_d;z++,z1++){if(z1&gt;2){z1=0;z0++;}
   if(z1==1){lcd.setCursor(z0,1);lcd.write((uint8_t)0);lcd.setCursor(z0+1,1);lcd.print(&quot;   &quot;);}}
   if(z1==3){lcd.setCursor(z0,1);lcd.write((uint8_t)1);}
   if(z1==2){lcd.setCursor(z0,1);lcd.write((uint8_t)2);}w2=0;}}

   /////////////////////// BASS +/-20 dB ///////////////////////////////////////////////////////////
   if(menu==1){
     if(ir.value==IR_3){bass++;gr1=1;gr2=0;cl1();w2=1;bass_func();audio();}// кнопка &gt; 
     if(ir.value==0xFFFFFFFF and gr1==1){bass++;gr2=0;cl1();w2=1;bass_func();audio();}// кнопка &gt;&gt;&gt;&gt;&gt;&gt;
     if(ir.value==IR_4){bass--;gr1=0;gr2=1;cl1();w2=1;bass_func();audio();}// кнопка &lt; 
     if(ir.value==0xFFFFFFFF and gr2==1){bass--;gr1=0;cl1();w2=1;bass_func();audio();}// кнопка &lt;&lt;&lt;&lt;&lt;&lt;  
    
    if (newPosition != oldPosition) {
    oldPosition = newPosition;
    bass=bass+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;bass_func();audio();} 
   lcd.setCursor(0,0);lcd.print(&quot;BASS    &quot;);
   lcd.print(&quot; &quot;);lcd.print(bass);lcd.print(&quot; &quot;);lcd.setCursor(13,0);lcd.print(&quot;dB&quot;);bass_d=bass+15;
   if(w2==1){
   for(z=0,z0=0,z1=0;z&lt;=bass_d;z++,z1++){if(z1&gt;2){z1=0;z0++;}
   if(z1==1){lcd.setCursor(z0+3,1);lcd.write((uint8_t)0);lcd.setCursor(z0+1+3,1);lcd.print(&quot;   &quot;);}}
   if(z1==3){lcd.setCursor(z0+3,1);lcd.write((uint8_t)1);}
   if(z1==2){lcd.setCursor(z0+3,1);lcd.write((uint8_t)2);}w2=0;}}

   ///////////////////////// TREBLE +/-20 dB /////////////////////////////////////////////////////////
   if(menu==2){
     if(ir.value==IR_3){treb++;gr1=1;gr2=0;cl1();w2=1;treb_func();audio();}// кнопка &gt; 
     if(ir.value==0xFFFFFFFF and gr1==1){treb++;gr2=0;cl1();w2=1;treb_func();audio();}// кнопка &gt;&gt;&gt;&gt;&gt;&gt;
     if(ir.value==IR_4){treb--;gr1=0;gr2=1;cl1();w2=1;treb_func();audio();}// кнопка &lt; 
     if(ir.value==0xFFFFFFFF and gr2==1){treb--;gr1=0;cl1();w2=1;treb_func();audio();}// кнопка &lt;&lt;&lt;&lt;&lt;&lt;
    
     if (newPosition != oldPosition) {
    oldPosition = newPosition;
    treb=treb+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;treb_func();audio();} 
   lcd.setCursor(0,0);lcd.print(&quot;TREBLE  &quot;);
   lcd.print(&quot; &quot;);lcd.print(treb);lcd.print(&quot; &quot;);lcd.setCursor(13,0);lcd.print(&quot;dB&quot;);treb_d=treb+15;
   if(w2==1){
   for(z=0,z0=0,z1=0;z&lt;=treb_d;z++,z1++){if(z1&gt;2){z1=0;z0++;}
   if(z1==1){lcd.setCursor(z0+3,1);lcd.write((uint8_t)0);lcd.setCursor(z0+1+3,1);lcd.print(&quot;   &quot;);}}
   if(z1==3){lcd.setCursor(z0+3,1);lcd.write((uint8_t)1);}
   if(z1==2){lcd.setCursor(z0+3,1);lcd.write((uint8_t)2);}w2=0;}}

  //////////////////////////  MENU 2 //////////////////////////////////////////////////////////////////////

//////////////// IN + GAIN /////////////////////////////////////////////////////////////
   if(menu2==1){ 
       switch(in){
     case 1: gain0 = gain1;break;
     case 2: gain0 = gain2;break;
     case 3: gain0 = gain3;break;}

    if (newPosition != oldPosition) {
    oldPosition = newPosition;
    gain0=gain0+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;gain_func();audio();} 
   switch(in){
     case 1: gain1 = gain0;break;
     case 2: gain2 = gain0;break;
     case 3: gain3 = gain0;break;
     } 
    if(www==1){audio();www=0;}
  lcd.setCursor(0,0);lcd.print(&quot;Gain IN &quot;);lcd.print(in);
      lcd.setCursor(10,0);lcd.print(&quot; &quot;);lcd.print(gain0);lcd.print(&quot; &quot;);lcd.setCursor(14,0);lcd.print(&quot;dB&quot;);gain_d=gain0*2;
   if(w2==1){
   for(z=0,z0=0,z1=0;z&lt;=gain_d;z++,z1++){if(z1&gt;2){z1=0;z0++;}
   if(z1==1){lcd.setCursor(z0+3,1);lcd.write((uint8_t)0);lcd.setCursor(z0+1+3,1);lcd.print(&quot;   &quot;);}}
   if(z1==3){lcd.setCursor(z0+3,1);lcd.write((uint8_t)1);}
   if(z1==2){lcd.setCursor(z0+3,1);lcd.write((uint8_t)2);}}w2=0;} 

/////////////////////// loudness ///////////////////////////////////////////
    if(menu2==2){
  
      if (newPosition != oldPosition) {
      oldPosition = newPosition;
      lon=lon+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;lon_func();audio();} 

   lcd.setCursor(0,0);lcd.print(&quot;Loud gain&quot;);
   lcd.print(&quot; &quot;);lcd.print(lon);lcd.print(&quot; &quot;);lcd.setCursor(13,0);lcd.print(&quot;dB&quot;);lon_d=lon*2;
   if(w2==1){
   for(z=0,z0=0,z1=0;z&lt;=lon_d;z++,z1++){if(z1&gt;2){z1=0;z0++;}
   if(z1==1){lcd.setCursor(z0+3,1);lcd.write((uint8_t)0);lcd.setCursor(z0+1+3,1);lcd.print(&quot;   &quot;);}}
   if(z1==3){lcd.setCursor(z0+3,1);lcd.write((uint8_t)1);}
   if(z1==2){lcd.setCursor(z0+3,1);lcd.write((uint8_t)2);}w2=0;}}

  ////////////////////////////////////////// out /////////////////////////////////////////////////
 if(menu2==3){  
   if(digitalRead(2)==HIGH){out++;cl();time=millis();www=1;w=1;if(out&gt;4){out=0;}audio();} // перебор выходов кнопкой IN
   if(ir.value==IR_5){out++;cl();time=millis();www=1;w=1;if(out&gt;4){out=0;}audio();} // перебор выходов кнопкой IN
       switch(out){
          case 0:vol_out=rf;break;
          case 1:vol_out=lf;break;
          case 2:vol_out=rt;break;
          case 3:vol_out=lt;break;
          case 4:vol_out=sab;break;}
          
      if (newPosition != oldPosition) {
      oldPosition = newPosition;
      vol_out=vol_out+newPosition;myEnc.write(0);newPosition=0;time=millis();www=1;w=1;w2=1;vol_out_func();audio();} 
      
   lcd.setCursor(0,0);lcd.print(&quot;Volume OUT&quot;);lcd.setCursor(0,1);
      switch(out){
   case 0:rf=vol_out;lcd.print(&quot;RF:  &quot;);lcd.print(rf);break;
   case 1:lf=vol_out;lcd.print(&quot;LF:  &quot;);lcd.print(lf);break;
   case 2:rt=vol_out;lcd.print(&quot;RT:  &quot;);lcd.print(rt);break;
   case 3:lt=vol_out;lcd.print(&quot;LT:  &quot;);lcd.print(lt);break;
   case 4:sab=vol_out;lcd.print(&quot;SUB:  &quot;);lcd.print(sab);break;
   }
    if(www==1){audio();www=0;}
  lcd.print(&quot; dB      &quot;);} 

  //////////////////////////////////////subw//////////////////////////////////////////////// 
 if(menu2==4){ 
     if(ir.value==IR_3){sab_f++;gr1=1;gr2=0;cl1();w2=1;sab_f_func();audio();}// кнопка &gt; 
     if(ir.value==0xFFFFFFFF and gr1==1){sab_f++;gr2=0;cl1();w2=1;sab_f_func();audio();}// кнопка &gt;&gt;&gt;&gt;&gt;&gt;
     if(ir.value==IR_4){sab_f--;gr1=0;gr2=1;cl1();w2=1;sab_f_func();audio();}// кнопка &lt; 
     if(ir.value==0xFFFFFFFF and gr2==1){sab_f--;gr1=0;cl1();w2=1;sab_f_func();audio();}// кнопка &lt;&lt;&lt;&lt;&lt;&lt;  
     
      if (newPosition != oldPosition) {
      oldPosition = newPosition;
      sab_f=sab_f+newPosition;myEnc.write(0);newPosition=0;time=millis();w=1;w2=1;sab_f_func();audio();}   
    lcd.setCursor(0,0);lcd.print(&quot;Subwoofer Freq.&quot;);
    lcd.setCursor(1,6);
      switch(sab_f){
         case 0: lcd.print(&quot;80  Hz &quot;);break;
         case 1: lcd.print(&quot;120 Hz &quot;);break;
         case 2: lcd.print(&quot;160 Hz &quot;);break;}} 


   ///////////////////// EEPROM ///////////////////////////////////////////////////////////////         
  if(millis()-time&gt;10000 &amp;&amp; w==1){
     EEPROM.update(0,vol+79);EEPROM.update(1,bass+15);EEPROM.update(2,treb+15);EEPROM.update(3,in);
     EEPROM.update(5,gain1);EEPROM.update(6,gain2);EEPROM.update(7,gain3);EEPROM.update(8,lon);
     EEPROM.update(10,rf+15);EEPROM.update(11,lf+15);EEPROM.update(12,rt+15);EEPROM.update(13,lt+15);EEPROM.update(14,sab+15);
     EEPROM.update(18,sab_f);
     menu=0;menu2=0;w=0;w2=1;cl();}
  
  }// LOOP

void sab_f_func(){if(sab_f&gt;2){sab_f=0;}if(sab_f&lt;0){sab_f=2;}}
void vol_out_func(){if(vol_out&gt;15){vol_out=15;}if(vol_out&lt;-15){vol_out=-15;}}
void lon_func(){if(lon&gt;15){lon=15;}if(lon&lt;0){lon=0;}}
void gain_func(){if(gain0&lt;0){gain0=0;}if(gain0&gt;15){gain0=15;}}
void treb_func(){if(treb&gt;15){treb=15;}if(treb&lt;-15){treb=-15;}}
void bass_func(){if(bass&gt;15){bass=15;}if(bass&lt;-15){bass=-15;}}
void vol_func(){if(vol&lt;-79){vol=-79;}if(vol&gt;15){vol=15;}}
void cl(){ir.value=0;delay(300);lcd.clear();}
void cl1(){ir.value=0;delay(100);}
void to_Timer(){newPosition = myEnc.read()/4;}


void audio(){
   pt.setMain_in(in, gain0); 
                 /* Input Selector - in_sel
                    int 0 === QD/SE : QD
                    int 1 === SE IN1
                    int 2 === SE IN2
                    int 3 === SE IN3
                    int 4 === QD/SE : SE IN4
                    int 5 === Mute  
                    Input Gain - in_gain
                    int 0...15 === 0...+15 dB */
   pt.setLoun_sub(lon, 1, sab_f);
                 /* Loudness - loun, loun_off
                    int 0...15 === 0...-15 dB
                    int 0...1 === on...off
                    Subwoofer Cut-off Frequency - sub_f
                    int 0...2 === 80 120 160 Hz */
   pt.setVol(vol); // Volume int +15...-80 === +15...-80 dB
   pt.setBass_mix(bass, 1, 1, 1);
                 /* BASS - bass
                    int -15...15 === -15...+15 dB
                    MIXING 
                    mixing enable int 0...1 === on...off
                    mixing to LF  int 0...1 === on...off
                    mixing to RF  int 0...1 === on...off */
   pt.setTreble(treb);// TREBLE int -15...+15 === -15...+15 dB
   pt.setAtt_mix(0);//MIXING LEVEL int -15...+15 === -15...+15 dB
   pt.setAtt_LF(lf);// SPEAKER ATTENUATOR LEFT FRONT int -15...+15 === -15...+15 dB
   pt.setAtt_RF(rf);// SPEAKER ATTENUATOR RIGHT FRONT int -15...+15 === -15...+15 dB
   pt.setAtt_LR(lt);// SPEAKER ATTENUATOR LEFT REAR  int -15...+15 === -15...+15 dB
   pt.setAtt_RR(rt);// SPEAKER ATTENUATOR RIGHT REAR  int -15...+15 === -15...+15 dB
   pt.setAtt_SUB(sab);// SPEAKER ATTENUATOR SUBWOOFER  int -15...+15 === -15...+15 dB
   pt.setSecond_in(5, 0, 0);
                /* Second Input Selector 
                    int 0 === QD/SE : QD
                    int 1 === SE IN1
                    int 2 === SE IN2
                    int 3 === SE IN3
                    int 4 === QD/SE : SE IN4
                    int 5 === Mute  
                    Input Gain - in_gain
                    int 0...15 === 0...+15 dB 
                    Rear Speaker Source 
                    int 0...1 === main source...second source */
  }</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Wed, 11 Dec 2019 15:05:27 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=444#p444</guid>
		</item>
		<item>
			<title><![CDATA[Re: PT2348 4.1-Channel Audio Processor with Subwoofer]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=281#p281</link>
			<description><![CDATA[<p>Протестировано!!!</p>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Sun, 20 Oct 2019 09:46:28 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=281#p281</guid>
		</item>
		<item>
			<title><![CDATA[PT2348 4.1-Channel Audio Processor with Subwoofer]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=280#p280</link>
			<description><![CDATA[<p><span class="attention-yellow"></span> </p><br /><p>The PT2348 is a 4.1CH audio processor designed for<br />Car Audio purpose. Using I2<br />C interface controls all of<br />the functions. Like most of audio processor, it<br />equipped up to 4 stereo sources input with adjustable<br />gain, master volume with adaptive loudness, treble<br />and bass tone control.<br />In a car entertainment system needs front and rear<br />seat individual control, the PT2348 provides separate<br />input source selection and output volume adjust ; a<br />special design mixing amp is very easy combine the<br />navigation system or cellular phone’s voice into the car<br />audio system. </p><p>FEATURES <br />• Controlled by I²C Interface<br />• 4 Stereo Inputs (including 1 quasi-differential input)<br />with selectable input gain<br />• 2 Channels Electronic Volume： +15 to -79dB with<br />1dB/step<br />• 1 Subwoofer Output: +15 to -79dB with 1dB/step<br />• Adjustable crossover frequency for Subwoofer<br />• Tone Control (Bass and Treble): -15 to +15dB,<br />1dB/step<br />• Input Gain Control: 0 to +15dB, 1dB/step<br />• Loudness: 0 to -15dB, 1dB/step<br />• 4 independent speaker outputs: +15 to -79dB with<br />1dB/step &amp; independent programmable mix<br />input with 50% mixing ratio for front speakers<br />• Low Distortion and Low Noise<br />• 36-pin SSOP package </p><p>PT2348.ino</p><div class="codebox"><pre><code>#include &lt;Wire.h&gt; 
#include &lt;PT2348.h&gt;
PT2348 pt; 

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

void loop(){}

void audio(){
   pt.setMain_in(1, 0); 
                 /* Input Selector - in_sel
                    int 0 === QD/SE : QD
                    int 1 === SE IN1
                    int 2 === SE IN2
                    int 3 === SE IN3
                    int 4 === QD/SE : SE IN4
                    int 5 === Mute  
                    Input Gain - in_gain
                    int 0...15 === 0...+15 dB */
   pt.setLoun_sub(0, 0, 0);
                 /* Loudness - loun, loun_off
                    int 0...15 === 0...-15 dB
                    int 0...1 === on...off
                    Subwoofer Cut-off Frequency - sub_f
                    int 0...2 === 80 120 160 Hz */
   pt.setVol(0); // Volume int +15...-80 === +15...-80 dB
   pt.setBass_mix(0, 1, 1, 1);
                 /* BASS - bass
                    int -15...15 === -15...+15 dB
                    MIXING 
                    mixing enable int 0...1 === on...off
                    mixing to LF  int 0...1 === on...off
                    mixing to RF  int 0...1 === on...off */
   pt.setTreble(0);// TREBLE int -15...+15 === -15...+15 dB
   pt.setAtt_mix(0);//MIXING LEVEL int -15...+15 === -15...+15 dB
   pt.setAtt_LF(0);// SPEAKER ATTENUATOR LEFT FRONT int -15...+15 === -15...+15 dB
   pt.setAtt_RF(0);// SPEAKER ATTENUATOR RIGHT FRONT int -15...+15 === -15...+15 dB
   pt.setAtt_LR(0);// SPEAKER ATTENUATOR LEFT REAR  int -15...+15 === -15...+15 dB
   pt.setAtt_RR(0);// SPEAKER ATTENUATOR RIGHT REAR  int -15...+15 === -15...+15 dB
   pt.setAtt_SUB(0);// SPEAKER ATTENUATOR SUBWOOFER  int -15...+15 === -15...+15 dB
   pt.setSecond_in(5, 0, 0);
                /* Second Input Selector 
                    int 0 === QD/SE : QD
                    int 1 === SE IN1
                    int 2 === SE IN2
                    int 3 === SE IN3
                    int 4 === QD/SE : SE IN4
                    int 5 === Mute  
                    Input Gain - in_gain
                    int 0...15 === 0...+15 dB 
                    Rear Speaker Source 
                    int 0...1 === main source...second source */
  }</code></pre></div><p>PT2348.h</p><div class="codebox"><pre><code>/* Alexander Liman
   liman324@yandex.ru
   rcl-radio.ru */

#ifndef PT2348_H
#define PT2348_H

#define PT2348_address 0x44

#define MAIN_IN        0x00
#define LOUN_SUB       0x01
#define VOLUME         0x02
#define BASS_MIX       0x03
#define TREBLE         0x04
#define MIX_LEVEL      0x05
#define ATT_LF         0x06
#define ATT_RF         0x07
#define ATT_LR         0x08
#define ATT_RR         0x09
#define ATT_SUB        0x0A
#define SECOND_IN      0x0B

#include &lt;Arduino.h&gt;
class PT2348
{
  public:
    PT2348();
   void setMain_in(int in_sel, int in_gain); 
                 /* Input Selector - in_sel
                    int 0 === QD/SE : QD
                    int 1 === SE IN1
                    int 2 === SE IN2
                    int 3 === SE IN3
                    int 4 === QD/SE : SE IN4
                    int 5 === Mute  
                    Input Gain - in_gain
                    int 0...15 === 0...+15 dB */
   void setLoun_sub(int loud, int loun_off, int sub_f);
                 /* Loudness - loun, loun_off
                    int 0...15 === 0...-15 dB
                    int 0...1 === on...off
                    Subwoofer Cut-off Frequency - sub_f
                    int 0...2 === 80 120 160 Hz */
   void setVol(int vol); // Volume int +15...-80 === +15...-80 dB
   void setBass_mix(int bass, int mix_off, int mix_LF, int mix_RF);
                 /* BASS - bass
                    int -15...15 === -15...+15 dB
                    MIXING 
                    mixing enable int 0...1 === on...off
                    mixing to LF  int 0...1 === on...off
                    mixing to RF  int 0...1 === on...off */
   void setTreble(int treb);// TREBLE int -15...+15 === -15...+15 dB
   void setAtt_mix(int att_mix);//MIXING LEVEL int -15...+15 === -15...+15 dB
   void setAtt_LF(int att_LF);// SPEAKER ATTENUATOR LEFT FRONT int -15...+15 === -15...+15 dB
   void setAtt_RF(int att_RF);// SPEAKER ATTENUATOR RIGHT FRONT int -15...+15 === -15...+15 dB
   void setAtt_LR(int att_LR);// SPEAKER ATTENUATOR LEFT REAR  int -15...+15 === -15...+15 dB
   void setAtt_RR(int att_RR);// SPEAKER ATTENUATOR RIGHT REAR  int -15...+15 === -15...+15 dB
   void setAtt_SUB(int att_SUB);// SPEAKER ATTENUATOR SUBWOOFER  int -15...+15 === -15...+15 dB
   void setSecond_in(int in_sec_sel, int in_sec_gain, int main_second);
                /* Second Input Selector 
                    int 0 === QD/SE : QD
                    int 1 === SE IN1
                    int 2 === SE IN2
                    int 3 === SE IN3
                    int 4 === QD/SE : SE IN4
                    int 5 === Mute  
                    Input Gain - in_gain
                    int 0...15 === 0...+15 dB 
                    Rear Speaker Source 
                    int 0...1 === main source...second source */

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

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

void PT2348::setMain_in(int in_sel, int in_gain){
           switch(in_sel){
               case 0: in_sel = 0b00000000;break;
               case 1: in_sel = 0b00000001;break;
               case 2: in_sel = 0b00000010;break;
               case 3: in_sel = 0b00000011;break;
               case 4: in_sel = 0b00000100;break;
               case 5: in_sel = 0b00000101;break;
   }
           switch(in_gain){
               case 0: in_gain =  0b00000000;break;
               case 1: in_gain =  0b00001000;break;
               case 2: in_gain =  0b00010000;break;
               case 3: in_gain =  0b00011000;break;
               case 4: in_gain =  0b00100000;break;
               case 5: in_gain =  0b00101000;break;
               case 6: in_gain =  0b00110000;break;
               case 7: in_gain =  0b00111000;break;
               case 8: in_gain =  0b01000000;break;
               case 9: in_gain =  0b01001000;break;
               case 10: in_gain = 0b01010000;break;
               case 11: in_gain = 0b01011000;break;
               case 12: in_gain = 0b01100000;break;
               case 13: in_gain = 0b01101000;break;
               case 14: in_gain = 0b01110000;break;
               case 15: in_gain = 0b01111000;break;
   }
        
           writeWire(MAIN_IN, in_sel+in_gain); 
   }

void PT2348::setLoun_sub(int loud, int loun_off, int sub_f){
           switch(loud){
               case 0: loud =  0b00000000;break;
               case 1: loud =  0b00000001;break;
               case 2: loud =  0b00000010;break;
               case 3: loud =  0b00000011;break;
               case 4: loud =  0b00000100;break;
               case 5: loud =  0b00000101;break;
               case 6: loud =  0b00000110;break;
               case 7: loud =  0b00000111;break;
               case 8: loud =  0b00001000;break;
               case 9: loud =  0b00001001;break;
               case 10: loud = 0b00001010;break;
               case 11: loud = 0b00001011;break;
               case 12: loud = 0b00001100;break;
               case 13: loud = 0b00001101;break;
               case 14: loud = 0b00001110;break;
               case 15: loud = 0b00001111;break;
   }
            switch(loun_off){
               case 0: loun_off = 0b00000000;break;
               case 1: loun_off = 0b00010000;break;
   } 
            switch(sub_f){
               case 0: sub_f = 0b00100000;break;
               case 1: sub_f = 0b01000000;break;
               case 2: sub_f = 0b01100000;break;
   } 
           writeWire(LOUN_SUB, loud+loun_off+sub_f); 
   }

void PT2348::setVol(int vol){
             switch(vol){
               case 0: vol =  0b00000000;break;
               case 1: vol =  0b00000001;break;
               case 2: vol =  0b00000010;break;
               case 3: vol =  0b00000011;break;
               case 4: vol =  0b00000100;break;
               case 5: vol =  0b00000101;break;
               case 6: vol =  0b00000110;break;
               case 7: vol =  0b00000111;break;
               case 8: vol =  0b00001000;break;
               case 9: vol =  0b00001001;break;
               case 10: vol = 0b00001010;break;
               case 11: vol = 0b00001011;break;
               case 12: vol = 0b00001100;break;
               case 13: vol = 0b00001101;break;
               case 14: vol = 0b00001110;break;
               case 15: vol = 0b00001111;break;

               case -1: vol =  0b00010001;break;
               case -2: vol =  0b00010010;break;
               case -3: vol =  0b00010011;break;
               case -4: vol =  0b00010100;break;
               case -5: vol =  0b00010101;break;
               case -6: vol =  0b00010110;break;
               case -7: vol =  0b00010111;break;
               case -8: vol =  0b00100000;break;
               case -9: vol =  0b00100001;break;
               case -10: vol = 0b00100010;break;
               case -11: vol = 0b00100011;break;
               case -12: vol = 0b00100100;break;
               case -13: vol = 0b00100101;break;
               case -14: vol = 0b00100110;break;
               case -15: vol = 0b00100111;break;

               case -16: vol =  0b00110000;break;
               case -17: vol =  0b00110001;break;
               case -18: vol =  0b00110010;break;
               case -19: vol =  0b00110011;break;
               case -20: vol =  0b00110100;break;
               case -21: vol =  0b00110101;break;
               case -22: vol =  0b00110110;break;
               case -23: vol =  0b00110111;break;
               case -24: vol =  0b01000000;break;
               case -25: vol =  0b01000001;break;
               case -26: vol =  0b01000010;break;
               case -27: vol =  0b01000011;break;
               case -28: vol =  0b01000100;break;
               case -29: vol =  0b01000101;break;
               case -30: vol =  0b01000110;break;
               case -31: vol =  0b01000111;break;

               case -32: vol =  0b01010000;break;
               case -33: vol =  0b01010001;break;
               case -34: vol =  0b01010010;break;
               case -35: vol =  0b01010011;break;
               case -36: vol =  0b01010100;break;
               case -37: vol =  0b01010101;break;
               case -38: vol =  0b01010110;break;
               case -39: vol =  0b01010111;break;
               case -40: vol =  0b01100000;break;
               case -41: vol =  0b01100001;break;
               case -42: vol =  0b01100010;break;
               case -43: vol =  0b01100011;break;
               case -44: vol =  0b01100100;break;
               case -45: vol =  0b01100101;break;
               case -46: vol =  0b01100110;break;
               case -47: vol =  0b01100111;break;

               case -48: vol =  0b01110000;break;
               case -49: vol =  0b01110001;break;
               case -50: vol =  0b01110010;break;
               case -51: vol =  0b01110011;break;
               case -52: vol =  0b01110100;break;
               case -53: vol =  0b01110101;break;
               case -54: vol =  0b01110110;break;
               case -55: vol =  0b01110111;break;
               case -56: vol =  0b10000000;break;
               case -57: vol =  0b10000001;break;
               case -58: vol =  0b10000010;break;
               case -59: vol =  0b10000011;break;
               case -60: vol =  0b10000100;break;
               case -61: vol =  0b10000101;break;
               case -62: vol =  0b10000110;break;
               case -63: vol =  0b10000111;break;

               case -64: vol =  0b10010000;break;
               case -65: vol =  0b10010001;break;
               case -66: vol =  0b10010010;break;
               case -67: vol =  0b10010011;break;
               case -68: vol =  0b10010100;break;
               case -69: vol =  0b10010101;break;
               case -70: vol =  0b10010110;break;
               case -71: vol =  0b10010111;break;
               case -72: vol =  0b10100000;break;
               case -73: vol =  0b10100001;break;
               case -74: vol =  0b10100010;break;
               case -75: vol =  0b10100011;break;
               case -76: vol =  0b10100100;break;
               case -77: vol =  0b10100101;break;
               case -78: vol =  0b10100110;break;
               case -79: vol =  0b10100111;break;
  } 
              if(vol&lt;=-80){vol = 0b11110000;}
           writeWire(VOLUME, vol); 
  }


void PT2348::setBass_mix(int bass, int mix_off, int mix_LF, int mix_RF){
             switch(bass){
               case -1: bass =  0b00000001;break;
               case -2: bass =  0b00000010;break;
               case -3: bass =  0b00000011;break;
               case -4: bass =  0b00000100;break;
               case -5: bass =  0b00000101;break;
               case -6: bass =  0b00000110;break;
               case -7: bass =  0b00000111;break;
               case -8: bass =  0b00001000;break;
               case -9: bass =  0b00001001;break;
               case -10: bass = 0b00001010;break;
               case -11: bass = 0b00001011;break;
               case -12: bass = 0b00001100;break;
               case -13: bass = 0b00001101;break;
               case -14: bass = 0b00001110;break;
               case -15: bass = 0b00001111;break;

               case 0: bass =  0b00010000;break;
               case 1: bass =  0b00010001;break;
               case 2: bass =  0b00010010;break;
               case 3: bass =  0b00010011;break;
               case 4: bass =  0b00010100;break;
               case 5: bass =  0b00010101;break;
               case 6: bass =  0b00010110;break;
               case 7: bass =  0b00010111;break;
               case 8: bass =  0b00011000;break;
               case 9: bass =  0b00011001;break;
               case 10: bass = 0b00011010;break;
               case 11: bass = 0b00011011;break;
               case 12: bass = 0b00011100;break;
               case 13: bass = 0b00011101;break;
               case 14: bass = 0b00011110;break;
               case 15: bass = 0b00011111;break;
  }
            switch(mix_off){
               case 0: mix_off = 0b00000000;break;
               case 1: mix_off = 0b00100000;break;
  } 
            switch(mix_LF){
               case 0: mix_LF = 0b00000000;break;
               case 1: mix_LF = 0b01000000;break;
  } 
            switch(mix_RF){
               case 0: mix_RF = 0b00000000;break;
               case 1: mix_RF = 0b10000000;break;
  } 
           writeWire(BASS_MIX, bass+mix_off+mix_LF+mix_RF); 
  }

void PT2348::setTreble(int treb){
             switch(treb){
               case -1: treb =  0b00000001;break;
               case -2: treb =  0b00000010;break;
               case -3: treb =  0b00000011;break;
               case -4: treb =  0b00000100;break;
               case -5: treb =  0b00000101;break;
               case -6: treb =  0b00000110;break;
               case -7: treb =  0b00000111;break;
               case -8: treb =  0b00001000;break;
               case -9: treb =  0b00001001;break;
               case -10: treb = 0b00001010;break;
               case -11: treb = 0b00001011;break;
               case -12: treb = 0b00001100;break;
               case -13: treb = 0b00001101;break;
               case -14: treb = 0b00001110;break;
               case -15: treb = 0b00001111;break;

               case 0: treb =  0b00010000;break;
               case 1: treb =  0b00010001;break;
               case 2: treb =  0b00010010;break;
               case 3: treb =  0b00010011;break;
               case 4: treb =  0b00010100;break;
               case 5: treb =  0b00010101;break;
               case 6: treb =  0b00010110;break;
               case 7: treb =  0b00010111;break;
               case 8: treb =  0b00011000;break;
               case 9: treb =  0b00011001;break;
               case 10: treb = 0b00011010;break;
               case 11: treb = 0b00011011;break;
               case 12: treb = 0b00011100;break;
               case 13: treb = 0b00011101;break;
               case 14: treb = 0b00011110;break;
               case 15: treb = 0b00011111;break;
  }    
           writeWire(TREBLE, treb);    
  }

void PT2348::setAtt_mix(int att_mix){
             switch(att_mix){
               case 0: att_mix =  0b00000000;break;
               case 1: att_mix =  0b00000001;break;
               case 2: att_mix =  0b00000010;break;
               case 3: att_mix =  0b00000011;break;
               case 4: att_mix =  0b00000100;break;
               case 5: att_mix =  0b00000101;break;
               case 6: att_mix =  0b00000110;break;
               case 7: att_mix =  0b00000111;break;
               case 8: att_mix =  0b00001000;break;
               case 9: att_mix =  0b00001001;break;
               case 10: att_mix = 0b00001010;break;
               case 11: att_mix = 0b00001011;break;
               case 12: att_mix = 0b00001100;break;
               case 13: att_mix = 0b00001101;break;
               case 14: att_mix = 0b00001110;break;
               case 15: att_mix = 0b00001111;break;

               case -1: att_mix =  0b00010001;break;
               case -2: att_mix =  0b00010010;break;
               case -3: att_mix =  0b00010011;break;
               case -4: att_mix =  0b00010100;break;
               case -5: att_mix =  0b00010101;break;
               case -6: att_mix =  0b00010110;break;
               case -7: att_mix =  0b00010111;break;
               case -8: att_mix =  0b00100000;break;
               case -9: att_mix =  0b00100001;break;
               case -10: att_mix = 0b00100010;break;
               case -11: att_mix = 0b00100011;break;
               case -12: att_mix = 0b00100100;break;
               case -13: att_mix = 0b00100101;break;
               case -14: att_mix = 0b00100110;break;
               case -15: att_mix = 0b00100111;break;
  }    
           writeWire(MIX_LEVEL, att_mix);    
  }

void PT2348::setAtt_LF(int att_LF){
             switch(att_LF){
               case 0: att_LF =  0b00000000;break;
               case 1: att_LF =  0b00000001;break;
               case 2: att_LF =  0b00000010;break;
               case 3: att_LF =  0b00000011;break;
               case 4: att_LF =  0b00000100;break;
               case 5: att_LF =  0b00000101;break;
               case 6: att_LF =  0b00000110;break;
               case 7: att_LF =  0b00000111;break;
               case 8: att_LF =  0b00001000;break;
               case 9: att_LF =  0b00001001;break;
               case 10: att_LF = 0b00001010;break;
               case 11: att_LF = 0b00001011;break;
               case 12: att_LF = 0b00001100;break;
               case 13: att_LF = 0b00001101;break;
               case 14: att_LF = 0b00001110;break;
               case 15: att_LF = 0b00001111;break;

               case -1: att_LF =  0b00010001;break;
               case -2: att_LF =  0b00010010;break;
               case -3: att_LF =  0b00010011;break;
               case -4: att_LF =  0b00010100;break;
               case -5: att_LF =  0b00010101;break;
               case -6: att_LF =  0b00010110;break;
               case -7: att_LF =  0b00010111;break;
               case -8: att_LF =  0b00100000;break;
               case -9: att_LF =  0b00100001;break;
               case -10: att_LF = 0b00100010;break;
               case -11: att_LF = 0b00100011;break;
               case -12: att_LF = 0b00100100;break;
               case -13: att_LF = 0b00100101;break;
               case -14: att_LF = 0b00100110;break;
               case -15: att_LF = 0b00100111;break;
  }    
           writeWire(ATT_LF, att_LF);    
  }

void PT2348::setAtt_RF(int att_RF){
             switch(att_RF){
               case 0: att_RF =  0b00000000;break;
               case 1: att_RF =  0b00000001;break;
               case 2: att_RF =  0b00000010;break;
               case 3: att_RF =  0b00000011;break;
               case 4: att_RF =  0b00000100;break;
               case 5: att_RF =  0b00000101;break;
               case 6: att_RF =  0b00000110;break;
               case 7: att_RF =  0b00000111;break;
               case 8: att_RF =  0b00001000;break;
               case 9: att_RF =  0b00001001;break;
               case 10: att_RF = 0b00001010;break;
               case 11: att_RF = 0b00001011;break;
               case 12: att_RF = 0b00001100;break;
               case 13: att_RF = 0b00001101;break;
               case 14: att_RF = 0b00001110;break;
               case 15: att_RF = 0b00001111;break;

               case -1: att_RF =  0b00010001;break;
               case -2: att_RF =  0b00010010;break;
               case -3: att_RF =  0b00010011;break;
               case -4: att_RF =  0b00010100;break;
               case -5: att_RF =  0b00010101;break;
               case -6: att_RF =  0b00010110;break;
               case -7: att_RF =  0b00010111;break;
               case -8: att_RF =  0b00100000;break;
               case -9: att_RF =  0b00100001;break;
               case -10: att_RF = 0b00100010;break;
               case -11: att_RF = 0b00100011;break;
               case -12: att_RF = 0b00100100;break;
               case -13: att_RF = 0b00100101;break;
               case -14: att_RF = 0b00100110;break;
               case -15: att_RF = 0b00100111;break;
  }    
           writeWire(ATT_RF, att_RF);    
  }

void PT2348::setAtt_LR(int att_LR){
             switch(att_LR){
               case 0: att_LR =  0b00000000;break;
               case 1: att_LR =  0b00000001;break;
               case 2: att_LR =  0b00000010;break;
               case 3: att_LR =  0b00000011;break;
               case 4: att_LR =  0b00000100;break;
               case 5: att_LR =  0b00000101;break;
               case 6: att_LR =  0b00000110;break;
               case 7: att_LR =  0b00000111;break;
               case 8: att_LR =  0b00001000;break;
               case 9: att_LR =  0b00001001;break;
               case 10: att_LR = 0b00001010;break;
               case 11: att_LR = 0b00001011;break;
               case 12: att_LR = 0b00001100;break;
               case 13: att_LR = 0b00001101;break;
               case 14: att_LR = 0b00001110;break;
               case 15: att_LR = 0b00001111;break;

               case -1: att_LR =  0b00010001;break;
               case -2: att_LR =  0b00010010;break;
               case -3: att_LR =  0b00010011;break;
               case -4: att_LR =  0b00010100;break;
               case -5: att_LR =  0b00010101;break;
               case -6: att_LR =  0b00010110;break;
               case -7: att_LR =  0b00010111;break;
               case -8: att_LR =  0b00100000;break;
               case -9: att_LR =  0b00100001;break;
               case -10: att_LR = 0b00100010;break;
               case -11: att_LR = 0b00100011;break;
               case -12: att_LR = 0b00100100;break;
               case -13: att_LR = 0b00100101;break;
               case -14: att_LR = 0b00100110;break;
               case -15: att_LR = 0b00100111;break;
  }    
           writeWire(ATT_LR, att_LR);    
  }

void PT2348::setAtt_RR(int att_RR){
             switch(att_RR){
               case 0: att_RR =  0b00000000;break;
               case 1: att_RR =  0b00000001;break;
               case 2: att_RR =  0b00000010;break;
               case 3: att_RR =  0b00000011;break;
               case 4: att_RR =  0b00000100;break;
               case 5: att_RR =  0b00000101;break;
               case 6: att_RR =  0b00000110;break;
               case 7: att_RR =  0b00000111;break;
               case 8: att_RR =  0b00001000;break;
               case 9: att_RR =  0b00001001;break;
               case 10: att_RR = 0b00001010;break;
               case 11: att_RR = 0b00001011;break;
               case 12: att_RR = 0b00001100;break;
               case 13: att_RR = 0b00001101;break;
               case 14: att_RR = 0b00001110;break;
               case 15: att_RR = 0b00001111;break;

               case -1: att_RR =  0b00010001;break;
               case -2: att_RR =  0b00010010;break;
               case -3: att_RR =  0b00010011;break;
               case -4: att_RR =  0b00010100;break;
               case -5: att_RR =  0b00010101;break;
               case -6: att_RR =  0b00010110;break;
               case -7: att_RR =  0b00010111;break;
               case -8: att_RR =  0b00100000;break;
               case -9: att_RR =  0b00100001;break;
               case -10: att_RR = 0b00100010;break;
               case -11: att_RR = 0b00100011;break;
               case -12: att_RR = 0b00100100;break;
               case -13: att_RR = 0b00100101;break;
               case -14: att_RR = 0b00100110;break;
               case -15: att_RR = 0b00100111;break;
  }    
           writeWire(ATT_RR, att_RR);    
  }

void PT2348::setAtt_SUB(int att_SUB){
             switch(att_SUB){
               case 0: att_SUB =  0b00000000;break;
               case 1: att_SUB =  0b00000001;break;
               case 2: att_SUB =  0b00000010;break;
               case 3: att_SUB =  0b00000011;break;
               case 4: att_SUB =  0b00000100;break;
               case 5: att_SUB =  0b00000101;break;
               case 6: att_SUB =  0b00000110;break;
               case 7: att_SUB =  0b00000111;break;
               case 8: att_SUB =  0b00001000;break;
               case 9: att_SUB =  0b00001001;break;
               case 10: att_SUB = 0b00001010;break;
               case 11: att_SUB = 0b00001011;break;
               case 12: att_SUB = 0b00001100;break;
               case 13: att_SUB = 0b00001101;break;
               case 14: att_SUB = 0b00001110;break;
               case 15: att_SUB = 0b00001111;break;

               case -1: att_SUB =  0b00010001;break;
               case -2: att_SUB =  0b00010010;break;
               case -3: att_SUB =  0b00010011;break;
               case -4: att_SUB =  0b00010100;break;
               case -5: att_SUB =  0b00010101;break;
               case -6: att_SUB =  0b00010110;break;
               case -7: att_SUB =  0b00010111;break;
               case -8: att_SUB =  0b00100000;break;
               case -9: att_SUB =  0b00100001;break;
               case -10: att_SUB = 0b00100010;break;
               case -11: att_SUB = 0b00100011;break;
               case -12: att_SUB = 0b00100100;break;
               case -13: att_SUB = 0b00100101;break;
               case -14: att_SUB = 0b00100110;break;
               case -15: att_SUB = 0b00100111;break;
  }    
           writeWire(ATT_SUB, att_SUB);    
  }

void PT2348::setSecond_in(int in_sec_sel, int in_sec_gain, int main_second){
           switch(in_sec_sel){
               case 0: in_sec_sel = 0b00000000;break;
               case 1: in_sec_sel = 0b00000001;break;
               case 2: in_sec_sel = 0b00000010;break;
               case 3: in_sec_sel = 0b00000011;break;
               case 4: in_sec_sel = 0b00000100;break;
               case 5: in_sec_sel = 0b00000101;break;
   }
           switch(in_sec_gain){
               case 0: in_sec_gain =  0b00000000;break;
               case 1: in_sec_gain =  0b00001000;break;
               case 2: in_sec_gain =  0b00010000;break;
               case 3: in_sec_gain =  0b00011000;break;
               case 4: in_sec_gain =  0b00100000;break;
               case 5: in_sec_gain =  0b00101000;break;
               case 6: in_sec_gain =  0b00110000;break;
               case 7: in_sec_gain =  0b00111000;break;
               case 8: in_sec_gain =  0b01000000;break;
               case 9: in_sec_gain =  0b01001000;break;
               case 10: in_sec_gain = 0b01010000;break;
               case 11: in_sec_gain = 0b01011000;break;
               case 12: in_sec_gain = 0b01100000;break;
               case 13: in_sec_gain = 0b01101000;break;
               case 14: in_sec_gain = 0b01110000;break;
               case 15: in_sec_gain = 0b01111000;break;
   }
           switch(main_second){
               case 0: main_second = 0b00000000;break;
               case 1: main_second = 0b10000000;break;
   }
        
           writeWire(SECOND_IN, in_sec_sel+in_sec_gain+main_second); 
   }

void PT2348::writeWire(char a, char b){
  Wire.beginTransmission(PT2348_address);
  Wire.write (a);
  Wire.write (b);
  Wire.endTransmission();
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Sun, 20 Oct 2019 09:44:35 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=280#p280</guid>
		</item>
	</channel>
</rss>
