PU2CLR RDA5807 Arduino Library 1.1.8
Arduino Library for RDA5807 Devices - By Ricardo Lima Caratti
Loading...
Searching...
No Matches
RDS Functions

Functions

char * RDA5807::getRdsStationName (void)
 Gets the Station Name.
 
char * RDA5807::getRdsProgramInformation (void)
 Gets the Program Information.
 
char * RDA5807::getRdsStationInformation (void)
 Gets the Station Information.
 
uint8_t RDA5807::getBlockId ()
 Gets the current Block ID.
 
uint8_t RDA5807::getErrorBlockA ()
 Gets the current Status of block A.
 
uint8_t RDA5807::getErrorBlockB ()
 Gets the current Status of block B.
 
bool RDA5807::hasRdsInfo ()
 Returns true when the RDS system has valid information.
 
bool RDA5807::hasRdsInfoAB ()
 Returns true when the RDS system has valid information.
 
bool RDA5807::getRdsSync ()
 Gets the Rds Sync.
 
void RDA5807::setRDS (bool value)
 Sets the RDS operation.
 
void RDA5807::setRBDS (bool value)
 Sets the RBDS operation.
 
bool RDA5807::getRdsReady ()
 Returns true if RDS Ready.
 
uint8_t RDA5807::getRdsFlagAB (void)
 Returns the current Text Flag A/B.
 
bool RDA5807::isNewRdsFlagAB (void)
 Returns true if the Text Flag A/B has changed.
 
bool RDA5807::getRdsAllData (char **stationName, char **stationInformation, char **programInformation, char **utcTime)
 Gets Station Name, Station Information, Program Information and utcTime.
 
uint16_t RDA5807::getRdsGroupType ()
 Return the group type.
 
uint8_t RDA5807::getRdsVersionCode (void)
 Gets the version code (extracted from the Block B)
 
uint8_t RDA5807::getRdsProgramType (void)
 Returns the Program Type (extracted from the Block B)
 
void RDA5807::getNext2Block (char *c)
 Process data received from group 2B.
 
void RDA5807::getNext4Block (char *c)
 Process data received from group 2A.
 
char * RDA5807::getRdsText0A (void)
 Gets the station name and other messages.
 
char * RDA5807::getRdsText2A (void)
 Gets the Program Information.
 
char * RDA5807::getRdsText2B (void)
 Gets the Station Information.

 
char * RDA5807::getRdsTime ()
 Gets the RDS UTC time and date when the Group type is 4.
 
char * RDA5807::getRdsLocalTime ()
 Gets the RDS time converted to local time.
 
void RDA5807::setRdsFifo (bool value)
 Sets RDS fifo mode enable.
 
void RDA5807::clearRdsFifo (bool value=1)
 Clear RDS fifo.
 
void RDA5807::clearRdsBuffer ()
 Clear RDS Information (Station Name, Station Information, Program Information and Time)
 

Detailed Description

RDS/RBDS

Is important to mention that almost all the essential methods required to implement RDS are already implemented here.

Begin working with RDS, simply invoke the setRDS or setRBDS methods.

Querying a set of RDS information, please ensure to call getRdsReady before.

Function Documentation

◆ getRdsStationName()

char * RDA5807::getRdsStationName ( void  )
inline

Gets the Station Name.

Alias for getRdsText0A

ATTENTION: You must call getRdsReady before calling this function.

Returns
char* should return a string with the station name. However, some stations send other kind of messages
See also
getRdsText0A

Definition at line 862 of file RDA5807.h.

References RDA5807::getRdsText0A().

◆ getRdsProgramInformation()

char * RDA5807::getRdsProgramInformation ( void  )
inline

Gets the Program Information.

@

Process the program information data. Same getRdsText2A(). It is a alias for getRdsText2A.

ATTENTION: You must call getRdsReady before calling this function.

Returns
char array with the program information (63 bytes)
See also
getRdsText2A

Definition at line 873 of file RDA5807.h.

References RDA5807::getRdsText2A().

◆ getRdsStationInformation()

char * RDA5807::getRdsStationInformation ( void  )
inline

Gets the Station Information.

ATTENTION: You must call getRdsReady before calling this function.

Returns
char array with the Text of Station Information (33 bytes)
See also
getRdsReady

