<?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; Библиотеки]]></title>
		<link>http://forum.rcl-radio.ru/index.php</link>
		<atom:link href="http://forum.rcl-radio.ru/extern.php?action=feed&amp;fid=24&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние темы раздела «forum.rcl-radio.ru».]]></description>
		<lastBuildDate>Sun, 20 Mar 2022 16:09:26 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[STM32_TM1637]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?id=485&amp;action=new</link>
			<description><![CDATA[<p><span class="attention-yellow"></span> </p><br /><p>STM32_TM1637.h<br /></p><div class="codebox"><pre><code>//  STM32_TM1637 v2.0
//  Alexander Liman
//  liman324@yandex.ru
//  rcl-radio.ru

#ifndef  STM32_TM1637_H
#define  STM32_TM1637_H

#include &lt;Arduino.h&gt;

#define CODE0    0b10001000
#define CODE1    0x40
#define ADDR0    0xC0

class  STM32_TM1637
  {
    public:

  STM32_TM1637(uint8_t, uint8_t);
  void print_float(float decimal, byte pd,      byte h0, byte h1, byte h2, byte h3);
  void print_time(int t, byte pd_t); 
  void brig(byte br);
  
    private:
  
  void dec(byte dig);
  void stop();
  void start();
  void del();
  byte qwer;
  uint8_t DIO;
  uint8_t CLK;
  };
#endif</code></pre></div><p>STM32_TM1637.cpp<br /></p><div class="codebox"><pre><code>#include &lt;STM32_TM1637.h&gt;

STM32_TM1637::STM32_TM1637(uint8_t clk, uint8_t dio){
         CLK = clk;
         DIO = dio;
};

void STM32_TM1637::brig(byte br){
     qwer = br + CODE0;
  }

void STM32_TM1637::del(){delayMicroseconds(100);}


void STM32_TM1637::dec(byte dig){
         for(int i = 0; i &lt; 8; i++) {
           pinMode(CLK, OUTPUT);del();
         if (dig &amp; 0x01)
           pinMode(DIO, INPUT);
         else
           pinMode(DIO, OUTPUT);del();
           pinMode(CLK, INPUT);del();
           dig = dig &gt;&gt; 1;
  }
           pinMode(CLK, OUTPUT);
           pinMode(DIO, INPUT);del();
           pinMode(CLK, INPUT);del();
           uint8_t ack = digitalRead(DIO);
         if (ack == 0)
           pinMode(DIO, OUTPUT);del();
           pinMode(CLK, OUTPUT);del();
  }
            
void STM32_TM1637::stop(){
           pinMode(DIO, OUTPUT);del();
           pinMode(CLK, INPUT);del();
           pinMode(DIO, INPUT);del();
  }  

void STM32_TM1637::start(){
           pinMode(DIO, OUTPUT);del();
  }

void STM32_TM1637::print_float(float decimal, byte pd,    byte h0, byte h1, byte h2, byte h3){
        start();dec(qwer);stop();start();dec(CODE1);stop();start();

        byte minus;
        int mn;
        
        switch(pd){
          case 0: mn = 1;break;
          case 1: mn = 10;break;
          case 2: mn = 100;break;
          case 3: mn = 1000;break;
          }
        
        if(decimal&lt;0){decimal = abs(decimal); minus = 1;}else{minus = 0;}
        
        //if(decimal/1000&gt;=1){pd = 0;}
        if(decimal/100&gt;=1&amp;&amp;decimal/100&lt;10){decimal = round(decimal*mn);}
        if(decimal/10&gt;=1&amp;&amp;decimal/10&lt;10){decimal = round(decimal*mn);}
        if(decimal&gt;=0&amp;&amp;decimal&lt;10){decimal = round(decimal*mn);}

        int data0 = (int)decimal/1000;
        int data1 = (int)decimal/100%10;
        int data2 = (int)decimal/10%10;
        int data3 = (int)decimal%10;
        
        for(int n=0;n&lt;4;n++){
        int data;
        if(n==0){data=data0;}
        if(n==1){data=data1;}
        if(n==2){data=data2;}
        if(n==3){data=data3;}
              
        switch(data){  // XGFEDCBA
        case 0:  data = 0b00111111;break;     // 0
        case 1:  data = 0b00000110;break;     // 1
        case 2:  data = 0b01011011;break;     // 2
        case 3:  data = 0b01001111;break;     // 3
        case 4:  data = 0b01100110;break;     // 4
        case 5:  data = 0b01101101;break;     // 5
        case 6:  data = 0b01111101;break;     // 6
        case 7:  data = 0b00000111;break;     // 7
        case 8:  data = 0b01111111;break;     // 8
        case 9:  data = 0b01101111;break;     // 9
        }
              
        if(n==0){data0=data;}
        if(n==1){data1=data;}
        if(n==2){data2=data;}
        if(n==3){data3=data;}
        }
        
        if(minus==0){
        if(pd==3&amp;&amp;decimal&lt;1000){data0 = 0b00111111;}
        if(pd==2&amp;&amp;decimal&lt;100){data0 = 0b00000000;data1 = 0b00111111;}
        if(pd==2&amp;&amp;decimal&lt;1000){data0 = 0b00000000;}
        if(pd==0&amp;&amp;decimal&lt;10){data0 = 0b00000000;data1 = 0b00000000;data2 = 0b00000000;}
        if(pd==0&amp;&amp;decimal&lt;100){data0 = 0b00000000;data1 = 0b00000000;}
        if(pd==0&amp;&amp;decimal&lt;1000){data0 = 0b00000000;}
        if(pd==1&amp;&amp;decimal&lt;1000){data0 = 0b00000000;}
        if(pd==1&amp;&amp;decimal&lt;100){data0 = 0b00000000;data1 = 0b00000000;}
        if(pd==1&amp;&amp;decimal&lt;10){data0 = 0b00000000;data1 = 0b00000000;data2 = 0b00111111;}
        if(decimal&gt;9999){data0 = 0b01000000;data1 = 0b01000000;data2 = 0b01000000;data3 = 0b01000000;}
        }

        if(minus==1){
        if(pd==0&amp;&amp;decimal&lt;10){data0 = 0b00000000;data1 = 0b00000000;data2 = 0b01000000;}
        if(pd==0&amp;&amp;decimal&lt;100&amp;&amp;decimal&gt;9){data0 = 0b00000000;data1 = 0b01000000;}
        if(pd==0&amp;&amp;decimal&lt;1000&amp;&amp;decimal&gt;99){data0 = 0b01000000;}
        if(pd==1&amp;&amp;decimal&lt;100){data0 = 0b00000000;data1 = 0b01000000;}
        if(pd==1&amp;&amp;decimal&lt;1000&amp;&amp;decimal&gt;=100){data0 = 0b01000000;}
        if(pd==2&amp;&amp;decimal&lt;1000){data0 = 0b01000000;}
        if(decimal&gt;1000){data0 = 0b01000000;data1 = 0b01000000;data2 = 0b01000000;data3 = 0b01000000;}
        }
 
        switch(pd){
        case 1 : data2 = data2+0b10000000;break;
        case 2 : data1 = data1+0b10000000;break;
        case 3 : data0 = data0+0b10000000;break;
        }

        if(h0&gt;0){data0 = h0;}
        if(h1&gt;0){data1 = h1;}
        if(h2&gt;0){data2 = h2;}
        if(h3&gt;0){data3 = h3;}
        
        dec(ADDR0);dec(data0);dec(data1);dec(data2);dec(data3);stop();
    }

void STM32_TM1637::print_time(int t, byte pd_t){
        start();dec(qwer);stop();start();dec(CODE1);stop();start();
        
        int data0 = t/1000;
        int data1 = t/100%10;
        int data2 = t/10%10;
        int data3 = t%10;
        
        for(int n=0;n&lt;4;n++){
        int data;
        if(n==0){data=data0;}
        if(n==1){data=data1;}
        if(n==2){data=data2;}
        if(n==3){data=data3;}
              
        switch(data){  // XGFEDCBA
        case 0:  data = 0b00111111;break;     // 0
        case 1:  data = 0b00000110;break;     // 1
        case 2:  data = 0b01011011;break;     // 2
        case 3:  data = 0b01001111;break;     // 3
        case 4:  data = 0b01100110;break;     // 4
        case 5:  data = 0b01101101;break;     // 5
        case 6:  data = 0b01111101;break;     // 6
        case 7:  data = 0b00000111;break;     // 7
        case 8:  data = 0b01111111;break;     // 8
        case 9:  data = 0b01101111;break;     // 9
        }
              
        if(n==0){data0=data;}
        if(n==1){data1=data;}
        if(n==2){data2=data;}
        if(n==3){data3=data;}
        }
        if(pd_t==1){data1=data1+0b10000000;}
        
        dec(ADDR0);dec(data0);dec(data1);dec(data2);dec(data3);stop();
}</code></pre></div><p>test.ino<br /></p><div class="codebox"><pre><code>#include &lt;STM32_TM1637.h&gt;

STM32_TM1637 tm(PB0,PB1);// CLK, DIO

float h=0.1;
byte p=1;

void setup(){
  Serial.begin(9600);   
  tm.brig(7); // ЯРКОСТЬ 0...7
}

void loop(){
   
   tm.print_float(h,p,  0,0,0,0); 
   delay(500);
  }

  /*
    
  tm.print_float(h,p,  h0,h1,h2,h3); 

  float h = -999...9999 | 0.000...0.999 | -9.99...99.99 | -99.9...999.9 
  byte p = 0...3 - число знаков после запятой
  
      A
     ---
  F |   | B
     -G-
  E |   | C
     ---
      D

 h0 h1 h2 h3 
 -----------
   XGFEDCBA (X - запятая)
 0b00000000 
      
   */</code></pre></div><p>time.ino<br /></p><div class="codebox"><pre><code>#include &lt;Wire.h&gt;
#include &lt;STM32_TM1637.h&gt; // http://forum.rcl-radio.ru/misc.php?action=pan_download&amp;item=403&amp;download=1
#include &lt;uRTCLib.h&gt;//https://github.com/Naguissa/uRTCLib.git
   STM32_TM1637 tm(PB0,PB1);// CLK, DIO
   uRTCLib rtc(0x68);       
 
   // PB7 = SDA DS1307 (DS3231) 
   // PB6 = SCL DS1307 (DS3231)
   // PB0 = CLK TM1637
   // PB1 = DIO TM1637
 
float h;
int i;
 
void setup(){  
  tm.brig(7); // ЯРКОСТЬ 0...7
   Wire.begin();
  // rtc.set(30, 37, 23, 2, 17, 12, 19);
  // RTCLib::set(byte second, byte minute, byte hour, byte dayOfWeek, byte dayOfMonth, byte month, byte year)
}
 
void loop(){
   rtc.refresh();// опрос времни
   h = rtc.hour()*100 + rtc.minute();
   tm.print_time(h, 0);
   delay(500);
   tm.print_time(h, 1);
   delay(500);
i++;
if(i==10){i=0;tm.print_float(rtc.temp()/100,0 ,0b1111000,0,0,0);delay(2000);}// вывод температуры DS3231
    
  }</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Sun, 20 Mar 2022 16:09:26 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?id=485&amp;action=new</guid>
		</item>
		<item>
			<title><![CDATA[Wire_low]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?id=482&amp;action=new</link>
			<description><![CDATA[<p>Тестовая библиотека, основной архив.</p><p><span class="attention-yellow"></span> </p><br /><p>Wire_low.h<br /></p><div class="codebox"><pre><code>// rcl-radio.ru liman324@yandex.ru 

// Atmega8
// Atmega48
// Atmega88
// Atmega168
// Atmega328
#include &lt;Arduino.h&gt;
    void wire_set(long f_clock, long i2c_clock);
    void wire_start_r(byte i2c_addr);
    void wire_start_w(byte i2c_addr);
    void wire_write(byte i2c_data);
    byte wire_read_a();
    byte wire_read();
    void wire_stop();</code></pre></div><p>Wire_low.cpp<br /></p><div class="codebox"><pre><code>#include &lt;avr/io.h&gt;
#include &lt;util/delay.h&gt;
#include &lt;Wire_low.h&gt;

void wire_set(long f_clock, long i2c_clock){
   TWBR = (((f_clock)/(i2c_clock)-16 )/2) ;
   TWSR = 0;
}

void wire_start_r(byte i2c_addr){
   TWCR = (1&lt;&lt;TWINT)|(1&lt;&lt;TWSTA)|(1&lt;&lt;TWEN);  // START
  while (!(TWCR &amp; (1&lt;&lt;TWINT))); 
   TWDR = (i2c_addr &lt;&lt; 1) | 1;
   TWCR = (1&lt;&lt;TWINT) | (1&lt;&lt;TWEN);
  while (!(TWCR &amp; (1&lt;&lt;TWINT)));
}

byte wire_read_a(){
   TWCR=(1&lt;&lt;TWINT)|(1&lt;&lt;TWEN)|(1&lt;&lt;TWEA); 
  while(~TWCR&amp;(1&lt;&lt;TWINT));
   byte value = TWDR; 
  return value;
}

byte wire_read(){
   TWCR = (1&lt;&lt;TWINT) | (1&lt;&lt;TWEN); 
  while(~TWCR&amp;(1&lt;&lt;TWINT));
   byte value = TWDR; 
  return value;
}

void wire_start_w(byte i2c_addr){
   TWCR = (1&lt;&lt;TWINT)|(1&lt;&lt;TWSTA)|(1&lt;&lt;TWEN);  
  while (!(TWCR &amp; (1&lt;&lt;TWINT)));
   TWDR = i2c_addr &lt;&lt; 1;
   TWCR = (1&lt;&lt;TWINT) | (1&lt;&lt;TWEN);
  while (!(TWCR &amp; (1&lt;&lt;TWINT)));
}

void wire_write(byte i2c_data){
   TWDR = i2c_data;
   TWCR = (1&lt;&lt;TWINT) | (1&lt;&lt;TWEN);
  while (!(TWCR &amp; (1&lt;&lt;TWINT)));
}

void wire_stop(){  
   TWCR = (1&lt;&lt;TWINT)|(1&lt;&lt;TWEN)|(1&lt;&lt;TWSTO); 
  }  </code></pre></div>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Sun, 13 Mar 2022 10:28:08 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?id=482&amp;action=new</guid>
		</item>
		<item>
			<title><![CDATA[PT2314]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?id=481&amp;action=new</link>
			<description><![CDATA[<p><span class="attention-yellow"></span> </p><p>PT2314.h<br /></p><div class="codebox"><pre><code>// liman324@yandex.ru rcl-radio.ru


#ifndef PT2314_H
#define PT2314_H

#define PT2314_address 0x44 // адрес 0b10001000


#include &lt;Arduino.h&gt;
class PT2314
{
  public:
    PT2314();
        void setVolume(int vol); // int 0...56 === 0...-70 dB step 1.25 dB
	void setAttL(int att_l); // int 0...24 === 0...-30 db step 1.25 dB      
	void setAttR(int att_r); // int 0...24 === 0...-30 dB step 1.25 dB
        void setSwitch(int input, int loud, int usil); 
        // input int 0..2 === IN 1...3 
        // loudness int 0...1 === 1-on 0-off
        // input gain int 0...3 === 0...11.25dB step 3.75 dB
        void setBass(int bass);   // int -7...+7 === -14...+14 dB step 2 dB
        void setTreble(int treb); // int -7...+7 === -14...+14 dB step 2 dB
	
  private:
	void writeWire(char a);
};
	
#endif //PT2314_H</code></pre></div><p>PT2314.cpp<br /></p><div class="codebox"><pre><code>#include &lt;Arduino.h&gt;
#include &lt;Wire.h&gt;
#include &quot;PT2314.h&quot;

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

void PT2314::setVolume(int vol){
  vol = 56-vol;
  writeWire(vol);
}

void PT2314::setAttL(int att_l){
  att_l = 0b11000000 + att_l;
  writeWire(att_l);
}

void PT2314::setAttR(int att_r){
  att_r = 0b11100000 + att_r;
  writeWire(att_r);
}

void PT2314::setSwitch(int input, int loud, int usil){
  switch (loud){
    case 1:loud = 0b00000000;break;
    case 0:loud = 0b00000100;break;
  }
  switch (usil){
    case 3:usil = 0b00000000;break;
    case 2:usil = 0b00001000;break;
    case 1:usil = 0b00010000;break;
    case 0:usil = 0b00011000;break; 
  }
  writeWire(0b01000000 + input + loud + usil);
}

void PT2314::setBass(int bass){
  switch (bass){
    case -7: bass = 0b01100000;break;
    case -6: bass = 0b01100001;break;
    case -5: bass = 0b01100010;break;
    case -4: bass = 0b01100011;break; 
    case -3: bass = 0b01100100;break;
    case -2: bass = 0b01100101;break;
    case -1: bass = 0b01100110;break;
    case 0:  bass = 0b01100111;break;
    case 1:  bass = 0b01101110;break;
    case 2:  bass = 0b01101101;break;
    case 3:  bass = 0b01101100;break;
    case 4:  bass = 0b01101011;break;
    case 5:  bass = 0b01101010;break;
    case 6:  bass = 0b01101001;break;
    case 7:  bass = 0b01101000;break;
  }
  writeWire(bass);
}

void PT2314::setTreble(int treb){
  switch (treb){
    case -7: treb = 0b01110000;break;
    case -6: treb = 0b01110001;break;
    case -5: treb = 0b01110010;break;
    case -4: treb = 0b01110011;break; 
    case -3: treb = 0b01110100;break;
    case -2: treb = 0b01110101;break;
    case -1: treb = 0b01110110;break;
    case 0:  treb = 0b01111111;break;
    case 1:  treb = 0b01111110;break;
    case 2:  treb = 0b01111101;break;
    case 3:  treb = 0b01111100;break;
    case 4:  treb = 0b01111011;break;
    case 5:  treb = 0b01111010;break;
    case 6:  treb = 0b01111001;break;
    case 7:  treb = 0b01111000;break;
  }
  writeWire(treb);
}

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

PT2314 pt;

void setup() {
     audio();
}

void loop() {
}

void audio(){
  pt.setVolume(45); // int 0...56 === -70...0 dB step 1.25 dB
  pt.setAttL(0); // int 0...24 === 0...-30 db step 1.25 dB &gt; int 31 === mute on     
  pt.setAttR(0); // int 0...24 === 0...-30 dB step 1.25 dB &gt; int 31 === mute on
  pt.setSwitch(0, 0, 0); 
        // input      int 0..3 === IN 1...4 
        // loudness   int 0...1 === 1-on 0-off
        // input gain int 0...3 === 11.25...0 dB step 3.75 dB
  pt.setBass(0);   // int -7...+7 === -14...+14 dB step 2 dB
  pt.setTreble(0); // int -7...+7 === -14...+14 dB step 2 dB
  }</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Sun, 13 Mar 2022 08:30:19 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?id=481&amp;action=new</guid>
		</item>
		<item>
			<title><![CDATA[BD37543FS.h]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?id=480&amp;action=new</link>
			<description><![CDATA[<p><span class="attention-yellow"></span> </p><p>BD37543FS.h<br /></p><div class="codebox"><pre><code>#ifndef BD37543FS_H
#define BD37543FS_H

#define BD37543FS_address 0b1000000 

#define SETUP_1        0x01
#define SETUP_2        0x02
#define SETUP_3        0x03
#define INPUT_SELECT   0x05
#define INPUT_GAIN     0x06
#define VOLUME_GAIN    0x20
#define FADER_1_FRONT  0x28
#define FADER_2_FRONT  0x29
#define FADER_1_REAR   0x2A
#define FADER_2_REAR   0x2B
#define FADER_SUB      0x2C
#define MIXING         0x30
#define BASS_SETUP     0x41
#define MIDDLE_SETUP   0x44
#define TREBLE_SETUP   0x47
#define BASS_GAIN      0x51
#define MIDDLE_GAIN    0x54
#define TREBLE_GAIN    0x57
#define LOUDNESS_GAIN  0x75

#include &lt;Arduino.h&gt;
class BD37543FS
{
  public:
    BD37543FS();
    void setSetup_1(int sw_time_mute, int sw_time, int sw_on_off); 
                   // default (0,2,1) | int 0...3, 0...3, 0...1
    void setSetup_2(int sub_f, int sub_out, int level_metr, int lpf_faza); 
                   // int sub_f ------ OFF 55Hz 85Hz 120Hz 160Hz = int 0...4
                   // int sub_out ---- LPF Front Rear Prohibition = int 0...3
                   // int level_metr - HOLD REST = int 0..1
                   // int faza ------- 0 180 = int 0...1
    void setSetup_3(int f_r_hpf, int r_hpf, int f_hpf); 
                   // int f_r_hpf ---- 55Hz 85Hz 120Hz 160Hz = int 0...3
                   // int r_hpf ------ pass NOT_pass = int 0...1
                   // int f_hpf ------ pass NOT_pass = int 0...1
    void setIn(int in); 
                   // 0...10 | in A B C = int 0 1 2 
    void setIn_gain(int in_gain, int mute); 
                   // in_gain -- 0...20 = 0...20 dB, mute -- 0 default 
    void setVol(int vol); 
                   // -79...+15 dB = int -79...15
    void setFront_1(int front_1); 
                   // -79...+15 dB = int -79...15
    void setFront_2(int front_2); 
                   // -79...+15 dB = int -79...15
    void setRear_1(int rear_1); 
                   // -79...+15 dB = int -79...15
    void setRear_2(int rear_2); 
                   // -79...+15 dB = int -79...15
    void setSub(int sub); 
                   // -79...+15 dB = int -79...15
    void setMix(int mix_gain);
                   // -79...+7 dB = int -79...7
    void setBass_setup(int bass_q, int bass_f); 
                   // 0.5 1.0 1.5 2.0 --- int 0...3, 60Hz 80Hz 100Hz 120Hz --- int 0...3
    void setMiddle_setup(int mid_q, int mid_f); 
                   // 0.75 1.0 1.25 1.5 --- int 0...3, 500Hz 1kHz 1.5kHz 2.5kHz --- int 0...3
    void setTreble_setup(int treb_q, int treb_f); 
                   // 0.75 1.25  --- int 0...1, 7.5kHz 10kHz 12.5kHz 15kHz --- int 0...3
    void setBass_gain(int bass_gain); 
                   // --20 ... +20 dB = int -20 ... 20    
    void setMiddle_gain(int mid_gain); 
                   // --20 ... +20 dB = int -20 ... 20
    void setTreble_gain(int treb_gain); 
                   // --20 ... +20 dB = int -20 ... 20        
    void setLoudness_gain(int loud_hicut, int loud_gain); 
                   // Hicut1 Hicut2 Hicut3 Hicut4 = int 0...3
                   // 0 ... 20 dB = int 0 ... 20

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

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

void BD37543FS::setSetup_1(int sw_time_mute, int sw_time, int sw_on_off){
       switch(sw_time){
         case 0: sw_time = 0b00000000;break;
         case 1: sw_time = 0b00010000;break;
         case 2: sw_time = 0b00100000;break;
         case 3: sw_time = 0b00110000;break;
  }    
       switch(sw_on_off){
         case 0: sw_on_off = 0b00000000;break;
         case 1: sw_on_off = 0b10000000;break;
  }
           writeWire(SETUP_1, 0b00000100 + sw_time_mute + sw_time + sw_on_off); 
  }

void BD37543FS::setSetup_2(int sub_f, int sub_out, int level_metr, int lpf_faza){
       switch(sub_out){
         case 0: sub_out = 0b00000000;break;
         case 1: sub_out = 0b00010000;break;
         case 2: sub_out = 0b00100000;break;
         case 3: sub_out = 0b00110000;break;  
  }
       switch(level_metr){
         case 0: level_metr = 0b00000000;break;
         case 1: level_metr = 0b01000000;break;
   }
       switch(lpf_faza){
         case 0: lpf_faza = 0b00000000;break;
         case 1: lpf_faza = 0b10000000;break;
   }
         writeWire(SETUP_2, sub_f + sub_out + level_metr + lpf_faza); 
   }
   
void BD37543FS::setSetup_3(int f_r_hpf, int r_hpf, int f_hpf){
       switch(f_r_hpf){
         case 0: f_r_hpf = 0b00000000;break;
         case 1: f_r_hpf = 0b00001000;break;
         case 2: f_r_hpf = 0b00110000;break;
         case 3: f_r_hpf = 0b00010000;break;  
   }
       switch(r_hpf){
         case 0: r_hpf = 0b00000000;break;
         case 1: r_hpf = 0b01000000;break;
   }
       switch(f_hpf){
         case 0: r_hpf = 0b00000000;break;
         case 1: r_hpf = 0b10000000;break;
       
   }   
         writeWire(SETUP_3, 0b00000010 + f_r_hpf + r_hpf + f_hpf); 
   }

void BD37543FS::setIn(int in){
       switch(in){
         case 0: in = 0b00000000;break;
         case 1: in = 0b00000001;break;
         case 2: in = 0b00000010;break;
         case 3: in = 0b00000011;break;
         case 4: in = 0b00001010;break;
         case 5: in = 0b00001011;break;
         case 6: in = 0b00001111;break;
         case 7: in = 0b00010000;break;
         case 8: in = 0b00000110;break;
         case 9: in = 0b00001000;break;
        case 10: in = 0b00001001;break;
   }  
         writeWire(INPUT_SELECT, in); 
   }


void BD37543FS::setIn_gain(int in_gain, int mute){
       switch(mute){
         case 0: mute = 0b00000000;break;
         case 1: mute = 0b10000000;break;
   }
         writeWire(INPUT_GAIN, in_gain + mute); 
   }

void BD37543FS::setVol(int vol){
       if(vol &gt; 0){vol = 128 - vol;}
       if(vol &lt;= 0){vol = abs(vol) + 128;}
       writeWire(VOLUME_GAIN, vol); 
   }

void BD37543FS::setFront_1(int front_1){
       if(front_1 &gt; 0){front_1 = 128 - front_1;}
       if(front_1 &lt;= 0){front_1 = abs(front_1) + 128;}
       writeWire(FADER_1_FRONT, front_1); 
   }

void BD37543FS::setFront_2(int front_2){
       if(front_2 &gt; 0){front_2 = 128 - front_2;}
       if(front_2 &lt;= 0){front_2 = abs(front_2) + 128;}
       writeWire(FADER_2_FRONT, front_2); 
   }

void BD37543FS::setRear_1(int rear_1){
       if(rear_1 &gt; 0){rear_1 = 128 - rear_1;}
       if(rear_1 &lt;= 0){rear_1 = abs(rear_1) + 128;}
       writeWire(FADER_1_REAR, rear_1); 
   }

void BD37543FS::setRear_2(int rear_2){
       if(rear_2 &gt; 0){rear_2 = 128 - rear_2;}
       if(rear_2 &lt;= 0){rear_2 = abs(rear_2) + 128;}
       writeWire(FADER_2_REAR, rear_2); 
   }

void BD37543FS::setSub(int sub){
       if(sub &gt; 0){sub = 128 - sub;}
       if(sub &lt;= 0){sub = abs(sub) + 128;}
       writeWire(FADER_SUB, sub); 
   }

void BD37543FS::setMix(int mix_gain){
       if(mix_gain &gt; 0){mix_gain = 128 - mix_gain;}
       if(mix_gain &lt;= 0){mix_gain = abs(mix_gain) + 128;}
            writeWire(MIXING, mix_gain); 
   }

void BD37543FS::setBass_setup(int bass_q, int bass_f){
       switch(bass_f){
         case 0: bass_f = 0b00000000;break;
         case 1: bass_f = 0b00010000;break;
         case 2: bass_f = 0b00100000;break;
         case 3: bass_f = 0b00110000;break;  
   }
         writeWire(BASS_SETUP, bass_q + bass_f); 
   }
   
void BD37543FS::setMiddle_setup(int mid_q, int mid_f){
       switch(mid_f){
         case 0: mid_f = 0b00000000;break;
         case 1: mid_f = 0b00010000;break;
         case 2: mid_f = 0b00100000;break;
         case 3: mid_f = 0b00110000;break;  
   }
         writeWire(MIDDLE_SETUP, mid_q + mid_f); 
   }
   

void BD37543FS::setTreble_setup(int treb_q, int treb_f){
       switch(treb_f){
         case 0: treb_f = 0b00000000;break;
         case 1: treb_f = 0b00010000;break;
         case 2: treb_f = 0b00100000;break;
         case 3: treb_f = 0b00110000;break;  
   }
         writeWire(TREBLE_SETUP, treb_q + treb_f); 
   }

void BD37543FS::setBass_gain(int bass_gain){
       if(bass_gain&gt;0){bass_gain = bass_gain;}                     
       if(bass_gain&lt;=0){bass_gain = abs(bass_gain) + 0b10000000;}  
       writeWire(BASS_GAIN, bass_gain);   
   }

void BD37543FS::setMiddle_gain(int mid_gain){
       if(mid_gain&gt;0){mid_gain = mid_gain;}                     
       if(mid_gain&lt;=0){mid_gain = abs(mid_gain) + 0b10000000;}  
       writeWire(MIDDLE_GAIN, mid_gain);   
   }

void BD37543FS::setTreble_gain(int treb_gain){
       if(treb_gain&gt;0){treb_gain = treb_gain;}                     
       if(treb_gain&lt;=0){treb_gain = abs(treb_gain) + 0b10000000;}  
       writeWire(TREBLE_GAIN, treb_gain);   
   }

void BD37543FS::setLoudness_gain(int loud_hicut, int loud_gain){
       switch(loud_hicut){
         case 0: loud_hicut = 0b00000000;break;
         case 1: loud_hicut = 0b00100000;break;
         case 2: loud_hicut = 0b01000000;break;
         case 3: loud_hicut = 0b01100000;break;
   }
         writeWire(LOUDNESS_GAIN, loud_hicut + loud_gain);  
   }

void BD37543FS::writeWire(char a, char b){
  Wire.beginTransmission(BD37543FS_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;BD37543FS.h&gt;
BD37543FS bd; 

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

void loop(){}

void audio(){
   bd.setSetup_1(0,2,1); 
                   // default (0,2,1) | int 0...3, 0...3, 0...1
    bd.setSetup_2(0,0,0,0); 
                   // int sub_f ------ OFF 55Hz 85Hz 120Hz 160Hz = int 0...4
                   // int sub_out ---- LPF Front Rear Prohibition = int 0...3
                   // int level_metr - HOLD REST = int 0..1
                   // int faza ------- 0 180 = int 0...1
    bd.setSetup_3(0,0,0); 
                   // int f_r_hpf ---- 55Hz 85Hz 120Hz 160Hz = int 0...3
                   // int r_hpf ------ pass NOT_pass = int 0...1
                   // int f_hpf ------ pass NOT_pass = int 0...1
    bd.setIn(0); 
                   // 0...10 | in A B C = int 0 1 2 
    bd.setIn_gain(0,0); 
                   // in_gain -- 0...20 = 0...20 dB, mute -- 0 default 
    bd.setVol(0); 
                   // -79...+15 dB = int -79...15
    bd.setFront_1(0); 
                   // -79...+15 dB = int -79...15
    bd.setFront_2(0); 
                   // -79...+15 dB = int -79...15
    bd.setRear_1(0); 
                   // -79...+15 dB = int -79...15
    bd.setRear_2(0); 
                   // -79...+15 dB = int -79...15
    bd.setSub(0); 
                   // -79...+15 dB = int -79...15
    bd.setMix(-79);
                   // -79...+7 dB = int -79...7
    bd.setBass_setup(0, 0); 
                   // 0.5 1.0 1.5 2.0 --- int 0...3, 60Hz 80Hz 100Hz 120Hz --- int 0...3
    bd.setMiddle_setup(0,0); 
                   // 0.75 1.0 1.25 1.5 --- int 0...3, 500Hz 1kHz 1.5kHz 2.5kHz --- int 0...3
    bd.setTreble_setup(0,0); 
                   // 0.75 1.25  --- int 0...1, 7.5kHz 10kHz 12.5kHz 15kHz --- int 0...3
    bd.setBass_gain(0); 
                   // --20 ... +20 dB = int -20 ... 20    
    bd.setMiddle_gain(0); 
                   // --20 ... +20 dB = int -20 ... 20
    bd.setTreble_gain(0); 
                   // --20 ... +20 dB = int -20 ... 20        
    bd.setLoudness_gain(0,0); 
                   // Hicut1 Hicut2 Hicut3 Hicut4 = int 0...3
                   // 0 ... 20 dB = int 0 ... 20
  }</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Sun, 13 Mar 2022 08:28:35 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?id=480&amp;action=new</guid>
		</item>
		<item>
			<title><![CDATA[BD3702]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?id=479&amp;action=new</link>
			<description><![CDATA[<p><span class="attention-yellow"></span> </p><p>BD3702.h<br /></p><div class="codebox"><pre><code>// Александр Лиман
// liman324@yandex.ru
// rcl-radio.ru
// BD3702FV
// http://forum.rcl-radio.ru/viewtopic.php?id=121

#ifndef BD3702_H
#define BD3702_H

#define BD3702_address 0b1000000 

#define INITIAL_SETUP_1        0x01
#define INITIAL_SETUP_2        0x02
#define INITIAL_SETUP_3        0x03
#define INPUT_SELECT           0x05
#define INPUT_GAIN             0x06
#define VOLUME_GAIN            0x20
#define FADER_1_FRONT          0x28
#define FADER_2_FRONT          0x29
#define FADER_1_REAR           0x2A
#define FADER_2_REAR           0x2B
#define FADER_SUB              0x2C
#define MIXING                 0x30
#define BASS_SETUP             0x41
#define MIDDLE_SETUP           0x44
#define TREBLE_SETUP           0x47
#define BASS_GAIN              0x51
#define MIDDLE_GAIN            0x54
#define TREBLE_GAIN            0x57
#define LOUDNESS_GAIN          0x75
#define INITIAL_SETUP_4        0x90

#include &lt;Arduino.h&gt;
class BD3702
{
  public:
    BD3702();
    // Advanced switch time of Mute === 0.6 1.0 1.4 3.2 ms = int 0...3
    // Advanced switch time of Input gain/Volume/Tone/Fader/Loudness === 4.7 7.1 11.2 14.4 ms = int 0...3
    // Advanced switch ON/OFF === OFF ON = int 0...1    
    void setInitial_1(int sw1, int sw2, int sw3); // 0x01
    // Subwoofer LPF fc === OFF 55Hz 85 Hz 120Hz = int 0...3
    // Subwoofer Output Select === LPF Front Rear Prohibition = int 0...3
    // Level Meter RESET === HOLD RESET = int 0...1
        void setInitial_2(int sub_f, int sub_out, int l_metr); // 0x02    
    // Loudness fo === 250Hz 400Hz 800Hz Prohibition = int 0...3
        void setInitial_3(int loud_f); // 0x03
    // Input Selector === A B C D_single E1_single E2_single D_diff E_full_diff Input_SHORT = int 0...8 
        void setIn(int in, int in_type); // 0x05
    // Input Gain === 0...20 dB = int 0...20
    // MUTE ON/OFF === OFF ON = int 0...1    
        void setIn_gain(int in_gain, int mute); // 0x06
    // VOL === -79...+15 dB = int -79...15
        void setVol(int vol); // 0x20
    // FADER FRONT 1CH === -79...+15 dB = int -79...15
        void setFront_1(int front_1); // 0x28
    // FADER FRONT 2CH === -79...+15 dB = int -79...15
        void setFront_2(int front_2); // 0x29
    // FADER REAR 1CH === -79...+15 dB = int -79...15
        void setRear_1(int rear_1); // 0x2A
    // FADER REAR 2CH === -79...+15 dB = int -79...15
        void setRear_2(int rear_2); // 0x2B
    // FADER SUB === -79...+15 dB = int -79...15
        void setSub(int sub); // 0x2C
    // Mixing Gain === -79...+7 dB = int -79...7
        void setMix_gain(int mix_g); // 0x30
    // Bass Q factor === 0.5 1.0 1.5 2.0 = int 0...3
    // Bass fo === 60Hz 80Hz 100Hz 120Hz = int 0...3
        void setBass_setup(int bass_q, int bass_f); // 0x41
    // Middle Q factor === 0.75 1.0 1.25 1.5 = int 0...3
    // Middle fo === 500Hz 1kHz 1.5kHz 2.5kHz = int 0...3
        void setMiddle_setup(int mid_q, int mid_f); // 0x44
    // Treble Q factor === 0.75 1.25 = int 0...1
    // Treble fo === 7.5kHz 10kHz 12.5kHz 15kHz = int 0...3
        void setTreble_setup(int treb_q, int treb_f); // 0x47
    // Bass Gain === -20...+20 dB = int -20...20
        void setBass_gain(int bass_gain); // 0x51
    // Middle Gain === -20...+20 dB = int -20...20
        void setMiddle_gain(int mid_gain); // 0x54
    // Treble Gain === -20...+20 dB = int -20...20
        void setTreble_gain(int treb_gain); // 0x57
    // Loudness Gain === 0...20 dB = int 0...20
        void setLoudness_gain(int loud_gain); // 0x75
    // Setup 4 = not param
        void setInitial_4();

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

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

void BD3702::setInitial_1(int sw1, int sw2, int sw3){
           switch(sw1){
              case 0: sw1 = 0b00000000;break;
              case 1: sw1 = 0b00000001;break;
              case 2: sw1 = 0b00000010;break;
              case 3: sw1 = 0b00000011;break;
}
           switch(sw2){
              case 0: sw2 = 0b00000000;break;
              case 1: sw2 = 0b00010000;break;
              case 2: sw2 = 0b00100000;break;
              case 3: sw2 = 0b00110000;break;
}
           switch(sw3){
              case 0: sw3 = 0b00000000;break;
              case 1: sw3 = 0b10000000;break;
}
           writeWire(INITIAL_SETUP_1, 0b01000100 + sw1 + sw2 + sw3); 
}


void BD3702::setInitial_2(int sub_f, int sub_out, int l_metr){
           switch(sub_f){
              case 0: sub_f = 0b00000000;break;
              case 1: sub_f = 0b00000001;break;
              case 2: sub_f = 0b00000010;break;
              case 3: sub_f = 0b00000011;break;
}
           switch(sub_out){
              case 0: sub_out = 0b00000000;break;
              case 1: sub_out = 0b00010000;break;
              case 2: sub_out = 0b00100000;break;
              case 3: sub_out = 0b00110000;break;
}
          switch(l_metr){
              case 0: l_metr = 0b00000000;break;
              case 1: l_metr = 0b01000000;break;
}
           writeWire(INITIAL_SETUP_2, sub_f + sub_out + l_metr);
}


void BD3702::setInitial_3(int loud_f){
            switch(loud_f){
              case 0: loud_f = 0b00000001;break;
              case 1: loud_f = 0b00001001;break;
              case 2: loud_f = 0b00010001;break;
              case 3: loud_f = 0b00011001;break;
}                 
           writeWire(INITIAL_SETUP_3, loud_f);
}


void BD3702::setIn(int in, int in_type){
           switch(in){
             case 0: in = 0b00000000;break;  
             case 1: in = 0b00000001;break; 
             case 2: in = 0b00000010;break; 
             case 3: in = 0b00000011;break;
             case 4: in = 0b00001010;break;
             case 5: in = 0b00001011;break; 
             case 6: in = 0b00000110;break;
             case 7: in = 0b00001000;break;    
             case 8: in = 0b00001001;break;
}  
          switch(in_type){
             case 0: in_type = 0b00000000;break;
             case 1: in_type = 0b10000000;break;
} 
             writeWire(INPUT_SELECT, in + in_type); 
}


void BD3702::setIn_gain(int in_gain, int mute){
            switch(mute){
               case 0: mute = 0b00000000;break;
               case 1: mute = 0b10000000;break;
   }
            writeWire(INPUT_GAIN, in_gain + mute); 
   }


void BD3702::setVol(int vol){
            if(vol &gt; 0){vol = 128 - vol;}
            if(vol &lt;= 0){vol = abs(vol) + 128;}
            writeWire(VOLUME_GAIN, vol); 
}


void BD3702::setFront_1(int front_1){
            if(front_1 &gt; 0){front_1 = 128 - front_1;}
            if(front_1 &lt;= 0){front_1 = abs(front_1) + 128;}
            writeWire(FADER_1_FRONT, front_1); 
}

void BD3702::setFront_2(int front_2){
            if(front_2 &gt; 0){front_2 = 128 - front_2;}
            if(front_2 &lt;= 0){front_2 = abs(front_2) + 128;}         
            writeWire(FADER_2_FRONT, front_2); 
}


void BD3702::setRear_1(int rear_1){
            if(rear_1 &gt; 0){rear_1 = 128 - rear_1;}
            if(rear_1 &lt;= 0){rear_1 = abs(rear_1) + 128;}
            writeWire(FADER_1_REAR, rear_1); 
}

void BD3702::setRear_2(int rear_2){
            if(rear_2 &gt; 0){rear_2 = 128 - rear_2;}
            if(rear_2 &lt;= 0){rear_2 = abs(rear_2) + 128;}
            writeWire(FADER_2_REAR, rear_2); 
}

void BD3702::setSub(int sub){ 
            if(sub &gt; 0){sub = 128 - sub;}
            if(sub &lt;= 0){sub = abs(sub) + 128;}
            writeWire(FADER_SUB, sub); 
}


void BD3702::setMix_gain(int mix_g){
            if(mix_g &gt; 0){mix_g = 128 - mix_g;}
            if(mix_g &lt;= 0){mix_g = abs(mix_g) + 128;}
            writeWire(MIXING, mix_g); 
}


void BD3702::setBass_setup(int bass_q, int bass_f){
            switch(bass_q){
               case 0: bass_q = 0b00000000;break;
               case 1: bass_q = 0b00000001;break;
               case 2: bass_q = 0b00000010;break;
               case 3: bass_q = 0b00000011;break;  
}
            switch(bass_f){
               case 0: bass_f = 0b00000000;break;
               case 1: bass_f = 0b00010000;break;
               case 2: bass_f = 0b00100000;break;
               case 3: bass_f = 0b00110000;break;  
}
            writeWire(BASS_SETUP, bass_q + bass_f); 
}


void BD3702::setMiddle_setup(int mid_q, int mid_f){
            switch(mid_q){
               case 0: mid_q = 0b00000000;break;
               case 1: mid_q = 0b00000001;break;
               case 2: mid_q = 0b00000010;break;
               case 3: mid_q = 0b00000011;break;  
}
            switch(mid_f){
               case 0: mid_f = 0b00000000;break;
               case 1: mid_f = 0b00010000;break;
               case 2: mid_f = 0b00100000;break;
               case 3: mid_f = 0b00110000;break;  
}
            writeWire(MIDDLE_SETUP, mid_q + mid_f); 
}


void BD3702::setTreble_setup(int treb_q, int treb_f){
            switch(treb_q){
               case 0: treb_q = 0b00000000;break;
               case 1: treb_q = 0b00000001;break; 
}
            switch(treb_f){
               case 0: treb_f = 0b00000000;break;
               case 1: treb_f = 0b00010000;break;
               case 2: treb_f = 0b00100000;break;
               case 3: treb_f = 0b00110000;break;  
}
            writeWire(TREBLE_SETUP, treb_q + treb_f); 
}


void BD3702::setBass_gain(int bass_gain){
                 if(bass_gain&gt;0){bass_gain = bass_gain + 0b00000000;}                     
                 if(bass_gain&lt;=0){bass_gain = abs(bass_gain) + 0b10000000;}  
               writeWire(BASS_GAIN, bass_gain);   
}

void BD3702::setMiddle_gain(int mid_gain){
                 if(mid_gain&gt;0){mid_gain = mid_gain + 0b00000000;}                     
                 if(mid_gain&lt;=0){mid_gain = abs(mid_gain) + 0b10000000;}  
               writeWire(MIDDLE_GAIN, mid_gain);   
}

void BD3702::setTreble_gain(int treb_gain){
                 if(treb_gain&gt;0){treb_gain = treb_gain + 0b00000000;}                     
                 if(treb_gain&lt;=0){treb_gain = abs(treb_gain) + 0b10000000;}  
               writeWire(TREBLE_GAIN, treb_gain);   
}


void BD3702::setLoudness_gain(int loud_gain){
               writeWire(LOUDNESS_GAIN, loud_gain);  
}

void BD3702::setInitial_4(){
           writeWire(INITIAL_SETUP_4, 0b00110000);  
}

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

void setup() {
  audio();
}

void loop() {}

void audio(){
    // Advanced switch time of Mute === 0.6 1.0 1.4 3.2 ms = int 0...3
    // Advanced switch time of Input gain/Volume/Tone/Fader/Loudness === 4.7 7.1 11.2 14.4 ms = int 0...3
    // Advanced switch ON/OFF === OFF ON = int 0...1    
  bd.setInitial_1(0, 0, 0); // 0x01
    // Subwoofer LPF fc === OFF 55Hz 85 Hz 120Hz = int 0...3
    // Subwoofer Output Select === LPF Front Rear Prohibition = int 0...3
    // Level Meter RESET === HOLD RESET = int 0...1
  bd.setInitial_2(0, 0, 0); // 0x02  
    // Loudness fo === 250Hz 400Hz 800Hz Prohibition = int 0...3
  bd.setInitial_3(0); // 0x03
    // Input Selector === A B C D_single E1_single E2_single D_diff E_full_diff Input_SHORT = int 0...8 
  bd.setIn(0, 0); // 0x05
    // Input Gain === 0...20 dB = int 0...20
    // MUTE ON/OFF === OFF ON = int 0...1    
  bd.setIn_gain(0, 0); // 0x06
    // VOL === -79...+15 dB = int -79...15
  bd.setVol(0); // 0x20
    // FADER FRONT 1CH === -79...+15 dB = int -79...15
  bd.setFront_1(0); // 0x28
    // FADER FRONT 2CH === -79...+15 dB = int -79...15
  bd.setFront_2(0); // 0x29
    // FADER REAR 1CH === -79...+15 dB = int -79...15
  bd.setRear_1(0); // 0x2A
    // FADER REAR 2CH === -79...+15 dB = int -79...15
  bd.setRear_2(0); // 0x2B
    // FADER SUB === -79...+15 dB = int -79...15
  bd.setSub(0); // 0x2C
    // Mixing Gain === -79...+7 dB = int -79...7
  bd.setMix_gain(0); // 0x30
    // Bass Q factor === 0.5 1.0 1.5 2.0 = int 0...3
    // Bass fo === 60Hz 80Hz 100Hz 120Hz = int 0...3
  bd.setBass_setup(0, 0); // 0x41
    // Middle Q factor === 0.75 1.0 1.25 1.5 = int 0...3
    // Middle fo === 500Hz 1kHz 1.5kHz 2.5kHz = int 0...3
  bd.setMiddle_setup(0, 0); // 0x44
    // Treble Q factor === 0.75 1.25 = int 0...1
    // Treble fo === 7.5kHz 10kHz 12.5kHz 15kHz = int 0...3
  bd.setTreble_setup(0, 0); // 0x47
    // Bass Gain === -20...+20 dB = int -20...20
  bd.setBass_gain(0); // 0x51
    // Middle Gain === -20...+20 dB = int -20...20
  bd.setMiddle_gain(0); // 0x54
    // Treble Gain === -20...+20 dB = int -20...20
  bd.setTreble_gain(0); // 0x57
    // Loudness Gain === 0...20 dB = int 0...20
  bd.setLoudness_gain(0); // 0x75
    // Setup 4 = not param
  bd.setInitial_4();
  }</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Sun, 13 Mar 2022 08:26:39 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?id=479&amp;action=new</guid>
		</item>
		<item>
			<title><![CDATA[BD37033FV]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?id=478&amp;action=new</link>
			<description><![CDATA[<p><span class="attention-yellow"></span> </p><p>BD37033FV.h<br /></p><div class="codebox"><pre><code>#ifndef BD37033FV_H
#define BD37033FV_H

#define BD37033FV_address 0b1000000 

#define INITIAL_SETUP        0x01
#define LPF_SETUP            0x02
#define MIXING_SETUP         0x03
#define INPUT_SELECT         0x05
#define INPUT_GAIN           0x06
#define VOLUME_GAIN          0x20
#define FADER_1_FRONT        0x28
#define FADER_2_FRONT        0x29
#define FADER_1_REAR         0x2A
#define FADER_2_REAR         0x2B
#define FADER_SUB_1          0x2C
#define FADER_SUB_2          0x30
#define BASS_SETUP           0x41
#define MIDDLE_SETUP         0x44
#define TREBLE_SETUP         0x47
#define BASS_GAIN            0x51
#define MIDDLE_GAIN          0x54
#define TREBLE_GAIN          0x57
#define LOUDNESS_GAIN        0x75

#include &lt;Arduino.h&gt;
class BD37033FV
{
  public:
    BD37033FV();
    void setInitial();
        void setSub_setup(int sub_f,int sub_out, int faza); // off 55hz 85hz 120hz 160hz pass = int sub_f(0...5) || LPF front rear sub = int sub_out(0...3) 0 - default || 0 180 = int faza(0...1)
        void setLoud_f(int mix_in, int loud_f, int mix_ch1, int mix_ch2); // MIX_IN 0...3 3=off || 400hz 800hz 2400hz Prohibition = int loud_f(0...3) || MIXING 1ch 2ch -- on off = mix_ch1(0...1) mix_ch2(0..1)
        void setIn(int in); // in1 in2 in3 = int in(0...2)
        void setIn_gain(int in_gain, int mute); // 0...16 dB = int in_gain(0...16) || off on = int mute(0...1)
        void setVol(int vol); // -79...+15 dB = int vol(-79...15)
        void setFront_1(int front_1); // -79...+15 dB = int -79...15
        void setFront_2(int front_2); // -79...+15 dB = int -79...15
        void setRear_1(int rear_1); // -79...+15 dB = int -79...15
        void setRear_2(int rear_2); // -79...+15 dB = int -79...15
        void setSub1(int sub1); // -79...+15 dB = int -79...15
        void setSub2(int sub2); // -79...+15 dB = int -79...15
        void setBass_setup(int bass_q, int bass_f); // 0.5 1.0 1.5 2.0 --- int 0...3, 60Hz 80Hz 100Hz 120Hz --- int 0...3
        void setMiddle_setup(int mid_q, int mid_f); // 0.75 1.0 1.25 1.5 --- int 0...3, 500Hz 1kHz 1.5kHz 2.5kHz --- int 0...3
        void setTreble_setup(int treb_q, int treb_f); // 0.75 1.25  --- int 0...1, 7.5kHz 10kHz 12.5kHz 15kHz --- int 0...3
        void setBass_gain(int bass_gain); // --15 ... +15 dB = int -15 ... 15    
        void setMiddle_gain(int mid_gain); // --15 ... +15 dB = int -15 ... 15
        void setTreble_gain(int treb_gain); // --15 ... +20 dB = int -15 ... 15
        void setLoudness_gain(int loud_gain); // 0 ... 15 dB = int 0 ... 15    

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

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

void BD37033FV::setInitial(){
             int initial = 0b00100100;
           writeWire(INITIAL_SETUP, initial); 
   }

void BD37033FV::setSub_setup(int sub_f,int sub_out, int faza){
          switch(sub_f){
             case 0: sub_f = 0b00000000;break;  
             case 1: sub_f = 0b00000001;break; 
             case 2: sub_f = 0b00000010;break; 
             case 3: sub_f = 0b00000011;break; 
             case 4: sub_f = 0b00000100;break; 
             case 5: sub_f = 0b00000101;break;        
   }   
          switch(sub_out){
             case 0: sub_out = 0b00000000;break;  
             case 1: sub_out = 0b00010000;break; 
             case 2: sub_out = 0b00100000;break; 
             case 3: sub_out = 0b00110000;break;
   } 
          switch(faza){
             case 0: faza = 0b00000000;break;
             case 1: faza = 0b10000000;break;
   }
             int sub_set_sum = sub_f + sub_out + faza;
             writeWire(LPF_SETUP, sub_set_sum); 
   }

void BD37033FV::setLoud_f(int mix_in, int loud_f, int mix_ch1, int mix_ch2){
             switch(mix_in){
             case 0: mix_in = 0b00000000;break;  
             case 1: mix_in = 0b01000000;break; 
             case 2: mix_in = 0b10000000;break; 
             case 3: mix_in = 0b11000000;break; 
   }
             switch(loud_f){
             case 0: loud_f = 0b00000000;break;  
             case 1: loud_f = 0b00001000;break; 
             case 2: loud_f = 0b00010000;break; 
             case 3: loud_f = 0b00011000;break;      
   }   
             switch(mix_ch1){
             case 0: mix_ch1 = 0b00000000;break;  
             case 1: mix_ch1 = 0b00000010;break; 
   }
             switch(mix_ch2){
             case 0: mix_ch2 = 0b00000000;break;  
             case 1: mix_ch2 = 0b00000100;break; 
   }     
             int loun_sum = 0b00000001 + loud_f + mix_ch1 + mix_ch2 + mix_in;
             writeWire(MIXING_SETUP, loun_sum); 
   }

void BD37033FV::setIn(int in){
             switch(in){
             case 0: in = 0b00000000;break;  
             case 1: in = 0b00000001;break; 
             case 2: in = 0b00000010;break;      
   }   
             writeWire(INPUT_SELECT, in); 
   }

void BD37033FV::setIn_gain(int in_gain, int mute){
            switch(mute){
               case 0: mute = 0b00000000;break;
               case 1: mute = 0b10000000;break;
   }
            int sum_in_gain = in_gain + mute;
            writeWire(INPUT_GAIN, sum_in_gain); 
   }

void BD37033FV::setVol(int vol){
            if(vol &gt; 0){vol = 128 - vol;}
            if(vol &lt;= 0){vol = abs(vol) + 128;}
            writeWire(VOLUME_GAIN, vol); 
   }

void BD37033FV::setFront_1(int front_1){
            if(front_1 &gt; 0){front_1 = 128 - front_1;}
            if(front_1 &lt;= 0){front_1 = abs(front_1) + 128;}
            
            writeWire(FADER_1_FRONT, front_1); 
   }

void BD37033FV::setFront_2(int front_2){
            if(front_2 &gt; 0){front_2 = 128 - front_2;}
            if(front_2 &lt;= 0){front_2 = abs(front_2) + 128;}
            
            writeWire(FADER_2_FRONT, front_2); 
   }

void BD37033FV::setRear_1(int rear_1){
            if(rear_1 &gt; 0){rear_1 = 128 - rear_1;}
            if(rear_1 &lt;= 0){rear_1 = abs(rear_1) + 128;}
            
            writeWire(FADER_1_REAR, rear_1); 
   }

void BD37033FV::setRear_2(int rear_2){
            if(rear_2 &gt; 0){rear_2 = 128 - rear_2;}
            if(rear_2 &lt;= 0){rear_2 = abs(rear_2) + 128;}
            
            writeWire(FADER_2_REAR, rear_2); 
   }

void BD37033FV::setSub1(int sub1){
            if(sub1 &gt; 0){sub1 = 128 - sub1;}
            if(sub1 &lt;= 0){sub1 = abs(sub1) + 128;}
            
            writeWire(FADER_SUB_1, sub1); 
   }

void BD37033FV::setSub2(int sub2){
            if(sub2 &gt; 0){sub2 = 128 - sub2;}
            if(sub2 &lt;= 0){sub2 = abs(sub2) + 128;}
            
            writeWire(FADER_SUB_2, sub2); 
   }

void BD37033FV::setBass_setup(int bass_q, int bass_f){
            switch(bass_q){
               case 0: bass_q = 0b00000000;break;
               case 1: bass_q = 0b00000001;break;
               case 2: bass_q = 0b00000010;break;
               case 3: bass_q = 0b00000011;break;  
   }
            switch(bass_f){
               case 0: bass_f = 0b00000000;break;
               case 1: bass_f = 0b00010000;break;
               case 2: bass_f = 0b00100000;break;
               case 3: bass_f = 0b00110000;break;  
   }
            int bass_s_sum = bass_q + bass_f;
            writeWire(BASS_SETUP, bass_s_sum); 
   }

void BD37033FV::setMiddle_setup(int mid_q, int mid_f){
            switch(mid_q){
               case 0: mid_q = 0b00000000;break;
               case 1: mid_q = 0b00000001;break;
               case 2: mid_q = 0b00000010;break;
               case 3: mid_q = 0b00000011;break;  
   }
            switch(mid_f){
               case 0: mid_f = 0b00000000;break;
               case 1: mid_f = 0b00010000;break;
               case 2: mid_f = 0b00100000;break;
               case 3: mid_f = 0b00110000;break;  
   }
            int mid_s_sum = mid_q + mid_f;
            writeWire(MIDDLE_SETUP, mid_s_sum); 
   }

void BD37033FV::setTreble_setup(int treb_q, int treb_f){
            switch(treb_q){
               case 0: treb_q = 0b00000000;break;
               case 1: treb_q = 0b00000001;break; 
   }
            switch(treb_f){
               case 0: treb_f = 0b00000000;break;
               case 1: treb_f = 0b00010000;break;
               case 2: treb_f = 0b00100000;break;
               case 3: treb_f = 0b00110000;break;  
   }
            int treb_s_sum = treb_q + treb_f;
            writeWire(TREBLE_SETUP, treb_s_sum); 
   }

void BD37033FV::setBass_gain(int bass_gain){
                 if(bass_gain&gt;0){bass_gain = bass_gain + 0b00000000;}                     
                 if(bass_gain&lt;=0){bass_gain = abs(bass_gain) + 0b10000000;}  
               writeWire(BASS_GAIN, bass_gain);   
   }

void BD37033FV::setMiddle_gain(int mid_gain){
                 if(mid_gain&gt;0){mid_gain = mid_gain + 0b00000000;}                     
                 if(mid_gain&lt;=0){mid_gain = abs(mid_gain) + 0b10000000;}  
               writeWire(MIDDLE_GAIN, mid_gain);   
   }

void BD37033FV::setTreble_gain(int treb_gain){
                 if(treb_gain&gt;0){treb_gain = treb_gain + 0b00000000;}                     
                 if(treb_gain&lt;=0){treb_gain = abs(treb_gain) + 0b10000000;}  
               writeWire(TREBLE_GAIN, treb_gain);   
   }

void BD37033FV::setLoudness_gain(int loud_gain){
               writeWire(LOUDNESS_GAIN, loud_gain);  
   }



void BD37033FV::writeWire(char a, char b){
  Wire.beginTransmission(BD37033FV_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;BD37033FV.h&gt;
BD37033FV tda; 

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

void loop(){}

void audio(){
        tda.setInitial();
        tda.setSub_setup(0,0,0); // off 55hz 85hz 120hz 160hz pass = int sub_f(0...5) || LPF front rear sub = int sub_out(0...3) 0 - default || 0 180 = int faza(0...1)
        tda.setLoud_f(3,0,0,0); // mix_in off || 400hz 800hz 2400hz Prohibition = int loud_f(0...3) || MIXING 1ch 2ch -- on off = mix_ch1(0...1) mix_ch2(0..1)
        tda.setIn(0); // in1 in2 in3 = int in(0...2)
        tda.setIn_gain(0,0); // 0...16 dB = int in_gain(0...16) || off on = int mute(0...1)
        tda.setVol(0); // -79...+15 dB = int vol(-79...15)
        tda.setFront_1(0); // -79...+15 dB = int -79...15
        tda.setFront_2(0); // -79...+15 dB = int -79...15
        tda.setRear_1(0); // -79...+15 dB = int -79...15
        tda.setRear_2(0); // -79...+15 dB = int -79...15
        tda.setSub1(0); // -79...+15 dB = int -79...15
        tda.setSub2(0); // -79...+15 dB = int -79...15
        tda.setBass_setup(0,0); // 0.5 1.0 1.5 2.0 --- int 0...3, 60Hz 80Hz 100Hz 120Hz --- int 0...3
        tda.setMiddle_setup(0,0); // 0.75 1.0 1.25 1.5 --- int 0...3, 500Hz 1kHz 1.5kHz 2.5kHz --- int 0...3
        tda.setTreble_setup(0,0); // 0.75 1.25  --- int 0...1, 7.5kHz 10kHz 12.5kHz 15kHz --- int 0...3
        tda.setBass_gain(0); // --15 ... +15 dB = int -15 ... 15 
        tda.setMiddle_gain(0); // --15 ... +15 dB = int -15 ... 15
        tda.setTreble_gain(0); // --15 ... +20 dB = int -15 ... 15
        tda.setLoudness_gain(0); // 0 ... 15 dB = int 0 ... 15 
  }</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Sun, 13 Mar 2022 08:23:12 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?id=478&amp;action=new</guid>
		</item>
		<item>
			<title><![CDATA[BD3491FS]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?id=477&amp;action=new</link>
			<description><![CDATA[<p><span class="attention-yellow"></span> </p><p>BD3491FS.h<br /></p><div class="codebox"><pre><code>// ALEXSANDER LIMAN
// liman324@yandex.ru
// rcl-radio.ru
// 08.11.2019

#ifndef BD3491FS_H
#define BD3491FS_H

#define BD3491FS_address 0b1000001 

#define INPUT_SELECT        0x04
#define INPUT_GAIN          0x06
#define VOLUME_GAIN_1       0x21
#define VOLUME_GAIN_2       0x22
#define BASS_GAIN           0x51
#define TREBLE_GAIN         0x57
#define SURROUND            0x78

#include &lt;Arduino.h&gt;
class BD3491FS
{
  public:
    BD3491FS();
    void setSelect(int in);// int 0...7 === A B C D E F INPUT_SHORT INPUT_MUTE
    void setIn_gain(int in_gain); // int 0...7 === 0...20 dB    
    void setVol_1(int vol_1); // int 0...87 === 0...-87 dB
    void setVol_2(int vol_2); // int 0...87 === 0...-87 dB
    void setBass(int bass); // int -7...0...+7 === -14...+14 dB
    void setTreb(int treb); // int -7...0...+7 === -14...+14 dB
    void setSurround(int sur); // int 0...3 === OFF LOW MIDDLE HIGH
	
  private:
	void writeWire(char a, char b);
};
	
#endif //BD3491FS_H</code></pre></div><p>BD3491FS.cpp<br /></p><div class="codebox"><pre><code>#include &lt;Arduino.h&gt;
#include &lt;Wire.h&gt;
#include &quot;BD3491FS.h&quot;

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

void BD3491FS::setSelect(int in){
     writeWire(INPUT_SELECT, in); 
}

void BD3491FS::setIn_gain(int in_gain){
     switch(in_gain){
       case 0: in_gain = 0b00000000;break;
       case 1: in_gain = 0b00000010;break;
       case 2: in_gain = 0b00000100;break;
       case 3: in_gain = 0b00000110;break;
       case 4: in_gain = 0b00001000;break;
       case 5: in_gain = 0b00001100;break;
       case 6: in_gain = 0b00010000;break;
       case 7: in_gain = 0b00010100;break;
}
     writeWire(INPUT_GAIN, in_gain); 
}

void BD3491FS::setVol_1(int vol_1){
     writeWire(VOLUME_GAIN_1, vol_1 + 0b10000000); 
}

void BD3491FS::setVol_2(int vol_2){
     writeWire(VOLUME_GAIN_2, vol_2 + 0b10000000); 
}

void BD3491FS::setBass(int bass){
     switch(bass){
       case 0: bass = 0b00000000;break;
       case 1: bass = 0b00000010;break;
       case 2: bass = 0b00000100;break;
       case 3: bass = 0b00000110;break;
       case 4: bass = 0b00001000;break;
       case 5: bass = 0b00001010;break;
       case 6: bass = 0b00001100;break;
       case 7: bass = 0b00001110;break;
       case -1: bass = 0b10000010;break;
       case -2: bass = 0b10000100;break;
       case -3: bass = 0b10000110;break;
       case -4: bass = 0b10001000;break;
       case -5: bass = 0b10001010;break;
       case -6: bass = 0b10001100;break;
       case -7: bass = 0b10001110;break;
}
     writeWire(BASS_GAIN, bass); 
}

void BD3491FS::setTreb(int treb){
     switch(treb){
       case 0: treb = 0b00000000;break;
       case 1: treb = 0b00000010;break;
       case 2: treb = 0b00000100;break;
       case 3: treb = 0b00000110;break;
       case 4: treb = 0b00001000;break;
       case 5: treb = 0b00001010;break;
       case 6: treb = 0b00001100;break;
       case 7: treb = 0b00001110;break;
       case -1: treb = 0b10000010;break;
       case -2: treb = 0b10000100;break;
       case -3: treb = 0b10000110;break;
       case -4: treb = 0b10001000;break;
       case -5: treb = 0b10001010;break;
       case -6: treb = 0b10001100;break;
       case -7: treb = 0b10001110;break;
}
     writeWire(TREBLE_GAIN, treb); 
}

void BD3491FS::setSurround(int sur){
     switch(sur){
       case 0: sur = 0b10000000;break;
       case 1: sur = 0b10000101;break;
       case 2: sur = 0b10001010;break;
       case 3: sur = 0b10001111;break;
}
     writeWire(SURROUND, sur); 
}

void BD3491FS::writeWire(char a, char b){
  Wire.beginTransmission(BD3491FS_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;BD3491FS.h&gt;
BD3491FS bd; 

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

void loop(){}

void audio(){
    bd.setSelect(0);// int 0...7 === A B C D E F INPUT_SHORT INPUT_MUTE
    bd.setIn_gain(0); // int 0...7 === 0...20 dB    
    bd.setVol_1(0); // int 0...87 === 0...-87 dB
    bd.setVol_2(0); // int 0...87 === 0...-87 dB
    bd.setBass(0); // int -7...0...+7 === -14...+14 dB
    bd.setTreb(0); // int -7...0...+7 === -14...+14 dB
    bd.setSurround(1); // int 0...3 === OFF LOW MIDDLE HIGH
  }</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Sun, 13 Mar 2022 08:21:12 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?id=477&amp;action=new</guid>
		</item>
		<item>
			<title><![CDATA[PT2033]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?id=476&amp;action=new</link>
			<description><![CDATA[<p><span class="attention-yellow"></span> </p><br /><p>PT2033.h<br /></p><div class="codebox"><pre><code>// liman324@yandex.ru rcl-radio.ru


#ifndef PT2033_H
#define PT2033_H

#define PT2033_address 0b1000100


#include &lt;Arduino.h&gt;
class PT2033
{
  public:
    PT2033();
        void setVolume(int vol); //  int 0...63     
	void setAttL(int att_l); //  int 0...31       
	void setAttR(int att_r); //  int 0...31     
        void setAttS(int att_s); //  int 0...31
        void setIn(int in, int loud, int loud_gain);   
         // int 0...3, int 0...1, int 0...3
        void setBass(int bass); // -7...+7
        void setTreble(int treb); //  -7...+7
	
  private:
	void writeWire(char a);
};
	
#endif //PT2033_H</code></pre></div><p>PT2033.cpp<br /></p><div class="codebox"><pre><code>#include &lt;Arduino.h&gt;
#include &lt;Wire.h&gt;
#include &quot;PT2033.h&quot;

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

void PT2033::setVolume(int vol){
  vol = 63 - vol;
  writeWire(vol);
}

void PT2033::setAttL(int att_l){
  att_l = 0b11000000 + att_l;
  writeWire(att_l);
}

void PT2033::setAttR(int att_r){
  att_r = 0b11100000 + att_r;
  writeWire(att_r);
}

void PT2033::setAttS(int att_s){
  att_s = 0b10000000 + att_s;
  writeWire(att_s);
}

void PT2033::setIn(int in, int loud, int loud_gain){
  switch (in){
    case 0:in = 0b00000000;break;
    case 1:in = 0b00000001;break;
    case 2:in = 0b00000010;break;
    case 3:in = 0b00000011;break;
  }
  switch (loud){
    case 1:loud = 0b00000000;break;
    case 0:loud = 0b00000100;break;
  }
  switch (loud_gain){
    case 0:loud_gain = 0b00000000;break;
    case 1:loud_gain = 0b00001000;break;
    case 2:loud_gain = 0b00010000;break;
    case 3:loud_gain = 0b00011000;break; 
  }
  int sw = 0b01000000 + in + loud + loud_gain;
  writeWire(sw);
}

void PT2033::setBass(int bass){
  switch (bass){
    case -7: bass = 0b01100000;break;
    case -6: bass = 0b01100001;break;
    case -5: bass = 0b01100010;break;
    case -4: bass = 0b01100011;break; 
    case -3: bass = 0b01100100;break;
    case -2: bass = 0b01100101;break;
    case -1: bass = 0b01100110;break;
    case 0:  bass = 0b01100111;break;
    case 1:  bass = 0b01101110;break;
    case 2:  bass = 0b01101101;break;
    case 3:  bass = 0b01101100;break;
    case 4:  bass = 0b01101011;break;
    case 5:  bass = 0b01101010;break;
    case 6:  bass = 0b01101001;break;
    case 7:  bass = 0b01101000;break;
  }
  writeWire(bass);
}

void PT2033::setTreble(int treb){
  switch (treb){
    case -7: treb = 0b01110000;break;
    case -6: treb = 0b01110001;break;
    case -5: treb = 0b01110010;break;
    case -4: treb = 0b01110011;break; 
    case -3: treb = 0b01110100;break;
    case -2: treb = 0b01110101;break;
    case -1: treb = 0b01110110;break;
    case 0:  treb = 0b01111111;break;
    case 1:  treb = 0b01111110;break;
    case 2:  treb = 0b01111101;break;
    case 3:  treb = 0b01111100;break;
    case 4:  treb = 0b01111011;break;
    case 5:  treb = 0b01111010;break;
    case 6:  treb = 0b01111001;break;
    case 7:  treb = 0b01111000;break;
  }
  writeWire(treb);
}

void PT2033::writeWire(char a){
  Wire.beginTransmission(PT2033_address);
  Wire.write (a);
  Wire.endTransmission();
}</code></pre></div><p>test.ino<br /></p><div class="codebox"><pre><code>#include &lt;Wire.h&gt;
#include &lt;PT2033.h&gt;
  PT2033 pt;
  
void setup(){ 
  Serial.begin(9600);Wire.begin();
  audio();
}

void loop(){}

void audio(){
  pt.setVolume(55);  // громкость 0...63       
  pt.setAttL(0);     // аттенюатор L 0...31     
  pt.setAttR(0);     // аттенюатор R 0...31
  pt.setAttS(0);    // аттенюатор S 0...31

  pt.setIn(0,0,0); // вход 0...3, тонкомпенсация 1 вкл 0 выкл, усиление 0...3
  pt.setBass(0);       // тембр НЧ -7...+7
  pt.setTreble(0);     // тембр ВЧ -7...+7
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Sun, 13 Mar 2022 08:19:20 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?id=476&amp;action=new</guid>
		</item>
		<item>
			<title><![CDATA[PT2348]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?id=475&amp;action=new</link>
			<description><![CDATA[<p><span class="attention-yellow"></span> </p><p>PT2348.h<br /></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<br /></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><p>PT2348.ino<br /></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>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Tue, 08 Mar 2022 16:56:47 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?id=475&amp;action=new</guid>
		</item>
		<item>
			<title><![CDATA[LCD1602_I2C_LOW]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?id=474&amp;action=new</link>
			<description><![CDATA[<p><a href="http://rcl-radio.ru/wp-content/uploads/2022/03/Lcd1602_i2c_low.zip">http://rcl-radio.ru/wp-content/uploads/ … 2c_low.zip</a></p><p>Lcd1602_i2c_low.h<br /></p><div class="codebox"><pre><code>// rcl-radio.ru liman324@yandex.ru 

// Atmega8
// Atmega48
// Atmega88
// Atmega168
// Atmega328

#ifndef Lcd1602_i2c_low_H
#define Lcd1602_i2c_low_H

#include &lt;Arduino.h&gt;
class Lcd1602_i2c_low{
  public:
    Lcd1602_i2c_low(uint8_t);
    void setInit();
    void Clear();
    void Curs(byte str, byte mesto);
    void PrintString(const char* str);
    void PrintChar(const char chr);
    void led(bool led_on_off);
    void PrintInt(int data_int);
    void PrintFloat(float data_float, byte dp);
    void Write(byte addr_w, byte wr1,byte wr2,byte wr3,byte wr4,byte wr5,byte wr6,byte wr7,byte wr8);

  private:
    uint8_t ADDR_LED;
    void i2c_write_1bit(byte a);
    void lcd(uint8_t sett);
    void lcdSend(bool rs, byte data);
    void e_pin();

};
	
#endif //Lcd1602_i2c_low</code></pre></div><p>Lcd1602_i2c_low.cpp<br /></p><div class="codebox"><pre><code>#include &lt;avr/io.h&gt;
#include &lt;util/delay.h&gt;
#include &lt;Wire_low.h&gt;
#include &lt;Lcd1602_i2c_low.h&gt;

#define RS           0
#define E            2
#define LED          3

byte led_b;

Lcd1602_i2c_low::Lcd1602_i2c_low(uint8_t addr_led){
    ADDR_LED = addr_led;
}

void Lcd1602_i2c_low::led(bool led_on_off){
    if(led_on_off==1){i2c_write_1bit(led_b |= (1&lt;&lt;LED));}
    if(led_on_off==0){i2c_write_1bit(led_b &amp;=~ (1&lt;&lt;LED));}
}

void Lcd1602_i2c_low::Write(byte addr_w, byte wr1,byte wr2,byte wr3,byte wr4,byte wr5,byte wr6,byte wr7,byte wr8){
     lcd(0b01000000|addr_w*8);PrintChar(wr1);PrintChar(wr2);PrintChar(wr3);PrintChar(wr4);PrintChar(wr5);PrintChar(wr6);PrintChar(wr7);PrintChar(wr8);}

void Lcd1602_i2c_low::PrintInt(int data_int){char str[6];PrintString(itoa(data_int, str, 10));} 

void Lcd1602_i2c_low::PrintFloat(float data_float, byte dp){
    char str[8];
    if(data_float&lt;0){data_float=-data_float;PrintChar(0b101101);PrintString(itoa((int)data_float, str, 10));}
     else{PrintString(itoa((int)data_float, str, 10));}
    int float10 = round((data_float - (int)data_float)*pow(10,dp));
    PrintChar(0b101110);
    PrintString(itoa(float10, str, 10));
} 

void Lcd1602_i2c_low::setInit(){ 
    lcd(0x03);_delay_us(4500);
    lcd(0x03);_delay_us(4500);
    lcd(0x03);_delay_us(200);
    lcd(0b00000010);_delay_ms(5);
    lcd(0b00001100);_delay_ms(5);
    lcd(0b00000001);
} 

void Lcd1602_i2c_low::Clear(){lcd(0b00000001);} 

void Lcd1602_i2c_low::Curs(byte str, byte mesto){
  if(str==0){lcd(0b10000000+mesto);}
  if(str==1){lcd(0b11000000+mesto);}
  } 

void Lcd1602_i2c_low::PrintString(const char* str) {while(*str != &#039;\0&#039;) {_delay_us(200);PrintChar(*str);str++;}}

void Lcd1602_i2c_low::PrintChar(const char chr) {lcdSend(false, (uint8_t)chr);}

void Lcd1602_i2c_low::e_pin(){
    i2c_write_1bit(led_b |= (1&lt;&lt;E));
    _delay_us(200);
    i2c_write_1bit(led_b &amp;= ~(1&lt;&lt;E));
}

void Lcd1602_i2c_low::lcd(uint8_t sett) {lcdSend(true, sett);}

void Lcd1602_i2c_low::lcdSend(bool rs, byte data) {
//    cli();
    if(rs==0){led_b |= (1&lt;&lt;RS);} else {led_b &amp;= ~(1&lt;&lt;RS);}//RS
    _delay_us(200);
    if(((data &gt;&gt; 7) &amp; 1) ==1){i2c_write_1bit(led_b |= (1&lt;&lt;7));} else {i2c_write_1bit(led_b &amp;= ~(1&lt;&lt;7));}
    if(((data &gt;&gt; 6) &amp; 1) ==1){i2c_write_1bit(led_b |= (1&lt;&lt;6));} else {i2c_write_1bit(led_b &amp;= ~(1&lt;&lt;6));}
    if(((data &gt;&gt; 5) &amp; 1) ==1){i2c_write_1bit(led_b |= (1&lt;&lt;5));} else {i2c_write_1bit(led_b &amp;= ~(1&lt;&lt;5));}
    if(((data &gt;&gt; 4) &amp; 1) ==1){i2c_write_1bit(led_b |= (1&lt;&lt;4));} else {i2c_write_1bit(led_b &amp;= ~(1&lt;&lt;4));}
    e_pin();
    if(((data &gt;&gt; 3) &amp; 1) ==1){i2c_write_1bit(led_b |= (1&lt;&lt;7));} else {i2c_write_1bit(led_b &amp;= ~(1&lt;&lt;7));}
    if(((data &gt;&gt; 2) &amp; 1) ==1){i2c_write_1bit(led_b |= (1&lt;&lt;6));} else {i2c_write_1bit(led_b &amp;= ~(1&lt;&lt;6));}
    if(((data &gt;&gt; 1) &amp; 1) ==1){i2c_write_1bit(led_b |= (1&lt;&lt;5));} else {i2c_write_1bit(led_b &amp;= ~(1&lt;&lt;5));}
    if(((data &gt;&gt; 0) &amp; 1) ==1){i2c_write_1bit(led_b |= (1&lt;&lt;4));} else {i2c_write_1bit(led_b &amp;= ~(1&lt;&lt;4));}
    e_pin();
//    sei();
}

void Lcd1602_i2c_low::i2c_write_1bit(byte i2c_reg){
  wire_start_w(ADDR_LED);
  wire_write(i2c_reg);
  wire_stop();
}  </code></pre></div><p>test.ino<br /></p><div class="codebox"><pre><code>// ATMEGA8 ATMEGA48 ATMEGA88 ATMEGA168 ATMEGA328

#include &lt;avr/io.h&gt;
#include &lt;util/delay.h&gt;
#include &lt;Wire_low.h&gt;
#include &lt;Lcd1602_i2c_low.h&gt;
  Lcd1602_i2c_low lcd(0x27);// адрес I2C

int main(){ 
  wire_set(12000000,100000); // тактовая частота контроллера, частота шины I2C
  lcd.setInit();
  lcd.Clear(); // очистка экрана
  lcd.led(1);  // включение и отключение подсветки экрана
 // собственные символы, 0...7  
  lcd.Write(0,    0b11111,
                  0b00000,
                  0b10001,
                  0b10001,
                  0b10001,
                  0b10001,
                  0b00000,
                  0b11111);
                  
  lcd.Write(1,    0b11111,
                  0b10001,
                  0b11111,
                  0b10001,
                  0b11111,
                  0b10001,
                  0b11111,
                  0b00000);                
   
while(1){
    lcd.Curs(0,0);                // номер строки, положение курсора 
    lcd.PrintString(&quot;ATMEGA88  &quot;);// вывод String
    lcd.PrintFloat(1.227,3);      // вывод Float
    lcd.Curs(1,4);                // номер строки, положение курсора 
    lcd.PrintInt(-30125);         // вывод int
    lcd.PrintChar(0);             // вывод собственного символа 0
    lcd.PrintChar(1);             // вывод собственного символа 1
    _delay_ms(100);
    }}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Mon, 07 Mar 2022 04:23:17 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?id=474&amp;action=new</guid>
		</item>
		<item>
			<title><![CDATA[BD37534FV]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?id=473&amp;action=new</link>
			<description><![CDATA[<p><span class="attention-yellow"></span> </p><p>BD37534FV.h<br /></p><div class="codebox"><pre><code>#ifndef BD37534FV_H
#define BD37534FV_H

#define BD37534FV_address 0b1000000 

#define SETUP_1        0x01
#define SETUP_2        0x02
#define SETUP_3        0x03
#define INPUT_SELECT   0x05
#define INPUT_GAIN     0x06
#define VOLUME_GAIN    0x20
#define FADER_1_FRONT  0x28
#define FADER_2_FRONT  0x29
#define FADER_1_REAR   0x2A
#define FADER_2_REAR   0x2B
#define FADER_SUB      0x2C
#define MIXING         0x30
#define BASS_SETUP     0x41
#define MIDDLE_SETUP   0x44
#define TREBLE_SETUP   0x47
#define BASS_GAIN      0x51
#define MIDDLE_GAIN    0x54
#define TREBLE_GAIN    0x57
#define LOUDNESS_GAIN  0x75

#include &lt;Arduino.h&gt;
class BD37534FV
{
  public:
    BD37534FV();
    void setSetup_1(int sw_of, int sw_time, int time_mute); // default (1,2,0)
        void setSetup_2(int sub_f, int sub_out, int level_metr, int faza); 
                   // int sub_f ------ OFF 55Hz 85Hz 120Hz 160Hz = int 0...4
                   // int sub_out ---- LPF Front Rear Prohibition = int 0...3
                   // int level_metr - HOLD REST = int 0..1
                   // int faza ------- 0 180 = int 0...1
        void setLoudness_f(int loud_f); // 250Hz 400Hz 800Hz Prohibition = int 0...3
        void setIn(int in); // 0...2
        void setIn_gain(int in_gain, int mute); // in_gain -- 0...20 = 0...20 dB, mute -- 0 default 
        void setVol(int vol); // -79...+15 dB = int -79...15
        void setFront_1(int front_1); // -79...+15 dB = int -79...15
        void setFront_2(int front_2); // -79...+15 dB = int -79...15
        void setRear_1(int rear_1); // -79...+15 dB = int -79...15
        void setRear_2(int rear_2); // -79...+15 dB = int -79...15
        void setSub(int sub); // -79...+15 dB = int -79...15
        void mix();
        void setBass_setup(int bass_q, int bass_f); // 0.5 1.0 1.5 2.0 --- int 0...3, 60Hz 80Hz 100Hz 120Hz --- int 0...3
        void setMiddle_setup(int mid_q, int mid_f); // 0.75 1.0 1.25 1.5 --- int 0...3, 500Hz 1kHz 1.5kHz 2.5kHz --- int 0...3
        void setTreble_setup(int treb_q, int treb_f); // 0.75 1.25  --- int 0...1, 7.5kHz 10kHz 12.5kHz 15kHz --- int 0...3
        void setBass_gain(int bass_gain); // --20 ... +20 dB = int -20 ... 20    
        void setMiddle_gain(int mid_gain); // --20 ... +20 dB = int -20 ... 20
        void setTreble_gain(int treb_gain); // --20 ... +20 dB = int -20 ... 20        
        void setLoudness_gain(int loud_gain); // 0 ... 20 dB = int 0 ... 20

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

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

void BD37534FV::setSetup_1(int sw_of, int sw_time, int time_mute){
           switch(sw_of){
               case 0: sw_of = 0b00000000;break;
               case 1: sw_of = 0b10000000;break;
   }
           switch(sw_time){
               case 0: sw_time = 0b00000000;break;
               case 1: sw_time = 0b00010000;break;
               case 2: sw_time = 0b00100000;break;
               case 3: sw_time = 0b00110000;break;        
   }
           switch(time_mute){
               case 0: time_mute = 0b00000000;break;
               case 1: time_mute = 0b00000001;break;
               case 2: time_mute = 0b00000010;break;
               case 3: time_mute = 0b00000011;break;        
   }
           int set1_sum = 0b00000100 + sw_of + sw_time + time_mute;
           writeWire(SETUP_1, set1_sum); 
   }

void BD37534FV::setSetup_2(int sub_f, int sub_out, int level_metr, int faza){
            switch(sub_f){
               case 0: sub_f = 0b00000000;break;
               case 1: sub_f = 0b00000001;break;
               case 2: sub_f = 0b00000010;break;
               case 3: sub_f = 0b00000011;break;  
               case 4: sub_f = 0b00000100;break; 
   }
            switch(sub_out){
               case 0: sub_out = 0b00000000;break;
               case 1: sub_out = 0b00010000;break;
               case 2: sub_out = 0b00100000;break;
               case 3: sub_out = 0b00110000;break;  
   }
            switch(level_metr){
               case 0: level_metr = 0b00000000;break;
               case 1: level_metr = 0b01000000;break;
   }
            switch(faza){
               case 0: faza = 0b00000000;break;
               case 1: faza = 0b10000000;break;
   }
            int set2_sum =  sub_f + sub_out + level_metr + faza;
            writeWire(SETUP_2, set2_sum); 
   }
   
void BD37534FV::setLoudness_f(int loud_f){
            switch(loud_f){
               case 0: loud_f = 0b00000001;break;
               case 1: loud_f = 0b00001001;break;
               case 2: loud_f = 0b00010001;break;
               case 3: loud_f = 0b00011001;break;  
   }
            writeWire(SETUP_3, loud_f); 
   }

void BD37534FV::setIn(int in){
            writeWire(INPUT_SELECT, in); 
   }


void BD37534FV::setIn_gain(int in_gain, int mute){
            switch(mute){
               case 0: mute = 0b00000000;break;
               case 1: mute = 0b10000000;break;
   }
            int sum_in_gain = in_gain + mute;
            writeWire(INPUT_GAIN, sum_in_gain); 
   }

void BD37534FV::setVol(int vol){
            if(vol &gt; 0){vol = 128 - vol;}
            if(vol &lt;= 0){vol = abs(vol) + 128;}
            writeWire(VOLUME_GAIN, vol); 
   }

void BD37534FV::setFront_1(int front_1){
            if(front_1 &gt; 0){front_1 = 128 - front_1;}
            if(front_1 &lt;= 0){front_1 = abs(front_1) + 128;}
            writeWire(FADER_1_FRONT, front_1); 
   }

void BD37534FV::setFront_2(int front_2){
            if(front_2 &gt; 0){front_2 = 128 - front_2;}
            if(front_2 &lt;= 0){front_2 = abs(front_2) + 128;}
            writeWire(FADER_2_FRONT, front_2); 
   }

void BD37534FV::setRear_1(int rear_1){
            if(rear_1 &gt; 0){rear_1 = 128 - rear_1;}
            if(rear_1 &lt;= 0){rear_1 = abs(rear_1) + 128;}
            writeWire(FADER_1_REAR, rear_1); 
   }

void BD37534FV::setRear_2(int rear_2){
            if(rear_2 &gt; 0){rear_2 = 128 - rear_2;}
            if(rear_2 &lt;= 0){rear_2 = abs(rear_2) + 128;}
            writeWire(FADER_2_REAR, rear_2); 
   }

void BD37534FV::setSub(int sub){
            if(sub &gt; 0){sub = 128 - sub;}
            if(sub &lt;= 0){sub = abs(sub) + 128;}
            writeWire(FADER_SUB, sub); 
   }

void BD37534FV::mix(){
            writeWire(MIXING, 0b11111111); 
   }

void BD37534FV::setBass_setup(int bass_q, int bass_f){
            switch(bass_q){
               case 0: bass_q = 0b00000000;break;
               case 1: bass_q = 0b00000001;break;
               case 2: bass_q = 0b00000010;break;
               case 3: bass_q = 0b00000011;break;  
   }
            switch(bass_f){
               case 0: bass_f = 0b00000000;break;
               case 1: bass_f = 0b00010000;break;
               case 2: bass_f = 0b00100000;break;
               case 3: bass_f = 0b00110000;break;  
   }
            int bass_s_sum = bass_q + bass_f;
            writeWire(BASS_SETUP, bass_s_sum); 
   }

void BD37534FV::setTreble_setup(int treb_q, int treb_f){
            switch(treb_q){
               case 0: treb_q = 0b00000000;break;
               case 1: treb_q = 0b00000001;break; 
   }
            switch(treb_f){
               case 0: treb_f = 0b00000000;break;
               case 1: treb_f = 0b00010000;break;
               case 2: treb_f = 0b00100000;break;
               case 3: treb_f = 0b00110000;break;  
   }
            int treb_s_sum = treb_q + treb_f;
            writeWire(TREBLE_SETUP, treb_s_sum); 
   }

void BD37534FV::setBass_gain(int bass_gain){
                 if(bass_gain&gt;0){bass_gain = bass_gain + 0b00000000;}                     
                 if(bass_gain&lt;=0){bass_gain = abs(bass_gain) + 0b10000000;}  
               writeWire(BASS_GAIN, bass_gain);   
   }

void BD37534FV::setMiddle_gain(int mid_gain){
                 if(mid_gain&gt;0){mid_gain = mid_gain + 0b00000000;}                     
                 if(mid_gain&lt;=0){mid_gain = abs(mid_gain) + 0b10000000;}  
               writeWire(MIDDLE_GAIN, mid_gain);   
   }

void BD37534FV::setTreble_gain(int treb_gain){
                 if(treb_gain&gt;0){treb_gain = treb_gain + 0b00000000;}                     
                 if(treb_gain&lt;=0){treb_gain = abs(treb_gain) + 0b10000000;}  
               writeWire(TREBLE_GAIN, treb_gain);   
   }

void BD37534FV::setLoudness_gain(int loud_gain){
               writeWire(LOUDNESS_GAIN, loud_gain);  
   }


void BD37534FV::setMiddle_setup(int mid_q, int mid_f){
            switch(mid_q){
               case 0: mid_q = 0b00000000;break;
               case 1: mid_q = 0b00000001;break;
               case 2: mid_q = 0b00000010;break;
               case 3: mid_q = 0b00000011;break;  
   }
            switch(mid_f){
               case 0: mid_f = 0b00000000;break;
               case 1: mid_f = 0b00010000;break;
               case 2: mid_f = 0b00100000;break;
               case 3: mid_f = 0b00110000;break;  
   }
            int mid_s_sum = mid_q + mid_f;
            writeWire(MIDDLE_SETUP, mid_s_sum); 
   }



void BD37534FV::writeWire(char a, char b){
  Wire.beginTransmission(BD37534FV_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;BD37534FV.h&gt;
BD37534FV tda; 

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

void loop(){}

void audio(){
   tda.setSetup_1(1,2,0); // default (1,2,0)
   tda.setSetup_2(0,0,0,0); 
                   // int sub_f ------ OFF 55Hz 85Hz 120Hz 160Hz = int 0...4
                   // int sub_out ---- LPF Front Rear Prohibition = int 0...3
                   // int level_metr - HOLD REST = int 0..1
                   // int faza ------- 0 180 = int 0...1
   tda.setLoudness_f(0); // 250Hz 400Hz 800Hz Prohibition = int 0...3
   tda.setIn(0); // 0...2
   tda.setIn_gain(0,0); // in_gain -- 0...20 = 0...20 dB, mute -- 0 default 
   tda.setVol(0); // -79...+15 dB = int -79...15
   tda.setFront_1(0); // -79...+15 dB = int -79...15
   tda.setFront_2(0); // -79...+15 dB = int -79...15
   tda.setRear_1(0); // -79...+15 dB = int -79...15
   tda.setRear_2(0); // -79...+15 dB = int -79...15
   tda.setSub(0); // -79...+15 dB = int -79...15
   tda.mix();
   tda.setBass_setup(0,0); // 0.5 1.0 1.5 2.0 --- int 0...3, 60Hz 80Hz 100Hz 120Hz --- int 0...3
   tda.setMiddle_setup(0,0); // 0.75 1.0 1.25 1.5 --- int 0...3, 500Hz 1kHz 1.5kHz 2.5kHz --- int 0...3
   tda.setTreble_setup(0,0); // 0.75 1.25  --- int 0...1, 7.5kHz 10kHz 12.5kHz 15kHz --- int 0...3
   tda.setBass_gain(0); // --20 ... +20 dB = int -20 ... 20  
   tda.setMiddle_gain(0); // --20 ... +20 dB = int -20 ... 20
   tda.setTreble_gain(0); // --20 ... +20 dB = int -20 ... 20   
   tda.setLoudness_gain(0); // 0 ... 20 dB = int 0 ... 20
  }</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Sat, 05 Mar 2022 12:32:14 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?id=473&amp;action=new</guid>
		</item>
		<item>
			<title><![CDATA[TEA6360]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?id=472&amp;action=new</link>
			<description><![CDATA[<p><span class="attention-yellow"></span> </p><p>TEA6360.h<br /></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.cpp<br /></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>test.ino<br /></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>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Sat, 05 Mar 2022 12:28:45 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?id=472&amp;action=new</guid>
		</item>
		<item>
			<title><![CDATA[TDA7448]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?id=471&amp;action=new</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Fri, 04 Mar 2022 13:49:52 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?id=471&amp;action=new</guid>
		</item>
		<item>
			<title><![CDATA[PT2323]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?id=470&amp;action=new</link>
			<description><![CDATA[<p><span class="attention-yellow"></span> </p><p>PT2323.h<br /></p><div class="codebox"><pre><code>//  PT2323
#ifndef  PT2323_H
#define  PT2323_H

#define  PT2323_address 0b1001010 // адрес

#include &lt;Arduino.h&gt;
class  PT2323
{
  public:
     PT2323();
        void setInput(int in); // входы 1...4 (in = 0...3), 6 моно входов (in = 4)
        void setMute(int fl, int fr, int ct, int sub, int sl, int sr, int mute); 
        // MUTE OFF для выходов (0,0,0,0,0,0,0); 
        // MUTE ON  для выходов (1,1,1,1,1,1,1); 
        // fl,  fr,  ct,  sub,  sl,  sr, все  выходы mute
        void setFeature(int surr, int mix); // дополнительные функции 0...1, 0...1
               // 0 - Enhanced Surround Function Active
               // 1 - Enhanced Surround Function Disabled
               // 0 - Mixed Channel (0dB) Setup
               // 1 - Mixed Channel (+6dB) Setup 
  private:
	void writeWire(char a);
};
	
#endif // PT2323_H</code></pre></div><p>PT2323.cpp<br /></p><div class="codebox"><pre><code>#include &lt;Arduino.h&gt;
#include &lt;Wire.h&gt;
#include &quot;PT2323.h&quot;

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

void PT2323::setInput(int in){
     switch(in){
        case 0: in = 0b11001011;break;
	case 1: in = 0b11001010;break;
	case 2: in = 0b11001001;break;
	case 3: in = 0b11001000;break;
        case 4: in = 0b11000111;break;
        } 
        writeWire(in);}

void PT2323::setMute(int fl, int fr, int ct, int sub, int sl, int sr, int mute){
      if(fl==1){fl = 0b11110001;}else{fl = 0b11110000;}
      if(fr==1){fr = 0b11110011;}else{fr = 0b11110010;}
      if(ct==1){ct = 0b11110101;}else{ct = 0b11110100;}
    if(sub==1){sub = 0b11110111;}else{sub= 0b11110110;}
      if(sl==1){sl = 0b11111001;}else{sl = 0b11111000;}
      if(sr==1){sr = 0b11111011;}else{sr = 0b11111010;} ///
  if(mute==1){mute = 0b11111111;}else{mute=0b11111110;}
      
  writeWire(fl);
  writeWire(fr);
  writeWire(ct);
  writeWire(sub);
  writeWire(sl);
  writeWire(sr);
  writeWire(mute);
}

void PT2323::setFeature(int surr, int mix){
     switch(surr){
        case 0: surr = 0b11010000;break;
	case 1: surr = 0b11010001;break;
        }
     switch(mix){
        case 0: mix = 0b10010000;break;
	case 1: mix = 0b10010001;break;
        } 
        writeWire(surr);
        writeWire(mix);
}

void PT2323::writeWire(char a){
  Wire.beginTransmission(PT2323_address);
  Wire.write (a);
  Wire.endTransmission();
}</code></pre></div><p>PT2323.ino<br /></p><div class="codebox"><pre><code>// rcl-radio.ru / liman324@yandex.ru
#include &lt;Wire.h&gt;
#include &lt;PT2323.h&gt;
PT2323 rt0;
 
void setup() {
  Wire.begin();
}
 
void loop() {
  rt0.setInput(0); // входы 1...4 (0...3) или 6 моно (4)
  rt0.setMute(0,0,0,0,0,0,0); // MUTE OFF для выходов (0,0,0,0,0,0,0); 
                              // MUTE ON  для выходов (1,1,1,1,1,1,1); 
                              // fl,  fr,  ct,  sub,  sl,  sr, все  выходы mute
  rt0.setFeature(0,0); // дополнительные функции 0...3
                     // 0 - Enhanced Surround Function Active
                     // 1 - Enhanced Surround Function Disabled
                     // 0 - Mixed Channel (0dB) Setup
                     // 1 - Mixed Channel (+6dB) Setup 
  delay(1000);
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Fri, 04 Mar 2022 13:44:01 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?id=470&amp;action=new</guid>
		</item>
		<item>
			<title><![CDATA[M62429]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?id=469&amp;action=new</link>
			<description><![CDATA[<p><span class="attention-yellow"></span> </p><p>M62429.h<br /></p><div class="codebox"><pre><code>//rcl-radio.ru
// liman324@yandex.ru
// библиотека создана на основе https://soltau.ru/index.php/arduino/item/497-kak-podklyuchit-regulyator-gromkosti-m62429-k-arduino

#include &lt;Arduino.h&gt;

void setVolume (int clk, int data, int canal, int k, int att);
	</code></pre></div><p>M62429.cpp<br /></p><div class="codebox"><pre><code>//rcl-radio.ru
// liman324@yandex.ru
// библиотека создана на основе https://soltau.ru/index.php/arduino/item/497-kak-podklyuchit-regulyator-gromkosti-m62429-k-arduino

#include &lt;Arduino.h&gt;

void setVolume (int clk, int data, int canal, int k, int att){
  pinMode(data, OUTPUT);
  pinMode(clk, OUTPUT);
  digitalWrite(data, HIGH);
  digitalWrite(clk, LOW);
  
  
   int att1[21][5] = {
  {1, 0, 1, 0, 1}, //-0db
  {0, 0, 1, 0, 1}, //-4db
  {1, 1, 0, 0, 1}, //-8db
  {0, 1, 0, 0, 1}, //-12db
  {1, 0, 0, 0, 1}, //-16db
  {0, 0, 0, 0, 1}, //-20db
  {1, 1, 1, 1, 0}, //-24db
  {0, 1, 1, 1, 0}, //-28db
  {1, 0, 1, 1, 0}, //-32db
  {0, 0, 1, 1, 0}, //-36db
  {1, 1, 0, 1, 0}, //-40db
  {0, 1, 0, 1, 0}, //-44db
  {1, 0, 0, 1, 0}, //-48db
  {0, 0, 0, 1, 0}, //-52db
  {1, 1, 1, 0, 0}, //-56db
  {0, 1, 1, 0, 0}, //-60db
  {1, 0, 1, 0, 0}, //-64db
  {0, 0, 1, 0, 0}, //-68db
  {1, 1, 0, 0, 0}, //-72db
  {0, 1, 0, 0, 0}, //-76db
  {1, 0, 0, 0, 0}  //-80db
};

// Коды громкости аттенюатора 2
int att2[4][2] = {
  {1, 1}, //-0db
  {0, 1}, //-1db
  {1, 0}, //-2db
  {0 ,0}  //-3db
};   
int att1index = floor(abs(att) / 4);
  int att2index = abs(att) % 4;
  
  // Задаём в пакете канал:
  digitalWrite(data, (bool)canal);
  digitalWrite(clk, HIGH);
  digitalWrite(data, LOW);
  digitalWrite(clk, LOW);

  // Задаём одновременное или независимое управление каналами:
  digitalWrite(data, k);
  digitalWrite(clk, HIGH);
  digitalWrite(data, LOW);
  digitalWrite(clk, LOW);

  // Задаём значение 1-го аттенюатора D2..D6:
  for (int i=0; i&lt;5; i++) {
    digitalWrite(data, (bool)att1[att1index][i]);
    digitalWrite(clk, HIGH);
    digitalWrite(data, LOW);
    digitalWrite(clk, LOW);
  }
  
  // Задаём значение 2-го аттенюатора D7..D8:
  for (int i=0; i&lt;2; i++) {
    digitalWrite(data, (bool)att2[att2index][i]);
    digitalWrite(clk, HIGH);
    digitalWrite(data, LOW);
    digitalWrite(clk, LOW);
  }

  // Два последних бита пакета – две единицы:
  digitalWrite(data, HIGH);
  digitalWrite(clk, HIGH);
  delayMicroseconds(2);
  digitalWrite(data, LOW);
  digitalWrite(clk, LOW);
  delayMicroseconds(2);

  digitalWrite(data, HIGH);
  digitalWrite(clk, HIGH);
  delayMicroseconds(2);
  digitalWrite(clk, LOW);
  digitalWrite(data, LOW);
  delayMicroseconds(2);

}</code></pre></div><p>M62429.ino<br /></p><div class="codebox"><pre><code>#include &lt;M62429.h&gt;

void setup(){
}

void loop(){
audio();
delay(1000);
}

void audio(){
setVolume (11,12,0,0,5); 
setVolume (11,12,0,1,5);
/* pin CLK
   pin DATA
   0 - по одному каналу, 1 - оба вместе
   0 ПК 1 ЛК
   83 ... 0 громкость 83 = -83 дБ */  
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Thu, 03 Mar 2022 13:56:04 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?id=469&amp;action=new</guid>
		</item>
	</channel>
</rss>
