@@ -67,6 +67,13 @@ class I2SDriverRP2040 {
6767 break ;
6868 }
6969
70+ if (!cfg.is_master ) {
71+ if (!i2s.setSlave ()) {
72+ LOGE (" Could not set slave mode" );
73+ return false ;
74+ }
75+ }
76+
7077 if (cfg.pin_ws == cfg.pin_bck + 1 ) { // normal pin order
7178 if (!i2s.setBCLK (cfg.pin_bck )) {
7279 LOGE (" Could not set bck pin: %d" , cfg.pin_bck );
@@ -89,6 +96,8 @@ class I2SDriverRP2040 {
8996 return false ;
9097 }
9198 if (cfg.pin_mck != -1 ) {
99+ LOGI (" Using MCK pin: %d with multiplier %d" , cfg.pin_mck ,
100+ cfg.mck_multiplier );
92101 i2s.setMCLKmult (cfg.mck_multiplier );
93102 if (!i2s.setMCLK (cfg.pin_mck )) {
94103 LOGE (" Could not set data pin: %d" , cfg.pin_mck );
@@ -123,8 +132,6 @@ class I2SDriverRP2040 {
123132 return false ;
124133 }
125134
126- #if defined(RP2040_HOWER)
127-
128135 if (cfg.signal_type != TDM && (cfg.channels < 1 || cfg.channels > 2 )) {
129136 LOGE (" Unsupported channels: '%d'" , cfg.channels );
130137 return false ;
@@ -135,19 +142,6 @@ class I2SDriverRP2040 {
135142 i2s.setTDMChannels (cfg.channels );
136143 }
137144
138- #else
139-
140- if (cfg.channels < 1 || cfg.channels > 2 ) {
141- LOGE (" Unsupported channels: '%d'" , cfg.channels );
142- return false ;
143- }
144-
145- if (cfg.signal_type != Digital) {
146- LOGE (" Unsupported signal_type: '%d'" , cfg.signal_type );
147- return false ;
148- }
149-
150- #endif
151145 if (!i2s.begin (cfg.sample_rate )) {
152146 LOGE (" Could not start I2S" );
153147 return false ;
0 commit comments