First Publish. Works fine.

Dependents:   unzen_sample_lpcxpresso_4337_callbacks

Revision:
13:845ba6aa3449
Parent:
12:5e73a102d809
Child:
16:5e682712d3de
--- a/unzen.h	Thu May 12 22:13:04 2016 +0000
+++ b/unzen.h	Sat May 14 21:37:42 2016 +0000
@@ -22,7 +22,94 @@
         };
     
     /**
-      \brief adio frame work. Create a object and execute the \ref framework::start() method.
+      \brief adio frame work. Create a object and execute the \ref Framework::start() method.
+      
+      example :
+      \code
+#include "unzen.h"          // audio framework include file
+#include "umb_adau1361a.h"     // audio codec contoler include file
+#include "mbed.h"
+
+#define CODEC_I2C_ADDR 0x38
+
+DigitalOut myled1(LED1);
+
+
+    // customer signal processing initialization call back.
+void init_callback(
+            unsigned int block_size     // block size [sample]
+            )
+{
+        // place initialization code here
+}
+
+
+    // customer signal processing call back.
+void process_callback(
+            float rx_left_buffer[],     // array of the left input samples
+            float rx_right_buffer[],    // array of the right input samples
+            float tx_left_buffer[],     // place to write the left output samples
+            float tx_right_buffer[],    // place to write the left output samples
+            unsigned int block_size     // block size [sample]
+            )
+{
+        // Sample processing
+    for ( int i=0; i<block_size; i++)   // for all sample
+    {
+        tx_left_buffer[i] = rx_left_buffer[i];      // copy from input to output
+        tx_right_buffer[i] = rx_right_buffer[i];
+        
+    }
+}
+
+
+
+int main() 
+{    
+        // I2C is essential to talk with ADAU1361
+    I2C i2c(SDA, SCL);
+
+        // create an audio codec contoler
+    shimabara::UMB_ADAU1361A codec(shimabara::Fs_32, &i2c, CODEC_I2C_ADDR ); // Default Fs is 48kHz
+//    shimabara::UMB_ADAU1361A codec(shimabara::Fs_441, &i2c, CODEC_I2C_ADDR );
+//    shimabara::UMB_ADAU1361A codec(shimabara::Fs_48, &i2c, CODEC_I2C_ADDR );
+//    shimabara::UMB_ADAU1361A codec(shimabara::Fs_96, &i2c, CODEC_I2C_ADDR );
+
+       // create an audio framework by singlton pattern
+    unzen::Framework audio;
+ 
+         // Set I3C clock to 10kHz
+    i2c.frequency( 10000 );
+
+
+        // Configure the optional block size of signal processing. By default, it is 1[Sample] 
+//    audio.set_block_size(16);
+
+    
+        // Start the ADAU1361. Audio codec starts to generate the I2C signals 
+    codec.start();
+
+        // Start the audio framework on ARM processor.  
+    audio.start( init_callback, process_callback);     // path the initializaiton and process call back to framework 
+
+
+        // periodically changing gain for test
+    while(1)     
+    {
+        for ( int i=-15; i<4; i++ )
+        {
+            codec.set_hp_output_gain( i, i );
+            codec.set_line_output_gain( i, i );
+            myled1 = 1;
+            wait(0.2);
+            myled1 = 0;
+            wait(0.2);
+        }
+    }
+}
+
+
+      \endcode
     */
     class Framework 
     {