PU2CLR RDA5807 Arduino Library  1.0.1
Arduino Library for RDA5807 Devices - By Ricardo Lima Caratti
Basic Functions

Functions

void RDA5807::setI2CBusAddrs (int directAccess, int fullAccess)
 Sets alternatives I2C bus address. More...
 
void RDA5807::getStatusRegisters ()
 Gets all current device status and RDS information registers (From 0x0A to 0x0F) More...
 
void * RDA5807::getStatus (uint8_t reg)
 Gets the register content of a given status register (from 0x0A to 0x0F) More...
 
void RDA5807::setAllRegisters ()
 Sets values to the device registers from 0x02 to 0x07. More...
 
void RDA5807::setRegister (uint8_t reg, uint16_t value)
 Sets a given value to a specific device register. More...
 
void RDA5807::waitAndFinishTune ()
 Waits for Seek or Tune finish. More...
 
void RDA5807::softReset ()
 Resets the device. More...
 
void RDA5807::powerUp ()
 Powers the receiver on. More...
 
void RDA5807::powerDown ()
 
void RDA5807::setup (uint8_t clock_type=CLOCK_32K, uint8_t oscillator_type=OSCILLATOR_TYPE_CRYSTAL)
 Starts the device. More...
 
void RDA5807::setChannel (uint16_t channel)
 Sets the channel. More...
 
void RDA5807::setFrequency (uint16_t frequency)
 Sets the frequency. More...
 
uint16_t RDA5807::getFrequency ()
 Gets the current frequency. More...
 
uint16_t RDA5807::getRealChannel ()
 
uint16_t RDA5807::getRealFrequency ()
 
void RDA5807::seek (uint8_t seek_mode, uint8_t direction)
 Seek function. More...
 
void RDA5807::setSeekThreshold (uint8_t value)
 Sets RSSI Seek Threshold. More...
 
void RDA5807::setBand (uint8_t band=1)
 Sets the FM band. See table below. More...
 
void RDA5807::setSpace (uint8_t space=0)
 Sets the FM channel space. More...
 
int RDA5807::getRssi ()
 Gets the current Rssi. More...
 
void RDA5807::setSoftmute (bool value)
 Sets Soft Mute Enable or disable. More...
 
void RDA5807::setMute (bool value)
 Sets Audio mute or unmute. More...
 
void RDA5807::setMono (bool value)
 Sets audio Mono or stereo. More...
 
void RDA5807::setRDS (bool value)
 Sets the RDS operation. More...
 
void RDA5807::setRBDS (bool value)
 Sets the RBDS operation. More...
 
void RDA5807::clearRdsFifo ()
 Clears RDS/RBDS FIFO. More...
 
void RDA5807::setVolume (uint8_t value)
 Sets the audio volume level. More...
 
uint8_t RDA5807::getVolume ()
 Gets the current audio volume level. More...
 
void RDA5807::setVolumeUp ()
 Increments the audio volume. More...
 
void RDA5807::setVolumeDown ()
 Decrements the audio volume. More...
 
uint8_t RDA5807::getDeviceId ()
 Gets the Device identification. More...
 
void RDA5807::setFmDeemphasis (uint8_t de)
 Sets De-emphasis. More...
 

Detailed Description

Basic

Function Documentation

◆ setI2CBusAddrs()

void RDA5807::setI2CBusAddrs ( int  directAccess,
int  fullAccess 
)
inline

Sets alternatives I2C bus address.

You do not need use this function on RDA5807M

Parameters
directAccess
fullAccess

References RDA5807::deviceAddressDirectAccess, and RDA5807::deviceAddressFullAccess.

◆ getStatusRegisters()

void RDA5807::getStatusRegisters ( )

Gets all current device status and RDS information registers (From 0x0A to 0x0F)

See also
RDA5807M - SINGLE-CHIP BROADCAST FMRADIO TUNER; pages 5, 9, 12 and 13.
rda_reg0a, rda_reg0b, rda_reg0c, rda_reg0d, rda_reg0e, rda_reg0f
shadowStatusRegisters;

◆ getStatus()

void * RDA5807::getStatus ( uint8_t  reg)

Gets the register content of a given status register (from 0x0A to 0x0F)

Useful when you need just a specific status register content.

This methos update the first element of the shadowStatusRegisters linked to the register

Returns
rdax_reg0a the reference to current value of the 0x0A register.

◆ setAllRegisters()

void RDA5807::setAllRegisters ( )

Sets values to the device registers from 0x02 to 0x07.

An internal address counter automatically increments to allow continuous data byte writes, starting with the upper byte of register 02h, followed by the lower byte of register 02h, and onward until the lower byte of the last register is reached.

The registers from 0x2 to 0x07 are used to setup the device. This method writes the array shadowStatusRegisters. See Device registers map in RDA5807.h file.

To implement this, a register maping was created to deal with each register structure. For each type of register, there is a reference to the array element.

See also
shadowStatusRegisters;

◆ setRegister()

void RDA5807::setRegister ( uint8_t  reg,
uint16_t  value 
)

