FM-test

Dependencies:   MODSERIAL mbed-rtos mbed

Fork of Master by Ohnishi_Gundan

Revision:
13:3f0505bbe284
Parent:
12:168338a29373
--- a/fm.cpp	Mon Sep 15 02:45:54 2014 +0000
+++ b/fm.cpp	Mon Sep 15 04:05:56 2014 +0000
@@ -30,8 +30,20 @@
     i2c.start();
     i2c.write(i2c_write);
     i2c.write(0x02);
-    i2c.write(0xC0);
-    i2c.write(0x0D);
+    i2c.write(
+        1*I2C_NORMAL_OUTPUT_Z |
+        1*I2C_NO_MUTE |
+        1*I2C_MONORAL |
+        0*I2C_BASS_BOOST 
+    );
+    i2c.write(//0x0D
+        
+        I2C_CLK_32k |
+        1*I2C_ANTENNA_INNER |
+        0*I2C_SOFT_RESET |
+        1*I2C_POWER_UP
+        
+    );
     i2c.stop();
     wait(0.5);   
    
@@ -68,4 +80,52 @@
     wait(0.5);
     
     f_led1 = 1;
+}
+
+void fmStop(){
+    const int addr = 0x11;     //slave address
+    const int i2c_write = (addr << 1) | I2C_WRITE;
+    
+    i2c.start();
+    i2c.write(i2c_write);
+    i2c.write(0x02);
+    i2c.write(
+        1*I2C_NORMAL_OUTPUT_Z |
+        0*I2C_NO_MUTE |
+        1*I2C_MONORAL |
+        0*I2C_BASS_BOOST 
+    );
+    i2c.write(//0x0D
+        
+        I2C_CLK_32k |
+        1*I2C_ANTENNA_INNER |
+        0*I2C_SOFT_RESET |
+        1*I2C_POWER_UP
+        
+    );
+    i2c.stop();
+}
+
+void fmRestart(){
+    const int addr = 0x11;     //slave address
+    const int i2c_write = (addr << 1) | I2C_WRITE;
+    
+    i2c.start();
+    i2c.write(i2c_write);
+    i2c.write(0x02);
+    i2c.write(
+        1*I2C_NORMAL_OUTPUT_Z |
+        1*I2C_NO_MUTE |
+        1*I2C_MONORAL |
+        0*I2C_BASS_BOOST 
+    );
+    i2c.write(//0x0D
+        
+        I2C_CLK_32k |
+        1*I2C_ANTENNA_INNER |
+        0*I2C_SOFT_RESET |
+        1*I2C_POWER_UP
+        
+    );
+    i2c.stop();
 }
\ No newline at end of file