TLV320_RBSP class, defined on the I2C master bus.

Dependents:   MovPlayer GR-PEACH_Audio_Playback_Sample GR-PEACH_Audio_Playback_7InchLCD_Sample RGA-MJPEG_VideoDemo ... more

Fork of TLV320_RBSP by Daiki Kato

Revision:
4:15487e571d9f
Parent:
2:b1fab4a2b59d
--- a/TLV320_RBSP.cpp	Tue Aug 18 04:34:26 2015 +0000
+++ b/TLV320_RBSP.cpp	Wed Oct 21 06:58:35 2015 +0000
@@ -29,7 +29,7 @@
 #undef  MCLK_11_2896MHZ
 
 TLV320_RBSP::TLV320_RBSP(PinName cs, PinName sda, PinName scl, PinName sck, PinName ws, PinName tx, PinName rx, uint8_t int_level, int32_t max_write_num, int32_t max_read_num) 
-       : mI2c_(sda, scl), mI2s_(sck, ws, tx, rx, int_level, max_write_num, max_read_num), audio_cs_(cs) {
+       : audio_cs_(cs), mI2c_(sda, scl), mI2s_(sck, ws, tx, rx, int_level, max_write_num, max_read_num) {
     audio_cs_ = 0;
     mAddr     = 0x34;
     audio_path_control = 0;
@@ -139,6 +139,22 @@
     mI2c_.write(mAddr, cmd, 2);
 }
 
+void TLV320_RBSP::micVolume(bool mute, bool boost) {
+    cmd[0] = ANALOG_AUDIO_PATH_CONTROL;
+    if (mute != false) {
+        audio_path_control |= (1 << 1);        // MICM Muted
+    } else {
+        audio_path_control &= ~(1 << 1);       // MICM Normal
+    }
+    if (boost != false) {
+        audio_path_control |= (1 << 0);        // MICB 20dB
+    } else {
+        audio_path_control &= ~(1 << 0);       // MICB 0dB
+    }
+    cmd[1] = audio_path_control;
+    mI2c_.write(mAddr, cmd, 2);
+}
+
 void TLV320_RBSP::mute(bool softMute) {
     cmd[0] = DIGITAL_AUDIO_PATH_CONTROL;
     if (softMute != false) {