Sets a given value to a specific device register.

See also
RDA5807M - SINGLE-CHIP BROADCAST FMRADIO TUNER; pages 5, 9, 10 and 11.
rda_reg02, rda_reg03, rda_reg04, rda_reg05, rda_reg06, rda_reg07
Parameters
regregister number (valid values is between 0x02 and 0x07)
valuethe unsigned 16 bits word value (see rda_rec0x data types)

◆ waitAndFinishTune()

void RDA5807::waitAndFinishTune ( )

Waits for Seek or Tune finish.

Referenced by RDA5807::setChannel().

◆ softReset()

void RDA5807::softReset ( )

Resets the device.

The RDA5807M is RESET itself When VIO is Power up.

Also, it support soft reset by triggering the 0x02 register (rda_reg02) bit 1 from 0 to 1.

◆ powerUp()

void RDA5807::powerUp ( )

Powers the receiver on.

Referenced by RDA5807::setup().

◆ powerDown()

void RDA5807::powerDown ( )

◆ setup()

void RDA5807::setup ( uint8_t  clock_type = CLOCK_32K,
uint8_t  oscillator_type = OSCILLATOR_TYPE_CRYSTAL 
)

Starts the device.

Parameters
clock_typeClock used.
oscillator_typeoptional. Sets the Oscillator type used (Default Crystal or Ref. Clock).

References RDA5807::powerUp().

◆ setChannel()

void RDA5807::setChannel ( uint16_t  channel)

Sets the channel.

Parameters
channel

References RDA5807::waitAndFinishTune().

◆ setFrequency()

void RDA5807::setFrequency ( uint16_t  frequency)

Sets the frequency.

Parameters
frequency

◆ getFrequency()

uint16_t RDA5807::getFrequency ( )

Gets the current frequency.

Returns
uint16_t

◆ getRealChannel()

uint16_t RDA5807::getRealChannel ( )
Returns
uint16_t

◆ getRealFrequency()

uint16_t RDA5807::getRealFrequency ( )
Returns
uint16_t

◆ seek()

void RDA5807::seek ( uint8_t  seek_mode,
uint8_t  direction 
)

Seek function.

Parameters
seek_modeif 0, wrap at the upper or lower band limit and continue seeking; 1 = stop seeking at the upper or lower band limit
directionif 0, seek down; if 1, seek up.

◆ setSeekThreshold()

void RDA5807::setSeekThreshold ( uint8_t  value)

Sets RSSI Seek Threshold.

Parameters
value

◆ setBand()

void RDA5807::setBand ( uint8_t  band = 1)

Sets the FM band. See table below.

FM band table

Value Description
00 87–108 MHz (US/Europe)
01 76–91 MHz (Japan)
10 76–108 MHz (world wide)
11 65 –76 MHz (East Europe) or 50-65MHz (see bit 9 of gegister 0x06)
Parameters
bandFM band index. See table above.

◆ setSpace()

void RDA5807::setSpace ( uint8_t  space = 0)

Sets the FM channel space.

Channel space table

Value Description
00 100KHz
01 200KHz
10 50KHz
11 25KHz
Parameters
spaceFM channel space. See table above.

◆ getRssi()

int RDA5807::getRssi ( )

Gets the current Rssi.

RSSI; 000000 = min; 111111 = max; RSSI scale is logarithmic.

Returns
int

◆ setSoftmute()

void RDA5807::setSoftmute ( bool  value)

Sets Soft Mute Enable or disable.

Parameters
valuetrue = enable; false=disable

◆ setMute()

void RDA5807::setMute ( bool  value)

Sets Audio mute or unmute.

Parameters
valueTRUE = mute; FALSE = unmute

◆ setMono()

void RDA5807::setMono ( bool  value)

Sets audio Mono or stereo.

Parameters
valueTRUE = Mono; FALSE force stereo

◆ setRDS()

void RDA5807::setRDS ( bool  value)

Sets the RDS operation.

Enable or Disable the RDS

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

◆ 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

◆ clearRdsFifo()

void RDA5807::clearRdsFifo ( )

Clears RDS/RBDS FIFO.

◆ setVolume()

void RDA5807::setVolume ( uint8_t  value)

Sets the audio volume level.

Parameters
value

◆ getVolume()

uint8_t RDA5807::getVolume ( )

Gets the current audio volume level.

Returns
uint8_t 0 to 15

◆ setVolumeUp()

void RDA5807::setVolumeUp ( )

Increments the audio volume.

◆ setVolumeDown()

void RDA5807::setVolumeDown ( )

Decrements the audio volume.

◆ getDeviceId()

uint8_t RDA5807::getDeviceId ( )

Gets the Device identification.

Todo:
Returns
number

◆ setFmDeemphasis()

void RDA5807::setFmDeemphasis ( uint8_t  de)

Sets De-emphasis.

75 μs. Used in USA (default); 50 μs. Used in Europe, Australia, Japan.

Parameters
de0 = 75 μs; 1 = 50 μs