I2S driver modified for UDA1345 slave mode

Dependents:   USBAudioUDA1345

Fork of I2S by Giles Barton-Owen

Files at this revision

API Documentation at this revision

Comitter:
edy555
Date:
Tue Feb 04 15:21:28 2014 +0000
Parent:
0:455d5826751b
Commit message:
add rx slave and tx master trial

Changed in this revision

I2S.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/I2S.cpp	Wed Sep 19 10:53:33 2012 +0000
+++ b/I2S.cpp	Tue Feb 04 15:21:28 2014 +0000
@@ -491,9 +491,9 @@
 
             if (clk_d == true) {
                 if (_clk == p15)
-                    LPC_PINCON->PINSEL0 |= (val1 << 8);
+                    LPC_PINCON->PINSEL1 |= (val2 << 14);
                 else
-                    LPC_PINCON->PINSEL1 |= (val2 << 14);
+                    LPC_PINCON->PINSEL0 |= (val1 << 8);
             }
         }
     }
@@ -549,9 +549,12 @@
     if (_rxtx == I2S_TRANSMIT) {
         int regvals = ((pre_num << 8) & 0xFF00) | (pre_den & 0xFF);
         LPC_I2S->I2STXRATE = regvals;                // Setting the X/Y fraction
-        LPC_I2S->I2STXBITRATE = (bitrate_div - 1) & 0x3F;// Setting up the bitrate divider, the periferal adds one to this
+        //LPC_I2S->I2STXBITRATE = (bitrate_div - 1) & 0x3F;// Setting up the bitrate divider, the periferal adds one to this
 
-        LPC_I2S->I2STXMODE = fourwire << 2;
+        //LPC_I2S->I2STXMODE = fourwire << 2;
+        
+        LPC_I2S->I2STXBITRATE = 4-1;// Setting up the bitrate divider, the periferal adds one to this
+        LPC_I2S->I2STXMODE = 0x2;
 
         if (mclk_d == true) {
             LPC_I2S->I2STXMODE |= (1 << 3);