@@ -678,25 +678,40 @@ class AudioDriverWM8960Class : public AudioDriver {
678678 mtb_wm8960_free ();
679679 return true ;
680680 }
681+
681682 bool setMute (bool enable) { return setVolume (enable ? 0 : volume_out); }
683+
682684 // / Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
683685 bool setVolume (int volume) {
684686 setOutputVolume (volume);
685687 return true ;
686688 };
687689 int getVolume () { return volume_out; }
690+
688691 bool setInputVolume (int volume) {
689692 adjustInputVolume (volume);
690693 return true ;
691694 }
692695 bool isVolumeSupported () { return true ; }
696+
693697 bool isInputVolumeSupported () { return true ; }
694698
699+ // / Configuration: define retry count (default : 0)
700+ void setI2CRetryCount (int cnt) { i2c_retry_count = cnt; }
701+
702+ // / Configuration: enable/diable PLL (active by default)
703+ void setEnablePLL (bool active) { vs1053_enable_pll = active; }
704+
705+ // / Configuration: define master clock frequency (default: 0)
706+ void setMclkHz (uint32_t hz ){
707+ vs1053_mclk_hz = hz;
708+ }
709+
695710protected:
696- int volume_in;
697- int volume_out;
698- int i2c_retry_count = 5 ;
699- int vs1053_mclk_hz = 0 ;
711+ int volume_in = 100 ;
712+ int volume_out = 100 ;
713+ int i2c_retry_count = 0 ;
714+ uint32_t vs1053_mclk_hz = 0 ;
700715 bool vs1053_enable_pll = true ;
701716
702717 void adjustInputVolume (int vol) {
@@ -751,7 +766,8 @@ class AudioDriverWM8960Class : public AudioDriver {
751766 vs1053_mclk_hz = 512 * codec_cfg.getRateNumeric ();
752767 }
753768 if (!mtb_wm8960_configure_clocking (
754- vs1053_mclk_hz, vs1053_enable_pll, sampleRate (codec_cfg.getRateNumeric ()),
769+ vs1053_mclk_hz, vs1053_enable_pll,
770+ sampleRate (codec_cfg.getRateNumeric ()),
755771 wordLength (codec_cfg.getBitsNumeric ()),
756772 modeMasterSlave (codec_cfg.i2s .mode == MODE_MASTER))) {
757773 AD_LOGE (" mtb_wm8960_configure_clocking" );
0 commit comments