Definition at line 883 of file RDA5807.h.

References RDA5807::getRdsText2B().

◆ getBlockId()

uint8_t RDA5807::getBlockId ( )
inline

Gets the current Block ID.

You must call getRdsReady before calling this function

See also
getRdsReady

1= the block id of register 0cH,0dH,0eH,0fH is E

0= the block id of register 0cH, 0dH, 0eH,0fH is A, B, C, D

Returns
0= the block id of register 0cH, 0dH, 0eH,0fH is A, B, C, D; 1 = the block id of register 0cH,0dH,0eH,0fH is E

Definition at line 897 of file RDA5807.h.

◆ getErrorBlockA()

uint8_t RDA5807::getErrorBlockA ( )
inline

Gets the current Status of block A.

You must call getRdsReady before calling this function

See also
getRdsReady Block Errors Level of RDS_DATA_0, and is always read as Errors Level of RDS BLOCK A (in RDS mode) or BLOCK E (in RBDS mode when ABCD_E flag is 1)
Bin Dec description
00 0 0 errors requiring correction
01 1 1~2 errors requiring correction
10 2 3~5 errors requiring correction
11 3 6+ errors or error in checkword, correction not possible

Available only in RDS Verbose mode

Returns
value See table above.

Definition at line 920 of file RDA5807.h.

◆ getErrorBlockB()

uint8_t RDA5807::getErrorBlockB ( )
inline

Gets the current Status of block B.

You must call getRdsReady before calling this function

See also
getRdsReady

Block Errors Level of RDS_DATA_1, and is always read as Errors Level of RDS BLOCK B (in RDS mode ) or E (in RBDS mode when ABCD_E flag is 1).

Bin Dec description
00 0 0 errors requiring correction
01 1 1~2 errors requiring correction
10 2 3~5 errors requiring correction
11 3 6+ errors or error in checkword, correction not possible

Available only in RDS Verbose mode

Returns
value See table above.

Definition at line 944 of file RDA5807.h.

◆ hasRdsInfo()

bool RDA5807::hasRdsInfo ( )
inline

Returns true when the RDS system has valid information.

Returns true if RDS currently synchronized; the information are A, B, C and D blocks; and no errors

You must call getRdsReady before calling this function

See also
getRdsReady
Returns
true or false

Definition at line 957 of file RDA5807.h.

◆ hasRdsInfoAB()

bool RDA5807::hasRdsInfoAB ( )
inline

Returns true when the RDS system has valid information.

You must call getRdsReady before calling this function

See also
getRdsReady
Returns
true or false

Definition at line 969 of file RDA5807.h.

Referenced by RDA5807::getRdsAllData().

◆ getRdsSync()

bool RDA5807::getRdsSync ( )
inline

Gets the Rds Sync.

You must call getRdsReady before calling this function

See also
getRdsReady

Returns true if RDS currently synchronized.

Returns
true or false

Definition at line 982 of file RDA5807.h.

◆ setRDS()

void RDA5807::setRDS ( bool  value)

Sets the RDS operation.

Enable or Disable the RDS

You must call this function before stating deal with RDS.

#include <RDA5807.h>
RDA5807 rx;
void setup()
rx.setup(); // Starts the receiver with default parameters
rx.setRDS(true);
rx.setRdsFifo(true);
rx.setFrequency(10390); // Station with RDS service
}
KT0915 Class.
Definition: RDA5807.h:568
void setup(uint8_t clock_frequency=CLOCK_32K, uint8_t oscillator_type=OSCILLATOR_TYPE_PASSIVE, uint8_t rlck_no_calibrate=RLCK_NO_CALIBRATE_MODE_OFF)
Starts the device.
Definition: RDA5807.cpp:273
void setFrequency(uint16_t frequency)
Sets the frequency.
Definition: RDA5807.cpp:372
void setRDS(bool value)
Sets the RDS operation.
Definition: RDA5807.cpp:778
void setRdsFifo(bool value)
Sets RDS fifo mode enable.
Definition: RDA5807.cpp:1249
Parameters
true= turns the RDS ON; false = turns the RDS OFF
See also
setRdsFifo

Definition at line 778 of file RDA5807.cpp.

◆ setRBDS()

