@@ -193,7 +193,7 @@ class AudioDriver {
193193 GpioPin pin = pins ().getPinID (PinFunction::PA);
194194 if (pin == -1 )
195195 return false ;
196- // AD_LOGI("setPAPower pin %d -> %d", pin, enable);
196+ AD_LOGI (" setPAPower pin %d -> %d" , pin, enable);
197197 digitalWrite (pin, enable ? HIGH : LOW);
198198 return true ;
199199 }
@@ -286,13 +286,13 @@ class AudioDriverAC101Class : public AudioDriver {
286286};
287287
288288/* *
289- * @brief Driver API for the CS43l22 codec chip
289+ * @brief Driver API for the CS43l22 codec chip on 0x94 (0x4A<<1)
290290 * @author Phil Schatzmann
291291 * @copyright GPLv3
292292 */
293293class AudioDriverCS43l22Class : public AudioDriver {
294294public:
295- AudioDriverCS43l22Class (uint16_t deviceAddr = 0x94 ) {
295+ AudioDriverCS43l22Class (uint16_t deviceAddr = 0x94 ) {
296296 this ->deviceAddr = deviceAddr;
297297 }
298298
@@ -304,12 +304,18 @@ class AudioDriverCS43l22Class : public AudioDriver {
304304 codec_cfg = codecCfg;
305305 // manage reset pin -> acive high
306306 setPAPower (true );
307- delay (10 );
307+ // Setup enable pin for codec
308+ delay (100 );
308309 int vol = map (volume, 0 , 100 , DEFAULT_VOLMIN, DEFAULT_VOLMAX);
309310 uint32_t freq = getFrequency (codec_cfg.i2s .rate );
310311 uint16_t outputDevice = getOutput (codec_cfg.output_device );
311312 AD_LOGD (" cs43l22_Init" );
312- return cs43l22_Init (deviceAddr, outputDevice, vol, freq, getI2C ()) == 0 ;
313+ bool result = cs43l22_Init (deviceAddr, outputDevice, vol, freq, getI2C ()) == 0 ;
314+ if (!result){
315+ AD_LOGE (" error: cs43l22_Init" );
316+ }
317+ cs43l22_Play (deviceAddr, nullptr , 0 );
318+ return result;
313319 }
314320
315321 bool setMute (bool mute) {
0 commit comments