FM-test
Dependencies: MODSERIAL mbed-rtos mbed
Fork of Master by
Revision 13:3f0505bbe284, committed 2014-09-15
- Comitter:
- 9uS7
- Date:
- Mon Sep 15 04:05:56 2014 +0000
- Parent:
- 12:168338a29373
- Commit message:
- add fmStop and fmRestart
Changed in this revision
--- 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
--- a/fm.h Mon Sep 15 02:45:54 2014 +0000 +++ b/fm.h Mon Sep 15 04:05:56 2014 +0000 @@ -23,6 +23,7 @@ void fmSetup(unsigned int); //setup i2c (int frequency) frequency:760~910 - +void fmStop(void); +void fmRestart(void); #endif \ No newline at end of file
--- a/main.cpp Mon Sep 15 02:45:54 2014 +0000 +++ b/main.cpp Mon Sep 15 04:05:56 2014 +0000 @@ -33,13 +33,10 @@ if( DEVICE_ROLE==BT_MASTER ){ //masterLoop(); } - /*i2c.start(); - i2c.write(0x11); - i2c.write(0x42); - i2c.write(0x07); - i2c.write(0x0F); - i2c.stop(); - wait(0.05);*/ + fmStop(); + wait(2); + fmRestart(); + wait(2); } }