3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
29#define MAX_DELAY_AFTER_OSCILLATOR 500
32#define I2C_ADDR_DIRECT_ACCESS 0x11
33#define I2C_ADDR_FULL_ACCESS 0x10
36#define OSCILLATOR_TYPE_CRYSTAL 0
37#define OSCILLATOR_TYPE_REFCLK 1
50#define RDA_FM_BAND_USA_EU 0
51#define RDA_FM_BAND_JAPAN_WIDE 1
52#define RDA_FM_BAND_WORLD 2
53#define RDA_FM_BAND_SPECIAL 3
55#define RDA_SEEK_WRAP 0
56#define RDA_SEEK_STOP 1
57#define RDA_SEEK_DOWN 0
82#define I2S_WS_STEP_48 0b1000
83#define I2S_WS_STEP_44_1 0b0111
84#define I2S_WS_STEP_32 0b0110
85#define I2S_WS_STEP_24 0b0101
86#define I2S_WS_STEP_22_05 0b0100
87#define I2S_WS_STEP_16 0b0011
88#define I2S_WS_STEP_12 0b0010
89#define I2S_WS_STEP_11_025 0b0001
90#define I2S_WS_STEP_8 0b0000
94
95
96
97
98
99
102
103
104
105
115
116
117
118
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
155 uint8_t SOFT_RESET : 1;
156 uint8_t NEW_METHOD : 1;
158 uint8_t CLK_MODE : 3;
162 uint8_t RCLK_DIRECT_IN : 1;
163 uint8_t NON_CALIBRATE : 1;
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
214 uint16_t DIRECT_MODE : 1;
221
222
223
224
225
226
233 uint8_t I2S_ENABLE : 1;
236 uint8_t SOFTMUTE_EN : 1;
237 uint8_t RDS_FIFO_CLR : 1;
239 uint8_t RDS_FIFO_EN : 1;
248
249
250
255 uint8_t LNA_ICSEL_BIT : 2;
256 uint8_t LNA_PORT_SEL : 2;
259 uint8_t SEEK_MODE : 2;
260 uint8_t INT_MODE : 1;
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
288 uint8_t SCLK_O_EDGE : 1;
289 uint8_t SW_O_EDGE : 1;
290 uint8_t I2S_SW_CNT : 4;
291 uint8_t WS_I_EDGE : 1;
292 uint8_t DATA_SIGNED : 1;
293 uint8_t SCLK_I_EDGE : 1;
295 uint8_t SLAVE_MASTER : 1;
296 uint8_t OPEN_MODE : 2;
303
304
305
309 uint8_t FREQ_MODE : 1;
310 uint8_t SOFTBLEND_EN : 1;
311 uint8_t SEEK_TH_OLD : 6;
313 uint8_t MODE_50_60 : 1;
314 uint8_t TH_SOFRBLEND : 5;
321
322
323
324
325
326
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
357 uint16_t READCHAN : 10;
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
391 uint8_t FM_READY : 1;
400
401
402
403
404
414
415
416
417
418
431
432
433
434
435
447
448
449
450
451
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
482 uint16_t address : 2;
486 uint16_t programType : 5;
487 uint16_t trafficProgramCode : 1;
488 uint16_t versionCode : 1;
489 uint16_t groupType : 4;
493 uint16_t address : 4;
494 uint16_t textABFlag : 1;
495 uint16_t programType : 5;
496 uint16_t trafficProgramCode : 1;
497 uint16_t versionCode : 1;
498 uint16_t groupType : 4;
502 uint16_t content : 4;
503 uint16_t textABFlag : 1;
504 uint16_t programType : 5;
505 uint16_t trafficProgramCode : 1;
506 uint16_t versionCode : 1;
507 uint16_t groupType : 4;
513
514
515
516
517
518
519
520
521
526 uint8_t offset_sense : 1;
537
538
539
550
551
552
553
554
555
587 char rds_buffer2A[65];
588 char rds_buffer2B[33];
589 char rds_buffer0A[9];
615
616
617
618
622
623
624
625
626
627
637 void setGpio(uint8_t gpioPin, uint8_t gpioSetup = 0,
int mcuPin = -1);
660 void seek(uint8_t seek_mode, uint8_t direction);
661 void seek(uint8_t seek_mode, uint8_t direction,
void (*showFunc)());
664 void setBand(uint8_t band = 0);
666 void setStep(uint8_t step = 100);
675
676
677
678
688
689
690
691
692 inline bool isMuted() {
return reg02->refined.DMUTE;};
729 void setI2SAllParameters(uint8_t R_DELY, uint8_t L_DELY, uint8_t SCLK_O_EDGE, uint8_t SW_O_EDGE, uint8_t I2S_SW_CNT, uint8_t WS_I_EDGE, uint8_t DATA_SIGNED, uint8_t SCLK_I_EDGE, uint8_t WS_LR, uint8_t SLAVE_MASTER, uint8_t OPEN_MODE );
735 void convertToChar(uint16_t value,
char *strValue, uint8_t len, uint8_t dot, uint8_t separator,
bool remove_leading_zeros =
true );
#define REG02
Definition: RDA5807.h:61
#define I2C_ADDR_DIRECT_ACCESS
Can be used to access a given register at a time.
Definition: RDA5807.h:32
#define REG0A
Definition: RDA5807.h:67
#define REG0B
Definition: RDA5807.h:68
#define REG05
Definition: RDA5807.h:64
#define REG04
Definition: RDA5807.h:63
#define CLOCK_32K
32.768kHz
Definition: RDA5807.h:39
#define REG03
Definition: RDA5807.h:62
#define REG06
Definition: RDA5807.h:65
#define I2C_ADDR_FULL_ACCESS
Can be used to access a set of register at a time.
Definition: RDA5807.h:33
#define OSCILLATOR_TYPE_CRYSTAL
Crystal.
Definition: RDA5807.h:36
#define MAX_DELAY_AFTER_OSCILLATOR
Definition: RDA5807.h:29
void convertToChar(uint16_t value, char *strValue, uint8_t len, uint8_t dot, uint8_t separator, bool remove_leading_zeros=true)
Converts a number to a char array.
Definition: RDA5807.cpp:1112
int gpio1Control
Can be used to add control to the system via GPIO1 pin.
Definition: RDA5807.h:603
uint16_t raw
Definition: RDA5807.h:395
uint16_t currentFrequency
Definition: RDA5807.h:598
int deviceAddressDirectAccess
Definition: RDA5807.h:594
uint16_t raw
Definition: RDA5807.h:169
void setDelayAfterCrystalOn(uint8_t ms_value)
Set the Delay After Crystal On (default 500ms)
Definition: RDA5807.h:619
uint16_t raw
Definition: RDA5807.h:334
uint16_t raw
Definition: RDA5807.h:317
uint8_t currentVolume
Definition: RDA5807.h:601
uint16_t raw
Definition: RDA5807.h:111
uint16_t RDSD
Definition: RDA5807.h:459
uint16_t raw
Definition: RDA5807.h:365
uint8_t oscillatorType
Definition: RDA5807.h:608
uint16_t RDSC
Definition: RDA5807.h:443
int resetPin
Definition: RDA5807.h:597
uint16_t raw
Definition: RDA5807.h:126
uint16_t raw
Definition: RDA5807.h:244
uint16_t blockB
Definition: RDA5807.h:509
uint16_t raw
Definition: RDA5807.h:299
uint8_t clockType
Definition: RDA5807.h:607
int deviceAddressFullAccess
Definition: RDA5807.h:595
uint16_t raw
Definition: RDA5807.h:217
uint16_t maxDelayAftarCrystalOn
Definition: RDA5807.h:610
uint16_t RDSB
Definition: RDA5807.h:426
uint16_t RDSA
BLOCK A ( in RDS mode) or BLOCK E (in RBDS mode when ABCD_E flag is 1)
Definition: RDA5807.h:410
uint16_t raw
Definition: RDA5807.h:262
uint8_t currentFMBand
Definition: RDA5807.h:599
int gpio2Control
Can be used to add control to the system via GPIO2 pin.
Definition: RDA5807.h:604
uint8_t raw[6]
Definition: RDA5807.h:533
uint16_t raw
Definition: RDA5807.h:546
uint8_t currentFMSpace
Definition: RDA5807.h:600
int gpio3Control
Can be used to add control to the system via GPIO3 pin.
Definition: RDA5807.h:605
KT0915 Class.
Definition: RDA5807.h:556
uint16_t getRealFrequency()
Gets the current frequency bases on the current channel.
Definition: RDA5807.cpp:327
void * getStatus(uint8_t reg)
Gets the register content of a given status register (from 0x0A to 0x0F)
Definition: RDA5807.cpp:85
void powerDown()
Power the receiver off.
Definition: RDA5807.cpp:197
bool isStereo()
Gets the current Stereo status.
Definition: RDA5807.cpp:558
void powerUp()
Powers the receiver on.
Definition: RDA5807.cpp:156
uint16_t getRealChannel()
Gets the current channel stored in 0x0A status register.
Definition: RDA5807.cpp:305
void setRegister(uint8_t reg, uint16_t value)
Sets a given value to a specific device register.
Definition: RDA5807.cpp:115
void softReset()
Resets the device.
Definition: RDA5807.cpp:146
void waitAndFinishTune()
Waits for Seek or Tune finish.
Definition: RDA5807.cpp:133
void setSeekThreshold(uint8_t value)
Sets RSSI Seek Threshold.
Definition: RDA5807.cpp:406
bool isSoftmuted()
Gets the softmute status
Definition: RDA5807.h:679
int getRssi()
Gets the current Rssi.
Definition: RDA5807.cpp:494
void setFrequencyUp()
Increments the current frequency.
Definition: RDA5807.cpp:261
void setFmDeemphasis(uint8_t de)
Sets De-emphasis.
Definition: RDA5807.cpp:650
void setVolume(uint8_t value)
Sets the audio volume level.
Definition: RDA5807.cpp:584
uint8_t getDeviceId()
Gets the Device identification.
Definition: RDA5807.cpp:638
uint16_t getFrequency()
Gets the current frequency.
Definition: RDA5807.cpp:291
void setGpio(uint8_t gpioPin, uint8_t gpioSetup=0, int mcuPin=-1)
Set the Device GPIO pins.
Definition: RDA5807.cpp:34
uint8_t getVolume()
Gets the current audio volume level.
Definition: RDA5807.cpp:598
void setSpace(uint8_t space=0)
Sets the FM channel space.
Definition: RDA5807.cpp:450
void setBass(bool value)
Sets Bass Boost.
Definition: RDA5807.cpp:545
void setVolumeUp()
Increments the audio volume.
Definition: RDA5807.cpp:608
void seek(uint8_t seek_mode, uint8_t direction)
Seek function.
Definition: RDA5807.cpp:338
void setBand(uint8_t band=0)
Sets the FM band. See table below.
Definition: RDA5807.cpp:427
void setStep(uint8_t step=100)
Sets the FM Step;.
Definition: RDA5807.cpp:464
void setVolumeDown()
Decrements the audio volume.
Definition: RDA5807.cpp:622
void setChannel(uint16_t channel)
Sets the channel.
Definition: RDA5807.cpp:233
void setAudioOutputHighImpedance(bool value)
Sets the audio output hight or low impedance.
Definition: RDA5807.cpp:572
void setNewDemodulateMethod(bool value)
Sets new demodulate method. It can improve the receiver sensitivity about 1dB.
Definition: RDA5807.cpp:188
void getStatusRegisters()
Gets all current device status and RDS information registers (From 0x0A to 0x0F)
Definition: RDA5807.cpp:64
void setup(uint8_t clock_type=CLOCK_32K, uint8_t oscillator_type=OSCILLATOR_TYPE_CRYSTAL)
Starts the device.
Definition: RDA5807.cpp:210
void setFrequency(uint16_t frequency)
Sets the frequency.
Definition: RDA5807.cpp:249
void setMono(bool value)
Sets audio Mono or stereo.
Definition: RDA5807.cpp:532
void setFrequencyDown()
Decrements the current frequency.
Definition: RDA5807.cpp:276
void setSoftmute(bool value)
Sets Soft Mute Enable or disable.
Definition: RDA5807.cpp:505
void seek(uint8_t seek_mode, uint8_t direction, void(*showFunc)())
Seek function.
Definition: RDA5807.cpp:378
void setI2CBusAddrs(int directAccess, int fullAccess)
Sets alternatives I2C bus address.
Definition: RDA5807.h:628
bool isMuted()
Gets Audio Mute Status.
Definition: RDA5807.h:692
void setMute(bool value)
Sets Audio mute or unmute.
Definition: RDA5807.cpp:519
uint8_t getRdsFlagAB(void)
Returns the current Text Flag A/B
Definition: RDA5807.cpp:713
bool hasRdsInfo()
Returns true when the RDS system has valid information.
Definition: RDA5807.cpp:1061
bool getRdsSync()
Get the Rds Sync.
Definition: RDA5807.cpp:1014
uint8_t getBlockId()
Get the current Block ID.
Definition: RDA5807.cpp:1027
uint16_t getRdsGroupType()
Return the group type.
Definition: RDA5807.cpp:727
void getNext4Block(char *c)
Process data received from group 2A.
Definition: RDA5807.cpp:807
char * getRdsText2A(void)
Gets the Text processed for the 2A group.
Definition: RDA5807.cpp:901
void setRDS(bool value)
Sets the RDS operation.
Definition: RDA5807.cpp:668
char * getRdsText0A(void)
Gets the station name and other messages.
Definition: RDA5807.cpp:872
void getNext2Block(char *c)
Process data received from group 2B.
Definition: RDA5807.cpp:770
char * getRdsText(void)
Gets the RDS Text when the message is of the Group Type 2 version A.
Definition: RDA5807.cpp:846
void clearRdsFifo()
Clear RDS fifo.
Definition: RDA5807.cpp:1085
char * getRdsText2B(void)
Gets the Text processed for the 2B group.
Definition: RDA5807.cpp:930
bool getRdsReady()
Returns true if RDS Ready.
Definition: RDA5807.cpp:700
uint8_t getRdsVersionCode(void)
Gets the version code (extracted from the Block B)
Definition: RDA5807.cpp:742
uint8_t getErrorBlockB()
Get the current Status of block B.
Definition: RDA5807.cpp:1049
void setRdsFifo(bool value)
Sets RDS fifo mode enable.
Definition: RDA5807.cpp:1073
uint8_t getRdsProgramType(void)
Returns the Program Type (extracted from the Block B)
Definition: RDA5807.cpp:756
void setRBDS(bool value)
Sets the RBDS operation.
Definition: RDA5807.cpp:682
char * getRdsTime()
Gets the RDS time and date when the Group type is 4.
Definition: RDA5807.cpp:956
void setI2SAllParameters(uint8_t R_DELY, uint8_t L_DELY, uint8_t SCLK_O_EDGE, uint8_t SW_O_EDGE, uint8_t I2S_SW_CNT, uint8_t WS_I_EDGE, uint8_t DATA_SIGNED, uint8_t SCLK_I_EDGE, uint8_t WS_LR, uint8_t SLAVE_MASTER, uint8_t OPEN_MODE)
Configure all parameters for I2S.
Definition: RDA5807.cpp:1171
void setI2SSpeed(uint8_t value)
Sets the speed in kbps. You can use the predefined constantes: I2S_WS_STEP_48, I2S_WS_STEP_44_1,...
Definition: RDA5807.cpp:1222
void setI2SMaster(bool value)
Definition: RDA5807.cpp:1208
void setI2SDataSigned(bool value)
If 0, I2S output unsigned 16-bit audio data. If 1, I2S output signed 16-bit audio data.
Definition: RDA5807.cpp:1234
void setI2SOn(bool value)
Enable I2S setup.
Definition: RDA5807.cpp:1196