Dialog DA7212 evaluating project DEVELOP branch

Dependencies:   FXAS21002 TLV320 mbed sinelookup C12832 FXOS8700

Revision:
16:2edf3d4ccbe3
Parent:
15:f9f642239cb6
--- a/main.cpp	Fri Jun 09 17:01:20 2017 +0000
+++ b/main.cpp	Tue Jul 04 16:53:05 2017 +0000
@@ -91,7 +91,7 @@
 #include "sinelookup.h"
 //DA7212 codec(I2C_SDA, I2C_SCL);
 //TLV320 codec(I2C_SDA, I2C_SCL);
-FrdmI2s i2s(PTC1, PTE11, PTE12,TRANSMIT);
+FrdmI2s i2s(PTC6,PTC1, PTE11, PTE12,TRANSMIT);
 
 uint16_t phase_l;
 uint16_t phase_r;
@@ -107,7 +107,7 @@
 
 void play(void)
 {
-    int to_write = i2s.max_fifo_points() - (i2s.fifo_points());
+    int to_write = i2s.get_fifo_limit() - (i2s.fifo_points());
     for(int i = 0; i < to_write; i+=2) {
         minibuf[i] = (int)sine16lookup[(SINE16LENGTH - 1) &( phase_l+skipper)];
         minibuf[i+1] = (int)sine16lookup[(SINE16LENGTH - 1) & (phase_r+skipper)];
@@ -125,6 +125,8 @@
     volume = pot2.read_u16() >> 10;
     phase_l = 0;
     phase_r = 512;
+    int to_write =0;
+    int irq=0;
 
 //     codec.power(true);
     // codec.frequency(SAMPLERATE);
@@ -135,8 +137,8 @@
 
     i2s.frequency(SAMPLERATE);
     i2s.wordsize(16);
-    i2s.stereomono(STEREO);
-    i2s.role(MASTER);
+    i2s.stereomono(FrdmI2s::STEREO);
+    i2s.role(FrdmI2s::MASTER);
 //    i2s.attach(&play);
     i2s.start();
 
@@ -153,8 +155,11 @@
 //        lcd.printf("Volume: %+03d", (volume - 57));
 //        lcd.locate(0,15);
 //        lcd.printf("Skipper: %04d", skipper);
-        for(int j=0;j<8;j++){
-            I2S0->TDR[0] = 0x5555AAAA;
+        irq = (I2S0->TCSR &I2S_TCSR_FEF_MASK) >> I2S_TCSR_FEF_SHIFT;
+        to_write = i2s.get_fifo_limit() - (i2s.fifo_level());
+        pc.printf("%d, %d\r",irq,to_write);
+        for(int j=0;j<to_write ;j++){
+            I2S0->TDR[0] = 0x55AA;
         }
     }
 }