Arduino Radio Library  0.9
A set of Arduino libraries to control diverse FM radio receiver chips in Arduino projects.
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
RADIO Class Reference

Library to control radio chips in general. This library acts as a base library for the chip specific implementations. More...

#include <radio.h>

Inheritance diagram for RADIO:
newchip RDA5807M SI4703 SI4705 TEA5767

Public Member Functions

 RADIO ()
 create a new object from this class. More...
 
virtual bool init ()
 initialize library and the chip. More...
 
virtual void term ()
 terminate all radio functions. More...
 
virtual void setVolume (uint8_t newVolume)
 Control the volume output of the radio chip in the range 0..15. More...
 
virtual uint8_t getVolume ()
 Retrieve the current output volume in the range 0..15. More...
 
virtual void setMute (bool switchOn)
 Control the mute mode of the radio chip. More...
 
virtual bool getMute ()
 Retrieve the current mute mode setting. More...
 
virtual void setSoftMute (bool switchOn)
 Control the softmute mode (mute on low signals) of the radio chip. More...
 
virtual bool getSoftMute ()
 Retrieve the current soft mute mode setting. More...
 
virtual void setBassBoost (bool switchOn)
 Control the bass boost mode of the radio chip. More...
 
virtual bool getBassBoost ()
 Retrieve the current bass boost mode setting. More...
 
virtual RADIO_FREQ getMinFrequency ()
 Get the minimum frequency of the current selected band. More...
 
virtual RADIO_FREQ getMaxFrequency ()
 Get the maximum frequency of the current selected band. More...
 
virtual RADIO_FREQ getFrequencyStep ()
 Get resolution of the current selected band. More...
 
virtual void setBand (RADIO_BAND newBand)
 Set the current band. More...
 
virtual RADIO_BAND getBand ()
 Retrieve the current band setting. More...
 
virtual void setFrequency (RADIO_FREQ newF)
 Start using the new frequency for receiving. More...
 
virtual RADIO_FREQ getFrequency (void)
 Retrieve the current tuned frequency. More...
 
virtual void setBandFrequency (RADIO_BAND newBand, RADIO_FREQ newFreq)
 Set Band and Frequency in one call. More...
 
virtual void seekUp (bool toNextSender=true)
 Start a seek upwards from the current frequency. More...
 
virtual void seekDown (bool toNextSender=true)
 Start a seek downwards from the current frequency. More...
 
virtual void setMono (bool switchOn)
 Control the mono mode of the radio chip. More...
 
virtual bool getMono ()
 Retrieve the current mono mode setting. More...
 
virtual void getRadioInfo (RADIO_INFO *info)
 Retrieve some information about the current radio function of the chip. More...
 
virtual void getAudioInfo (AUDIO_INFO *info)
 Retrieve some information about the current audio function of the chip. More...
 
virtual void checkRDS ()
 Check if RDS Data is available and good. More...
 
virtual void clearRDS ()
 Clear RDS data in the attached RDS Receiver by sending 0,0,0,0. More...
 
virtual void attachReceiveRDS (receiveRDSFunction newFunction)
 Register a RDS processor function. More...
 
virtual void formatFrequency (char *s, uint8_t length)
 Format the current frequency for display and printing. More...
 
virtual void debugEnable (bool enable=true)
 Enable sending debug information to the Serial port. More...
 
virtual void debugRadioInfo ()
 Print out all radio information. More...
 
virtual void debugAudioInfo ()
 Print out all audio information. More...
 
virtual void debugStatus ()
 Send debug information about actual available chip functionality and other internal things. More...
 

Public Attributes

const uint8_t MAXVOLUME = 15
 max volume level for all radio implementations. More...
 

Protected Member Functions

void _printHex4 (uint16_t val)
 Prints a register as 4 character hexadecimal code with leading zeros. More...
 

Protected Attributes

bool _debugEnabled
 Set by debugEnable() and controls debugging functionality. More...
 
uint8_t _volume
 Last set volume level. More...
 
bool _bassBoost
 Last set bass Boost effect. More...
 
bool _mono
 Last set mono effect. More...
 
bool _mute
 Last set mute effect. More...
 
bool _softMute
 Last set softMute effect. More...
 
RADIO_BAND _band
 Last set band. More...
 
