PU2CLR RDA5807 Arduino Library
1.0.1
Arduino Library for RDA5807 Devices - By Ricardo Lima Caratti
|
Go to the documentation of this file.
25 #define MAX_DELAY_AFTER_OSCILLATOR 500
28 #define I2C_ADDR_DIRECT_ACCESS 0x11
29 #define I2C_ADDR_FULL_ACCESS 0x10
32 #define OSCILLATOR_TYPE_CRYSTAL 0
33 #define OSCILLATOR_TYPE_REFCLK 1
43 #define RDS_STANDARD 0
46 #define RDA_FM_BAND_USA_EU 0
47 #define RDA_FM_BAND_JAPAN_WIDE 1
48 #define RDA_FM_BAND_WORLD 2
49 #define RDA_FM_BAND_SPECIAL 3
51 #define RDA_SEEK_WRAP 0
52 #define RDA_SEEK_STOP 1
53 #define RDA_SEEK_DOWN 0
139 uint8_t SOFT_RESET : 1;
140 uint8_t NEW_METHOD : 1;
142 uint8_t CLK_MODE : 3;
146 uint8_t RCLK_DIRECT_IN : 1;
147 uint8_t NON_CALIBRATE : 1;
198 uint16_t DIRECT_MODE : 1;
217 uint8_t I2S_ENABLE : 1;
220 uint8_t SOFTMUTE_EN : 1;
221 uint8_t RDS_FIFO_CLR : 1;
223 uint8_t RDS_FIFO_EN : 1;
239 uint8_t LNA_ICSEL_BIT : 2;
240 uint8_t LNA_PORT_SEL : 2;
243 uint8_t SEEK_MODE : 2;
244 uint8_t INT_MODE : 1;
272 uint8_t SCLK_O_EDGE : 1;
273 uint8_t SW_O_EDGE : 1;
274 uint8_t I2S_SW_CNT : 4;
275 uint8_t WS_I_EDGE : 1;
276 uint8_t DATA_SIGNED : 1;
277 uint8_t SCLK_I_EDGE : 1;
279 uint8_t SLAVE_MASTER : 1;
280 uint8_t OPEN_MODE : 2;
293 uint8_t FREQ_MODE : 1;
294 uint8_t SOFTBLEND_EN : 1;
295 uint8_t SEEK_TH_OLD : 6;
297 uint8_t MODE_50_60 : 1;
298 uint8_t TH_SOFRBLEND : 5;
341 uint16_t READCHAN : 10;
375 uint8_t FM_READY : 1;
469 uint8_t programType : 5;
470 uint8_t trafficProgramCode : 1;
471 uint8_t versionCode : 1;
472 uint8_t groupType : 4;
477 uint8_t textABFlag : 1;
478 uint8_t programType : 5;
479 uint8_t trafficProgramCode : 1;
480 uint8_t versionCode : 1;
481 uint8_t groupType : 4;
486 uint8_t textABFlag : 1;
487 uint8_t programType : 5;
488 uint8_t trafficProgramCode : 1;
489 uint8_t versionCode : 1;
490 uint8_t groupType : 4;
509 uint8_t offset_sense : 1;
543 uint16_t shadowStatusRegisters[6];
544 uint16_t shadowRegisters[9];
547 rda_reg00 *reg00 = (rda_reg00 *)&shadowRegisters[0];
548 rda_reg01 *reg01 = (rda_reg01 *)&shadowRegisters[1];
549 rda_reg02 *reg02 = (rda_reg02 *)&shadowRegisters[2];
550 rda_reg03 *reg03 = (rda_reg03 *)&shadowRegisters[3];
551 rda_reg04 *reg04 = (rda_reg04 *)&shadowRegisters[4];
552 rda_reg05 *reg05 = (rda_reg05 *)&shadowRegisters[5];
553 rda_reg06 *reg06 = (rda_reg06 *)&shadowRegisters[6];
554 rda_reg07 *reg07 = (rda_reg07 *)&shadowRegisters[7];
555 rda_reg08 *reg08 = (rda_reg08 *)&shadowRegisters[8];
558 rda_reg0a *reg0a = (rda_reg0a *)&shadowStatusRegisters[0];
559 rda_reg0b *reg0b = (rda_reg0b *)&shadowStatusRegisters[1];
560 rda_reg0c *reg0c = (rda_reg0c *)&shadowStatusRegisters[2];
561 rda_reg0d *reg0d = (rda_reg0d *)&shadowStatusRegisters[3];
562 rda_reg0e *reg0e = (rda_reg0e *)&shadowStatusRegisters[4];
563 rda_reg0f *reg0f = (rda_reg0f *)&shadowStatusRegisters[5];
566 uint16_t startBand[4] = {8700, 7600, 7600, 6500};
567 uint16_t endBand[4] = {10800, 9100, 10800, 7600};
568 uint16_t fmSpace[4] = {100, 200, 50, 25};
570 char rds_buffer2A[65];
571 char rds_buffer2B[33];
572 char rds_buffer0A[9];
620 void setGpio(uint8_t gpioPin, uint8_t gpioSetup = 0,
int mcuPin = -1);
641 void seek(uint8_t seek_mode, uint8_t direction);
642 void seek(uint8_t seek_mode, uint8_t direction,
void (*showFunc)());
645 void setBand(uint8_t band = 1);
void setRDS(bool value)
Sets the RDS operation.
Definition: RDA5807.cpp:606
void powerUp()
Powers the receiver on.
Definition: RDA5807.cpp:155
void waitAndFinishTune()
Waits for Seek or Tune finish.
Definition: RDA5807.cpp:132
bool getRdsReady()
Returns true if RDS Ready.
Definition: RDA5807.cpp:636
void getStatusRegisters()
Gets all current device status and RDS information registers (From 0x0A to 0x0F)
Definition: RDA5807.cpp:63
uint16_t RDSD
Definition: RDA5807.h:443
void setRegister(uint8_t reg, uint16_t value)
Sets a given value to a specific device register.
Definition: RDA5807.cpp:114
uint8_t getErrorBlockB()
Get the current Status of block B.
Definition: RDA5807.cpp:984
uint8_t raw[6]
Definition: RDA5807.h:516
char * getRdsText0A(void)
Gets the station name and other messages.
Definition: RDA5807.cpp:807
void setSoftmute(bool value)
Sets Soft Mute Enable or disable.
Definition: RDA5807.cpp:458
uint16_t raw
Definition: RDA5807.h:228
void setVolume(uint8_t value)
Sets the audio volume level.
Definition: RDA5807.cpp:521
uint16_t currentFrequency
Definition: RDA5807.h:581
void getNext2Block(char *c)
Process data received from group 2B.
Definition: RDA5807.cpp:705
char * getRdsText(void)
Gets the RDS Text when the message is of the Group Type 2 version A.
Definition: RDA5807.cpp:781
void setup(uint8_t clock_type=CLOCK_32K, uint8_t oscillator_type=OSCILLATOR_TYPE_CRYSTAL)
Starts the device.
Definition: RDA5807.cpp:196
void seek(uint8_t seek_mode, uint8_t direction, void(*showFunc)())
Seek function.
Definition: RDA5807.cpp:364
int gpio3Control
Can be used to add control to the system via GPIO3 pin.
Definition: RDA5807.h:588
#define REG04
Definition: RDA5807.h:59
void setDelayAfterCrystalOn(uint8_t ms_value)
Set the Delay After Crystal On (default 500ms)
Definition: RDA5807.h:602
uint16_t raw
Definition: RDA5807.h:529
char * getRdsTime()
Gets the RDS time and date when the Group type is 4.
Definition: RDA5807.cpp:891
bool hasRdsInfo()
Returns true when the RDS system has valid information.
Definition: RDA5807.cpp:996
int gpio2Control
Can be used to add control to the system via GPIO2 pin.
Definition: RDA5807.h:587
void getNext4Block(char *c)
Process data received from group 2A.
Definition: RDA5807.cpp:742
char * getRdsText2B(void)
Gets the Text processed for the 2B group.
Definition: RDA5807.cpp:865
bool getRdsSync()
Get the Rds Sync.
Definition: RDA5807.cpp:949
#define REG05
Definition: RDA5807.h:60
void setMono(bool value)
Sets audio Mono or stereo.
Definition: RDA5807.cpp:483
bool isStereo()
Gets the current Stereo status.
Definition: RDA5807.cpp:507
uint8_t currentVolume
Definition: RDA5807.h:584
uint16_t getRdsGroupType()
Return the group type.
Definition: RDA5807.cpp:663
uint16_t raw
Definition: RDA5807.h:153
void setFrequencyUp()
Increments the current frequency.
Definition: RDA5807.cpp:247
void setSeekThreshold(uint8_t value)
Sets RSSI Seek Threshold.
Definition: RDA5807.cpp:392
uint16_t getRealFrequency()
Gets the current frequency bases on the current channel.
Definition: RDA5807.cpp:313
uint16_t RDSC
Definition: RDA5807.h:427
int resetPin
Definition: RDA5807.h:580
uint16_t raw
Definition: RDA5807.h:318
uint16_t raw
Definition: RDA5807.h:201
void powerDown()
Power the receiver off.
Definition: RDA5807.cpp:184
uint16_t getRealChannel()
Gets the current channel stored in 0x0A status register.
Definition: RDA5807.cpp:291
void seek(uint8_t seek_mode, uint8_t direction)
Seek function.
Definition: RDA5807.cpp:324
void setI2CBusAddrs(int directAccess, int fullAccess)
Sets alternatives I2C bus address.
Definition: RDA5807.h:611
uint8_t currentFMSpace
Definition: RDA5807.h:583
#define REG0B
Definition: RDA5807.h:64
#define I2C_ADDR_DIRECT_ACCESS
Can be used to access a given register at a time.
Definition: RDA5807.h:28
uint16_t raw
Definition: RDA5807.h:283
uint8_t clockType
Definition: RDA5807.h:590
#define I2C_ADDR_FULL_ACCESS
Can be used to access a set of register at a time.
Definition: RDA5807.h:29
void setFrequency(uint16_t frequency)
Sets the frequency.
Definition: RDA5807.cpp:235
uint8_t getBlockId()
Get the current Block ID.
Definition: RDA5807.cpp:962
uint16_t getFrequency()
Gets the current frequency.
Definition: RDA5807.cpp:277
int deviceAddressFullAccess
Definition: RDA5807.h:578
int getRssi()
Gets the current Rssi.
Definition: RDA5807.cpp:447
void setVolumeUp()
Increments the audio volume.
Definition: RDA5807.cpp:546
void setBass(bool value)
Sets Bass Boost.
Definition: RDA5807.cpp:495
void setMute(bool value)
Sets Audio mute or unmute.
Definition: RDA5807.cpp:471
uint16_t maxDelayAftarCrystalOn
Definition: RDA5807.h:593
uint8_t getVolume()
Gets the current audio volume level.
Definition: RDA5807.cpp:536
int deviceAddressDirectAccess
Definition: RDA5807.h:577
void softReset()
Resets the device.
Definition: RDA5807.cpp:145
uint16_t raw
Definition: RDA5807.h:246
#define REG0A
Definition: RDA5807.h:63
#define REG03
Definition: RDA5807.h:58
int gpio1Control
Can be used to add control to the system via GPIO1 pin.
Definition: RDA5807.h:586
void setBand(uint8_t band=1)
Sets the FM band. See table below.
Definition: RDA5807.cpp:413
uint16_t raw
Definition: RDA5807.h:349
void setFmDeemphasis(uint8_t de)
Sets De-emphasis.
Definition: RDA5807.cpp:588
void * getStatus(uint8_t reg)
Gets the register content of a given status register (from 0x0A to 0x0F)
Definition: RDA5807.cpp:84
void setRBDS(bool value)
Sets the RBDS operation.
Definition: RDA5807.cpp:619
uint8_t getRdsVersionCode(void)
Gets the version code (extracted from the Block B)
Definition: RDA5807.cpp:677
uint16_t raw
Definition: RDA5807.h:379
uint16_t raw
Definition: RDA5807.h:301
uint8_t getDeviceId()
Gets the Device identification.
Definition: RDA5807.cpp:576
void setFrequencyDown()
Decrements the current frequency.
Definition: RDA5807.cpp:262
void setVolumeDown()
Decrements the audio volume.
Definition: RDA5807.cpp:560
#define MAX_DELAY_AFTER_OSCILLATOR
Definition: RDA5807.h:25
uint8_t getRdsFlagAB(void)
Returns the current Text Flag A/B
Definition: RDA5807.cpp:649
void clearRdsFifo()
Clear RDS fifo.
Definition: RDA5807.cpp:1020
uint8_t oscillatorType
Definition: RDA5807.h:591
uint16_t RDSB
Definition: RDA5807.h:410
uint8_t getRdsProgramType(void)
Returns the Program Type (extracted from the Block B)
Definition: RDA5807.cpp:691
char * getRdsText2A(void)
Gets the Text processed for the 2A group.
Definition: RDA5807.cpp:836
void setChannel(uint16_t channel)
Sets the channel.
Definition: RDA5807.cpp:219
#define CLOCK_32K
32.768kHz
Definition: RDA5807.h:35
uint16_t blockB
Definition: RDA5807.h:492
#define REG02
Definition: RDA5807.h:57
void setRdsFifo(bool value)
Sets RDS fifo mode enable.
Definition: RDA5807.cpp:1008
uint16_t RDSA
BLOCK A ( in RDS mode) or BLOCK E (in RBDS mode when ABCD_E flag is 1)
Definition: RDA5807.h:394
void setSpace(uint8_t space=0)
Sets the FM channel space.
Definition: RDA5807.cpp:434
uint8_t currentFMBand
Definition: RDA5807.h:582
void setGpio(uint8_t gpioPin, uint8_t gpioSetup=0, int mcuPin=-1)
Set the Device GPIO pins.
Definition: RDA5807.cpp:33
uint16_t raw
Definition: RDA5807.h:95
#define OSCILLATOR_TYPE_CRYSTAL
Crystal.
Definition: RDA5807.h:32
uint16_t raw
Definition: RDA5807.h:110