void RDA5807::setRBDS ( bool  value)

Sets the RBDS operation.

Enable or Disable the RDS

Parameters
true= turns the RBDS ON; false = turns the RBDS OFF

Definition at line 792 of file RDA5807.cpp.

◆ getRdsReady()

bool RDA5807::getRdsReady ( )

Returns true if RDS Ready.

Read address 0Ah and check the bit RDSR.

When using the polling method, it is best not to poll continuously. The data will appear in intervals.

ATTENTION: You must call this function before calling any RDS query

if (rx.getRdsReady()) {
if (rx.hasRdsInfo() ) {
rdsMsg = rx.getRdsProgramInformation();
stationName = rx.getRdsStationName();
rdsTime = rx.getRdsTime(); // Gets the UTC Time. Check the getRdsTime documentation for more details. Some stations do not broadcast the right time.
}
}
Returns
true or false
See also
setRDS, setInterruptMode, getRdsAllData, getRdsSync, setRdsFifo
2wcom - RDS BasicsRDS

Definition at line 822 of file RDA5807.cpp.

References RDA5807::getStatusRegisters().

Referenced by RDA5807::getRdsAllData().

◆ getRdsFlagAB()

uint8_t RDA5807::getRdsFlagAB ( void  )

Returns the current Text Flag A/B.

ATTENTION: You must call getRdsReady before calling this function.

Returns
uint8_t current Text Flag A/B
See also
getRdsReady

Definition at line 837 of file RDA5807.cpp.

◆ isNewRdsFlagAB()

bool RDA5807::isNewRdsFlagAB ( void  )

Returns true if the Text Flag A/B has changed.

This function returns true if a new FlagAB has chenged. Also it clears the Station Name buffer in that condition.

It is useful to check and show the RDS Text in your application.

You must call getRdsReady before calling this function.

Returns
True or false

Definition at line 854 of file RDA5807.cpp.

References RDA5807::rds_buffer0A.

◆ getRdsAllData()

bool RDA5807::getRdsAllData ( char **  stationName,
char **  stationInformation,
char **  programInformation,
char **  utcTime 
)

Gets Station Name, Station Information, Program Information and utcTime.

This function populates four char pointer variable parameters with Station Name, Station Information, Programa Information and UTC time.

You must call setRDS(true), setRdsFifo(true) before calling getRdsAllData(...)

ATTENTION: the parameters below are point to point to array of char.

the right way to call this function is shown below.

char *stationName, *stationInfo, *programInfo, *rdsTime;
// The char pointers above will be populate by the call below. So, the char pointers need to be passed by reference (pointer to pointer).
if (rx.getRdsAllData(&stationName, &stationInfo , &programInfo, &rdsTime) ) {
showProgramaInfo(programInfo);
showStationName(stationName);
showStationInfo(stationInfo);
showUtcTime(rdsTime);
}
Parameters
stationName(reference) - if NOT NULL, point to Name of the Station (char array - 9 bytes)
stationInformation(reference) - if NOT NULL, point to Station information (char array - 33 bytes)
programInformation(reference) - if NOT NULL, point to program information (char array - 65 nytes)
utcTime(reference) - if NOT NULL, point to char array containing the current UTC time (format HH:MM:SS +HH:MM)
Returns
True if found at least one valid data
See also
setRDS, setRdsFifo, getRdsAllData

Definition at line 893 of file RDA5807.cpp.

References RDA5807::getRdsReady(), RDA5807::getRdsText0A(), RDA5807::getRdsText2A(), RDA5807::getRdsText2B(), RDA5807::getRdsTime(), and RDA5807::hasRdsInfoAB().

◆ getRdsGroupType()

uint16_t RDA5807::getRdsGroupType ( )

Return the group type.

ATTENTION: You must call getRdsReady before calling this function.

Returns
uint16_t
See also
getRdsReady

Definition at line 913 of file RDA5807.cpp.

◆ getRdsVersionCode()

uint8_t RDA5807::getRdsVersionCode ( void  )

Gets the version code (extracted from the Block B)

ATTENTION: You must call getRdsReady before calling this function.

Returns
0=A or 1=B
See also
getRdsReady

Definition at line 927 of file RDA5807.cpp.

◆ getRdsProgramType()

