@@ -678,25 +678,40 @@ class AudioDriverWM8960Class : public AudioDriver {
678
678
mtb_wm8960_free ();
679
679
return true ;
680
680
}
681
+
681
682
bool setMute (bool enable) { return setVolume (enable ? 0 : volume_out); }
683
+
682
684
// / Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
683
685
bool setVolume (int volume) {
684
686
setOutputVolume (volume);
685
687
return true ;
686
688
};
687
689
int getVolume () { return volume_out; }
690
+
688
691
bool setInputVolume (int volume) {
689
692
adjustInputVolume (volume);
690
693
return true ;
691
694
}
692
695
bool isVolumeSupported () { return true ; }
696
+
693
697
bool isInputVolumeSupported () { return true ; }
694
698
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
+
695
710
protected:
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 ;
700
715
bool vs1053_enable_pll = true ;
701
716
702
717
void adjustInputVolume (int vol) {
@@ -751,7 +766,8 @@ class AudioDriverWM8960Class : public AudioDriver {
751
766
vs1053_mclk_hz = 512 * codec_cfg.getRateNumeric ();
752
767
}
753
768
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 ()),
755
771
wordLength (codec_cfg.getBitsNumeric ()),
756
772
modeMasterSlave (codec_cfg.i2s .mode == MODE_MASTER))) {
757
773
AD_LOGE (" mtb_wm8960_configure_clocking" );
0 commit comments