Dialog DA7212 evaluating project DEVELOP branch

Dependencies:   FXAS21002 TLV320 mbed sinelookup C12832 FXOS8700

Files at this revision

API Documentation at this revision

Comitter:
k4zuki
Date:
Tue Mar 22 06:51:12 2016 +0000
Child:
1:98b55aeebaa5
Commit message:
first commit

Changed in this revision

DA7212dev.lib Show annotated file Show diff for this revision Revisions of this file
I2S.lib Show annotated file Show diff for this revision Revisions of this file
TLV320.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
sinelookup.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DA7212dev.lib	Tue Mar 22 06:51:12 2016 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/k4zuki/code/DA7212dev/#90bb8dc72868
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/I2S.lib	Tue Mar 22 06:51:12 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/k4zuki/code/I2S/#89cea1a77092
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TLV320.lib	Tue Mar 22 06:51:12 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/p07gbar/code/TLV320/#3ee50344f8f4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Mar 22 06:51:12 2016 +0000
@@ -0,0 +1,93 @@
+/** original: p07gbar/code/TLV320_Write_test/
+ * modify by k4zuki
+ * to control Dialog DA7212 codec
+ */
+#include "mbed.h"
+#include "sinelookup.h"
+//#include "TLV320.h"
+// #include "DA7212.h"
+//#include "I2S.h"
+
+#define SAMPLERATE 32000
+
+/*
+TLV320 codec(p9, p10);
+I2S i2s(I2S_TRANSMIT, p5, p6, p7);
+
+AnalogIn aIn(p19);
+AnalogIn vol(p20);
+
+float phase_l;
+float phase_r;
+int minibuf[16];
+float skipper;
+float volume;
+float phase_kill;
+
+
+extern "C" void HardFault_Handler()
+{
+    error("Hard Fault!\n");
+}
+
+
+void play(void)
+{   
+    int to_write = i2s.max_fifo_points() - (i2s.fifo_points());
+    for(int i = 0; i < to_write; i+=2) {
+        minibuf[i] = int(float(sine16lookup[int(phase_l)])*volume);
+        //minibuf[i] = int(sine16lookup[int(phase_l)]);
+        minibuf[i+1] = int(float(sine16lookup[int(phase_r)])*volume);
+        phase_l+=skipper;
+        phase_r = phase_l + phase_kill;
+        while(phase_l >= SINE16LENGTH) {
+            phase_l -= SINE16LENGTH;
+        }
+        
+        while(phase_r >= SINE16LENGTH) {
+            phase_r -= SINE16LENGTH;
+        }
+        while(phase_r< 0) phase_r += SINE16LENGTH;
+    }
+    i2s.write(minibuf, to_write);
+}
+*/
+/* main */
+int main()
+{
+    I2S0_TCSR |= 1u<<31;
+/*
+    skipper = (aIn*49)+1;
+    
+    codec.power(true);
+    codec.frequency(SAMPLERATE);
+    codec.wordsize(16);  
+    codec.master(false);
+    codec.headphone_volume(0.5);
+    codec.start();
+    
+    i2s.frequency(SAMPLERATE);
+    i2s.wordsize(16);
+    i2s.stereomono(I2S_STEREO);
+    i2s.masterslave(I2S_MASTER);
+    i2s.attach(&play);
+    i2s.start();
+*/
+    while(1)
+    {;
+/*
+        skipper = (aIn*30)+1;
+
+        volume = 1;
+        phase_kill = (vol-0.5)*400;
+
+        //printf("Skipper:%f, %i, %i\n\r",skipper, to_write,i2s.fifo_level());
+*/
+        /*if(flag)
+        {
+        printf(".");
+        flag = false;
+        }*/
+    }
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Mar 22 06:51:12 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/c0f6e94411f5
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sinelookup.lib	Tue Mar 22 06:51:12 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/p07gbar/code/sinelookup/#9099a1ada151