RDA5807M FM RDS radio program using 4DSystems 32028 Oled touch screen display. Search and direct frequency selection, RDS text, 10 preset memories

Dependencies:   4Dsystems_uOLED-32028-P1T RDA5807M FreescaleIAP mbed-src

/media/uploads/star297/fm_radio.jpg

Files at this revision

API Documentation at this revision

Comitter:
star297
Date:
Tue Mar 31 22:27:49 2015 +0000
Child:
1:365082270f1a
Commit message:
Initial version 1.0

Changed in this revision

4Dsystems_uOLED-32028-P1T.lib Show annotated file Show diff for this revision Revisions of this file
RDA5807M.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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/4Dsystems_uOLED-32028-P1T.lib	Tue Mar 31 22:27:49 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/star297/code/4Dsystems_uOLED-32028-P1T_LPC1768_KL25Z/#8ea60129317b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RDA5807M.lib	Tue Mar 31 22:27:49 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/star297/code/RDA5807M/#527aa96336ac
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Mar 31 22:27:49 2015 +0000
@@ -0,0 +1,59 @@
+#include "mbed.h"
+#include "RDA5807M.h"
+#include "OLED32028P1T.h"
+
+RDA5807M radio(p9, p10, 0x22);        // sda - scl
+
+OLED32028P1T oled(p28, p27, p29);   // Oled Display tx, rx, rs
+I2C i2c(p9, p10);
+
+DigitalOut myled(LED1);
+
+void readdata() // Extra read and print data function for checking, not actually used for anything. 
+{       
+        oled.locate(0,6);
+        int i;
+        char rcv[12];
+        i2c.read(0x20, rcv,12);   // read 12 bytes for reg 0x0A .. reg 0x0F 
+        for(i=0; i<6; i++){
+             oled.printf("  register:  %X =  %0X   \n", i + 0x0A, (rcv[i *2] << 8) | rcv [(i*2) +1] );
+            }
+}
+
+int main() {
+    
+    oled.init();
+    oled.clear();
+    oled.drawText(0,0,(FONT12X16)," -- RDA5807m FM Radio --",oled.toRGB(0,255,0));
+    oled.setTextBackgroundType (TEXT_OPAQUE);
+    oled.setFontSize(FONT12X16);oled.locate(2,2);
+    oled.setFontColor(oled.toRGB(255,255,255));
+        
+    i2c.frequency(400000);
+
+    radio.Reset();      // reset and power up radio chip
+    
+    radio.RDS();        // switch on RDS 
+    
+    radio.Volume(2);    // set volume
+    
+    while(1) {          // Continuous tune test.
+        myled = !myled;
+        
+        radio.SeekUp(); // start seek tuning and stop when signal found (loops at end of range, 108MHz)         
+        
+        wait(1);        // Allow station find.
+        
+        radio.Read();   // Read Registers for frequency, signal level and RDS data, etc  
+        
+        oled.locate(2,2);
+        oled.printf("Frequency: %3.2f MHz  \n",radio.freq/1000);        
+        oled.printf("  Signal Level: %d   \n",radio.signal);
+        if (radio.stereo == 1){oled.printf("  Stereo");}
+            else {oled.printf("  Mono  ");}
+        
+        readdata();     // Read registers (for testing)
+        wait(3);
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Mar 31 22:27:49 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/487b796308b0
\ No newline at end of file