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

Functions

void RDA5807::setDelayAfterCrystalOn (uint8_t ms_value)
 Set the Delay After Crystal On (default 500ms)
 
void RDA5807::setI2CBusAddrs (int directAccess, int fullAccess)
 Sets alternatives I2C bus address.
 
void RDA5807::setGpio (uint8_t gpioPin, uint8_t gpioSetup=0, int mcuPin=-1)
 Sets the Device GPIO pins.
 
void RDA5807::setInterruptMode (uint8_t value)
 Sets Interrupt Mode.
 
void RDA5807::getStatusRegisters ()
 Gets all current device status and RDS information registers (From 0x0A to 0x0F)
 
word16_to_bytes RDA5807::getDirectRegister (uint8_t reg)
 Gets the register content via direct access.
 
void * RDA5807::getStatus (uint8_t reg)
 Gets the register content of a given status register (from 0x0A to 0x0F)
 
void RDA5807::setRegister (uint8_t reg, uint16_t value)
 Sets a given value to a specific device register.
 
void RDA5807::waitAndFinishTune ()
 Waits for Seek or Tune finish.
 
void RDA5807::softReset ()
 Resets the device.
 
void RDA5807::powerUp ()
 Powers the receiver on.
 
void RDA5807::setNewDemodulateMethod (bool value)
 Sets new demodulate method. It can improve the receiver sensitivity about 1dB.
 
void RDA5807::powerDown ()
 Power the receiver off.
 
void RDA5807::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.
 
uint16_t RDA5807::getDeviceId ()
 Gets the Device identification.
 

Detailed Description

Basic Functions

Function Documentation

◆ getDeviceId()

uint16_t RDA5807::getDeviceId ( )

Gets the Device identification.

Returns
device number Id

◆ getDirectRegister()

word16_to_bytes RDA5807::getDirectRegister ( uint8_t  reg)

Gets the register content via direct access.

this method is useful to deal with a specific register.

Parameters
uint8_tregister number
Returns
word16_to_bytes register content
See also
word16_to_bytes datatype in RDA5807.h

◆ 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.

◆ 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;

Referenced by RDA5807::getRdsReady().

◆ powerDown()

void RDA5807::powerDown ( )

Power the receiver off.

◆ powerUp()

void RDA5807::powerUp ( )

Powers the receiver on.

Referenced by RDA5807::setup().

◆ setDelayAfterCrystalOn()

void RDA5807::setDelayAfterCrystalOn ( uint8_t  ms_value)
inline

Set the Delay After Crystal On (default 500ms)

Minimum time required for the oscillator to become stable

Parameters
ms_valueValue in milliseconds

◆ setGpio()

void RDA5807::setGpio ( uint8_t  gpioPin,
uint8_t  gpioSetup = 0,
int  mcuPin = -1 
)

Sets the Device GPIO pins.

This method is useful to add control to the system via GPIO RDA devive pins.

For example: You can use these pins to control RDS and SEEK via interrupt.

GPIOs are General Purpose I/O pin.

GPIO setup

When GPIO1 (#1), gpioSetup can be: 00 = High impedance; 01 = Reserved; 10 = Low; 11 = High

When GPIO2 (#2), gpioSetup can be: 00 = High impedance; 01 = Interrupt (INT) 10 = Low; 11 = High

When GPIO3 (#3), gpioSetup can be: 00 = High impedance; 01 = Mono/Stereo indicator (ST) = Low; 11 = High

Parameters
gpioPingpio number (1, 2 or 3)
gpioSetupSee description above
mcuPipMCU (Arduino) pin connected to the gpio

◆ 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.

◆ setInterruptMode()

void RDA5807::setInterruptMode ( uint8_t  value)

Sets Interrupt Mode.

GPIO2 could be programmed to output a low interrupt (interrupt will be generated only with interrupt enable bit STCIEN is set to high) when seek/tune process completes

Setting STCIEN = 1 will generate a low pulse on GPIO2 when the interrupt occurs.

ATTENTION: This function affects the behavior of the GPIO2 pin. The register 0x04 GPIO2 attribute will be setted to 1

Parameters
value0 = disable; 1 = enqble
See also
setGpio

◆ setNewDemodulateMethod()

void RDA5807::setNewDemodulateMethod ( bool  value)

Sets new demodulate method. It can improve the receiver sensitivity about 1dB.

Parameters
valuetrue or false

◆ 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)

◆ setup()

void RDA5807::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.

You can select the colck type and the frequency

oscillator type: OSCILLATOR_TYPE_CRYSTAL = passive crystal; OSCILLATOR_TYPE_REFCLK = active crystal or signal generator

Clock type: CLOCK_32K, CLOCK_12M, CLOCK_13M, CLOCK_19_2M, CLOCK_24M, CLOCK_26M and CLOCK_38_4M

#include <RDA5807.h>
RDA5807 rx;
void setup() {
rx.setup(); // Starts the receiver with default parameters
// rx.setup(CLOCK_32K, OSCILLATOR_TYPE_ACTIVE); // 32.768kHz Active Crystal
// rx.setup(CLOCK_12M, OSCILLATOR_TYPE_PASSIVE); // 12MHz passive crystal
// rx.setup(CLOCK_38_4M, OSCILLATOR_TYPE_PASSIVE); // 38.4 MHz passive crystal
rx.setFrequency(10390); // Tunes at 103.9 MHz
}
void loop() {
}
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
Parameters
clock_frequencyoptional; Clock frequency. Default 32.768 kHz.
oscillator_typeoptional; Sets the Oscillator type (passive or active crystal); default: passive Crystal.
rlck_no_calibrateoptional; if 0=RCLK clock is always supply; 1=RCLK clock is not always supply when FM work
See also
OSCILLATOR_TYPE_PASSIVE, OSCILLATOR_TYPE_ACTIVE, RLCK_NO_CALIBRATE_MODE_ON, RLCK_NO_CALIBRATE_MODE_OFF
powerUp, rda_reg02

References RDA5807::powerUp().

◆ 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.

◆ waitAndFinishTune()

void RDA5807::waitAndFinishTune ( )

Waits for Seek or Tune finish.

Referenced by RDA5807::seek(), and RDA5807::setChannel().