RADIO_FREQ _freq
 Last set frequency. More...
 
RADIO_FREQ _freqLow
 Lowest frequency of the current selected band. More...
 
RADIO_FREQ _freqHigh
 Highest frequency of the current selected band. More...
 
RADIO_FREQ _freqSteps
 Resulution of the tuner. More...
 
receiveRDSFunction _sendRDS
 Registered RDS Function that is called on new available data. More...
 

Private Member Functions

void int16_to_s (char *s, uint16_t val)
 

Prints a register as 4 character hexadecimal code with leading zeros.

More...
 

Detailed Description

Library to control radio chips in general. This library acts as a base library for the chip specific implementations.

Constructor & Destructor Documentation

RADIO::RADIO ( )

create a new object from this class.

Setup the radio object and initialize private variables to 0. Don't change the radio chip (yet).

Member Function Documentation

void RADIO::_printHex4 ( uint16_t  val)
protected

Prints a register as 4 character hexadecimal code with leading zeros.

void RADIO::attachReceiveRDS ( receiveRDSFunction  newFunction)
virtual

Register a RDS processor function.

void RADIO::checkRDS ( )
virtual

Check if RDS Data is available and good.

In the general radio implementation there is no chip for RDS. This function needs to be implemented for radio chips with RDS receiving functionality.

Reimplemented in SI4705, RDA5807M, SI4703, TEA5767, and newchip.

void RADIO::clearRDS ( )
virtual

Clear RDS data in the attached RDS Receiver by sending 0,0,0,0.

Send a 0.0.0.0 to the RDS receiver if there is any attached. This is to point out that there is a new situation and all existing data should be invalid from now on.

void RADIO::debugAudioInfo ( )
virtual

Print out all audio information.

void RADIO::debugEnable ( bool  enable = true)
virtual

Enable sending debug information to the Serial port.

void RADIO::debugRadioInfo ( )
virtual

Print out all radio information.

void RADIO::debugStatus ( )
virtual

Send debug information about actual available chip functionality and other internal things.

The RADIO class doesn't have interesting status information so nothing is sent.

Reimplemented in SI4705, RDA5807M, SI4703, TEA5767, and newchip.

void RADIO::formatFrequency ( char *  s,
uint8_t  length 
)
virtual

Format the current frequency for display and printing.

void RADIO::getAudioInfo ( AUDIO_INFO info)
virtual

Retrieve some information about the current audio function of the chip.

Return current settings as far as no chip is required. When using the radio::setXXX methods, no chip specific implementation is needed.

Reimplemented in SI4705, SI4703, TEA5767, and newchip.

RADIO_BAND RADIO::getBand ( )
virtual

Retrieve the current band setting.

bool RADIO::getBassBoost ( )
virtual

Retrieve the current bass boost mode setting.

Retrieve the current bass boost mode setting. The base implementation returns only the value in the internal variable.

RADIO_FREQ RADIO::getFrequency ( void  )
virtual

Retrieve the current tuned frequency.

Reimplemented in SI4705, SI4703, RDA5807M, TEA5767, and newchip.

RADIO_FREQ RADIO::getFrequencyStep ( )
virtual

Get resolution of the current selected band.

RADIO_FREQ RADIO::getMaxFrequency ( )
virtual

Get the maximum frequency of the current selected band.

RADIO_FREQ RADIO::getMinFrequency ( )
virtual

Get the minimum frequency of the current selected band.

bool RADIO::getMono ( )
virtual

Retrieve the current mono mode setting.

The base implementation returns only the value in the internal variable.

bool RADIO::getMute ( )
virtual

Retrieve the current mute mode setting.

The base implementation returns only the value in the internal variable.

void RADIO::getRadioInfo ( RADIO_INFO info)
virtual

Retrieve some information about the current radio function of the chip.

Return all the Radio settings. This implementation only knows some values from the last settings.

Reimplemented in SI4705, RDA5807M, SI4703, TEA5767, and newchip.

bool RADIO::getSoftMute ( )
virtual

Retrieve the current soft mute mode setting.

The base implementation returns only the value in the internal variable.

uint8_t RADIO::getVolume ( )
virtual

Retrieve the current output volume in the range 0..15.

bool RADIO::init ( )
virtual

