R2S15902FP Arduino Library with Basic Arduino Code
In this article I have explained a R2S15902FP Arduino library and basic Arduino code for testing. Included all features of the R2S15902FP in this library and included the circuit diagram and PCB design for testing. You can build best 5.1 surround sound system with these.
R2S15902FP is best 5.1 audio converter and 6 channel volume controller IC. You can build better quality 5.1 amplifier with this IC.
Features
- Input gain control
- 6 channels independent volume control
- 6 channels independent gain control
- Tone control: Bass and Treble
- L/R channel 4 input selector
- Multi channel input: 6 channels input
If you need more about the R2S15902FP, Please check the datasheet. I have attached end of this article.
Hardware
R2S15902FP is a SMD component. It can't connect to the breadboard for testing. So I have created a PCB design for testing. You can make the testing board with this. I have attached all files end of this article. In the Microcontroller section I am using the Arduino UNO board, Check the circuit diagram below.
Programming
After completing the hardware section successfully, then start the programming. First of all, create the library files and put into the Arduino's library folder in your PC. Its have two files for the library. Check the library code below.
R2S15902FP.h
#ifndef R2S15902FP_h #define R2S15902FP_h #include "Arduino.h" class R2S15902FP { public: R2S15902FP(int data, int clk); void slot1(int in, int rec_out, int rec_gain, int att, int lr_in, int bass, int treble, int sl_sr_c_sw_in, int in_gain); void slot2(int lch_gain, int lch_vol, int rch_gain, int rch_vol); void slot3(int cch_gain, int cch_vol, int swch_gain, int swch_vol); void slot4(int slch_gain, int slch_vol, int srch_gain, int srch_vol); private: int _data; int _clk; }; #endif
R2S15902FP.cpp
#include "Arduino.h" #include "R2S15902FP.h" //Data bool in_data[5][3]={{0,0,0},{0,1,0},{1,0,0},{1,1,0},{0,0,1}}; // Input Selector bool rec_gain_data[4][2]={{0,0},{0,1},{1,0},{1,1}}; // REC-Output Gain Control bool att_data[4][2]={{0,0},{0,1},{1,0},{1,1}}; // ADC Input ATT bool tone_data[15][4]={{0,1,1,1},{0,1,1,0},{0,1,0,1},{0,1,0,0},{0,0,1,1},{0,0,1,0},{0,0,0,1},{1,0,0,0},{1,0,0,1},{1,0,1,0},{1,0,1,1},{1,1,0,0},{1,1,0,1},{1,1,1,0},{1,1,1,1}}; // Bass/Treble bool gain_data[8][3]={{0,0,0},{0,0,1},{0,1,0},{0,1,1},{1,0,0},{1,0,1},{1,1,0},{1,1,1}}; // Gain Control bool ch_vol_data[100][7] ={{1,1,0,0,0,1,1},{1,1,0,0,0,1,0},{1,1,0,0,0,0,1},{1,1,0,0,0,0,0},{1,0,1,1,1,1,1},{1,0,1,1,1,1,0},{1,0,1,1,1,0,1},{1,0,1,1,1,0,0},{1,0,1,1,0,1,1},{1,0,1,1,0,1,0},{1,0,1,1,0,0,1},{1,0,1,1,0,0,0},{1,0,1,0,1,1,1},{1,0,1,0,1,1,0},{1,0,1,0,1,0,1},{1,0,1,0,1,0,0},{1,0,1,0,0,1,1},{1,0,1,0,0,1,0},{1,0,1,0,0,0,1},{1,0,1,0,0,0,0},{1,0,0,1,1,1,1},{1,0,0,1,1,1,0},{1,0,0,1,1,0,1},{1,0,0,1,1,0,0},{1,0,0,1,0,1,1},{1,0,0,1,0,1,0},{1,0,0,1,0,0,1},{1,0,0,1,0,0,0},{1,0,0,0,1,1,1},{1,0,0,0,1,1,0},{1,0,0,0,1,0,1},{1,0,0,0,1,0,0},{1,0,0,0,0,1,1},{1,0,0,0,0,1,0},{1,0,0,0,0,0,1},{1,0,0,0,0,0,0},{0,1,1,1,1,1,1},{0,1,1,1,1,1,0},{0,1,1,1,1,0,1},{0,1,1,1,1,0,0},{0,1,1,1,0,1,1},{0,1,1,1,0,1,0},{0,1,1,1,0,0,1},{0,1,1,1,0,0,0},{0,1,1,0,1,1,1},{0,1,1,0,1,1,0},{0,1,1,0,1,0,1},{0,1,1,0,1,0,0},{0,1,1,0,0,1,1},{0,1,1,0,0,1,0},{0,1,1,0,0,0,1},{0,1,1,0,0,0,0},{0,1,0,1,1,1,1},{0,1,0,1,1,1,0},{0,1,0,1,1,0,1},{0,1,0,1,1,0,0},{0,1,0,1,0,1,1},{0,1,0,1,0,1,0},{0,1,0,1,0,0,1},{0,1,0,1,0,0,0},{0,1,0,0,1,1,1},{0,1,0,0,1,1,0},{0,1,0,0,1,0,1},{0,1,0,0,1,0,0},{0,1,0,0,0,1,1},{0,1,0,0,0,1,0},{0,1,0,0,0,0,1},{0,1,0,0,0,0,0},{0,0,1,1,1,1,1},{0,0,1,1,1,1,0},{0,0,1,1,1,0,1},{0,0,1,1,1,0,0},{0,0,1,1,0,1,1},{0,0,1,1,0,1,0},{0,0,1,1,0,0,1},{0,0,1,1,0,0,0},{0,0,1,0,1,1,1},{0,0,1,0,1,1,0},{0,0,1,0,1,0,1},{0,0,1,0,1,0,0},{0,0,1,0,0,1,1},{0,0,1,0,0,1,0},{0,0,1,0,0,0,1},{0,0,1,0,0,0,0},{0,0,0,1,1,1,1},{0,0,0,1,1,1,0},{0,0,0,1,1,0,1},{0,0,0,1,1,0,0},{0,0,0,1,0,1,1},{0,0,0,1,0,1,0},{0,0,0,1,0,0,1},{0,0,0,1,0,0,0},{0,0,0,0,1,1,1},{0,0,0,0,1,1,0},{0,0,0,0,1,0,1},{0,0,0,0,1,0,0},{0,0,0,0,0,1,1},{0,0,0,0,0,1,0},{0,0,0,0,0,0,1},{0,0,0,0,0,0,0}}; // Channels Volume R2S15902FP::R2S15902FP(int data, int clk) { pinMode(data, OUTPUT); pinMode(clk, OUTPUT); _data = data; _clk = clk; } void R2S15902FP::slot1(int in, int rec_out, int rec_gain, int att, int lr_in, int bass, int treble, int sl_sr_c_sw_in, int in_gain) { // D0a - D2a for (int i = 0; i < 3; i++) { digitalWrite(_data, in_data[in][i]); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); } // D3a digitalWrite(_data, rec_out); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); // D4a - D5a for (int i = 0; i < 2; i++) { digitalWrite(_data, rec_gain_data[rec_gain][i]); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); } // D6a - D7a for (int i = 0; i < 2; i++) { digitalWrite(_data, att_data[att][i]); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); } // D8a digitalWrite(_data, lr_in); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); // D9a - D12a for (int i = 0; i < 4; i++) { digitalWrite(_data, tone_data[bass][i]); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); } // D13a - D16a for (int i = 0; i < 4; i++) { digitalWrite(_data, tone_data[treble][i]); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); } // D17a digitalWrite(_data, sl_sr_c_sw_in); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); // D18a - D20a for (int i = 0; i < 3; i++) { digitalWrite(_data, gain_data[in_gain][i]); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); } // D21a digitalWrite(_data, LOW); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); // D22a digitalWrite(_data, LOW); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); // D23a digitalWrite(_data, LOW); digitalWrite(_clk, HIGH); digitalWrite(_data, HIGH); digitalWrite(_clk, LOW); digitalWrite(_data, LOW); } void R2S15902FP::slot2(int lch_gain, int lch_vol, int rch_gain, int rch_vol) { // D0b - D2b for (int i = 0; i < 3; i++) { digitalWrite(_data, gain_data[lch_gain][i]); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); } // D3b - D9b for (int i = 0; i < 7; i++) { digitalWrite(_data, ch_vol_data[lch_vol][i]); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); } // D10b - D12b for (int i = 0; i < 3; i++) { digitalWrite(_data, gain_data[rch_gain][i]); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); } // D13b - D19b for (int i = 0; i < 7; i++) { digitalWrite(_data, ch_vol_data[rch_vol][i]); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); } // D20b digitalWrite(_data, LOW); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); // D21b digitalWrite(_data, LOW); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); // D22b digitalWrite(_data, LOW); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); // D23b digitalWrite(_data, HIGH); digitalWrite(_clk, HIGH); digitalWrite(_data, HIGH); digitalWrite(_clk, LOW); digitalWrite(_data, LOW); } void R2S15902FP::slot3(int cch_gain, int cch_vol, int swch_gain, int swch_vol) { // D0c - D2c for (int i = 0; i < 3; i++) { digitalWrite(_data, gain_data[cch_gain][i]); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); } // D3c - D9c for (int i = 0; i < 7; i++) { digitalWrite(_data, ch_vol_data[cch_vol][i]); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); } // D10c - D12c for (int i = 0; i < 3; i++) { digitalWrite(_data, gain_data[swch_gain][i]); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); } // D13c - D19c for (int i = 0; i < 7; i++) { digitalWrite(_data, ch_vol_data[swch_vol][i]); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); } // D20c digitalWrite(_data, LOW); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); // D21c digitalWrite(_data, LOW); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); // D22c digitalWrite(_data, HIGH); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); // D23c digitalWrite(_data, LOW); digitalWrite(_clk, HIGH); digitalWrite(_data, HIGH); digitalWrite(_clk, LOW); digitalWrite(_data, LOW); } void R2S15902FP::slot4(int slch_gain, int slch_vol, int srch_gain, int srch_vol) { // D0d - D2d for (int i = 0; i < 3; i++) { digitalWrite(_data, gain_data[slch_gain][i]); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); } // D3d - D9d for (int i = 0; i < 7; i++) { digitalWrite(_data, ch_vol_data[slch_vol][i]); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); } // D10d - D12d for (int i = 0; i < 3; i++) { digitalWrite(_data, gain_data[srch_gain][i]); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); } // D13d - D19d for (int i = 0; i < 7; i++) { digitalWrite(_data, ch_vol_data[srch_vol][i]); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); } // D20d digitalWrite(_data, LOW); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); // D21d digitalWrite(_data, LOW); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); // D22d digitalWrite(_data, HIGH); digitalWrite(_clk, HIGH); digitalWrite(_data, LOW); digitalWrite(_clk, LOW); // D23d digitalWrite(_data, HIGH); digitalWrite(_clk, HIGH); digitalWrite(_data, HIGH); digitalWrite(_clk, LOW); digitalWrite(_data, LOW); }
Arduino Code
Connect your Arduino board to the PC then upload the 'audio.ino' file from the downloaded folder. You can create the Arduino file with the below code. I have added 'Serial print' function in Arduino code. So you can see the particular feature's values in the Serial Monitor. This code is developed for testing purpose. But you can develop a good remote kit with these.
audio.ino
#include <R2S15902FP.h> R2S15902FP R2S15902FP(5, 6); // (Data Pin, Clock Pin) int ctrl, in, rec_out, rec_gain, att, lr_in, bass, treble, sl_sr_c_sw_in, in_gain, lch_gain, lch_vol, rch_gain, rch_vol, cch_gain, cch_vol, swch_gain, swch_vol, slch_gain, slch_vol, srch_gain, srch_vol; #define sw01 8 #define sw02 9 #define sw03 10 #define sw04 11 #define btn_delay 300 void setup() { Serial.begin(9600); pinMode(sw01, INPUT); pinMode(sw02, INPUT); pinMode(sw03, INPUT); pinMode(sw04, INPUT); delay(1000); initialControl(); audio(); } void loop() { // Serial Monitor Serial.print("Ctrl "); Serial.print(ctrl); Serial.print(", in-"); Serial.print(in); Serial.print(", rec_out-"); Serial.print(rec_out); Serial.print(", rec_gain-"); Serial.print(rec_gain); Serial.print(", att-"); Serial.print(att); Serial.print(", lr_in-"); Serial.print(lr_in); Serial.print(", bass-"); Serial.print(bass); Serial.print(", treble "); Serial.print(treble); Serial.print(", sl_sr_c_sw_in-"); Serial.print(sl_sr_c_sw_in); Serial.print(", in_gain-"); Serial.print(in_gain); Serial.print(", lch_gain-"); Serial.print(lch_gain); Serial.print(", lch_vol-"); Serial.print(lch_vol); Serial.print(", rch_gain-"); Serial.print(rch_gain); Serial.print(", rch_vol-"); Serial.print(rch_vol); Serial.print(", cch_gain-"); Serial.print(cch_gain); Serial.print(", cch_vol-"); Serial.print(cch_vol); Serial.print(", swch_gain-"); Serial.print(swch_gain); Serial.print(", swch_vol-"); Serial.print(swch_vol); Serial.print(", slch_gain-"); Serial.print(slch_gain); Serial.print(", slch_vol-"); Serial.print(slch_vol); Serial.print(", srch_gain-"); Serial.print(srch_gain); Serial.print(", srch_vol-"); Serial.println(srch_vol); // Control select if (digitalRead(sw03) == LOW) { ctrl++; if (ctrl > 20) { ctrl = 0; } if (ctrl > 20) { ctrl = 20; } delay(btn_delay); } if (digitalRead(sw04) == LOW) { ctrl--; if (ctrl < 0) { ctrl = 0; } delay(btn_delay); } // Control 0 - Input Selector if (ctrl == 0) { if (digitalRead(sw01) == LOW) { in++; if (in > 4) { in = 4; } audio(); delay(btn_delay); } if (digitalRead(sw02) == LOW) { in--; if (in < 0) { in = 0; } audio(); delay(btn_delay); } } // Control 1 - REC Output if (ctrl == 1) { if (digitalRead(sw01) == LOW) { rec_out++; if (rec_out > 1) { rec_out = 1; } audio(); delay(btn_delay); } if (digitalRead(sw02) == LOW) { rec_out--; if (rec_out < 0) { rec_out = 0; } audio(); delay(btn_delay); } } // Control 2 - REC-Output Gain Control if (ctrl == 2) { if (digitalRead(sw01) == LOW) { rec_gain++; if (rec_gain > 3) { rec_gain = 3; } audio(); delay(btn_delay); } if (digitalRead(sw02) == LOW) { rec_gain--; if (rec_gain < 0) { rec_gain = 0; } audio(); delay(btn_delay); } } // Control 3 - ADC Input ATT if (ctrl == 3) { if (digitalRead(sw01) == LOW) { att++; if (att > 3) { att = 3; } audio(); delay(btn_delay); } if (digitalRead(sw02) == LOW) { att--; if (att < 0) { att = 0; } audio(); delay(btn_delay); } } // Control 4 - L/R Input if (ctrl == 4) { if (digitalRead(sw01) == LOW) { lr_in++; if (lr_in > 1) { lr_in = 1; } audio(); delay(btn_delay); } if (digitalRead(sw02) == LOW) { lr_in--; if (lr_in < 0) { lr_in = 0; } audio(); delay(btn_delay); } } // Control 5 - Bass/Bypass (Tone control is bypass) if (ctrl == 5) { if (digitalRead(sw01) == LOW) { bass++; if (bass > 14) { bass = 14; } audio(); delay(btn_delay); } if (digitalRead(sw02) == LOW) { bass--; if (bass < 0) { bass = 0; } audio(); delay(btn_delay); } } // Control 6 - Treble if (ctrl == 6) { if (digitalRead(sw01) == LOW) { treble++; if (treble > 14) { treble = 14; } audio(); delay(btn_delay); } if (digitalRead(sw02) == LOW) { treble--; if (treble < 0) { treble = 0; } audio(); delay(btn_delay); } } // Control 7 - SL/ SR/ C/ SW Input if (ctrl == 7) { if (digitalRead(sw01) == LOW) { sl_sr_c_sw_in++; if (sl_sr_c_sw_in > 1) { sl_sr_c_sw_in = 1; } audio(); delay(btn_delay); } if (digitalRead(sw02) == LOW) { sl_sr_c_sw_in--; if (sl_sr_c_sw_in < 0) { sl_sr_c_sw_in = 0; } audio(); delay(btn_delay); } } // Control 8 - Input Gain if (ctrl == 8) { if (digitalRead(sw01) == LOW) { in_gain++; if (in_gain > 7) { in_gain = 7; } audio(); delay(btn_delay); } if (digitalRead(sw02) == LOW) { in_gain--; if (in_gain < 0) { in_gain = 0; } audio(); delay(btn_delay); } } // Control 9 - Left Channel Gain Control if (ctrl == 9) { if (digitalRead(sw01) == LOW) { lch_gain++; if (lch_gain > 7) { lch_gain = 7; } audio(); delay(btn_delay); } if (digitalRead(sw02) == LOW) { lch_gain--; if (lch_gain < 0) { lch_gain = 0; } audio(); delay(btn_delay); } } // Control 10 - Left Channel Volume Control if (ctrl == 10) { if (digitalRead(sw01) == LOW) { lch_vol++; if (lch_vol > 99) { lch_vol = 99; } audio(); delay(btn_delay); } if (digitalRead(sw02) == LOW) { lch_vol--; if (lch_vol < 0) { lch_vol = 0; } audio(); delay(btn_delay); } } // Control 11 - Right Channel Gain Control if (ctrl == 11) { if (digitalRead(sw01) == LOW) { rch_gain++; if (rch_gain > 7) { rch_gain = 7; } audio(); delay(btn_delay); } if (digitalRead(sw02) == LOW) { rch_gain--; if (rch_gain < 0) { rch_gain = 0; } audio(); delay(btn_delay); } } // Control 12 - Right Channel Volume Control if (ctrl == 12) { if (digitalRead(sw01) == LOW) { rch_vol++; if (rch_vol > 99) { rch_vol = 99; } audio(); delay(btn_delay); } if (digitalRead(sw02) == LOW) { rch_vol--; if (rch_vol < 0) { rch_vol = 0; } audio(); delay(btn_delay); } } // Control 13 - Center Channel Gain Control if (ctrl == 13) { if (digitalRead(sw01) == LOW) { cch_gain++; if (cch_gain > 7) { cch_gain = 7; } audio(); delay(btn_delay); } if (digitalRead(sw02) == LOW) { cch_gain--; if (cch_gain < 0) { cch_gain = 0; } audio(); delay(btn_delay); } } // Control 14 - Center Channel Volume Control if (ctrl == 14) { if (digitalRead(sw01) == LOW) { cch_vol++; if (cch_vol > 99) { cch_vol = 99; } audio(); delay(btn_delay); } if (digitalRead(sw02) == LOW) { cch_vol--; if (cch_vol < 0) { cch_vol = 0; } audio(); delay(btn_delay); } } // Control 15 - Subwoofer Channel Gain Control if (ctrl == 15) { if (digitalRead(sw01) == LOW) { swch_gain++; if (swch_gain > 7) { swch_gain = 7; } audio(); delay(btn_delay); } if (digitalRead(sw02) == LOW) { swch_gain--; if (swch_gain < 0) { swch_gain = 0; } audio(); delay(btn_delay); } } // Control 16 - Subwoofer Channel Volume Control if (ctrl == 16) { if (digitalRead(sw01) == LOW) { swch_vol++; if (swch_vol > 99) { swch_vol = 99; } audio(); delay(btn_delay); } if (digitalRead(sw02) == LOW) { swch_vol--; if (swch_vol < 0) { swch_vol = 0; } audio(); delay(btn_delay); } } // Control 17 - Surround Left Channel Gain Control if (ctrl == 17) { if (digitalRead(sw01) == LOW) { slch_gain++; if (slch_gain > 7) { slch_gain = 7; } audio(); delay(btn_delay); } if (digitalRead(sw02) == LOW) { slch_gain--; if (slch_gain < 0) { slch_gain = 0; } audio(); delay(btn_delay); } } // Control 18 - Surround Left Channel Volume Control if (ctrl == 18) { if (digitalRead(sw01) == LOW) { slch_vol++; if (slch_vol > 99) { slch_vol = 99; } audio(); delay(btn_delay); } if (digitalRead(sw02) == LOW) { slch_vol--; if (slch_vol < 0) { slch_vol = 0; } audio(); delay(btn_delay); } } // Control 19 - Surround Right Channel Gain Control if (ctrl == 19) { if (digitalRead(sw01) == LOW) { srch_gain++; if (srch_gain > 7) { srch_gain = 7; } audio(); delay(btn_delay); } if (digitalRead(sw02) == LOW) { srch_gain--; if (srch_gain < 0) { srch_gain = 0; } audio(); delay(btn_delay); } } // Control 20 - Surround Right Channel Volume Control if (ctrl == 20) { if (digitalRead(sw01) == LOW) { srch_vol++; if (srch_vol > 99) { srch_vol = 99; } audio(); delay(btn_delay); } if (digitalRead(sw02) == LOW) { srch_vol--; if (srch_vol < 0) { srch_vol = 0; } audio(); delay(btn_delay); } } } void initialControl() { ctrl = 0; // Control 0 - 20 in = 1; // Input Selector 0 to 4 (0=ALL OFF, 1=IN1, 2=IN2, 3=IN3 and 4=IN4) rec_out = 0; // REC Output 0 or 1 (0=OFF and 1=ON) rec_gain = 0; // REC-Output Gain Control 0 to 3 (0=0dB, 1=+2dB, 2=+4dB and 4=+6dB) att = 0; // ADC Input ATT 0 to 3 (0=0dB, 1=-6dB, 2=-12dB and 4=-18dB) lr_in = 0; // L/R Input 0 or 1 (0=Selector In and 1=Multi In) bass = 7; // Bass/Bypass 0 to 14 (0=-14dB, 7=0dB, 14=+14dB) treble = 7; // Treble 0 to 14 (0=-14dB, 7=0dB, 14=+14dB) sl_sr_c_sw_in = 0; // SL/ SR/ C/ SW Input 0 or 1 in_gain = 0; // Input Gain 0 to 7 (0=0dB to 7=+14dB) +2dB/step // Channel Gain 0 to 7 (0=0dB to 7=+14dB) +2dB/step // Channel Volume 0 to 99 (0=-99dB to 99=0dB) 1dB/step lch_gain = 0; // Left Channel Gain lch_vol = 60; // Left Channel Volume rch_gain = 0; // Right Channel Gain rch_vol = 60; // Right Channel Volume cch_gain = 0; // Center Channel Gain cch_vol = 60; // Center Channel Volume swch_gain = 0; // Subwoofer Channel Gain swch_vol = 50; // Subwoofer Channel Volume slch_gain = 0; // Surround Left Channel Gain slch_vol = 60; // Surround Left Channel Volume srch_gain = 0; // Surround Right Channel Gain srch_vol = 60; // Surround Right Channel Volume } void audio() { R2S15902FP.slot1(in, rec_out, rec_gain, att, lr_in, bass, treble, sl_sr_c_sw_in, in_gain); R2S15902FP.slot2(lch_gain, lch_vol, rch_gain, rch_vol); R2S15902FP.slot3(cch_gain, cch_vol, swch_gain, swch_vol); R2S15902FP.slot4(slch_gain, slch_vol, srch_gain, srch_vol); }
Documents
Download FilesI have included R2S15902FP.h, R2S15902FP.cpp, audio.ino, Circuit digram, PCB Design(PDF) and R2S15902FP Datasheet in the link.