uint8_t RDA5807::getRdsProgramType ( void  )

Returns the Program Type (extracted from the Block B)

ATTENTION: You must call getRdsReady before calling this function.

See also
https://en.wikipedia.org/wiki/Radio_Data_System
2wcom RDS Basics
getRdsReady
Returns
program type (an integer betwenn 0 and 31)

Definition at line 943 of file RDA5807.cpp.

◆ getNext2Block()

void RDA5807::getNext2Block ( char *  c)

Process data received from group 2B.

Parameters
cchar array reference to the "group 2B" text

Definition at line 956 of file RDA5807.cpp.

Referenced by RDA5807::getRdsText0A(), and RDA5807::getRdsText2B().

◆ getNext4Block()

void RDA5807::getNext4Block ( char *  c)

Process data received from group 2A.

Parameters
cchar array reference to the "group 2A" text

Definition at line 993 of file RDA5807.cpp.

Referenced by RDA5807::getRdsText2A().

◆ getRdsText0A()

char * RDA5807::getRdsText0A ( void  )

Gets the station name and other messages.

ATTENTION: You must call getRdsReady before calling this function.

Returns
char* should return a string with the station name. However, some stations send other kind of messages
See also
getRdsReady

Definition at line 1035 of file RDA5807.cpp.

References RDA5807::getNext2Block(), and RDA5807::rds_buffer0A.

Referenced by RDA5807::getRdsAllData(), and RDA5807::getRdsStationName().

◆ getRdsText2A()

char * RDA5807::getRdsText2A ( void  )

Gets the Program Information.

@

Process the program information data.

ATTENTION: You must call getRdsReady before calling this function.

Returns
char array with the program information (63 bytes)
See also
getRdsReady

Definition at line 1065 of file RDA5807.cpp.

References RDA5807::getNext4Block(), and RDA5807::rds_buffer2A.

Referenced by RDA5807::getRdsAllData(), and RDA5807::getRdsProgramInformation().

◆ getRdsText2B()

char * RDA5807::getRdsText2B ( void  )

Gets the Station Information.

Todo:
Under construction... To be checked.

ATTENTION: You must call getRdsReady before calling this function.

Returns
char array with the Text of Station Information (33 bytes)
See also
getRdsReady

Definition at line 1095 of file RDA5807.cpp.

References RDA5807::getNext2Block(), and RDA5807::rds_buffer2B.

Referenced by RDA5807::getRdsAllData(), and RDA5807::getRdsStationInformation().

◆ getRdsTime()

char * RDA5807::getRdsTime ( )

Gets the RDS UTC time and date when the Group type is 4.

ATTENTION: You must call getRdsReady before calling this function.

ATTENTION: Some stations broadcast wrong time.

Returns
char* a string with hh:mm +/- offset
See also
getRdsReady

Definition at line 1122 of file RDA5807.cpp.

References RDA5807::rds_time.

Referenced by RDA5807::getRdsAllData().

◆ getRdsLocalTime()

char * RDA5807::getRdsLocalTime ( )

Gets the RDS time converted to local time.

Todo:
Need to check.

ATTENTION: You must call getRdsReady before calling this function.

ATTENTION: Some stations broadcast wrong time.

Returns
char* a string with hh:mm
See also
getRdsReady

Definition at line 1185 of file RDA5807.cpp.

References RDA5807::rds_time.

◆ setRdsFifo()

void RDA5807::setRdsFifo ( bool  value)

Sets RDS fifo mode enable.

Parameters
valueIf true, it makes the the fifo mode enable.
Returns
true or false

Definition at line 1249 of file RDA5807.cpp.

◆ clearRdsFifo()

void RDA5807::clearRdsFifo ( bool  value = 1)

Clear RDS fifo.

Parameters
valueIf true, clears the RDS fifo
Returns
true or false

Definition at line 1262 of file RDA5807.cpp.

◆ clearRdsBuffer()

void RDA5807::clearRdsBuffer ( )

Clear RDS Information (Station Name, Station Information, Program Information and Time)

Clear the buffer with latest RDS information

Definition at line 1274 of file RDA5807.cpp.

References RDA5807::rds_buffer0A, RDA5807::rds_buffer2A, RDA5807::rds_buffer2B, and RDA5807::rds_time.