initialize library and the chip.

The RADIO class doesn't implement a concrete chip so nothing has to be initialized.

Reimplemented in RDA5807M, SI4705, SI4703, TEA5767, and newchip.

void RADIO::int16_to_s ( char *  s,
uint16_t  val 
)
private

Prints a register as 4 character hexadecimal code with leading zeros.

Converts a int16 number to a string, similar to itoa, but using the format "00000".

This is a special format routine used to format frequencies as strings with leading blanks. up to 5 digits only (" 0".."99999") *s MUST be able to hold the characters

void RADIO::seekDown ( bool  toNextSender = true)
virtual

Start a seek downwards from the current frequency.

Reimplemented in SI4705, SI4703, RDA5807M, TEA5767, and newchip.

void RADIO::seekUp ( bool  toNextSender = true)
virtual

Start a seek upwards from the current frequency.

Reimplemented in SI4705, SI4703, RDA5807M, TEA5767, and newchip.

void RADIO::setBand ( RADIO_BAND  newBand)
virtual

Set the current band.

Start using the new band for receiving.

Reimplemented in SI4705, RDA5807M, SI4703, TEA5767, and newchip.

void RADIO::setBandFrequency ( RADIO_BAND  newBand,
RADIO_FREQ  newFreq 
)
virtual

Set Band and Frequency in one call.

void RADIO::setBassBoost ( bool  switchOn)
virtual

Control the bass boost mode of the radio chip.

Control the bass boost mode of the radio chip. The base implementation ony stores the value to the internal variable.

Parameters
switchOntrue to switch bassBoost mode on, false to switch bassBoost mode off.

Reimplemented in SI4705, RDA5807M, TEA5767, and newchip.

void RADIO::setFrequency ( RADIO_FREQ  newFreq)
virtual

Start using the new frequency for receiving.

Start using the new frequency for receiving. The new frequency is stored for later retrieval.

Reimplemented in SI4705, SI4703, RDA5807M, TEA5767, and newchip.

void RADIO::setMono ( bool  switchOn)
virtual

Control the mono mode of the radio chip.

The base implementation ony stores the value to the internal variable.

Reimplemented in SI4705, RDA5807M, TEA5767, newchip, and SI4703.

void RADIO::setMute ( bool  switchOn)
virtual

Control the mute mode of the radio chip.

The base implementation ony stores the value to the internal variable.

Reimplemented in SI4705, RDA5807M, TEA5767, newchip, and SI4703.

void RADIO::setSoftMute ( bool  switchOn)
virtual

Control the softmute mode (mute on low signals) of the radio chip.

The base implementation ony stores the value to the internal variable.

Reimplemented in SI4705, RDA5807M, and SI4703.

void RADIO::setVolume ( uint8_t  newVolume)
virtual

Control the volume output of the radio chip in the range 0..15.

Reimplemented in RDA5807M, SI4705, SI4703, TEA5767, and newchip.

void RADIO::term ( )
virtual

terminate all radio functions.

switch the power off The RADIO class doesn't implement a concrete chip so nothing has to be terminated.

Reimplemented in RDA5807M, SI4705, SI4703, TEA5767, and newchip.

Member Data Documentation

RADIO_BAND RADIO::_band
protected

Last set band.

bool RADIO::_bassBoost
protected

Last set bass Boost effect.

bool RADIO::_debugEnabled
protected

Set by debugEnable() and controls debugging functionality.

RADIO_FREQ RADIO::_freq
protected

Last set frequency.

RADIO_FREQ RADIO::_freqHigh
protected

Highest frequency of the current selected band.

RADIO_FREQ RADIO::_freqLow
protected

Lowest frequency of the current selected band.

RADIO_FREQ RADIO::_freqSteps
protected

Resulution of the tuner.

bool RADIO::_mono
protected

Last set mono effect.

bool RADIO::_mute
protected

Last set mute effect.

receiveRDSFunction RADIO::_sendRDS
protected

Registered RDS Function that is called on new available data.

bool RADIO::_softMute
protected

Last set softMute effect.

uint8_t RADIO::_volume
protected

Last set volume level.

const uint8_t RADIO::MAXVOLUME = 15

max volume level for all radio implementations.


The documentation for this class was generated from the following files: