#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioInputTDM tdm1; //xy=146,1894
AudioInputTDM2 tdm2_1; //xy=148,2202.9998779296875
AudioOutputTDM tdm2; //xy=642,1897
AudioOutputTDM2 tdm2_2; //xy=643,2200.9998779296875
AudioControlCS42448 cs42448_1; //xy=366,2039.9998779296875
AudioControlCS42448 cs42448_2; //xy=378,2353.9998779296875
AudioSynthWaveformSine sine1; //xy=343,1789
AudioSynthWaveformSine sine2; //xy=346,1843
AudioSynthWaveformSine sine3; //xy=350,1895
AudioSynthWaveformSine sine4; //xy=350,1950
AudioSynthWaveformSine sine6; //xy=376,2149.9998779296875
AudioSynthWaveformSine sine5; //xy=377,2099.9998779296875
AudioSynthWaveformSine sine7; //xy=379,2200.9998779296875
AudioSynthWaveformSine sine8; //xy=384,2249.9998779296875
AudioConnection patchCord1(sine1, 0, tdm2, 0);
AudioConnection patchCord2(sine1, 0, tdm2, 2);
AudioConnection patchCord3(sine2, 0, tdm2, 4);
AudioConnection patchCord4(sine2, 0, tdm2, 6);
AudioConnection patchCord5(sine3, 0, tdm2, 8);
AudioConnection patchCord6(sine3, 0, tdm2, 10);
AudioConnection patchCord7(sine4, 0, tdm2, 12);
AudioConnection patchCord8(sine4, 0, tdm2, 14);
AudioConnection patchCord9(sine6, 0, tdm2_2, 4);
AudioConnection patchCord10(sine6, 0, tdm2_2, 6);
AudioConnection patchCord11(sine5, 0, tdm2_2, 0);
AudioConnection patchCord12(sine5, 0, tdm2_2, 2);
AudioConnection patchCord13(sine7, 0, tdm2_2, 8);
AudioConnection patchCord14(sine7, 0, tdm2_2, 10);
AudioConnection patchCord15(sine8, 0, tdm2_2, 12);
AudioConnection patchCord16(sine8, 0, tdm2_2, 14);
// GUItool: end automatically generated code
// Select I2C BUS
void TCA9548A(uint8_t bus){
Wire.beginTransmission(0x70); // TCA9548A address
Wire.write(1 << bus); // send byte to select bus
Wire.endTransmission();
Serial.print(bus);
}
void setup() {
Serial.begin(38400);
Wire.begin();
cs42448_1.setAddress(0x48);
cs42448_1.enable();
cs42448_2.setAddress(0x4A);
cs42448_2.enable();
AudioMemory(1500);
sine1.amplitude(0.3);
sine1.frequency(800);
sine2.amplitude(0.2);
sine2.frequency(1000);
sine3.amplitude(0.2);
sine3.frequency(1200);
sine4.amplitude(0.2);
sine4.frequency(1500);
sine5.amplitude(0.3);
sine5.frequency(800);
sine6.amplitude(0.2);
sine6.frequency(1000);
sine7.amplitude(0.2);
sine7.frequency(1200);
sine8.amplitude(0.2);
sine8.frequency(1500);
if (cs42448_1.enable() && cs42448_1.volume(0.8)) {
Serial.println("configured CS42448_1 at I2C address 0X48");
} else {
Serial.println("failed to config CS42448_1");
}
// Init cs42448 at I2C address 0X4A wired to TCA9548A channel1 (starts at 0)
TCA9548A(0);
if (cs42448_2.enable() && cs42448_2.volume(0.8)) {
Serial.println("configured CS42448_2 at I2C address 0X4A");
} else {
Serial.println("failed to config CS42448_2");
}
cs42448_1.inputLevel(5.0);
cs42448_2.inputLevel(5.0);
}
void loop() {
}