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.h
- Revision:
- 3:bdd691977de4
- Parent:
- 2:cf256181972f
--- a/RDA5807M.h Sun Apr 12 16:26:11 2015 +0000 +++ b/RDA5807M.h Thu Jun 11 20:17:16 2015 +0000 @@ -15,7 +15,7 @@ void WriteAll(void); void WriteReg(int address,int data); void Init(void); -void Read(void); +void Readregisters(void); void Reset(void); void PowerOn(void); void PowerOff(void); @@ -33,12 +33,11 @@ void Channel(void); void getRDS(void); - // Initialise internal variables before starting or after a change to another channel. void RDSinit(); // Pass all available RDS data through this function. -void processData(); +void ProcessData(); //-------------------------------------------------------------- // Definitions @@ -47,9 +46,9 @@ #define RDASequential 0x20 // Write address #define RDARandom 0x22 // Read address /* Initialization Options */ -#define StartingFreq 87.000 +#define StartingFreq 87.00 #define EndingFreq 108.00 -#define DefaultFreq 98.80 +#define DefaultFreq 87.50 #define InitialVolume 4 /* RDA5807M Function Code */ /* Register 0x02H (16Bits) */ @@ -90,7 +89,8 @@ char StationName[10]; // Station Name. 8 characters char RDSText[66]; // RDS test message 64 characters -int CTtime; // CT time transmitted on the minute +char CTtime[12]; // CT time string formatted as 'CT hh:mm' +int minutes; // CT minutes transmitted on the minute float freq; // Tuned frequency //-------------------------------------------------------------- @@ -99,21 +99,20 @@ I2C i2c; - unsigned int RDA5807M_WriteReg[8],RDA5807M_ReadReg[7],RDA5807M_RDS[32]; + unsigned int RDA5807M_WriteReg[8],RDA5807M_ReadReg[7],RDA5807M_RDS[32]; -// ----- actual RDS values - int textAB, lasttextAB, lastTextIDX; - int rdsGroupType, rdsTP, rdsPTY; -// Program Service Name - char PSName1[10]; // including trailing '\00' character. - char PSName2[10]; // including trailing '\00' character. - - typedef void(*receiveServicenNameFunction)(char *name); - typedef void(*receiveTextFunction)(char *name); - typedef void(*receiveTimeFunction)(uint8_t hour, uint8_t minute); - - receiveServicenNameFunction sendServiceName; ///< Registered ServiceName function. - receiveTimeFunction sendTime; ///< Registered Time function. - receiveTextFunction sendText; - + // ----- actual RDS values + int textAB, lasttextAB, lastTextIDX; + int rdsGroupType, rdsTP, rdsPTY; + + int mins; // RDS time in minutes + int lastmins; + int i,n; + int idx; // index of rdsText + int offset; // RDS time offset and sign + char c1, c2; + char RDSTxt[66]; + char PSName[10]; // including trailing '\00' character. + char PSName1[10]; + char PSName2[10]; }; \ No newline at end of file