Arduino Radio Library  0.9
A set of Arduino libraries to control diverse FM radio receiver chips in Arduino projects.
SI4705.h
Go to the documentation of this file.
1 
23 
24 #ifndef SI4705_h
25 #define SI4705_h
26 
27 #include <arduino.h>
28 
29 // The wire library is used for the communication with the radio chip.
30 #include <Wire.h>
31 
32 // Include the radio library that is extended by the SI4705 library.
33 #include <radio.h>
34 
35 // ----- library definition -----
36 
38 class SI4705 : public RADIO {
39 public:
40  const uint8_t MAXVOLUME = 15;
41  const uint8_t MAXVOLUMEX = 63;
42 
43  SI4705();
44 
45  bool init();
46  void term();
47 
48  // ----- Audio functions -----
49 
50  void setVolume(uint8_t newVolume);
51 
52  void setVolumeX(uint8_t newVolume);
53  uint8_t getVolumeX();
54 
55  void setMute(bool switchOn);
56  void setSoftMute(bool switchOn);
57 
58  // Overwrite audio functions that are not supported.
59  void setBassBoost(bool switchOn);
60 
61  // ----- Radio receiver functions -----
62 
63  void setMono(bool switchOn);
64 
65  void setBand(RADIO_BAND newBand);
66 
67  void setFrequency(RADIO_FREQ newF);
69 
70  void seekUp(bool toNextSender = true); // start seek mode upwards
71  void seekDown(bool toNextSender = true); // start seek mode downwards
72 
73  void checkRDS(); // read RDS data from the current station and process when data available.
74 
75  void getRadioInfo(RADIO_INFO *info);
76  void getAudioInfo(AUDIO_INFO *info);
77 
78  // ----- debug Helpers send information to Serial port
79 
80  void debugScan(); // Scan all frequencies and report a status
81  void debugStatus(); // Report Info about actual Station
82 
83 private:
84  // ----- local variables
85 
86  uint8_t _realVolume;
87 
88  // store the current status values
89  uint8_t _status;
90 
91  uint8_t tuneStatus[8];
92  uint8_t rsqStatus[1 + 7];
93  uint8_t rdsStatusx[1 + 12];
94  uint8_t agcStatus[1 + 2];
95 
97  union {
98  // use structured access
99  struct {
100  uint8_t status;
101  uint8_t resp1;
102  uint8_t resp2;
103  uint8_t rdsFifoUsed;
104  uint8_t blockAH; uint8_t blockAL;
105  uint8_t blockBH; uint8_t blockBL;
106  uint8_t blockCH; uint8_t blockCL;
107  uint8_t blockDH; uint8_t blockDL;
108  uint8_t blockErrors;
109  };
110  // use the the byte while receiving and sending.
111  uint8_t buffer[1 + 12];
112  } rdsStatus; // union RDSSTATUS
113 
114 
115  // ----- low level communication to the chip using I2C bus
116 
118  void _sendCommand(int cnt, int cmd, ...);
119 
121  void _setProperty(uint16_t prop, uint16_t value);
122 
124  uint8_t _readStatus();
125 
127  void _readStatusData(uint8_t cmd, uint8_t param, uint8_t *values, uint8_t len);
128 
129  void _seek(bool seekUp = true);
130  void _waitEnd();
131 };
132 
133 #endif
const uint8_t MAXVOLUMEX
max volume level for the SI4705 specific implementation.
Definition: SI4705.h:41
void seekDown(bool toNextSender=true)
Start seek mode downwards.
Definition: SI4705.cpp:342
uint8_t blockAH
Definition: SI4705.h:104
uint8_t blockBL
Definition: SI4705.h:105
void setVolumeX(uint8_t newVolume)
Control the volume output of the radio chip in the range 0..63.
Definition: SI4705.cpp:187
RADIO_BAND
Definition: radio.h:98
RADIO_FREQ getFrequency(void)
Definition: SI4705.cpp:304
uint8_t blockDH
Definition: SI4705.h:107
uint8_t blockCL
Definition: SI4705.h:106
void _sendCommand(int cnt, int cmd,...)
send a command
Definition: SI4705.cpp:490
uint8_t blockAL
Definition: SI4705.h:104
uint8_t rsqStatus[1+7]
Definition: SI4705.h:92
Library header file for the radio libraries to control radio chips.
uint8_t _readStatus()
read the interrupt status.
Definition: SI4705.cpp:357
bool init()
Initialize the library and the chip.
Definition: SI4705.cpp:131
uint8_t resp1
Definition: SI4705.h:101
void setSoftMute(bool switchOn)
Control the softmute mode (mute on low signals) of the radio chip.
Definition: SI4705.cpp:235
void setMute(bool switchOn)
Control the mute mode of the radio chip.
Definition: SI4705.cpp:207
Library to control the SI4705 radio chip.
Definition: SI4705.h:38
SI4705()
Initialize the extra variables in SI4705.
Definition: SI4705.cpp:124
void debugScan()
uint8_t buffer[1+12]
Definition: SI4705.h:111
void setVolume(uint8_t newVolume)
Control the volume output of the radio chip in the range 0..15.
Definition: SI4705.cpp:179
uint8_t blockCH
Definition: SI4705.h:106
void _setProperty(uint16_t prop, uint16_t value)
set a property
Definition: SI4705.cpp:518
uint8_t status
Definition: SI4705.h:100
void setMono(bool switchOn)
Control the mono/stereo mode of the radio chip.
Definition: SI4705.cpp:261
uint8_t rdsStatusx[1+12]
Definition: SI4705.h:93
void getAudioInfo(AUDIO_INFO *info)
Return a filled AUIO_INFO with the actual audio settings.
Definition: SI4705.cpp:408
uint16_t RADIO_FREQ
Definition: radio.h:112
void setFrequency(RADIO_FREQ newF)
Control the frequency.
Definition: SI4705.cpp:317
void _waitEnd()
wait until the current seek and tune operation is over.
Definition: SI4705.cpp:484
uint8_t tuneStatus[8]
Definition: SI4705.h:91
void checkRDS()
Retrieve the next RDS data if available.
Definition: SI4705.cpp:414
void _seek(bool seekUp=true)
uint8_t resp2
Definition: SI4705.h:102
void seekUp(bool toNextSender=true)
Start seek mode upwards.
Definition: SI4705.cpp:327
uint8_t blockErrors
Definition: SI4705.h:108
uint8_t _status
the status after sending a command
Definition: SI4705.h:89
uint8_t blockBH
Definition: SI4705.h:105
uint8_t rdsFifoUsed
Definition: SI4705.h:103
Library to control radio chips in general. This library acts as a base library for the chip specific ...
Definition: radio.h:137
void debugStatus()
Send the current values of all registers to the Serial port.
Definition: SI4705.cpp:440
void _readStatusData(uint8_t cmd, uint8_t param, uint8_t *values, uint8_t len)
read status information into a buffer
Definition: SI4705.cpp:373
union SI4705::@0 rdsStatus
structure used to read RDS information from the SI4705 radio chip.
A structure that contains information about the radio features from the chip.
Definition: radio.h:116
void getRadioInfo(RADIO_INFO *info)
Return a filled RADIO_INFO with the status of the radio features of the chip.
Definition: SI4705.cpp:390
void term()
Terminate all radio functions in the chip.
Definition: SI4705.cpp:169
uint8_t _realVolume
The real volume set to the chip.
Definition: SI4705.h:86
uint8_t getVolumeX()
Retrieve the current output volume in the range 0..63.
Definition: SI4705.cpp:198
void setBand(RADIO_BAND newBand)
Control the band of the radio chip.
Definition: SI4705.cpp:282
const uint8_t MAXVOLUME
max volume level for radio implementations.
Definition: SI4705.h:40
uint8_t blockDL
Definition: SI4705.h:107
a structure that contains information about the audio features
Definition: radio.h:127
uint8_t agcStatus[1+2]
Definition: SI4705.h:94
void setBassBoost(bool switchOn)
regardless of the given parameter, the Bass Boost will never switch on.
Definition: SI4705.cpp:251