Arduino Radio Library  0.9
A set of Arduino libraries to control diverse FM radio receiver chips in Arduino projects.
RDA5807M.h
Go to the documentation of this file.
1 
21 // multi-Band enabled
22 
23 // - - - - -
24 // help from: http://arduino.vom-kuhberg.de/index.php
25 // http://projects.qi-hardware.com/index.php/p/qi-kernel/source/tree/144e9c2530f863e32a3538b06c63484401bbe314/drivers/media/radio/radio-rda5807.c
26 
27 
28 #ifndef RDA5807M_h
29 #define RDA5807M_h
30 
31 #include <arduino.h>
32 #include <Wire.h>
33 
34 #include <radio.h>
35 
36 // ----- library definition -----
37 
39 class RDA5807M : public RADIO {
40  public:
41  // ----- RDA5807M specific implementations -----
42  const uint8_t MAXVOLUME = 15;
43 
44  RDA5807M();
45 
46  bool init();
47  void term();
48 
49  // ----- Audio features -----
50 
51  void setVolume(uint8_t newVolume);
52  void setBassBoost(bool switchOn);
53  void setMono(bool switchOn);
54  void setMute(bool switchOn);
55  void setSoftMute(bool switchOn);
56 
57  // ----- Receiver features -----
58  void setBand(RADIO_BAND newBand);
59  void setFrequency(RADIO_FREQ newF);
61 
62  void seekUp(bool toNextSender = true); // start seek mode upwards
63  void seekDown(bool toNextSender = true); // start seek mode downwards
64 
65  // ----- Supporting RDS for RADIO_BAND_FM and RADIO_BAND_FMWORLD
66 
67  void checkRDS();
68 
69  // ----- combined status functions -----
70 
71  virtual void getRadioInfo(RADIO_INFO *info);
72 
73  // ----- Supporting RDS for RADIO_BAND_FM and RADIO_BAND_FMWORLD
74 
75  // ----- debug Helpers send information to Serial port
76 
77  void debugScan(); // Scan all frequencies and report a status
78  void debugStatus(); // DebugInfo about actual chip data available
79 
80  private:
81  // ----- local variables
82  uint16_t registers[16]; // memory representation of the registers
83 
84  // ----- low level communication to the chip using I2C bus
85 
86  void _readRegisters(); // read all status & data registers
87  void _saveRegisters(); // Save writable registers back to the chip
88  void _saveRegister(byte regNr); // Save one register back to the chip
89 
90  void _write16(uint16_t val); // Write 16 Bit Value on I2C-Bus
91  uint16_t _read16(void);
92 };
93 
94 #endif
void setBand(RADIO_BAND newBand)
Set the current band.
Definition: RDA5807M.cpp:214
void setFrequency(RADIO_FREQ newF)
Start using the new frequency for receiving.
Definition: RDA5807M.cpp:240
const uint8_t MAXVOLUME
max volume level for radio implementations.
Definition: RDA5807M.h:42
RADIO_BAND
Definition: radio.h:98
void debugScan()
Definition: RDA5807M.cpp:427
void _write16(uint16_t val)
Definition: RDA5807M.cpp:333
uint16_t registers[16]
Definition: RDA5807M.h:82
Library header file for the radio libraries to control radio chips.
void debugStatus()
Send debug information about actual available chip functionality and other internal things...
Definition: RDA5807M.cpp:449
Library to control the RDA5807M radio chip.
Definition: RDA5807M.h:39
void seekDown(bool toNextSender=true)
Start a seek downwards from the current frequency.
Definition: RDA5807M.cpp:280
virtual void getRadioInfo(RADIO_INFO *info)
Retrieve some information about the current radio function of the chip.
Definition: RDA5807M.cpp:410
void setVolume(uint8_t newVolume)
Control the volume output of the radio chip in the range 0..15.
Definition: RDA5807M.cpp:140
void setMute(bool switchOn)
Control the mute mode of the radio chip.
Definition: RDA5807M.cpp:180
void setMono(bool switchOn)
Control the mono mode of the radio chip.
Definition: RDA5807M.cpp:164
uint16_t RADIO_FREQ
Definition: radio.h:112
void seekUp(bool toNextSender=true)
Start a seek upwards from the current frequency.
Definition: RDA5807M.cpp:265
RADIO_FREQ getFrequency(void)
Retrieve the current tuned frequency.
Definition: RDA5807M.cpp:227
void _saveRegisters()
Definition: RDA5807M.cpp:309
Library to control radio chips in general. This library acts as a base library for the chip specific ...
Definition: radio.h:137
bool init()
initialize library and the chip.
Definition: RDA5807M.cpp:95
void _readRegisters()
Definition: RDA5807M.cpp:296
uint16_t _read16(void)
Definition: RDA5807M.cpp:340
RDA5807M()
Definition: RDA5807M.cpp:90
A structure that contains information about the radio features from the chip.
Definition: radio.h:116
void _saveRegister(byte regNr)
Definition: RDA5807M.cpp:320
void checkRDS()
Check if RDS Data is available and good.
Definition: RDA5807M.cpp:356
void setSoftMute(bool switchOn)
Set the soft mute mode (mute on low signals) on or off.
Definition: RDA5807M.cpp:197
void setBassBoost(bool switchOn)
Control the bass boost mode of the radio chip.
Definition: RDA5807M.cpp:150
void term()
terminate all radio functions.
Definition: RDA5807M.cpp:129