RDA5807M FM Radio library with RDS.
Dependents: RDA5807M-FM-Radio EFM32 RDA5807M RDS Radio
Example program here:
https://developer.mbed.org/users/star297/code/RDA5807M-FM-Radio/
Diff: RDA5807M.cpp
- Revision:
- 4:3e7968bd455d
- Parent:
- 3:bdd691977de4
--- a/RDA5807M.cpp Thu Jun 11 20:17:16 2015 +0000 +++ b/RDA5807M.cpp Fri Jun 19 16:19:31 2015 +0000 @@ -240,7 +240,7 @@ PSName2[idx + 1] = c2; PSName2[8] = '\0'; if (strcmp(PSName1, PSName2) == 0) { - // publish station name + // populate station name n=0; for(i=0;i<(8);i++){ // remove non-printable error ASCCi characters if(PSName2[i] > 31 && PSName2[i] < 127){ @@ -259,15 +259,13 @@ case 0x2A: // RDS text - // The data received is part of the RDS Text. textAB = (block2 & 0x0010); - idx = 4 * (block2 & 0x000F); - if(idx>64){memset(RDSTxt, '\0', sizeof(RDSTxt));idx=0;} + idx = 4 * (block2 & 0x000F); if (idx < lastTextIDX) { - // the existing text might be complete because the index is starting at the beginning again. - // now send it to the possible listener. + // The existing text might be complete because the index is starting at the beginning again. + // Populate RDS text array. n=0; - for(i=0;i<64;i++){ + for(i=0;i<strlen(RDSTxt);i++){ if(RDSTxt[i] > 31 && RDSTxt[i] < 127){ // remove any non printable error charcters RDSText[n] = RDSTxt[i]; n++; @@ -293,7 +291,7 @@ case 0x4A: // Clock time and date - if(rdsblockerror ==0){ // allow no RDS data errors as we have no correctioin code + if(rdsblockerror <3){ // allow limited RDS data errors as we have no correctioin code offset = (block4) & 0x3F; // 6 bits mins = (block4 >> 6) & 0x3F; // 6 bits mins += 60 * (((block3 & 0x0001) << 4) | ((block4 >> 12) & 0x0F)); @@ -305,7 +303,7 @@ else { mins += 30 * (offset & 0x1F); } - if(mins == lastmins+1){ // get CT time twice before sending time + if(mins == lastmins+1){ // get CT time twice before populating time minutes=mins;} lastmins=mins; if(rdssynchro == 0x1000){