PU2CLR Si4735 Arduino Library  2.0.0
Arduino Library for Si47XX Devices - By Ricardo Lima Caratti
SI4735.h
Go to the documentation of this file.
1 /**
2  * @brief SI4735 ARDUINO LIBRARY
3  *
4  * @details This is an Arduino library for the SI47XX, BROADCAST AM/FM/SW RADIO RECEIVER IC family from Silicon Labs.
5  * @details This library is intended to provide an easier interface for controlling the SI47XX by using Arduino platform.
6  * @details The communication used by this library is I2C.
7  * @details This file contains: const (#define), Defined Data type and Methods declarations
8  * @details You can see a complete documentation on <https://github.com/pu2clr/SI4735>
9  * @details The are more than 20 examples on <https://github.com/pu2clr/SI4735/tree/master/examples>
10  *
11  * @see https://pu2clr.github.io/SI4735/
12  * @see Si47XX PROGRAMMING GUIDE AN332 (Rev 1.0): https://www.silabs.com/documents/public/application-notes/AN332.pdf
13  * @see AN332 REV 0.8 UNIVERSAL PROGRAMMING GUIDE; AMENDMENT FOR SI4735-D60 SSB AND NBFM PATCHES
14  *
15  *
16  * @author PU2CLR - Ricardo Lima Caratti
17  * @date 2019-2020
18  */
19 
20 #include <Arduino.h>
21 #include <Wire.h>
22 
23 #define POWER_UP_FM 0 // FM
24 #define POWER_UP_AM 1 // AM and SSB (if patch applyed)
25 #define POWER_UP_WB 3 // Weather Band Receiver
26 #define POWER_PATCH 15 //
27 
28 // SI473X commands (general)
29 #define SI473X_ADDR_SEN_LOW 0x11 // SI473X I2C bus address when the SEN pin (16) is set to low 0V.
30 #define SI473X_ADDR_SEN_HIGH 0x63 // SI473X I2C bus address when the SEN pin (16) is set to high +3.3V
31 
32 #define POWER_UP 0x01 // Power up device and mode selection.
33 #define GET_REV 0x10 // Returns revision information on the device.
34 #define POWER_DOWN 0x11 // Power down device.
35 #define SET_PROPERTY 0x12 // Sets the value of a property.
36 #define GET_PROPERTY 0x13 // Retrieves a property’s value.
37 #define GET_INT_STATUS 0x14 // Read interrupt status bits.
38 
39 // FM
40 #define FM_TUNE_FREQ 0x20
41 #define FM_SEEK_START 0x21 // Begins searching for a valid FM frequency.
42 #define FM_TUNE_STATUS 0x22
43 #define FM_AGC_STATUS 0x27
44 #define FM_AGC_OVERRIDE 0x28
45 #define FM_RSQ_STATUS 0x23
46 #define FM_RDS_STATUS 0x24 // Returns RDS information for current channel and reads an entry from the RDS FIFO.
47 
48 // FM RDS properties
49 #define FM_RDS_INT_SOURCE 0x1500
50 #define FM_RDS_INT_FIFO_COUNT 0x1501
51 #define FM_RDS_CONFIG 0x1502
52 #define FM_RDS_CONFIDENCE 0x1503
53 
54 #define FM_DEEMPHASIS 0x1100
55 #define FM_BLEND_STEREO_THRESHOLD 0x1105
56 #define FM_BLEND_MONO_THRESHOLD 0x1106
57 #define FM_BLEND_RSSI_STEREO_THRESHOLD 0x1800
58 #define FM_BLEND_RSSI_MONO_THRESHOLD 0x1801
59 #define FM_BLEND_SNR_STEREO_THRESHOLD 0x1804
60 #define FM_BLEND_SNR_MONO_THRESHOLD 0x1805
61 #define FM_BLEND_MULTIPATH_STEREO_THRESHOLD 0x1808
62 #define FM_BLEND_MULTIPATH_MONO_THRESHOLD 0x1809
63 
64 // FM SEEK Properties
65 #define FM_SEEK_BAND_BOTTOM 0x1400 // Sets the bottom of the FM band for seek
66 #define FM_SEEK_BAND_TOP 0x1401 // Sets the top of the FM band for seek
67 #define FM_SEEK_FREQ_SPACING 0x1402 // Selects frequency spacing for FM seek
68 #define FM_SEEK_TUNE_SNR_THRESHOLD 0x1403 // Sets the SNR threshold for a valid FM Seek/Tune
69 #define FM_SEEK_TUNE_RSSI_THRESHOLD 0x1404 // Sets the RSSI threshold for a valid FM Seek/Tune
70 
71 // AM command
72 #define AM_TUNE_FREQ 0x40 // Tunes to a given AM frequency.
73 #define AM_SEEK_START 0x41 // Begins searching for a valid AM frequency.
74 #define AM_TUNE_STATUS 0x42 // Queries the status of the already issued AM_TUNE_FREQ or AM_SEEK_START command.
75 #define AM_RSQ_STATUS 0x43 // Queries the status of the Received Signal Quality (RSQ) for the current channel.
76 #define AM_AGC_STATUS 0x47 // Queries the current AGC settings.
77 #define AM_AGC_OVERRIDE 0x48 // Overrides AGC settings by disabling and forcing it to a fixed value.
78 #define GPIO_CTL 0x80 // Configures GPO1, 2, and 3 as output or Hi-Z.
79 #define GPIO_SET 0x81 // Sets GPO1, 2, and 3 output level (low or high).
80 
81 //SSB command (SAME AM CMD VALUES)
82 // See AN332 REV 0.8 UNIVERSAL PROGRAMMING GUIDE; pages 4 and 5
83 #define SSB_TUNE_FREQ 0x40 // Tunes to a given SSB frequency.
84 #define SSB_TUNE_STATUS 0x42 // Queries the status of the already issued SSB_TUNE_FREQ or AM_SEEK_START command.
85 #define SSB_RSQ_STATUS 0x43 // Queries the status of the Received Signal Quality (RSQ) for the current channel.
86 #define SSB_AGC_STATUS 0x47 // Queries the current AGC settings.
87 #define SSB_AGC_OVERRIDE 0x48 // Overrides AGC settings by disabling and forcing it to a fixed value.
88 
89 // AM/SW/LW Receiver Property Summary
90 // See Si47XX PROGRAMMING GUIDE AN332 (REV 1.0); page 125
91 #define DIGITAL_OUTPUT_FORMAT 0x0102 // Configure digital audio outputs.
92 #define DIGITAL_OUTPUT_SAMPLE_RATE 0x0104 // Configure digital audio output sample rate
93 #define REFCLK_FREQ 0x0201 //Sets frequency of reference clock in Hz. The range is 31130 to 34406 Hz, or 0 to disable the AFC. Default is 32768 Hz.
94 #define REFCLK_PRESCALE 0x0202 // Sets the prescaler value for RCLK input.
95 #define AM_DEEMPHASIS 0x3100 // Sets deemphasis time constant. Can be set to 50 μs. Deemphasis is disabled by default.
96 #define AM_CHANNEL_FILTER 0x3102 // Selects the bandwidth of the channel filter for AM reception. The choices are 6, 4, 3, 2, 2.5, 1.8, or 1 (kHz). The default bandwidth is 2 kHz.
97 #define AM_AUTOMATIC_VOLUME_CONTROL_MAX_GAIN 0x3103 // Sets the maximum gain for automatic volume control.
98 #define AM_MODE_AFC_SW_PULL_IN_RANGE 0x3104 // Sets the SW AFC pull-in range.
99 #define AM_MODE_AFC_SW_LOCK_IN_RANGE 0x3105 // Sets the SW AFC lock-in.
100 #define AM_RSQ_INTERRUPTS 0x3200 // Same SSB - Configures interrupt related to Received Signal Quality metrics. All interrupts are disabled by default.
101 #define AM_RSQ_SNR_HIGH_THRESHOLD 0x3201 //Sets high threshold for SNR interrupt.
102 #define AM_RSQ_SNR_LOW_THRESHOLD 0x3202 // Sets low threshold for SNR interrupt.
103 #define AM_RSQ_RSSI_HIGH_THRESHOLD 0x3203 // Sets high threshold for RSSI interrupt.
104 #define AM_RSQ_RSSI_LOW_THRESHOLD 0x3204 // Sets low threshold for RSSI interrupt.
105 #define AM_SOFT_MUTE_RATE 0x3300 // Sets the attack and decay rates when entering or leaving soft mute. The default is 278 dB/s.
106 #define AM_SOFT_MUTE_SLOPE 0x3301 // Sets the AM soft mute slope. Default value is a slope of 1.
107 #define AM_SOFT_MUTE_MAX_ATTENUATION 0x3302 // Sets maximum attenuation during soft mute (dB). Set to 0 to disable soft mute. Default is 8 dB.
108 #define AM_SOFT_MUTE_SNR_THRESHOLD 0x3303 // Sets SNR threshold to engage soft mute. Default is 8 dB.
109 #define AM_SOFT_MUTE_RELEASE_RATE 0x3304 // Sets softmute release rate. Smaller values provide slower release, and larger values provide faster release.
110 #define AM_SOFT_MUTE_ATTACK_RATE 0x3305 // Sets software attack rate. Smaller values provide slower attack, and larger values provide faster attack.
111 #define AM_SEEK_BAND_BOTTOM 0x3400 // Sets the bottom of the AM band for seek. Default is 520.
112 #define AM_SEEK_BAND_TOP 0x3401 // Sets the top of the AM band for seek. Default is 1710.
113 #define AM_SEEK_FREQ_SPACING 0x3402 // Selects frequency spacing for AM seek. Default is 10 kHz spacing.
114 #define AM_SEEK_SNR_THRESHOLD 0x3403 // Sets the SNR threshold for a valid AM Seek/Tune.
115 #define AM_SEEK_RSSI_THRESHOLD 0x3404 // Sets the RSSI threshold for a valid AM Seek/Tune.
116 #define AM_AGC_ATTACK_RATE 0x3702 // Sets the number of milliseconds the high peak detector must be exceeded before decreasing gain.
117 #define AM_AGC_RELEASE_RATE 0x3703 // Sets the number of milliseconds the low peak detector must not be exceeded before increasing the gain.
118 #define AM_FRONTEND_AGC_CONTROL 0x3705 // Adjusts AM AGC for frontend (external) attenuator and LNA.
119 #define AM_NB_DETECT_THRESHOLD 0x3900 // Sets the threshold for detecting impulses in dB above the noise floor
120 #define AM_NB_INTERVAL 0x3901 // Interval in micro-seconds that original samples are replaced by interpolated clean samples
121 #define AM_NB_RATE 0x3902 // Noise blanking rate in 100 Hz units. Default value is 64.
122 #define AM_NB_IIR_FILTER 0x3903 // Sets the bandwidth of the noise floor estimator. Default value is 300.
123 #define AM_NB_DELAY 0x3904 // Delay in micro-seconds before applying impulse blanking to the original samples
124 
125 #define RX_VOLUME 0x4000
126 #define RX_HARD_MUTE 0x4001
127 
128 // SSB properties
129 // See AN332 REV 0.8 Universal Programming Guide (Amendment for SI4735-D60 SSN and NBFM Patches)
130 
131 #define GPO_IEN 0x0001 // AM and SSB - Enable interrupt source
132 #define SSB_BFO 0x0100 // Sets the Beat Frequency Offset (BFO) under SSB mode.
133 #define SSB_MODE 0x0101 // Sets number of properties of the SSB mode.
134 #define SSB_RSQ_INTERRUPTS 0x3200 // Configure Interrupts related to RSQ
135 #define SSB_RSQ_SNR_HI_THRESHOLD 0x3201 // Sets high threshold for SNR interrupt
136 #define SSB_RSQ_SNR_LO_THRESHOLD 0x3202 // Sets low threshold for SNR interrupt
137 #define SSB_RSQ_RSSI_HI_THRESHOLD 0x3203 // Sets high threshold for RSSI interrupt
138 #define SSB_RSQ_RSSI_LO_THRESHOLD 0x3204 // Sets low threshold for RSSI interrupt
139 #define SSB_SOFT_MUTE_RATE 0x3300 // Sets the attack and decay rates when entering or leaving soft mute
140 #define SSB_SOFT_MUTE_MAX_ATTENUATION 0x3302 // Sets the maximum attenuation during soft mute (db); 0dB to disable soft mute; defaul 8dB;
141 #define SSB_SOFT_MUTE_SNR_THRESHOLD 0x3303 // Sets SNR threshould to engage soft mute. Defaul 8dB
142 #define SSB_RF_AGC_ATTACK_RATE 0x3700 // Sets the number of milliseconds the high RF peak detector must be exceeded before decreasing the gain. Defaul 4.
143 #define SSB_RF_AGC_RELEASE_RATE 0x3701 // Sets the number of milliseconds the low RF peak detector must be exceeded before increasing the gain. Defaul 24.
144 
145 // SSB
146 #define SSB_RF_IF_AGC_ATTACK_RATE 0x3702 // Sets the number of milliseconds the high IF peak detector must be exceeded before decreasing gain. Defaul 4.
147 #define SSB_RF_IF_AGC_RELEASE_RATE 0x3703 // Sets the number of milliseconds the low IF peak detector must be exceeded before increasing the gain. Defaul 140.
148 
149 // See AN332 REV 0.8 UNIVERSAL PROGRAMMING GUIDE; pages 12 and 13
150 #define LSB_MODE 1 // 01
151 #define USB_MODE 2 // 10
152 
153 // Parameters
154 #define SI473X_RDS_OUTPUT_ONLY 0b00000000 // RDS output only (no audio outputs) Si4749 only
155 #define SI473X_ANALOG_AUDIO 0b00000101 // Analog Audio Inputs
156 #define SI473X_DIGITAL_AUDIO1 0b00001011 // Digital audio output (DCLK, LOUT/DFS, ROUT/DIO)
157 #define SI473X_DIGITAL_AUDIO2 0b10110000 // Digital audio outputs (DCLK, DFS, DIO)
158 #define SI473X_ANALOG_DIGITAL_AUDIO 0b10110101 // Analog and digital audio outputs (LOUT/ROUT and DCLK, DFS,DIO)
159 
160 // Other parameters
161 #define FM_CURRENT_MODE 0
162 #define AM_CURRENT_MODE 1
163 #define SSB_CURRENT_MODE 2
164 
165 #define SEEK_UP 1
166 #define SEEK_DOWN 0
167 
168 #define MAX_DELAY_AFTER_SET_FREQUENCY 30 // In ms - This value helps to improve the precision during of getting frequency value
169 #define MAX_DELAY_AFTER_POWERUP 10 // In ms - Max delay you have to setup after a power up command.
170 #define MIN_DELAY_WAIT_SEND_LOOP 300 // In uS (Microsecond) - each loop of waitToSend sould wait this value in microsecond
171 #define MAX_SEEK_TIME 8000 // defines the maximum seeking time 8s is default.
172 
173 #define XOSCEN_CRYSTAL 1 // Use crystal oscillator
174 #define XOSCEN_RCLK 0 // Use external RCLK (crystal oscillator disabled).
175 
176 /** @defgroup group01 Union, Struct and Defined Data Types
177  * @section group01 Data Types
178  *
179  * @brief SI473X data representation
180  *
181  * @details The goal of this approach is separating data from code.
182  * The Si47XX family works with many internal data that can be represented by data structure
183  * or defined data type in C/C++. These C/C++ resources have been used widely here.
184  * This aproach made the library easier to build and maintain. Each data structure created
185  * here has its reference (name of the document and page on which it was based).
186  * In other words, to make the SI47XX device easier to deal, some defined data types were
187  * created to handle byte and bits to process commands, properties and responses.
188  * These data types will be usefull to deal with SI473X
189  */
190 
191 /**
192  * @ingroup group01
193  *
194  * @brief Power Up arguments data type
195  *
196  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 64 and 65
197  */
198 typedef union {
199  struct
200  {
201  // ARG1
202  uint8_t FUNC : 4; //!< Function (0 = FM Receive; 1–14 = Reserved; 15 = Query Library ID)
203  uint8_t XOSCEN : 1; //!< Crystal Oscillator Enable (0 = crystal oscillator disabled; 1 = Use crystal oscillator and and OPMODE=ANALOG AUDIO) .
204  uint8_t PATCH : 1; //!< Patch Enable (0 = Boot normally; 1 = Copy non-volatile memory to RAM).
205  uint8_t GPO2OEN : 1; //!< GPO2 Output Enable (0 = GPO2 output disabled; 1 = GPO2 output enabled).
206  uint8_t CTSIEN : 1; //!< CTS Interrupt Enable (0 = CTS interrupt disabled; 1 = CTS interrupt enabled).
207  // ARG2
208  uint8_t OPMODE; //!< Application Setting. See page 65
209  } arg; //!< Refined powerup parameters
210  uint8_t raw[2]; //!< Raw powerup parameters data. Same arg memory position. So, same content.
211 } si473x_powerup;
212 
213 /**
214  * @ingroup group01
215  *
216  * @brief Data type for Enables output for GPO1, GPO2 and GPO3
217  *
218  * @details GPO1, 2, and 3 can be configured for output (Hi-Z or active drive) by setting the GPO1OEN, GPO2OEN, and GPO3OEN bit.
219  *
220  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); page 82 and 144
221  */
222 typedef union {
223  struct
224  {
225  uint8_t DUMMY1 : 1; //!< Always write 0.
226  uint8_t GPO1OEN : 1; //!< GPO1 Output Enable.
227  uint8_t GPO2OEN : 1; //!< GPO2 Output Enable.
228  uint8_t GPO3OEN : 1; //!< GPO3 Output Enable.
229  uint8_t DUMMY2 : 4; //!< Always write 0.
230  } arg; //!< Refined powerup parameters
232 } si473x_gpio;
233 
234 /**
235  * @ingroup group01
236  *
237  * @brief Data type for Configuring the sources for the GPO2/INT interrupt pin
238  *
239  * @details Valid sources are the lower 8 bits of the STATUS byte, including CTS, ERR, RSQINT, and STCINT bits.
240  *
241  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); page 146
242  */
243 typedef union {
244  struct
245  {
246  uint8_t STCIEN : 1; //!< Seek/Tune Complete Interrupt Enable (0 or 1).
247  uint8_t DUMMY1 : 2; //!< Always write 0.
248  uint8_t RSQIEN : 1; //!< RSQ Interrupt Enable (0 or 1).
249  uint8_t DUMMY2 : 2; //!< Always write 0.
250  uint8_t ERRIEN : 1; //!< ERR Interrupt Enable (0 or 1).
251  uint8_t CTSIEN : 1; //!< CTS Interrupt Enable (0 or 1).
252  uint8_t STCREP : 1; //!< STC Interrupt Repeat (0 or 1).
253  uint8_t DUMMY3 : 2; //!< Always write 0.
254  uint8_t RSQREP : 1; //!< RSQ Interrupt Repeat (0 or 1).
255  uint8_t DUMMY4 : 4; //!< Always write 0.
256  } arg;
258 } si473x_gpio_ien;
259 
260 /**
261  * @ingroup group01
262  *
263  * @brief Represents how the frequency is stored in the si4735.
264  * @details It helps to convert frequency in uint16_t to two bytes (uint8_t) (FREQL and FREQH)
265  */
266 typedef union {
267  struct
268  {
269  uint8_t FREQL; //!< Tune Frequency Low byte.
270  uint8_t FREQH; //!< Tune Frequency High byte.
271  } raw; //!< Raw data that represents the frequency stored in the Si47XX device.
272  uint16_t value; //!< frequency (integer value)
273 } si47x_frequency;
274 
275 /**
276  * @ingroup group01
277  * @brief Antenna Tuning Capacitor data type manupulation
278  */
279 typedef union {
280  struct
281  {
282  uint8_t ANTCAPL; //!< Antenna Tuning Capacitor High byte
283  uint8_t ANTCAPH; //!< Antenna Tuning Capacitor Low byte
284  } raw;
286 } si47x_antenna_capacitor;
287 
288 /**
289  * @ingroup group01
290  *
291  * @brief AM Tune frequency data type command (AM_TUNE_FREQ command)
292  *
293  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 135
294  */
295 typedef union {
296  struct
297  {
298  uint8_t FAST : 1; //!< ARG1 - FAST Tuning. If set, executes fast and invalidated tune. The tune status will not be accurate.
299  uint8_t FREEZE : 1; //!< Valid only for FM (Must be 0 to AM)
300  uint8_t DUMMY1 : 4; //!< Always set 0
301  uint8_t USBLSB : 2; //!< SSB Upper Side Band (USB) and Lower Side Band (LSB) Selection. 10 = USB is selected; 01 = LSB is selected.
302  uint8_t FREQH; //!< ARG2 - Tune Frequency High byte.
303  uint8_t FREQL; //!< ARG3 - Tune Frequency Low byte.
304  uint8_t ANTCAPH; //!< ARG4 - Antenna Tuning Capacitor High byte.
305  uint8_t ANTCAPL; //!< ARG5 - Antenna Tuning Capacitor Low byte. Note used for FM.
306  } arg;
308 } si47x_set_frequency;
309 
310 /**
311  * @ingroup group01
312  *
313  * @brief Seek frequency (automatic tuning). ARG1
314  *
315  * @details Represents searching for a valid frequency data type AM and FM.
316  * @details When AM, the searching data have to be complemented by si47x_seek_am_complement.
317  *
318  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 72 and 137
319  * @see si47x_seek_am_complement
320  */
321 typedef union {
322  struct
323  {
324  uint8_t RESERVED1 : 2;
325  uint8_t WRAP : 1; //!< Determines whether the seek should Wrap = 1, or Halt = 0 when it hits the band limit.
326  uint8_t SEEKUP : 1; //!< Determines the direction of the search, either UP = 1, or DOWN = 0.
327  uint8_t RESERVED2 : 4;
328  } arg;
330 } si47x_seek;
331 
332 /**
333  * @ingroup group01
334  *
335  * @brief Seek frequency (automatic tuning) AM complement (ARG2, ARG3, ARG4 and ARG5)
336  *
337  * @details Represents AM complement searching information for a valid frequency data type.
338  *
339  * @see @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 72 and 137
340  */
341 typedef struct
342 {
343  uint8_t ARG2; // Always 0.
344  uint8_t ARG3; // Always 0.
347 } si47x_seek_am_complement;
348 
349 /**
350  * @ingroup group01 status response structure
351  *
352  * @brief Status response data representation
353  *
354  * @details Represents searching for a valid frequency data type.
355  */
356 typedef union {
357  struct
358  {
359  uint8_t STCINT : 1; //!< 1 = Tune complete has been triggered.
360  uint8_t DUMMY1 : 1; //!< Reserved (Values may vary).
361  uint8_t RDSINT : 1; //!< 1 = Radio data system interrupt has been triggered.
362  uint8_t RSQINT : 1; //!< 1 = Received Signal Quality measurement has been triggered.
363  uint8_t DUMMY2 : 2; //!< Reserved (Values may vary).
364  uint8_t ERR : 1; //!< 1 = Error.
365  uint8_t CTS : 1; //!< 0 = Wait before sending next command; 1 = Clear to send next command.
366  } refined;
368 } si47x_status;
369 
370 /**
371  * @ingroup group01
372  *
373  * @brief Response status command
374  *
375  * @details Response data from a query status command
376  *
377  * @see Si47XX PROGRAMMING GUIDE; pages 73 and
378  */
379 typedef union {
380  struct
381  {
382  // Status
383  uint8_t STCINT : 1; //!< Seek/Tune Complete Interrupt; 1 = Tune complete has been triggered.
384  uint8_t DUMMY1 : 1;
385  uint8_t RDSINT : 1; //!< Radio Data System (RDS) Interrup; 0 = interrupt has not been triggered.
386  uint8_t RSQINT : 1; //!< Received Signal Quality Interrupt; 0 = interrupt has not been triggered.
387  uint8_t DUMMY2 : 2;
388  uint8_t ERR : 1; //!< Error. 0 = No error 1 = Error
389  uint8_t CTS : 1; //!< Clear to Send.
390  // RESP1
391  uint8_t VALID : 1; //!< Valid Channel
392  uint8_t AFCRL : 1; //!< AFC Rail Indicator
393  uint8_t DUMMY3 : 5;
394  uint8_t BLTF : 1; //!< Reports if a seek hit the band limit
395  // RESP2
396  uint8_t READFREQH; //!< Read Frequency High byte.
397  // RESP3
398  uint8_t READFREQL; //!< Read Frequency Low byte.
399  // RESP4
400  uint8_t RSSI; //!< Received Signal Strength Indicator (dBμV)
401  // RESP5
402  uint8_t SNR; //!< This byte contains the SNR metric when tune is complete (dB).
403  // RESP6
404  uint8_t MULT; //!< Contains the multipath metric when tune is complete
405  // RESP7
406  uint8_t READANTCAP; //!< Contains the current antenna tuning capacitor value
407  } resp;
408  uint8_t raw[8]; //!< Check it
409 } si47x_response_status;
410 
411 /**
412  * @ingroup group01
413  *
414  * @brief Data representation for Firmware Information (GET_REV)
415  *
416  * @details The part number, chip revision, firmware revision, patch revision and component revision numbers.
417  *
418  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 66 and 131
419  */
420 typedef union {
421  struct
422  {
423  // status ("RESP0")
424  uint8_t STCINT : 1;
425  uint8_t DUMMY1 : 1;
426  uint8_t RDSINT : 1;
427  uint8_t RSQINT : 1;
428  uint8_t DUMMY2 : 2;
429  uint8_t ERR : 1;
430  uint8_t CTS : 1;
431  uint8_t PN; //!< RESP1 - Final 2 digits of Part Number (HEX).
432  uint8_t FWMAJOR; //!< RESP2 - Firmware Major Revision (ASCII).
433  uint8_t FWMINOR; //!< RESP3 - Firmware Minor Revision (ASCII).
434  uint8_t PATCHH; //!< RESP4 - Patch ID High byte (HEX).
435  uint8_t PATCHL; //!< RESP5 - Patch ID Low byte (HEX).
436  uint8_t CMPMAJOR; //!< RESP6 - Component Major Revision (ASCII).
437  uint8_t CMPMINOR; //!< RESP7 - Component Minor Revision (ASCII).
438  uint8_t CHIPREV; //!< RESP8 - Chip Revision (ASCII).
439  // RESP9 to RESP15 not used
440  } resp;
442 } si47x_firmware_information;
443 
444 /**
445  * @ingroup group01
446  *
447  * @brief Firmware Query Library ID response.
448  *
449  * @details Used to represent the response of a power up command with FUNC = 15 (patch)
450  *
451  * To confirm that the patch is compatible with the internal device library revision, the library
452  * revision should be confirmed by issuing the POWER_UP command with Function = 15 (query library ID)
453  *
454  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); page 12
455  */
456 typedef union {
457  struct
458  {
459  // status ("RESP0")
460  uint8_t STCINT : 1;
461  uint8_t DUMMY1 : 1;
462  uint8_t RDSINT : 1;
463  uint8_t RSQINT : 1;
464  uint8_t DUMMY2 : 2;
465  uint8_t ERR : 1;
466  uint8_t CTS : 1;
467  uint8_t PN; //!< RESP1 - Final 2 digits of Part Number (HEX).
468  uint8_t FWMAJOR; //!< RESP2 - Firmware Major Revision (ASCII).
469  uint8_t FWMINOR; //!< RESP3 - Firmware Minor Revision (ASCII).
470  uint8_t RESERVED1; //!< RESP4 - Reserved, various values.
471  uint8_t RESERVED2; //!< RESP5 - Reserved, various values.
472  uint8_t CHIPREV; //!< RESP6 - Chip Revision (ASCII).
473  uint8_t LIBRARYID; //!< RESP7 - Library Revision (HEX).
474  // RESP9 to RESP15 not used
475  } resp;
477 } si47x_firmware_query_library;
478 
479 /**
480  * @ingroup group01
481  *
482  * @brief Seek station status
483  *
484  * @details Status of FM_TUNE_FREQ or FM_SEEK_START commands or Status of AM_TUNE_FREQ or AM_SEEK_START commands.
485  *
486  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 73 and 139
487  */
488 typedef union {
489  struct
490  {
491  uint8_t INTACK : 1; //!< If set, clears the seek/tune complete interrupt status indicator.
492  uint8_t CANCEL : 1; //!< If set, aborts a seek currently in progress.
493  uint8_t RESERVED2 : 6;
494  } arg;
496 } si47x_tune_status;
497 
498 /**
499  * @ingroup group01
500  *
501  * @brief Data type to deal with SET_PROPERTY command
502  *
503  * @details Property Data type (help to deal with SET_PROPERTY command on si473X)
504  */
505 typedef union {
506  struct
507  {
508  uint8_t byteLow;
509  uint8_t byteHigh;
510  } raw;
512 } si47x_property;
513 
514 /**
515  * @ingroup group01
516  *
517  * @brief Radio Signal Quality data representation
518  *
519  * @details Data type for status information about the received signal quality (FM_RSQ_STATUS and AM_RSQ_STATUS)
520  *
521  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 75 and
522  */
523 typedef union {
524  struct
525  {
526  // status ("RESP0")
527  uint8_t STCINT : 1;
528  uint8_t DUMMY1 : 1;
529  uint8_t RDSINT : 1;
530  uint8_t RSQINT : 1;
531  uint8_t DUMMY2 : 2;
532  uint8_t ERR : 1;
533  uint8_t CTS : 1;
534  // RESP1
535  uint8_t RSSIILINT : 1; //!< RSSI Detect Low.
536  uint8_t RSSIHINT : 1; //!< RSSI Detect High.
537  uint8_t SNRLINT : 1; //!< SNR Detect Low.
538  uint8_t SNRHINT : 1; //!< SNR Detect High.
539  uint8_t MULTLINT : 1; //!< Multipath Detect Low
540  uint8_t MULTHINT : 1; //!< Multipath Detect High
541  uint8_t DUMMY3 : 1;
542  uint8_t BLENDINT : 1; //!< Blend Detect Interrupt.
543  // RESP2
544  uint8_t VALID : 1; //!< Valid Channel.
545  uint8_t AFCRL : 1; //!< AFC Rail Indicator.
546  uint8_t DUMMY4 : 1;
547  uint8_t SMUTE : 1; //!< Soft Mute Indicator. Indicates soft mute is engaged.
548  uint8_t DUMMY5 : 4;
549  // RESP3
550  uint8_t STBLEND : 7; //!< Indicates amount of stereo blend in% (100 = full stereo, 0 = full mono).
551  uint8_t PILOT : 1; //!< Indicates stereo pilot presence.
552  // RESP4 to RESP7
553  uint8_t RSSI; //!< RESP4 - Contains the current receive signal strength (0–127 dBμV).
554  uint8_t SNR; //!< RESP5 - Contains the current SNR metric (0–127 dB).
555  uint8_t MULT; //!< RESP6 - Contains the current multipath metric. (0 = no multipath; 100 = full multipath)
556  uint8_t FREQOFF; //!< RESP7 - Signed frequency offset (kHz).
557  } resp;
559 } si47x_rqs_status;
560 
561 /**
562  * @ingroup group01
563  *
564  * @brief Data type for RDS Status command and response information
565  *
566  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 77 and 78
567  * @see Also https://en.wikipedia.org/wiki/Radio_Data_System
568  */
569 typedef union {
570  struct
571  {
572  uint8_t INTACK : 1; // Interrupt Acknowledge; 0 = RDSINT status preserved; 1 = Clears RDSINT.
573  uint8_t MTFIFO : 1; // Empty FIFO; 0 = If FIFO not empty; 1 = Clear RDS Receive FIFO.
574  uint8_t STATUSONLY : 1; // Determines if data should be removed from the RDS FIFO.
575  uint8_t dummy : 5;
576  } arg;
578 } si47x_rds_command;
579 
580 /**
581  * @ingroup group01
582  *
583  * @brief Response data type for current channel and reads an entry from the RDS FIFO.
584  *
585  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 77 and 78
586  */
587 typedef union {
588  struct
589  {
590  // status ("RESP0")
591  uint8_t STCINT : 1;
592  uint8_t DUMMY1 : 1;
593  uint8_t RDSINT : 1;
594  uint8_t RSQINT : 1;
595  uint8_t DUMMY2 : 2;
596  uint8_t ERR : 1;
597  uint8_t CTS : 1;
598  // RESP1
599  uint8_t RDSRECV : 1; //!< RDS Received; 1 = FIFO filled to minimum number of groups set by RDSFIFOCNT.
600  uint8_t RDSSYNCLOST : 1; //!< RDS Sync Lost; 1 = Lost RDS synchronization.
601  uint8_t RDSSYNCFOUND : 1; //!< RDS Sync Found; 1 = Found RDS synchronization.
602  uint8_t DUMMY3 : 1;
603  uint8_t RDSNEWBLOCKA : 1; //!< RDS New Block A; 1 = Valid Block A data has been received.
604  uint8_t RDSNEWBLOCKB : 1; //!< RDS New Block B; 1 = Valid Block B data has been received.
605  uint8_t DUMMY4 : 2;
606  // RESP2
607  uint8_t RDSSYNC : 1; //!< RDS Sync; 1 = RDS currently synchronized.
608  uint8_t DUMMY5 : 1;
609  uint8_t GRPLOST : 1; //!< Group Lost; 1 = One or more RDS groups discarded due to FIFO overrun.
610  uint8_t DUMMY6 : 5;
611  // RESP3 to RESP11
612  uint8_t RDSFIFOUSED; //!< RESP3 - RDS FIFO Used; Number of groups remaining in the RDS FIFO (0 if empty).
613  uint8_t BLOCKAH; //!< RESP4 - RDS Block A; HIGH byte
614  uint8_t BLOCKAL; //!< RESP5 - RDS Block A; LOW byte
615  uint8_t BLOCKBH; //!< RESP6 - RDS Block B; HIGH byte
616  uint8_t BLOCKBL; //!< RESP7 - RDS Block B; LOW byte
617  uint8_t BLOCKCH; //!< RESP8 - RDS Block C; HIGH byte
618  uint8_t BLOCKCL; //!< RESP9 - RDS Block C; LOW byte
619  uint8_t BLOCKDH; //!< RESP10 - RDS Block D; HIGH byte
620  uint8_t BLOCKDL; //!< RESP11 - RDS Block D; LOW byte
621  // RESP12 - Blocks A to D Corrected Errors.
622  // 0 = No errors;
623  // 1 = 1–2 bit errors detected and corrected;
624  // 2 = 3–5 bit errors detected and corrected.
625  // 3 = Uncorrectable.
626  uint8_t BLED : 2;
627  uint8_t BLEC : 2;
628  uint8_t BLEB : 2;
629  uint8_t BLEA : 2;
630  } resp;
632 } si47x_rds_status;
633 
634 /**
635  * @ingroup group01
636  *
637  * @brief FM_RDS_INT_SOURCE property data type
638  *
639  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); page 103
640  * @see also https://en.wikipedia.org/wiki/Radio_Data_System
641  */
642 typedef union {
643  struct
644  {
645  uint8_t RDSRECV : 1; //!< If set, generate RDSINT when RDS FIFO has at least FM_RDS_INT_FIFO_COUNT entries.
646  uint8_t RDSSYNCLOST : 1; //!< If set, generate RDSINT when RDS loses synchronization.
647  uint8_t RDSSYNCFOUND : 1; //!< f set, generate RDSINT when RDS gains synchronization.
648  uint8_t DUMMY1 : 1; //!< Always write to 0.
649  uint8_t RDSNEWBLOCKA : 1; //!< If set, generate an interrupt when Block A data is found or subsequently changed
650  uint8_t RDSNEWBLOCKB : 1; //!< If set, generate an interrupt when Block B data is found or subsequently changed
651  uint8_t DUMMY2 : 5; //!< Reserved - Always write to 0.
652  uint8_t DUMMY3 : 5; //!< Reserved - Always write to 0.
653  } refined;
655 } si47x_rds_int_source;
656 
657 /**
658  * @ingroup group01
659  *
660  * @brief Data type for FM_RDS_CONFIG Property
661  *
662  * IMPORTANT: all block errors must be less than or equal the associated block error threshold for the group
663  * to be stored in the RDS FIFO.
664  * 0 = No errors; 1 = 1–2 bit errors detected and corrected; 2 = 3–5 bit errors detected and corrected; 3 = Uncorrectable.
665  * Recommended Block Error Threshold options:
666  * 2,2,2,2 = No group stored if any errors are uncorrected.
667  * 3,3,3,3 = Group stored regardless of errors.
668  * 0,0,0,0 = No group stored containing corrected or uncorrected errors.
669  * 3,2,3,3 = Group stored with corrected errors on B, regardless of errors on A, C, or D.
670  *
671  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 58 and 104
672  */
673 typedef union {
674  struct
675  {
676  uint8_t RDSEN : 1; //!< 1 = RDS Processing Enable.
677  uint8_t DUMMY1 : 7;
678  uint8_t BLETHD : 2; //!< Block Error Threshold BLOCKD
679  uint8_t BLETHC : 2; //!< Block Error Threshold BLOCKC.
680  uint8_t BLETHB : 2; //!< Block Error Threshold BLOCKB.
681  uint8_t BLETHA : 2; //!< Block Error Threshold BLOCKA.
682  } arg;
684 } si47x_rds_config;
685 
686 /**
687  * @ingroup group01
688  *
689  * @brief Block A data type
690  */
691 typedef union {
692  struct
693  {
694  uint16_t pi;
695  } refined;
696  struct
697  {
698  uint8_t highValue; // Most Significant uint8_t first
699  uint8_t lowValue;
700  } raw;
701 } si47x_rds_blocka;
702 
703 /**
704  * @ingroup group01
705  *
706  * @brief Block B data type
707  *
708  * @details For GCC on System-V ABI on 386-compatible (32-bit processors), the following stands:
709  *
710  * 1) Bit-fields are allocated from right to left (least to most significant).
711  * 2) A bit-field must entirely reside in a storage unit appropriate for its declared type.
712  * Thus a bit-field never crosses its unit boundary.
713  * 3) Bit-fields may share a storage unit with other struct/union members, including members that are not bit-fields.
714  * Of course, struct members occupy different parts of the storage unit.
715  * 4) Unnamed bit-fields' types do not affect the alignment of a structure or union, although individual
716  * bit-fields' member offsets obey the alignment constraints.
717  *
718  * @see also Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 78 and 79
719  * @see also https://en.wikipedia.org/wiki/Radio_Data_System
720  */
721 typedef union {
722  struct
723  {
724  uint16_t address : 2; // Depends on Group Type and Version codes. If 0A or 0B it is the Text Segment Address.
725  uint16_t DI : 1; // Decoder Controll bit
726  uint16_t MS : 1; // Music/Speech
727  uint16_t TA : 1; // Traffic Announcement
728  uint16_t programType : 5; // PTY (Program Type) code
729  uint16_t trafficProgramCode : 1; // (TP) => 0 = No Traffic Alerts; 1 = Station gives Traffic Alerts
730  uint16_t versionCode : 1; // (B0) => 0=A; 1=B
731  uint16_t groupType : 4; // Group Type code.
732  } group0;
733  struct
734  {
735  uint16_t address : 4; // Depends on Group Type and Version codes. If 2A or 2B it is the Text Segment Address.
736  uint16_t textABFlag : 1; // Do something if it chanhes from binary "0" to binary "1" or vice-versa
737  uint16_t programType : 5; // PTY (Program Type) code
738  uint16_t trafficProgramCode : 1; // (TP) => 0 = No Traffic Alerts; 1 = Station gives Traffic Alerts
739  uint16_t versionCode : 1; // (B0) => 0=A; 1=B
740  uint16_t groupType : 4; // Group Type code.
741  } group2;
742  struct
743  {
744  uint16_t content : 4; // Depends on Group Type and Version codes.
745  uint16_t textABFlag : 1; // Do something if it chanhes from binary "0" to binary "1" or vice-versa
746  uint16_t programType : 5; // PTY (Program Type) code
747  uint16_t trafficProgramCode : 1; // (TP) => 0 = No Traffic Alerts; 1 = Station gives Traffic Alerts
748  uint16_t versionCode : 1; // (B0) => 0=A; 1=B
749  uint16_t groupType : 4; // Group Type code.
750  } refined;
751  struct
752  {
753  uint8_t lowValue;
754  uint8_t highValue; // Most Significant byte first
755  } raw;
756 } si47x_rds_blockb;
757 
758 /*
759  *
760  *
761  * Group type 4A ( RDS Date and Time)
762  * When group type 4A is used by the station, it shall be transmitted every minute according to EN 50067.
763  * This Structure uses blocks 2,3 and 5 (B,C,D)
764  *
765  * Commented due to “Crosses boundary” on GCC 32-bit plataform.
766  */
767 /*
768 typedef union {
769  struct
770  {
771  uint32_t offset : 5; // Local Time Offset
772  uint32_t offset_sense : 1; // Local Offset Sign ( 0 = + , 1 = - )
773  uint32_t minute : 6; // UTC Minutes
774  uint32_t hour : 5; // UTC Hours
775  uint32_t mjd : 17; // Modified Julian Day Code
776  } refined;
777  uint8_t raw[6];
778 } si47x_rds_date_time;
779 */
780 
781 /**
782  * @ingroup group01
783  *
784  * Group type 4A ( RDS Date and Time)
785  * When group type 4A is used by the station, it shall be transmitted every minute according to EN 50067.
786  * This Structure uses blocks 2,3 and 5 (B,C,D)
787  *
788  * ATTENTION:
789  * To make it compatible with 8, 16 and 32 bits platforms and avoid Crosses boundary, it was necessary to
790  * split minute and hour representation.
791  */
792 typedef union {
793  struct
794  {
795  uint8_t offset : 5; // Local Time Offset
796  uint8_t offset_sense : 1; // Local Offset Sign ( 0 = + , 1 = - )
797  uint8_t minute1 : 2; // UTC Minutes - 2 bits less significant (void “Crosses boundary”).
798  uint8_t minute2 : 4; // UTC Minutes - 4 bits more significant (void “Crosses boundary”)
799  uint8_t hour1 : 4; // UTC Hours - 4 bits less significant (void “Crosses boundary”)
800  uint8_t hour2 : 1; // UTC Hours - 4 bits more significant (void “Crosses boundary”)
801  uint32_t mjd : 17; // Modified Julian Day Code
802  } refined;
804 } si47x_rds_date_time;
805 
806 /**
807  * @ingroup group01
808  *
809  * AGC data types
810  * FM / AM and SSB structure to AGC
811  *
812  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); For FM page 80; for AM page 142
813  * @see AN332 REV 0.8 Universal Programming Guide Amendment for SI4735-D60 SSB and NBFM patches; page 18.
814  */
815 typedef union {
816  struct
817  {
818  // status ("RESP0")
819  uint8_t STCINT : 1;
820  uint8_t DUMMY1 : 1;
821  uint8_t RDSINT : 1; // Not used for AM/SSB
822  uint8_t RSQINT : 1;
823  uint8_t DUMMY2 : 2;
824  uint8_t ERR : 1;
825  uint8_t CTS : 1;
826  // RESP1
827  uint8_t AGCDIS : 1; // This bit indicates if the AGC is enabled or disabled. 0 = AGC enabled; 1 = AGC disabled.
828  uint8_t DUMMY : 7;
829  // RESP2
830  uint8_t AGCIDX; // For FM (5 bits - READ_LNA_GAIN_INDEX - 0 = Minimum attenuation (max gain)). For AM (8 bits). This byte reports the current AGC gain index.
831  } refined;
833 } si47x_agc_status;
834 
835 /**
836  * @ingroup group01
837  *
838  * If FM, Overrides AGC setting by disabling the AGC and forcing the LNA to have a certain gain that ranges between 0
839  * (minimum attenuation) and 26 (maximum attenuation).
840  * If AM, overrides the AGC setting by disabling the AGC and forcing the gain index that ranges between 0
841  *
842  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); For FM page 81; for AM page 143
843  */
844 typedef union {
845  struct
846  {
847  // ARG1
848  uint8_t AGCDIS : 1; // if set to 1 indicates if the AGC is disabled. 0 = AGC enabled; 1 = AGC disabled.
849  uint8_t DUMMY : 7;
850  // ARG2
851  uint8_t AGCIDX; // AGC Index; If AMAGCDIS = 1, this byte forces the AGC gain index; 0 = Minimum attenuation (max gain)
852  } arg;
854 } si47x_agc_overrride;
855 
856 /**
857  * @ingroup group01
858  *
859  * The bandwidth of the AM channel filter data type
860  * AMCHFLT values: 0 = 6 kHz Bandwidth
861  * 1 = 4 kHz Bandwidth
862  * 2 = 3 kHz Bandwidth
863  * 3 = 2 kHz Bandwidth
864  * 4 = 1 kHz Bandwidth
865  * 5 = 1.8 kHz Bandwidth
866  * 6 = 2.5 kHz Bandwidth, gradual roll off
867  * 7–15 = Reserved (Do not use)
868  *
869  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 125 and 151
870  */
871 typedef union {
872  struct
873  {
874  uint8_t AMCHFLT : 4; //!< Selects the bandwidth of the AM channel filter.
875  uint8_t DUMMY1 : 4;
876  uint8_t AMPLFLT : 1; //!< Enables the AM Power Line Noise Rejection Filter.
877  uint8_t DUMMY2 : 7;
878  } param;
880 } si47x_bandwidth_config; // AM_CHANNEL_FILTER
881 
882 /**
883  * @ingroup group01
884  *
885  * SSB - datatype for SSB_MODE (property 0x0101)
886  *
887  * @see AN332 REV 0.8 UNIVERSAL PROGRAMMING GUIDE; page 24
888  */
889 typedef union {
890  struct
891  {
892  uint8_t AUDIOBW : 4; //!< 0 = 1.2KHz (default); 1=2.2KHz; 2=3KHz; 3=4KHz; 4=500Hz; 5=1KHz
893  uint8_t SBCUTFLT : 4; //!< SSB side band cutoff filter for band passand low pass filter
894  uint8_t AVC_DIVIDER : 4; //!< set 0 for SSB mode; set 3 for SYNC mode;
895  uint8_t AVCEN : 1; //!< SSB Automatic Volume Control (AVC) enable; 0=disable; 1=enable (default);
896  uint8_t SMUTESEL : 1; //!< SSB Soft-mute Based on RSSI or SNR
897  uint8_t DUMMY1 : 1; //!< Always write 0;
898  uint8_t DSP_AFCDIS : 1; //!< 0=SYNC MODE, AFC enable; 1=SSB MODE, AFC disable.
899  } param;
901 } si47x_ssb_mode;
902 
903 /**
904  * @ingroup group01
905  *
906  * @brief Digital audio output format data structure (Property 0x0102. DIGITAL_OUTPUT_FORMAT).
907  *
908  * @details Used to configure: DCLK edge, data format, force mono, and sample precision.
909  *
910  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); page 195.
911  */
912 typedef union {
913  struct
914  {
915  uint8_t OSIZE : 2; //!< Digital Output Audio Sample Precision (0=16 bits, 1=20 bits, 2=24 bits, 3=8bits).
916  uint8_t OMONO : 1; //!< Digital Output Mono Mode (0=Use mono/stereo blend ).
917  uint8_t OMODE : 4; //!< Digital Output Mode (0000=I2S, 0110 = Left-justified, 1000 = MSB at second DCLK after DFS pulse, 1100 = MSB at first DCLK after DFS pulse).
918  uint8_t OFALL : 1; //!< Digital Output DCLK Edge (0 = use DCLK rising edge, 1 = use DCLK falling edge)
919  uint8_t dummy : 8; //!< Always 0.
920  } refined;
922 } si4735_digital_output_format;
923 
924 /**
925  * @ingroup group01
926  * @brief patch header stored in a eeprom
927  * @details This data type represents o header of a eeprom with a patch content
928  * @details This structure will be used to read an eeprom generated by leo sketch SI47XX_09_SAVE_SSB_PATCH_EEPROM.ino.
929  * @details The sketch SI47XX_09_SAVE_SSB_PATCH_EEPROM can be found on Examples/SI47XX_TOOLS folder
930  */
931 typedef union {
932  struct
933  {
934  uint8_t reserved[8]; // Not used
935  uint8_t status[8]; // Note used
936  uint8_t patch_id[14]; // Patch name
937  uint16_t patch_size; // Patch size (in bytes)
938  } refined;
940 } si4735_eeprom_patch_header;
941 
942 /**
943  * @ingroup group01
944  *
945  * @brief Digital audio output sample structure (Property 0x0104. DIGITAL_OUTPUT_SAMPLE_RATE).
946  *
947  * @details Used to enable digital audio output and to configure the digital audio output sample rate in samples per second (sps).
948  *
949  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); page 196.
950  */
951 typedef struct
952 {
953  uint16_t DOSR; // Digital Output Sample Rate(32–48 ksps .0 to disable digital audio output).
954 } si4735_digital_output_sample_rate; // Maybe not necessary
955 
956 volatile static bool data_from_si4735; /** @ingroup group04 store the interrupt status */
957 
958 /**
959  * @brief Interrupt Function
960  *
961  * @details this function just set the volatile static bool data_from_si4735 to true;
962  *
963  * If you are using interrupt feature, this function will be called by the system, not by you.
964  * If you are not using interrupt feature, please, ignore the compile message:
965  * "warning: 'void interrupt_hundler()' defined but not used [-Wunused-function]"
966  */
967 static void interrupt_hundler()
968 {
969  data_from_si4735 = true;
970 };
971 
972 /**********************************************************************
973  * SI4735 Class definition
974  **********************************************************************/
975 
976 /**
977  * @brief SI4735 Class
978  *
979  * @details This class implements all functions to help you to control the Si47XX devices.
980  * This library was built based on “Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0)”.
981  * It also can be used on all members of the SI473X family respecting, of course, the features available
982  * for each IC version. These functionalities can be seen in the comparison matrix shown in
983  * table 1 (Product Family Function); pages 2 and 3 of the programming guide.
984  *
985  * @author PU2CLR - Ricardo Lima Caratti
986  */
987 class SI4735
988 {
989 protected:
990  char rds_buffer2A[65]; //!< RDS Radio Text buffer - Program Information
991  char rds_buffer2B[33]; //!< RDS Radio Text buffer - Station Informaation
992  char rds_buffer0A[9]; //!< RDS Basic tuning and switching information (Type 0 groups)
993  char rds_time[20]; //!< RDS date time received information
994 
995  int rdsTextAdress2A; //!< rds_buffer2A current position
996  int rdsTextAdress2B; //!< rds_buffer2B current position
997  int rdsTextAdress0A; //!< rds_buffer0A current position
998 
999  int16_t deviceAddress = SI473X_ADDR_SEN_LOW; //!< Stores the current I2C bus address.
1000 
1001  // Delays
1002  uint16_t maxDelaySetFrequency = MAX_DELAY_AFTER_SET_FREQUENCY; //!< Stores the maximum delay after set frequency command (in ms).
1003  uint16_t maxDelayAfterPouwerUp = MAX_DELAY_AFTER_POWERUP; //!< Stores the maximum delay you have to setup after a power up command (in ms).
1004  unsigned long maxSeekTime = MAX_SEEK_TIME; //!< Stores the maximum time (ms) for a seeking process. Defines the maximum seeking time.
1005 
1007  uint8_t resetPin; //!< pin used on Arduino Board to RESET the Si47XX device
1008  uint8_t interruptPin; //!< pin used on Arduino Board to control interrupt. If -1, interrupt is no used.
1009 
1010  uint8_t currentTune; //!< tell the current tune (FM, AM or SSB)
1011 
1012  uint16_t currentMinimumFrequency; //!< minimum frequency of the current band
1013  uint16_t currentMaximumFrequency; //!< maximum frequency of the current band
1014  uint16_t currentWorkFrequency; //!< current frequency
1015 
1016  uint16_t currentStep; //!< Stores the current step used to increment or decrement the frequency.
1017 
1018  uint8_t lastMode = -1; //!< Stores the last mode used.
1019 
1020  uint8_t currentAvcAmMaxGain = 48; //!< Stores the current Automatic Volume Control Gain for AM. Default value is 48.
1021  uint8_t currentClockType = XOSCEN_CRYSTAL; //!< Stores the current clock type used (Crystal or REF CLOCK)
1022  uint8_t currentInterruptEnable = 0; //!< If you are using interrupt, this variable stores 1.
1023 
1024  uint16_t refClock = 31768; //!< Frequency of Reference Clock in Hz.
1025  uint16_t refClockPrescale = 1; //!< Prescaler for Reference Clock (divider).
1026  uint8_t refClockSourcePin = 0; //!< 0 = RCLK pin is clock source; 1 = DCLK pin is clock source.
1027 
1028  si47x_frequency currentFrequency; //!< data structure to get current frequency
1029  si47x_set_frequency currentFrequencyParams;
1030  si47x_rqs_status currentRqsStatus; //!< current Radio SIgnal Quality status
1031  si47x_response_status currentStatus; //!< current device status
1032  si47x_firmware_information firmwareInfo; //!< firmware information
1033  si47x_rds_status currentRdsStatus; //!< current RDS status
1034  si47x_agc_status currentAgcStatus; //!< current AGC status
1035  si47x_ssb_mode currentSSBMode; //!< indicates if USB or LSB
1036 
1037 
1038  si473x_powerup powerUp;
1039 
1040  uint8_t volume = 32; //!< Stores the current vlume setup (0-63).
1041 
1042  uint8_t currentAudioMode = SI473X_ANALOG_AUDIO; //!< Current audio mode used (ANALOG or DIGITAL or both)
1044 
1045  bool controlMcu = false;
1049 
1050  void waitInterrupr(void);
1051  si47x_status getInterruptStatus();
1052 
1053  void setGpioCtl(uint8_t GPO1OEN, uint8_t GPO2OEN, uint8_t GPO3OEN);
1054  void setGpio(uint8_t GPO1LEVEL, uint8_t GPO2LEVEL, uint8_t GPO3LEVEL);
1055  void setGpioIen(uint8_t STCIEN, uint8_t RSQIEN, uint8_t ERRIEN, uint8_t CTSIEN, uint8_t STCREP, uint8_t RSQREP);
1056 
1057  void sendProperty(uint16_t propertyNumber, uint16_t param);
1058 
1059  void sendSSBModeProperty();
1060  void disableFmDebug();
1061  void clearRdsBuffer2A();
1062  void clearRdsBuffer2B();
1063  void clearRdsBuffer0A();
1064 
1065 public:
1066  SI4735();
1067  void reset(void);
1068  void waitToSend(void);
1069 
1070  void setup(uint8_t resetPin, uint8_t defaultFunction);
1071  void setup(uint8_t resetPin, int interruptPin, uint8_t defaultFunction, uint8_t audioMode = SI473X_ANALOG_AUDIO, uint8_t clockType = XOSCEN_CRYSTAL);
1072 
1073  void setRefClock(uint16_t refclk);
1074  void setRefClockPrescaler(uint16_t prescale, uint8_t rclk_sel = 0);
1075 
1077 
1078  /**
1079  * @ingroup group10 Generic set and get property
1080  *
1081  * @brief Sets a given SI47XX device property
1082  *
1083  * @details Sets the Si47XX device with a given attribute.
1084  * @details You might need to use the bit operations or some bit field structure to set right the values.
1085  * @details Used this function instead of the sendProperty.
1086  *
1087  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 55, 69, 124 and 134.
1088  * @see getProperty, sendProperty
1089  * @param propertyNumber
1090  * @param param pamameter value
1091  */
1092  inline void setProperty(uint16_t propertyNumber, uint16_t param)
1093  {
1094  sendProperty(propertyNumber, param);
1095  };
1096 
1097  void sendCommand(uint8_t cmd, int parameter_size, const uint8_t *parameter);
1098  void getCommandResponse(int num_of_bytes, uint8_t *response);
1099  si47x_status getStatusResponse();
1100 
1101  void setPowerUp(uint8_t CTSIEN, uint8_t GPO2OEN, uint8_t PATCH, uint8_t XOSCEN, uint8_t FUNC, uint8_t OPMODE);
1102  void radioPowerUp(void);
1103  void analogPowerUp(void);
1104  void powerDown(void);
1105 
1106  void setFrequency(uint16_t);
1107 
1108  void getStatus(uint8_t, uint8_t);
1109 
1110  uint16_t getFrequency(void);
1111 
1112  /**
1113  * STATUS RESPONSE
1114  * Set of methods to get current status information. Call them after getStatus or getFrequency or seekStation
1115  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 63
1116  */
1117 
1118  /**
1119  * @brief Get the Signal Quality Interrupt status
1120  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 63
1121  * @return RDSINT status
1122  */
1124  {
1125  return currentStatus.resp.RSQINT;
1126  };
1127 
1128  /**
1129  * @brief Get the Radio Data System (RDS) Interrupt status
1130  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); page 63
1131  * @return RDSINT status
1132  */
1134  {
1135  return currentStatus.resp.RDSINT;
1136  };
1137 
1138  /**
1139  * @brief Get the Tune Complete status
1140  * @details Seek/Tune Complete Interrupt; 1 = Tune complete has been triggered.
1141  * @return STCINT status
1142  */
1144  {
1145  return currentStatus.resp.STCINT;
1146  };
1147 
1148  /**
1149  * @brief Get the Status Error
1150  * @details Return the Error flag (true or false) of status of the least Tune or Seek
1151  * @return Error flag
1152  */
1153  inline bool getStatusError()
1154  {
1155  return currentStatus.resp.ERR;
1156  };
1157 
1158  /**
1159  * @brief Gets the Error flag Clear to Send
1160  *
1161  * @return CTS
1162  */
1163  inline bool getStatusCTS() { return currentStatus.resp.CTS; };
1164 
1165  /**
1166  * @brief Returns true if the AFC rails (AFC Rail Indicator).
1167  *
1168  * @return true
1169  */
1170  inline bool getACFIndicator()
1171  {
1172  return currentStatus.resp.AFCRL;
1173  };
1174 
1175  /**
1176  * @brief Returns true if a seek hit the band limit
1177  *
1178  * @details (WRAP = 0 in FM_START_SEEK) or wrapped to the original frequency(WRAP = 1).
1179  *
1180  * @return BLTF
1181  */
1182  inline bool getBandLimit()
1183  {
1184  return currentStatus.resp.BLTF;
1185  };
1186 
1187  /**
1188  * @brief Gets the channel status
1189  *
1190  * @details Returns true if the channel is currently valid as determined by the seek/tune properties (0x1403, 0x1404, 0x1108)
1191  *
1192  * @return true
1193  * @return false
1194  */
1195  inline bool getStatusValid()
1196  {
1197  return currentStatus.resp.VALID;
1198  };
1199 
1200  /**
1201  * @brief Returns the value of Received Signal Strength Indicator (dBμV).
1202  *
1203  * @return uint8_t
1204  */
1206  {
1207  return currentStatus.resp.RSSI;
1208  };
1209 
1210  /**
1211  * @brief Gets the SNR metric when tune is complete (dB)
1212  *
1213  * @details Returns the value of the SNR metric when tune is complete (dB).
1214  *
1215  * @return uint8_t
1216  */
1218  {
1219  return currentStatus.resp.SNR;
1220  };
1221 
1222  /**
1223  * @brief Get the Status the M U L T
1224  *
1225  * @details Returns the value containing the multipath metric when tune is complete.
1226  *
1227  * @return uint8_t
1228  */
1230  {
1231  return currentStatus.resp.MULT;
1232  };
1233 
1234  /**
1235  * @brief Get the Antenna Tuning Capacitor value
1236  *
1237  * @details Returns the current antenna tuning capacitor value.
1238  *
1239  * @return uint8_t capacitance
1240  */
1242  {
1243  return currentStatus.resp.READANTCAP;
1244  };
1245 
1246  void getAutomaticGainControl(); //!< Queries Automatic Gain Control STATUS
1247 
1248  /**
1249  * @brief Sets the Avc Am Max Gain to 48dB
1250  *
1251  */
1252  inline void setAvcAmMaxGain()
1253  {
1254  sendProperty(AM_AUTOMATIC_VOLUME_CONTROL_MAX_GAIN, ((currentAvcAmMaxGain = 48) * 340));
1255  };
1256 
1257  void setAvcAmMaxGain(uint8_t gain); //!< Sets the maximum gain for automatic volume control.
1258 
1259  /**
1260  * @brief Get the current Avc Am Max Gain
1261  *
1262  * @return uint8_t Current AVC gain index value
1263  */
1265  {
1266  return currentAvcAmMaxGain;
1267  };
1268 
1269  /**
1270  * @brief Sets the Am Soft Mute Max Attenuation
1271  *
1272  * @details This function can be useful to disable Soft Mute. The value 0 disable soft mute.
1273  * @details Specified in units of dB. Default maximum attenuation is 8 dB. It works for AM and SSB.
1274  *
1275  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); page 158.
1276  *
1277  * @param smattn Maximum attenuation to apply when in soft mute
1278  */
1279  inline void setAmSoftMuteMaxAttenuation(uint8_t smattn = 0)
1280  {
1281  sendProperty(AM_SOFT_MUTE_MAX_ATTENUATION, smattn);
1282  };
1283 
1284  /**
1285  * @brief Sets the SSB Soft Mute Max Attenuation object
1286  *
1287  * @details Sets maximum attenuation during soft mute (dB). Set to 0 to disable soft mute.
1288  * @details Specified in units of dB. Default maximum attenuation is 8 dB.
1289  * @details You can use setAmSoftMuteMaxAttenuation instead. Same AM property values.
1290  * @param smattn Maximum attenuation to apply when in soft mute.
1291  */
1292  inline void setSsbSoftMuteMaxAttenuation(uint8_t smattn = 0)
1293  {
1294  sendProperty(SSB_SOFT_MUTE_MAX_ATTENUATION, smattn);
1295  };
1296 
1297  /**
1298  * @brief Checks if the AGC is enabled
1299  *
1300  * @return true if the AGC is enabled
1301  */
1302  inline bool isAgcEnabled()
1303  {
1304  return !currentAgcStatus.refined.AGCDIS;
1305  };
1306 
1307  /**
1308  * @brief Gets the current AGC gain index
1309  *
1310  * @return uint8_t The current AGC gain index.
1311  */
1313  {
1314  return currentAgcStatus.refined.AGCIDX;
1315  };
1316 
1317  void setAutomaticGainControl(uint8_t AGCDIS, uint8_t AGCIDX);
1318 
1319  void getCurrentReceivedSignalQuality(uint8_t INTACK);
1321 
1322  // AM and FM
1323 
1324  /**
1325  * @brief Get the current receive signal strength (0–127 dBμV)
1326  *
1327  * @return uint8_t a value between 0 to 127
1328  */
1330  {
1331  return currentRqsStatus.resp.RSSI;
1332  };
1333 
1334  /**
1335  * @brief Gets the current SNR metric (0–127 dB).
1336  *
1337  * @return uint8_t SNR value in dB (0-127)
1338  */
1340  {
1341  return currentRqsStatus.resp.SNR;
1342  };
1343 
1344  /**
1345  * @brief Checks if RSSI detected is LOW.
1346  *
1347  * @return true if RSSI is low
1348  */
1350  {
1351  return currentRqsStatus.resp.RSSIILINT;
1352  };
1353 
1354  /**
1355  * @brief Checks if RSSI detected is high
1356  *
1357  * @return true if RSSI detected is high
1358  */
1360  {
1361  return currentRqsStatus.resp.RSSIHINT;
1362  };
1363 
1364  /**
1365  * @brief Checks if SNR detect is low
1366  *
1367  * @return true if SNR detected is low
1368  */
1370  {
1371  return currentRqsStatus.resp.SNRLINT;
1372  };
1373 
1374  /**
1375  * @brief Checks if SNR detect is high
1376  *
1377  * @return true if SNR detect is high
1378  */
1380  {
1381  return currentRqsStatus.resp.SNRHINT;
1382  };
1383 
1384  /**
1385  * @brief Checks if the current channel is valid
1386  *
1387  * @return true if the current channel is valid
1388  */
1390  {
1391  return currentRqsStatus.resp.VALID;
1392  };
1393 
1394  /**
1395  * @brief AFC Rail Indicator
1396  *
1397  * @return true or false
1398  */
1400  {
1401  return currentRqsStatus.resp.AFCRL;
1402  };
1403 
1404  /**
1405  * @brief Soft Mute Indicator.
1406  *
1407  * @details Indicates soft mute is engaged.
1408  *
1409  * @return true if soft mute indicates is engaged.
1410  */
1412  {
1413  return currentRqsStatus.resp.SMUTE;
1414  };
1415 
1416  // Just FM
1417 
1418  /**
1419  * @brief Gets the value of the amount of stereo blend in % (100 = full stereo, 0 = full mono).
1420  *
1421  * @return uint8_t value (0 to 100)
1422  */
1424  {
1425  return currentRqsStatus.resp.STBLEND;
1426  };
1427 
1428  /**
1429  * @brief Checks the current pilot
1430  *
1431  * @details Indicates stereo pilot presence.
1432  *
1433  * @return true if stereo pilot presence has detected
1434  */
1435  inline bool getCurrentPilot()
1436  {
1437  return currentRqsStatus.resp.PILOT;
1438  };
1439 
1440  /**
1441  * @brief Gets the current Multipath
1442  *
1443  * @details Contains the current multipath metric. (0 = no multipath; 100 = full multipath)
1444  *
1445  * @return uint8_t value (0 to 100)
1446  */
1448  {
1449  return currentRqsStatus.resp.MULT;
1450  };
1451 
1452  inline uint8_t getCurrentSignedFrequencyOffset() { return currentRqsStatus.resp.FREQOFF; }; //!< Signed frequency offset (kHz).
1453  inline bool getCurrentMultipathDetectLow() { return currentRqsStatus.resp.MULTLINT; }; //!< Multipath Detect Low.
1454  inline bool getCurrentMultipathDetectHigh() { return currentRqsStatus.resp.MULTHINT; }; //!< Multipath Detect High
1455  inline bool getCurrentBlendDetectInterrupt() { return currentRqsStatus.resp.BLENDINT; }; //!< Blend Detect Interrupt
1456 
1457  /*
1458  * FIRMWARE RESPONSE
1459  *
1460  * See Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); page 66
1461  */
1462 
1463  inline uint8_t getFirmwarePN() { return firmwareInfo.resp.PN; }; //!< RESP1 - Part Number (HEX)
1464  inline uint8_t getFirmwareFWMAJOR() { return firmwareInfo.resp.FWMAJOR; }; //!< RESP2 - Returns the Firmware Major Revision (ASCII).
1465  inline uint8_t getFirmwareFWMINOR() { return firmwareInfo.resp.FWMINOR; }; //!< RESP3 - Returns the Firmware Minor Revision (ASCII).
1466  inline uint8_t getFirmwarePATCHH() { return firmwareInfo.resp.PATCHH; }; //!< RESP4 - Returns the Patch ID High byte (HEX).
1467  inline uint8_t getFirmwarePATCHL() { return firmwareInfo.resp.PATCHL; }; //!< RESP5 - Returns the Patch ID Low byte (HEX).
1468  inline uint8_t getFirmwareCMPMAJOR() { return firmwareInfo.resp.CMPMAJOR; }; //!< RESP6 - Returns the Component Major Revision (ASCII).
1469  inline uint8_t getFirmwareCMPMINOR() { return firmwareInfo.resp.CMPMINOR; }; //!< RESP7 - Returns the Component Minor Revision (ASCII).
1470  inline uint8_t getFirmwareCHIPREV() { return firmwareInfo.resp.CHIPREV; }; //!< RESP8 - Returns the Chip Revision (ASCII).
1471 
1472  void setVolume(uint8_t volume);
1473  uint8_t getVolume();
1474  void volumeDown();
1475  void volumeUp();
1476  inline uint8_t getCurrentVolume() { return volume; }; //!< Returns the current volume level.
1477 
1478  /**
1479  * @ingroup group13 Digital Audio setup
1480  * @brief Sets the Audio Mode. See table below.
1481  * @details If you want to change the audio mode, call this function before call setAM(), setFM() or setSSB().
1482  * @details Sets the Si47XX device to use ANALOG or DIGITAL audio output. The table below show the valid values.
1483  * @details This function will only take effect after calling setAM(), setFM() or setSSB().
1484  *
1485  *
1486  * | Macro | Value (Binary) | Description |
1487  * | ----- | ----- | ----------- |
1488  * | SI473X_ANALOG_AUDIO | 0b00000101 | Analog Audio Inputs |
1489  * | SI473X_DIGITAL_AUDIO1 | 0b00001011 | Digital audio output (DCLK, LOUT/DFS, ROUT/DIO) |
1490  * | SI473X_DIGITAL_AUDIO2 | 0b10110000 | Digital audio outputs (DCLK, DFS, DIO) |
1491  * | SI473X_DIGITAL_AUDIO3 | 0b10110101 | Analog and digital audio outputs (LOUT/ROUT and DCLK, DFS,DIO) |
1492  *
1493  * @see setAM(), setFM(), setSSB().
1494  * @param audioMode One of the values options above
1495  */
1496  inline void setAudioMode(uint8_t audioMode)
1497  {
1498  currentAudioMode = audioMode;
1499  };
1500 
1501  void digitalOutputFormat(uint8_t OSIZE, uint8_t OMONO, uint8_t OMODE, uint8_t OFALL);
1502  void digitalOutputSampleRate(uint16_t DOSR);
1503 
1504  void setAudioMute(bool off); // if true mute the audio; else unmute
1505 
1506  void setAM();
1507  void setFM();
1508  void setAM(uint16_t fromFreq, uint16_t toFreq, uint16_t intialFreq, uint16_t step);
1509  void setFM(uint16_t fromFreq, uint16_t toFreq, uint16_t initialFreq, uint16_t step);
1510 
1511  /**
1512  * @brief Sets the FM Receive de-emphasis to 50 or 75 μs.
1513  * @details valid parameters are 1 = 50 μs. Used in Europe, Australia, Japan; 2 = 75 μs. Used in USA (default)
1514  *
1515  * @param parameter 1 or 2 (default 1 - USA)
1516  */
1517  inline void setFMDeEmphasis(uint8_t parameter)
1518  {
1519  sendProperty(FM_DEEMPHASIS, parameter);
1520  };
1521 
1522  /**
1523  * @ingroup group08 Check FM mode status
1524  *
1525  * @brief Returns true if the current function is FM (FM_TUNE_FREQ).
1526  *
1527  * @return true if the current function is FM (FM_TUNE_FREQ).
1528  */
1529  inline bool isCurrentTuneFM()
1530  {
1531  return (currentTune == FM_TUNE_FREQ);
1532  }
1533 
1534  /**
1535  * @ingroup group08 Check AM mode status
1536  *
1537  * @brief Returns true if the current function is AM (AM_TUNE_FREQ).
1538  *
1539  * @return true if the current function is AM (AM_TUNE_FREQ).
1540  */
1541  inline bool isCurrentTuneAM()
1542  {
1543  return (currentTune == AM_TUNE_FREQ);
1544  }
1545 
1546  /**
1547  * @ingroup group08 Check SSB mode status
1548  *
1549  * @brief Returns true if the current function is SSB (SSB_TUNE_FREQ).
1550  *
1551  * @return true if the current function is SSB (SSB_TUNE_FREQ).
1552  */
1553  inline bool isCurrentTuneSSB()
1554  {
1555  return (currentTune == SSB_TUNE_FREQ);
1556  }
1557 
1558  void setBandwidth(uint8_t AMCHFLT, uint8_t AMPLFLT);
1559 
1560  inline uint8_t getTuneFrequencyFast() { return currentFrequencyParams.arg.FAST; }; //!< Returns the FAST tuning status
1561  inline void setTuneFrequencyFast(uint8_t FAST) { currentFrequencyParams.arg.FAST = FAST; }; //!< FAST Tuning. If set, executes fast and invalidated tune. The tune status will not be accurate
1562  inline uint8_t getTuneFrequencyFreeze() { return currentFrequencyParams.arg.FREEZE; }; //!< Returns the FREEZE status
1563  inline void setTuneFrequencyFreeze(uint8_t FREEZE) { currentFrequencyParams.arg.FREEZE = FREEZE; }; //!< Only FM. Freeze Metrics During Alternate Frequency Jump.
1564  void setTuneFrequencyAntennaCapacitor(uint16_t capacitor);
1565 
1566  void frequencyUp();
1567  void frequencyDown();
1568 
1569  void getFirmware(void);
1570 
1571 
1572  void seekStation(uint8_t SEEKUP, uint8_t WRAP); // See WRAP parameter
1573 
1574  /**
1575  * @ingroup group15 Seek
1576  * @brief Sets the maximum time in milliseconds for seeking. The default value is 8000ms (8s).
1577  * @details Depending on the bandwidth, your reception conditions or step configuration, the seek process can take a long time.
1578  * @details This function sets a time limit for seeking process and back the control to the system if the time runs out.
1579  *
1580  * @addindex Seek
1581  *
1582  * @param time_in_ms time in milliseconds.
1583  */
1584  inline void setMaxSeekTime(long time_in_ms) {
1585  this->maxSeekTime = time_in_ms;
1586  };
1587 
1588  /**
1589  * @ingroup group15 Seek
1590  *
1591  * @brief Search for the next station
1592  * @details Seek a station up. Stop when a station is found or the frequency has reached the upper limit
1593  * @see seekStation, seekStationProgress, setSeekAmLimits setSeekFmLimits
1594  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 124, 137, 139, 278
1595  */
1596  inline void seekStationUp()
1597  {
1598  seekStationProgress(NULL, SEEK_UP);
1599  };
1600 
1601  /**
1602  * @ingroup group15 Seek
1603  *
1604  * @brief Search the previous station
1605  * @details Seek a station Down. Stop when a station is found or the frequency has reached the lower limit
1606  * @see seekStation, seekStationProgress, setSeekAmLimits, setSeekFmLimits
1607  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 124, 137, 139, 278
1608  */
1609  inline void seekStationDown()
1610  {
1611  seekStationProgress(NULL, SEEK_DOWN);
1612  };
1613 
1614  void seekNextStation();
1615  void seekPreviousStation();
1616 
1617  void seekStationProgress(void (*showFunc)(uint16_t f), uint8_t up_down);
1618 
1619  // AM Seek property configurations
1620  void setSeekAmLimits(uint16_t bottom, uint16_t top);
1621  void setSeekAmSpacing(uint16_t spacing);
1622  void setSeekAmSrnThreshold(uint16_t value);
1623  void setSeekAmRssiThreshold(uint16_t value);
1624 
1625  // FM Seek property configurations
1626  void setSeekFmLimits(uint16_t bottom, uint16_t top);
1627  void setSeekFmSpacing(uint16_t spacing);
1628  void setSeekFmSrnThreshold(uint16_t value);
1629  void setSeekFmRssiThreshold(uint16_t value);
1630 
1631  void setFmBlendStereoThreshold(uint8_t parameter);
1632  void setFmBlendMonoThreshold(uint8_t parameter);
1633  void setFmBlendRssiStereoThreshold(uint8_t parameter);
1634  void setFmBLendRssiMonoThreshold(uint8_t parameter);
1635  void setFmBlendSnrStereoThreshold(uint8_t parameter);
1636  void setFmBLendSnrMonoThreshold(uint8_t parameter);
1637  void setFmBlendMultiPathStereoThreshold(uint8_t parameter);
1638  void setFmBlendMultiPathMonoThreshold(uint8_t parameter);
1639  void setFmStereoOn();
1640  void setFmStereoOff();
1641 
1642  void RdsInit();
1643  void setRdsIntSource(uint8_t RDSNEWBLOCKB, uint8_t RDSNEWBLOCKA, uint8_t RDSSYNCFOUND, uint8_t RDSSYNCLOST, uint8_t RDSRECV);
1644  void getRdsStatus(uint8_t INTACK, uint8_t MTFIFO, uint8_t STATUSONLY);
1645  void getRdsStatus();
1646 
1647  /**
1648  * @brief Get the Rds Received FIFO
1649  * @details if FIFO is 1, it means the minimum number of groups was filled
1650  * @return true if minimum number of groups was filled.
1651  */
1652  inline bool getRdsReceived()
1653  {
1654  return currentRdsStatus.resp.RDSRECV;
1655  };
1656 
1657  /**
1658  * @brief Get the Rds Sync Lost object
1659  * @details returns true (1) if Lost RDS synchronization is detected.
1660  * @return true if Lost RDS synchronization detected.
1661  */
1662  inline bool getRdsSyncLost()
1663  {
1664  return currentRdsStatus.resp.RDSSYNCLOST;
1665  };
1666 
1667  /**
1668  * @brief Get the Rds Sync Found
1669  * @details return true if found RDS synchronization
1670  * @return true if found RDS synchronization
1671  */
1672  inline bool getRdsSyncFound()
1673  {
1674  return currentRdsStatus.resp.RDSSYNCFOUND;
1675  };
1676 
1677  /**
1678  * @brief Get the Rds New Block A
1679  *
1680  * @details Returns true if valid Block A data has been received.
1681  * @return true or false
1682  */
1683  inline bool getRdsNewBlockA()
1684  {
1685  return currentRdsStatus.resp.RDSNEWBLOCKA;
1686  };
1687 
1688  /**
1689  * @brief Get the Rds New Block B
1690  * @details Returns true if valid Block B data has been received.
1691  * @return true or false
1692  */
1693  inline bool getRdsNewBlockB()
1694  {
1695  return currentRdsStatus.resp.RDSNEWBLOCKB;
1696  };
1697 
1698  /**
1699  * @brief Get the Rds Sync
1700  * @details Returns true if RDS currently synchronized.
1701  * @return true or false
1702  */
1703  inline bool getRdsSync()
1704  {
1705  return currentRdsStatus.resp.RDSSYNC;
1706  };
1707 
1708  /**
1709  * @brief Get the Group Lost
1710  * @details Returns true if one or more RDS groups discarded due to FIFO overrun.
1711  * @return true or false
1712  */
1713  inline bool getGroupLost()
1714  {
1715  return currentRdsStatus.resp.GRPLOST;
1716  };
1717 
1718  /**
1719  * @brief Get the Num Rds Fifo Used
1720  * @details Return the number of RDS FIFO used
1721  * @return uint8_t Total RDS FIFO used
1722  */
1724  {
1725  return currentRdsStatus.resp.RDSFIFOUSED;
1726  };
1727 
1728  void setRdsConfig(uint8_t RDSEN, uint8_t BLETHA, uint8_t BLETHB, uint8_t BLETHC, uint8_t BLETHD);
1729  uint16_t getRdsPI(void);
1730  uint8_t getRdsGroupType(void);
1731  uint8_t getRdsFlagAB(void);
1732  uint8_t getRdsVersionCode(void);
1733  uint8_t getRdsProgramType(void);
1735 
1736  char *getRdsText(void);
1737  char *getRdsText0A(void); // Gets the Station name
1738  char *getRdsText2A(void); // Gets the Radio Text
1739  char *getRdsText2B(void);
1740 
1741  char *getRdsTime(void);
1742 
1743  void getNext2Block(char *);
1744  void getNext4Block(char *);
1745 
1746  void ssbSetup();
1747  void setSSBBfo(int offset);
1748  void setSSBConfig(uint8_t AUDIOBW, uint8_t SBCUTFLT, uint8_t AVC_DIVIDER, uint8_t AVCEN, uint8_t SMUTESEL, uint8_t DSP_AFCDIS);
1749  void setSSB(uint16_t fromFreq, uint16_t toFreq, uint16_t intialFreq, uint16_t step, uint8_t usblsb);
1750  void setSSB(uint8_t usblsb);
1751  void setSSBAudioBandwidth(uint8_t AUDIOBW);
1752  void setSSBAutomaticVolumeControl(uint8_t AVCEN);
1753  void setSBBSidebandCutoffFilter(uint8_t SBCUTFLT);
1754  void setSSBAvcDivider(uint8_t AVC_DIVIDER);
1755  void setSSBDspAfc(uint8_t DSP_AFCDIS);
1756  void setSSBSoftMute(uint8_t SMUTESEL);
1757 
1758  si47x_firmware_query_library queryLibraryId();
1759  void patchPowerUp();
1760  bool downloadPatch(const uint8_t *ssb_patch_content, const uint16_t ssb_patch_content_size);
1761  si4735_eeprom_patch_header downloadPatchFromEeprom(int eeprom_i2c_address);
1762  void ssbPowerUp();
1763 
1764  /**
1765  * @ingroup group06 Si47XX device Power Up
1766  * @brief Set the Max Delay Power Up
1767  * @details Sets the delay needed in ms after a powerup command (default is 10ms).
1768  * @details Some crystal oscillator might need more time to become stable (500 ms is the recommended).
1769  * @details Low values make the load SSB patch faster. However, it can make the system unstable.
1770  *
1771  * @see MAX_DELAY_AFTER_POWERUP
1772  * @param ms delay in ms
1773  */
1774  inline void setMaxDelayPowerUp(uint16_t ms)
1775  {
1776  this->maxDelayAfterPouwerUp = ms;
1777  }
1778 
1779  /**
1780  * @ingroup group08 Tune Frequency
1781  * @brief Set the Max Delay after Set Frequency
1782  *
1783  * @details After the set frequency command, the system need a time to get ready to the next set frequency (default value 30ms).
1784  * @details Why the waitToSend() does not work in this case? No idea for while!
1785  * @details A low value makes the getFrequency command inaccurate.
1786  *
1787  * @see MAX_DELAY_AFTER_POWERUP
1788  * @param ms
1789  */
1790  inline void setMaxDelaySetFrequency(uint16_t ms)
1791  {
1792  this->maxDelaySetFrequency = ms;
1793  }
1794 
1795  /**
1796  * @ingroup group08 Tune Frequency step
1797  *
1798  * @brief Sets the current step value.
1799  *
1800  * @details This function does not check the limits of the current band. Please, don't take a step bigger than your legs.
1801  * @details Example:
1802  * @code
1803  * setFM(6400,10800,10390,10);
1804  * setFrequencyStep(100); // the step will be 1MHz (you are using FM mode)
1805  * .
1806  * .
1807  * .
1808  * setAM(7000,7600,7100,5);
1809  * setFrequencyStep(1); // the step will be 1KHz (you are usin AM or SSB mode)
1810  * @endcode
1811  *
1812  * @see setFM()
1813  * @see setAM()
1814  * @see setSSB()
1815  *
1816  * @param step if you are using FM, 10 means 100KHz. If you are using AM 10 means 10KHz
1817  * For AM, 1 (1KHz) to 1000 (1MHz) are valid values.
1818  * For FM 5 (50KHz), 10 (100KHz) and 100 (1MHz) are valid values.
1819  */
1820  inline void setFrequencyStep(uint16_t step)
1821  {
1822  this->currentStep = step;
1823  }
1824 
1825  /**
1826  * @ingroup group14 Frequency
1827  *
1828  * @brief Gets the current frequency saved in memory.
1829  *
1830  * @details Unlike getFrequency, this method gets the current frequency recorded after the last setFrequency command.
1831  * @details This method avoids bus traffic and CI processing.
1832  * @details However, you can not get others status information like RSSI.
1833  *
1834  * @see getFrequency()
1835  */
1837  {
1838  return this->currentWorkFrequency;
1839  }
1840 
1841  /**
1842  * @ingroup group14 Si47XX device Status
1843  *
1844  * @brief Gets the current status of the Si47XX (AM, FM or SSB)
1845  *
1846  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 73 (FM) and 139 (AM)
1847  */
1848  inline void getStatus()
1849  {
1850  getStatus(0, 1);
1851  }
1852 
1853  void setDeviceI2CAddress(uint8_t senPin);
1855  void setDeviceOtherI2CAddress(uint8_t i2cAddr);
1856 
1857  /*******************************************************************************
1858  * The functions below modify the clock frequency for I2C communication.
1859  * 100KHz is usually the baseline.
1860  * Use one of these funcition if you have problem on you default configuration.
1861  *******************************************************************************/
1862 
1863  /**
1864  * @ingroup group18 MCU I2C Speed
1865  * @brief Sets I2C bus to 10KHz
1866  */
1867  inline void setI2CLowSpeedMode(void)
1868  {
1869  Wire.setClock(10000);
1870  };
1871 
1872  /**
1873  * @ingroup group18 MCU I2C Speed
1874  *
1875  * @brief Sets I2C bus to 100KHz
1876  */
1877  inline void setI2CStandardMode(void) { Wire.setClock(100000); };
1878 
1879  /**
1880  * @ingroup group18 MCU I2C Speed
1881  *
1882  * @brief Sets I2C bus to 400KHz
1883  */
1884  inline void setI2CFastMode(void)
1885  {
1886  Wire.setClock(400000);
1887  };
1888 
1889  /**
1890  * @ingroup group18 MCU I2C Speed
1891  *
1892  * @brief Sets the I2C bus to a given value.
1893  * ATTENTION: use this function with cation
1894  *
1895  * @param value in Hz. For example: The values 500000 sets the bus to 500KHz.
1896  */
1897  inline void setI2CFastModeCustom(long value = 500000) { Wire.setClock(value); };
1898 
1899  // MCU control. Virtual
1900  virtual void setMcuControl(bool value);
1901  virtual void setMcuWakeUpPin(uint8_t pin);
1902  virtual void mcuWakeUp();
1903  virtual void mcuSleepDown();
1904  virtual void setMcuClockSpeed(uint32_t clock);
1905 
1906  // void setAudioMuteMcuPin(uint8_t pin);
1907  // void setHardwareAudioMute(bool on);
1908 
1909  /**
1910  * @ingroup group18 MCU External Audio Mute
1911  *
1912  * @brief Sets the Audio Mute Mcu Pin
1913  * @details This function sets the mcu digital pin you want to use to control the external audio mute circuit.
1914  * @details Some users may be uncomfortable with the loud popping of the speaker during some transitions caused by some SI47XX commands.
1915  * @details This problem occurs during the transition from the power down to power up.
1916  * @details Every time the user changes the mode (FM to AM or AM to FM) the power down and power up commands are required by the Si47XX devices.
1917  * @details If you have a extra circuit in your receiver to mute the audio on amplifier input, you can configure a MCU pin to control it by using this function.
1918  *
1919  * @see setHardwareAudioMute
1920  * @param pin if 0 ou greater sets the MCU digital pin will be used to control de external circuit.
1921  */
1922  inline void setAudioMuteMcuPin(int8_t pin)
1923  {
1924  audioMuteMcuPin = pin;
1925  pinMode(audioMuteMcuPin, OUTPUT);
1926  };
1927 
1928  /**
1929  * @ingroup group18 MCU External Audio Mute
1930  *
1931  * @brief Sets the Hardware Audio Mute
1932  * @details Turns the Hardware audio mute on or off
1933  *
1934  * @see setAudioMuteMcuPin
1935  *
1936  * @param on True or false
1937  */
1938  inline void setHardwareAudioMute(bool on)
1939  {
1940  digitalWrite(audioMuteMcuPin, on);
1941  delayMicroseconds(300);
1942  }
1943 };
SI4735::setGpioIen
void setGpioIen(uint8_t STCIEN, uint8_t RSQIEN, uint8_t ERRIEN, uint8_t CTSIEN, uint8_t STCREP, uint8_t RSQREP)
Configures the sources for the GPO2/INT interrupt pin.
Definition: SI4735.cpp:206
SI4735::getRdsProgramType
uint8_t getRdsProgramType(void)
Returns the Program Type (extracted from the Block B)
Definition: SI4735.cpp:2173
SSB_SOFT_MUTE_MAX_ATTENUATION
#define SSB_SOFT_MUTE_MAX_ATTENUATION
Definition: SI4735.h:140
SI4735::currentSsbStatus
uint8_t currentSsbStatus
Definition: SI4735.h:1043
SI4735::setRefClockPrescaler
void setRefClockPrescaler(uint16_t prescale, uint8_t rclk_sel=0)
Sets the number used by the prescaler to divide the external RCLK down to the internal REFCLK.
Definition: SI4735.cpp:545
SEEK_DOWN
#define SEEK_DOWN
Definition: SI4735.h:166
SI4735::currentInterruptEnable
uint8_t currentInterruptEnable
If you are using interrupt, this variable stores 1.
Definition: SI4735.h:1022
SI4735::getStatusResponse
si47x_status getStatusResponse()
Gets the first byte response.
Definition: SI4735.cpp:1015
SI4735::getCurrentSnrDetectHigh
bool getCurrentSnrDetectHigh()
Checks if SNR detect is high.
Definition: SI4735.h:1379
FM_BLEND_RSSI_STEREO_THRESHOLD
#define FM_BLEND_RSSI_STEREO_THRESHOLD
Definition: SI4735.h:57
SI4735::downloadPatch
bool downloadPatch(const uint8_t *ssb_patch_content, const uint16_t ssb_patch_content_size)
Transfers the content of a patch stored in a array of bytes to the SI4735 device.
Definition: SI4735.cpp:2897
SI4735::currentFrequency
si47x_frequency currentFrequency
data structure to get current frequency
Definition: SI4735.h:1028
SI4735::setMaxDelayPowerUp
void setMaxDelayPowerUp(uint16_t ms)
Set the Max Delay Power Up.
Definition: SI4735.h:1774
SI4735::isCurrentTuneFM
bool isCurrentTuneFM()
Returns true if the current function is FM (FM_TUNE_FREQ).
Definition: SI4735.h:1529
FM_TUNE_STATUS
#define FM_TUNE_STATUS
Definition: SI4735.h:42
SI4735::patchPowerUp
void patchPowerUp()
This method can be used to prepare the device to apply SSBRX patch.
Definition: SI4735.cpp:2809
SI4735::interruptPin
uint8_t interruptPin
pin used on Arduino Board to control interrupt. If -1, interrupt is no used.
Definition: SI4735.h:1008
SI4735::lastMode
uint8_t lastMode
Stores the last mode used.
Definition: SI4735.h:1018
SI4735::setFMDeEmphasis
void setFMDeEmphasis(uint8_t parameter)
Sets the FM Receive de-emphasis to 50 or 75 μs.
Definition: SI4735.h:1517
SI4735::getAntennaTuningCapacitor
uint8_t getAntennaTuningCapacitor()
Get the Antenna Tuning Capacitor value.
Definition: SI4735.h:1241
MAX_DELAY_AFTER_SET_FREQUENCY
#define MAX_DELAY_AFTER_SET_FREQUENCY
Definition: SI4735.h:168
SI4735::mcuWakeUp
virtual void mcuWakeUp()
Sets the pin that controls some MCU features. You might do something with that.
Definition: SI4735.cpp:3063
SI4735::getAutomaticGainControl
void getAutomaticGainControl()
Queries Automatic Gain Control STATUS.
Definition: SI4735.cpp:1435
SI4735::setProperty
void setProperty(uint16_t propertyNumber, uint16_t param)
Sets a given SI47XX device property.
Definition: SI4735.h:1092
SSB_BFO
#define SSB_BFO
Definition: SI4735.h:132
SI4735::refClockPrescale
uint16_t refClockPrescale
Prescaler for Reference Clock (divider).
Definition: SI4735.h:1025
SI4735::isCurrentTuneAM
bool isCurrentTuneAM()
Returns true if the current function is AM (AM_TUNE_FREQ).
Definition: SI4735.h:1541
SI4735::setFmStereoOn
void setFmStereoOn()
Turn Off Stereo operation.
Definition: SI4735.cpp:1217
SI4735::setFmStereoOff
void setFmStereoOff()
Turn Off Stereo operation.
Definition: SI4735.cpp:1207
SI4735::rds_time
char rds_time[20]
RDS date time received information.
Definition: SI4735.h:993
SI4735::setFM
void setFM(uint16_t fromFreq, uint16_t toFreq, uint16_t initialFreq, uint16_t step)
Sets the radio to FM function.
Definition: SI4735.cpp:856
SI4735::setTuneFrequencyFast
void setTuneFrequencyFast(uint8_t FAST)
Returns the FAST tuning status.
Definition: SI4735.h:1561
SI4735::setSeekAmLimits
void setSeekAmLimits(uint16_t bottom, uint16_t top)
Sets the bottom frequency and top frequency of the AM band for seek. Default is 520 to 1710.
Definition: SI4735.cpp:1728
POWER_UP
#define POWER_UP
Definition: SI4735.h:32
SI4735::getRdsGroupType
uint8_t getRdsGroupType(void)
Returns the Group Type (extracted from the Block B)
Definition: SI4735.cpp:2099
SI4735::getRdsText0A
char * getRdsText0A(void)
Gets the station name and other messages.
Definition: SI4735.cpp:2283
SI4735::refClockSourcePin
uint8_t refClockSourcePin
0 = RCLK pin is clock source; 1 = DCLK pin is clock source.
Definition: SI4735.h:1026
SI4735::maxSeekTime
unsigned long maxSeekTime
Stores the maximum time (ms) for a seeking process. Defines the maximum seeking time.
Definition: SI4735.h:1004
GPO_IEN
#define GPO_IEN
Definition: SI4735.h:131
SI4735::setAvcAmMaxGain
void setAvcAmMaxGain()
Sets the Avc Am Max Gain to 48dB.
Definition: SI4735.h:1252
AM_CURRENT_MODE
#define AM_CURRENT_MODE
Definition: SI4735.h:162
SI4735::getTuneFrequencyFast
uint8_t getTuneFrequencyFast()
Definition: SI4735.h:1560
SI4735::getVolume
uint8_t getVolume()
Gets the current volume level.
Definition: SI4735.cpp:1327
AM_TUNE_FREQ
#define AM_TUNE_FREQ
Definition: SI4735.h:72
SI4735::rds_buffer2B
char rds_buffer2B[33]
RDS Radio Text buffer - Station Informaation.
Definition: SI4735.h:991
XOSCEN_CRYSTAL
#define XOSCEN_CRYSTAL
Definition: SI4735.h:173
SI4735::getRdsSyncLost
bool getRdsSyncLost()
Get the Rds Sync Lost object.
Definition: SI4735.h:1662
SI4735::getRdsPI
uint16_t getRdsPI(void)
Returns the programa type.
Definition: SI4735.cpp:2083
SI4735::setSeekFmRssiThreshold
void setSeekFmRssiThreshold(uint16_t value)
Sets the RSSI threshold for a valid FM Seek/Tune.
Definition: SI4735.cpp:1831
si4735_digital_output_format::raw
uint16_t raw
Definition: SI4735.h:921
FM_AGC_STATUS
#define FM_AGC_STATUS
Definition: SI4735.h:43
SI4735::currentStatus
si47x_response_status currentStatus
current device status
Definition: SI4735.h:1031
SI4735::setGpio
void setGpio(uint8_t GPO1LEVEL, uint8_t GPO2LEVEL, uint8_t GPO3LEVEL)
Sets the output level (high or low) for GPO1, 2, and 3.
Definition: SI4735.cpp:169
SI4735::currentAvcAmMaxGain
uint8_t currentAvcAmMaxGain
Stores the current Automatic Volume Control Gain for AM. Default value is 48.
Definition: SI4735.h:1020
SI4735::seekStation
void seekStation(uint8_t SEEKUP, uint8_t WRAP)
Look for a station (Automatic tune)
Definition: SI4735.cpp:1601
si47x_rds_date_time::raw
uint8_t raw[6]
Definition: SI4735.h:803
SI4735::getGroupLost
bool getGroupLost()
Get the Group Lost.
Definition: SI4735.h:1713
SI4735::getAgcGainIndex
uint8_t getAgcGainIndex()
Gets the current AGC gain index.
Definition: SI4735.h:1312
SI4735::setMcuWakeUpPin
virtual void setMcuWakeUpPin(uint8_t pin)
Sets pin used to wake the MCU up.
Definition: SI4735.cpp:3048
SI4735::setSsbSoftMuteMaxAttenuation
void setSsbSoftMuteMaxAttenuation(uint8_t smattn=0)
Sets the SSB Soft Mute Max Attenuation object.
Definition: SI4735.h:1292
SI4735::setI2CFastModeCustom
void setI2CFastModeCustom(long value=500000)
Sets the I2C bus to a given value. ATTENTION: use this function with cation.
Definition: SI4735.h:1897
FM_RDS_STATUS
#define FM_RDS_STATUS
Definition: SI4735.h:46
SI4735::getStatus
void getStatus()
Gets the current status of the Si47XX (AM, FM or SSB)
Definition: SI4735.h:1848
si47x_set_frequency::raw
uint8_t raw[5]
Definition: SI4735.h:307
SI4735::currentRqsStatus
si47x_rqs_status currentRqsStatus
current Radio SIgnal Quality status
Definition: SI4735.h:1030
si47x_rds_int_source::raw
uint8_t raw[2]
Definition: SI4735.h:654
AM_AGC_OVERRIDE
#define AM_AGC_OVERRIDE
Definition: SI4735.h:77
si47x_rds_config::raw
uint8_t raw[2]
Definition: SI4735.h:683
SI4735::isAgcEnabled
bool isAgcEnabled()
Checks if the AGC is enabled.
Definition: SI4735.h:1302
SI4735::setFM
void setFM()
Sets the radio to FM function.
Definition: SI4735.cpp:788
SI4735::getRdsNewBlockA
bool getRdsNewBlockA()
Get the Rds New Block A.
Definition: SI4735.h:1683
si47x_tune_status::raw
uint8_t raw
Definition: SI4735.h:495
FM_SEEK_TUNE_SNR_THRESHOLD
#define FM_SEEK_TUNE_SNR_THRESHOLD
Definition: SI4735.h:68
SI4735::setVolume
void setVolume(uint8_t volume)
RESP8 - Returns the Chip Revision (ASCII).
Definition: SI4735.cpp:1295
SI4735::getRdsTextSegmentAddress
uint8_t getRdsTextSegmentAddress(void)
Returns the address of the text segment.
Definition: SI4735.cpp:2138
si47x_status::raw
uint8_t raw
Definition: SI4735.h:367
SI4735::setAudioMuteMcuPin
void setAudioMuteMcuPin(int8_t pin)
Sets the Audio Mute Mcu Pin.
Definition: SI4735.h:1922
SI4735::powerDown
void powerDown(void)
Moves the device from powerup to powerdown mode.
Definition: SI4735.cpp:462
SI4735::ssbSetup
void ssbSetup()
Starts the Si473X device on SSB (same AM Mode).
Definition: SI4735.cpp:2827
SI4735::setMaxSeekTime
void setMaxSeekTime(long time_in_ms)
Sets the maximum time in milliseconds for seeking. The default value is 8000ms (8s).
Definition: SI4735.h:1584
SI4735::getCurrentSoftMuteIndicator
bool getCurrentSoftMuteIndicator()
Soft Mute Indicator.
Definition: SI4735.h:1411
SI4735::controlMcu
bool controlMcu
Definition: SI4735.h:1045
SI4735::getFirmwareFWMINOR
uint8_t getFirmwareFWMINOR()
RESP2 - Returns the Firmware Major Revision (ASCII).
Definition: SI4735.h:1465
SI4735::seekNextStation
void seekNextStation()
Search for the next station.
Definition: SI4735.cpp:1644
SI4735::getCurrentMultipath
uint8_t getCurrentMultipath()
Gets the current Multipath.
Definition: SI4735.h:1447
SI4735::waitToSend
void waitToSend(void)
Wait for the si473x is ready (Clear to Send (CTS) status bit have to be 1).
Definition: SI4735.cpp:327
SI4735::getInterruptStatus
si47x_status getInterruptStatus()
Updates bits 6:0 of the status byte.
Definition: SI4735.cpp:94
FM_BLEND_SNR_MONO_THRESHOLD
#define FM_BLEND_SNR_MONO_THRESHOLD
Definition: SI4735.h:60
SI4735::setFmBlendRssiStereoThreshold
void setFmBlendRssiStereoThreshold(uint8_t parameter)
Sets RSSI threshold for stereo blend. (Full stereo above threshold, blend below threshold....
Definition: SI4735.cpp:1117
SI4735::setDeviceOtherI2CAddress
void setDeviceOtherI2CAddress(uint8_t i2cAddr)
Sets the onther I2C Bus Address (for Si470X)
Definition: SI4735.cpp:294
SI4735::digitalOutputFormat
void digitalOutputFormat(uint8_t OSIZE, uint8_t OMONO, uint8_t OMODE, uint8_t OFALL)
Configures the digital audio output format.
Definition: SI4735.cpp:1261
SI4735::getCurrentBlendDetectInterrupt
bool getCurrentBlendDetectInterrupt()
Multipath Detect High.
Definition: SI4735.h:1455
FM_BLEND_RSSI_MONO_THRESHOLD
#define FM_BLEND_RSSI_MONO_THRESHOLD
Definition: SI4735.h:58
FM_CURRENT_MODE
#define FM_CURRENT_MODE
Definition: SI4735.h:161
SI4735::setSeekFmSrnThreshold
void setSeekFmSrnThreshold(uint16_t value)
Sets the SNR threshold for a valid FM Seek/Tune.
Definition: SI4735.cpp:1803
SI4735::frequencyUp
void frequencyUp()
Increments the current frequency on current band/function by using the current step.
Definition: SI4735.cpp:724
SI4735::currentRdsStatus
si47x_rds_status currentRdsStatus
current RDS status
Definition: SI4735.h:1033
SI4735::getCurrentSignedFrequencyOffset
uint8_t getCurrentSignedFrequencyOffset()
Definition: SI4735.h:1452
SI4735::sendCommand
void sendCommand(uint8_t cmd, int parameter_size, const uint8_t *parameter)
Sends a given command to the SI47XX devices.
Definition: SI4735.cpp:974
SI4735::currentSSBMode
si47x_ssb_mode currentSSBMode
indicates if USB or LSB
Definition: SI4735.h:1035
SI4735::audioMuteMcuPin
int8_t audioMuteMcuPin
Definition: SI4735.h:1047
GPIO_SET
#define GPIO_SET
Definition: SI4735.h:79
SI4735::setTuneFrequencyAntennaCapacitor
void setTuneFrequencyAntennaCapacitor(uint16_t capacitor)
Only FM. Freeze Metrics During Alternate Frequency Jump.
Definition: SI4735.cpp:648
AM_SEEK_BAND_BOTTOM
#define AM_SEEK_BAND_BOTTOM
Definition: SI4735.h:111
SI4735::getRdsFlagAB
uint8_t getRdsFlagAB(void)
Returns the current Text Flag A/B
Definition: SI4735.cpp:2116
SI4735::setSeekAmRssiThreshold
void setSeekAmRssiThreshold(uint16_t value)
Sets the RSSI threshold for a valid AM Seek/Tune.
Definition: SI4735.cpp:1817
SI4735::analogPowerUp
void analogPowerUp(void)
You have to call setPowerUp method before.
Definition: SI4735.cpp:447
SI4735::getCurrentReceivedSignalQuality
void getCurrentReceivedSignalQuality(uint8_t INTACK)
Queries the status of the Received Signal Quality (RSQ) of the current channel.
Definition: SI4735.cpp:1536
SI4735::getCurrentAfcRailIndicator
bool getCurrentAfcRailIndicator()
AFC Rail Indicator.
Definition: SI4735.h:1399
si47x_frequency::value
uint16_t value
frequency (integer value)
Definition: SI4735.h:272
SI4735::getRdsNewBlockB
bool getRdsNewBlockB()
Get the Rds New Block B.
Definition: SI4735.h:1693
SI4735::setSSBSoftMute
void setSSBSoftMute(uint8_t SMUTESEL)
Sets SSB Soft-mute Based on RSSI or SNR Selection:
Definition: SI4735.cpp:2570
si47x_seek_am_complement::ANTCAPH
uint8_t ANTCAPH
Definition: SI4735.h:345
SI4735::deviceAddress
int16_t deviceAddress
Stores the current I2C bus address.
Definition: SI4735.h:999
SI4735::setMaxDelaySetFrequency
void setMaxDelaySetFrequency(uint16_t ms)
Set the Max Delay after Set Frequency.
Definition: SI4735.h:1790
SI4735::setSSBConfig
void setSSBConfig(uint8_t AUDIOBW, uint8_t SBCUTFLT, uint8_t AVC_DIVIDER, uint8_t AVCEN, uint8_t SMUTESEL, uint8_t DSP_AFCDIS)
Sets the SSB receiver mode.
Definition: SI4735.cpp:2530
SSB_TUNE_FREQ
#define SSB_TUNE_FREQ
Definition: SI4735.h:83
DIGITAL_OUTPUT_SAMPLE_RATE
#define DIGITAL_OUTPUT_SAMPLE_RATE
Definition: SI4735.h:92
SI4735::setAM
void setAM()
Sets the radio to AM function. It means: LW MW and SW.
Definition: SI4735.cpp:763
SI4735::getFirmwarePN
uint8_t getFirmwarePN()
Blend Detect Interrupt.
Definition: SI4735.h:1463
SI4735::ssbPowerUp
void ssbPowerUp()
This function can be useful for debug and test.
Definition: SI4735.cpp:2839
MAX_DELAY_AFTER_POWERUP
#define MAX_DELAY_AFTER_POWERUP
Definition: SI4735.h:169
SI4735::setFrequencyStep
void setFrequencyStep(uint16_t step)
Sets the current step value.
Definition: SI4735.h:1820
SI4735::clearRdsBuffer2A
void clearRdsBuffer2A()
Clear RDS buffer 2A (text)
Definition: SI4735.cpp:1865
SI4735::seekStationUp
void seekStationUp()
Search for the next station.
Definition: SI4735.h:1596
SI4735::getCurrentRssiDetectLow
bool getCurrentRssiDetectLow()
Checks if RSSI detected is LOW.
Definition: SI4735.h:1349
SI4735::setTuneFrequencyFreeze
void setTuneFrequencyFreeze(uint8_t FREEZE)
Returns the FREEZE status.
Definition: SI4735.h:1563
FM_BLEND_STEREO_THRESHOLD
#define FM_BLEND_STEREO_THRESHOLD
Definition: SI4735.h:55
SI4735::getFirmwareCMPMAJOR
uint8_t getFirmwareCMPMAJOR()
RESP5 - Returns the Patch ID Low byte (HEX).
Definition: SI4735.h:1468
SI4735::setFmBlendMonoThreshold
void setFmBlendMonoThreshold(uint8_t parameter)
Sets RSSI threshold for mono blend (Full mono below threshold, blend above threshold).
Definition: SI4735.cpp:1101
SI4735::currentMinimumFrequency
uint16_t currentMinimumFrequency
minimum frequency of the current band
Definition: SI4735.h:1012
SI4735::getTuneCompleteTriggered
bool getTuneCompleteTriggered()
Get the Tune Complete status.
Definition: SI4735.h:1143
SI4735::setMcuClockSpeed
virtual void setMcuClockSpeed(uint32_t clock)
Sets the Mcu Clock Speed if the platform supports this resource.
Definition: SI4735.cpp:3093
SI4735::volume
uint8_t volume
Stores the current vlume setup (0-63).
Definition: SI4735.h:1040
SI4735::volumeDown
void volumeDown()
Set sound volume level Down
Definition: SI4735.cpp:1353
SI4735::setFmBlendMultiPathStereoThreshold
void setFmBlendMultiPathStereoThreshold(uint8_t parameter)
Sets multipath threshold for stereo blend (Full stereo below threshold, blend above threshold).
Definition: SI4735.cpp:1181
SI4735::getCurrentAvcAmMaxGain
uint8_t getCurrentAvcAmMaxGain()
Get the current Avc Am Max Gain.
Definition: SI4735.h:1264
SI4735::seekPreviousStation
void seekPreviousStation()
Search the previous station.
Definition: SI4735.cpp:1659
SI4735::rdsTextAdress2B
int rdsTextAdress2B
rds_buffer2B current position
Definition: SI4735.h:996
SI4735::rdsTextAdress2A
int rdsTextAdress2A
rds_buffer2A current position
Definition: SI4735.h:995
SI4735::SI4735
SI4735()
Construct a new SI4735::SI4735.
Definition: SI4735.cpp:59
si473x_powerup::raw
uint8_t raw[2]
Raw powerup parameters data. Same arg memory position. So, same content.
Definition: SI4735.h:210
SI4735::getRdsTime
char * getRdsTime(void)
Gets the RDS time and date when the Group type is 4.
Definition: SI4735.cpp:2382
FM_RDS_INT_SOURCE
#define FM_RDS_INT_SOURCE
Definition: SI4735.h:49
SI4735::getStatusCTS
bool getStatusCTS()
Gets the Error flag Clear to Send.
Definition: SI4735.h:1163
si473x_gpio::raw
uint8_t raw
Definition: SI4735.h:231
si47x_rds_command::raw
uint8_t raw
Definition: SI4735.h:577
MAX_SEEK_TIME
#define MAX_SEEK_TIME
Definition: SI4735.h:171
FM_DEEMPHASIS
#define FM_DEEMPHASIS
Definition: SI4735.h:54
SI4735::setPowerUp
void setPowerUp(uint8_t CTSIEN, uint8_t GPO2OEN, uint8_t PATCH, uint8_t XOSCEN, uint8_t FUNC, uint8_t OPMODE)
Set the Power Up parameters for si473X.
Definition: SI4735.cpp:359
SI473X_ADDR_SEN_LOW
#define SI473X_ADDR_SEN_LOW
Definition: SI4735.h:29
SI4735::setAM
void setAM(uint16_t fromFreq, uint16_t toFreq, uint16_t intialFreq, uint16_t step)
Sets the radio to AM (LW/MW/SW) function.
Definition: SI4735.cpp:818
AM_SEEK_FREQ_SPACING
#define AM_SEEK_FREQ_SPACING
Definition: SI4735.h:113
SI4735::maxDelayAfterPouwerUp
uint16_t maxDelayAfterPouwerUp
Stores the maximum delay you have to setup after a power up command (in ms).
Definition: SI4735.h:1003
SI4735::setSSBAudioBandwidth
void setSSBAudioBandwidth(uint8_t AUDIOBW)
SSB Audio Bandwidth for SSB mode.
Definition: SI4735.cpp:2649
SI4735::currentFrequencyParams
si47x_set_frequency currentFrequencyParams
Definition: SI4735.h:1029
SI4735::setSBBSidebandCutoffFilter
void setSBBSidebandCutoffFilter(uint8_t SBCUTFLT)
Sets SBB Sideband Cutoff Filter for band pass and low pass filters.
Definition: SI4735.cpp:2619
DIGITAL_OUTPUT_FORMAT
#define DIGITAL_OUTPUT_FORMAT
Definition: SI4735.h:91
SI4735::setFmBLendSnrMonoThreshold
void setFmBLendSnrMonoThreshold(uint8_t parameter)
Sets SNR threshold for mono blend (Full mono below threshold, blend above threshold).
Definition: SI4735.cpp:1165
SI4735::getRdsText2A
char * getRdsText2A(void)
Gets the Text processed for the 2A group.
Definition: SI4735.cpp:2316
SI4735::setRdsConfig
void setRdsConfig(uint8_t RDSEN, uint8_t BLETHA, uint8_t BLETHB, uint8_t BLETHC, uint8_t BLETHD)
Sets RDS property.
Definition: SI4735.cpp:1928
SI4735::setFmBlendSnrStereoThreshold
void setFmBlendSnrStereoThreshold(uint8_t parameter)
Sets SNR threshold for stereo blend (Full stereo above threshold, blend below threshold).
Definition: SI4735.cpp:1149
SI4735::setSeekAmSrnThreshold
void setSeekAmSrnThreshold(uint16_t value)
Sets the SNR threshold for a valid AM Seek/Tune.
Definition: SI4735.cpp:1787
SI4735::waitInterrupr
void waitInterrupr(void)
Interrupt handle.
Definition: SI4735.cpp:73
si47x_seek_am_complement::ANTCAPL
uint8_t ANTCAPL
Definition: SI4735.h:346
SI4735::getCurrentReceivedSignalQuality
void getCurrentReceivedSignalQuality(void)
Queries the status of the Received Signal Quality (RSQ) of the current channel (FM_RSQ_STATUS)
Definition: SI4735.cpp:1583
si47x_rds_status::raw
uint8_t raw[13]
Definition: SI4735.h:631
SI4735
SI4735 Class.
Definition: SI4735.h:987
SI4735::resetPin
uint8_t resetPin
pin used on Arduino Board to RESET the Si47XX device
Definition: SI4735.h:1007
SI4735::setI2CFastMode
void setI2CFastMode(void)
Sets I2C bus to 400KHz.
Definition: SI4735.h:1884
si4735_eeprom_patch_header::raw
uint8_t raw[32]
Definition: SI4735.h:939
AM_TUNE_STATUS
#define AM_TUNE_STATUS
Definition: SI4735.h:74
si47x_seek_am_complement::ARG2
uint8_t ARG2
Definition: SI4735.h:343
SI4735::setup
void setup(uint8_t resetPin, uint8_t defaultFunction)
Starts the Si473X device.
Definition: SI4735.cpp:619
SI4735::setSSB
void setSSB(uint8_t usblsb)
Set the radio to AM function.
Definition: SI4735.cpp:2672
SI4735::setAmSoftMuteMaxAttenuation
void setAmSoftMuteMaxAttenuation(uint8_t smattn=0)
Sets the Am Soft Mute Max Attenuation.
Definition: SI4735.h:1279
si47x_seek::raw
uint8_t raw
Definition: SI4735.h:329
SI473X_ADDR_SEN_HIGH
#define SI473X_ADDR_SEN_HIGH
Definition: SI4735.h:30
SI4735::refClock
uint16_t refClock
Frequency of Reference Clock in Hz.
Definition: SI4735.h:1024
SI4735::getDeviceI2CAddress
int16_t getDeviceI2CAddress(uint8_t resetPin)
I2C bus address setup.
Definition: SI4735.cpp:235
si47x_agc_overrride::raw
uint8_t raw[2]
Definition: SI4735.h:853
SI4735::setBandwidth
void setBandwidth(uint8_t AMCHFLT, uint8_t AMPLFLT)
Selects the bandwidth of the channel filter for AM reception.
Definition: SI4735.cpp:894
SI4735::getReceivedSignalStrengthIndicator
uint8_t getReceivedSignalStrengthIndicator()
Returns the value of Received Signal Strength Indicator (dBμV).
Definition: SI4735.h:1205
SI4735::setI2CStandardMode
void setI2CStandardMode(void)
Sets I2C bus to 100KHz.
Definition: SI4735.h:1877
SI4735::mcuSleepDown
virtual void mcuSleepDown()
You might want to do something when MCU wakes up.
Definition: SI4735.cpp:3078
SI4735::isCurrentTuneSSB
bool isCurrentTuneSSB()
Returns true if the current function is SSB (SSB_TUNE_FREQ).
Definition: SI4735.h:1553
SI4735::getRadioDataSystemInterrupt
bool getRadioDataSystemInterrupt()
Get the Radio Data System (RDS) Interrupt status.
Definition: SI4735.h:1133
SI4735::getBandLimit
bool getBandLimit()
Returns true if a seek hit the band limit.
Definition: SI4735.h:1182
SI4735::setAudioMode
void setAudioMode(uint8_t audioMode)
Returns the current volume level.
Definition: SI4735.h:1496
SI4735::setSeekFmLimits
void setSeekFmLimits(uint16_t bottom, uint16_t top)
Sets the bottom frequency and top frequency of the FM band for seek. Default is 8750 to 10790.
Definition: SI4735.cpp:1744
SI4735::getNext4Block
void getNext4Block(char *)
Process data received from group 2A.
Definition: SI4735.cpp:2224
SI4735::controlMcuClock
uint32_t controlMcuClock
Definition: SI4735.h:1048
SI4735::setSSB
void setSSB(uint16_t fromFreq, uint16_t toFreq, uint16_t intialFreq, uint16_t step, uint8_t usblsb)
Definition: SI4735.cpp:2704
AM_SEEK_START
#define AM_SEEK_START
Definition: SI4735.h:73
si47x_antenna_capacitor::value
uint16_t value
Definition: SI4735.h:285
SI4735::getCurrentStereoBlend
uint8_t getCurrentStereoBlend()
Gets the value of the amount of stereo blend in % (100 = full stereo, 0 = full mono).
Definition: SI4735.h:1423
SI4735::setup
void setup(uint8_t resetPin, int interruptPin, uint8_t defaultFunction, uint8_t audioMode=SI473X_ANALOG_AUDIO, uint8_t clockType=XOSCEN_CRYSTAL)
Starts the Si473X device.
Definition: SI4735.cpp:567
SI4735::setSSBAutomaticVolumeControl
void setSSBAutomaticVolumeControl(uint8_t AVCEN)
Sets SSB Automatic Volume Control (AVC) for SSB mode.
Definition: SI4735.cpp:2585
si47x_agc_status::raw
uint8_t raw[3]
Definition: SI4735.h:832
SI4735::rds_buffer2A
char rds_buffer2A[65]
RDS Radio Text buffer - Program Information.
Definition: SI4735.h:990
SI4735::reset
void reset(void)
Reset the SI473X
Definition: SI4735.cpp:308
REFCLK_PRESCALE
#define REFCLK_PRESCALE
Definition: SI4735.h:94
SI4735::getCurrentMultipathDetectLow
bool getCurrentMultipathDetectLow()
Signed frequency offset (kHz).
Definition: SI4735.h:1453
RX_HARD_MUTE
#define RX_HARD_MUTE
Definition: SI4735.h:126
SI4735::queryLibraryId
si47x_firmware_query_library queryLibraryId()
Query the library information of the Si47XX device.
Definition: SI4735.cpp:2768
SI4735::getTuneFrequencyFreeze
uint8_t getTuneFrequencyFreeze()
FAST Tuning. If set, executes fast and invalidated tune. The tune status will not be accurate.
Definition: SI4735.h:1562
si47x_seek_am_complement::ARG3
uint8_t ARG3
Definition: SI4735.h:344
SI4735::getCurrentRSSI
uint8_t getCurrentRSSI()
Get the current receive signal strength (0–127 dBμV)
Definition: SI4735.h:1329
SET_PROPERTY
#define SET_PROPERTY
Definition: SI4735.h:35
SI4735::getRdsVersionCode
uint8_t getRdsVersionCode(void)
Gets the version code (extracted from the Block B)
Definition: SI4735.cpp:2154
SI4735::getCurrentFrequency
uint16_t getCurrentFrequency()
Gets the current frequency saved in memory.
Definition: SI4735.h:1836
FM_SEEK_FREQ_SPACING
#define FM_SEEK_FREQ_SPACING
Definition: SI4735.h:67
FM_BLEND_SNR_STEREO_THRESHOLD
#define FM_BLEND_SNR_STEREO_THRESHOLD
Definition: SI4735.h:59
SI4735::getCurrentMultipathDetectHigh
bool getCurrentMultipathDetectHigh()
Multipath Detect Low.
Definition: SI4735.h:1454
SI4735::getRdsText2B
char * getRdsText2B(void)
Gets the Text processed for the 2B group.
Definition: SI4735.cpp:2349
SI4735::getRdsStatus
void getRdsStatus(uint8_t INTACK, uint8_t MTFIFO, uint8_t STATUSONLY)
Gets the RDS status. Store the status in currentRdsStatus member. RDS COMMAND FM_RDS_STATUS.
Definition: SI4735.cpp:2016
GET_PROPERTY
#define GET_PROPERTY
Definition: SI4735.h:36
SI4735::maxDelaySetFrequency
uint16_t maxDelaySetFrequency
Stores the maximum delay after set frequency command (in ms).
Definition: SI4735.h:1002
FM_BLEND_MONO_THRESHOLD
#define FM_BLEND_MONO_THRESHOLD
Definition: SI4735.h:56
FM_SEEK_BAND_BOTTOM
#define FM_SEEK_BAND_BOTTOM
Definition: SI4735.h:65
FM_TUNE_FREQ
#define FM_TUNE_FREQ
Definition: SI4735.h:40
SI4735::setGpioCtl
void setGpioCtl(uint8_t GPO1OEN, uint8_t GPO2OEN, uint8_t GPO3OEN)
Enables output for GPO1, 2, and 3.
Definition: SI4735.cpp:130
SI4735::sendProperty
void sendProperty(uint16_t propertyNumber, uint16_t param)
Sends (sets) property to the SI47XX.
Definition: SI4735.cpp:942
SSB_MODE
#define SSB_MODE
Definition: SI4735.h:133
SI4735::clearRdsBuffer2B
void clearRdsBuffer2B()
Clear RDS buffer 2B (text)
Definition: SI4735.cpp:1877
SI4735::getStatusSNR
uint8_t getStatusSNR()
Gets the SNR metric when tune is complete (dB)
Definition: SI4735.h:1217
AM_AGC_STATUS
#define AM_AGC_STATUS
Definition: SI4735.h:76
SI4735::clearRdsBuffer0A
void clearRdsBuffer0A()
Clear RDS buffer 0A (text)
Definition: SI4735.cpp:1888
SI4735::currentAgcStatus
si47x_agc_status currentAgcStatus
current AGC status
Definition: SI4735.h:1034
SI4735::getRdsSync
bool getRdsSync()
Get the Rds Sync.
Definition: SI4735.h:1703
SI4735::getFrequency
uint16_t getFrequency(void)
Gets the current frequency of the Si4735 (AM or FM)
Definition: SI4735.cpp:1375
SI4735::setDeviceI2CAddress
void setDeviceI2CAddress(uint8_t senPin)
Sets the I2C Bus Address.
Definition: SI4735.cpp:280
SI4735::currentTune
uint8_t currentTune
tell the current tune (FM, AM or SSB)
Definition: SI4735.h:1010
SI4735::setFmBlendMultiPathMonoThreshold
void setFmBlendMultiPathMonoThreshold(uint8_t parameter)
Sets Multipath threshold for mono blend (Full mono above threshold, blend below threshold).
Definition: SI4735.cpp:1197
FM_SEEK_BAND_TOP
#define FM_SEEK_BAND_TOP
Definition: SI4735.h:66
AM_SEEK_BAND_TOP
#define AM_SEEK_BAND_TOP
Definition: SI4735.h:112
SI4735::radioPowerUp
void radioPowerUp(void)
Powerup the Si47XX.
Definition: SI4735.cpp:411
SI4735::getNumRdsFifoUsed
uint8_t getNumRdsFifoUsed()
Get the Num Rds Fifo Used.
Definition: SI4735.h:1723
si47x_response_status::raw
uint8_t raw[8]
Check it.
Definition: SI4735.h:408
GET_REV
#define GET_REV
Definition: SI4735.h:33
si47x_ssb_mode::raw
uint8_t raw[2]
Definition: SI4735.h:900
SI4735::getFirmwarePATCHH
uint8_t getFirmwarePATCHH()
RESP3 - Returns the Firmware Minor Revision (ASCII).
Definition: SI4735.h:1466
AM_SOFT_MUTE_MAX_ATTENUATION
#define AM_SOFT_MUTE_MAX_ATTENUATION
Definition: SI4735.h:107
SI4735::setAudioMute
void setAudioMute(bool off)
Sets the audio on or off.
Definition: SI4735.cpp:1312
SI4735::RdsInit
void RdsInit()
Starts the control member variables for RDS.
Definition: SI4735.cpp:1851
SI4735::setMcuControl
virtual void setMcuControl(bool value)
Enables MCU control resource.
Definition: SI4735.cpp:3033
si47x_firmware_information::raw
uint8_t raw[9]
Definition: SI4735.h:441
SI4735::getStatusError
bool getStatusError()
Get the Status Error.
Definition: SI4735.h:1153
SI4735::disableFmDebug
void disableFmDebug()
There is a debug feature that remains active in Si4704/05/3x-D60 firmware which can create periodic n...
Definition: SI4735.cpp:1232
SI4735::currentStep
uint16_t currentStep
Stores the current step used to increment or decrement the frequency.
Definition: SI4735.h:1016
SI4735::downloadPatchFromEeprom
si4735_eeprom_patch_header downloadPatchFromEeprom(int eeprom_i2c_address)
Transfers the content of a patch stored in an eeprom to the SI4735 device.
Definition: SI4735.cpp:2958
si47x_firmware_query_library::raw
uint8_t raw[8]
Definition: SI4735.h:476
SI4735::lastTextFlagAB
uint8_t lastTextFlagAB
Definition: SI4735.h:1006
SI4735::getCurrentValidChannel
bool getCurrentValidChannel()
Checks if the current channel is valid.
Definition: SI4735.h:1389
SI4735::currentAudioMode
uint8_t currentAudioMode
Current audio mode used (ANALOG or DIGITAL or both)
Definition: SI4735.h:1042
SI4735::getCurrentSnrDetectLow
bool getCurrentSnrDetectLow()
Checks if SNR detect is low.
Definition: SI4735.h:1369
FM_SEEK_TUNE_RSSI_THRESHOLD
#define FM_SEEK_TUNE_RSSI_THRESHOLD
Definition: SI4735.h:69
SI4735::getCurrentPilot
bool getCurrentPilot()
Checks the current pilot.
Definition: SI4735.h:1435
SI4735::setAvcAmMaxGain
void setAvcAmMaxGain(uint8_t gain)
Sets the maximum gain for automatic volume control.
Definition: SI4735.cpp:1514
SI4735::getACFIndicator
bool getACFIndicator()
Returns true if the AFC rails (AFC Rail Indicator).
Definition: SI4735.h:1170
SEEK_UP
#define SEEK_UP
Definition: SI4735.h:165
SI4735::setFmBLendRssiMonoThreshold
void setFmBLendRssiMonoThreshold(uint8_t parameter)
Sets RSSI threshold for mono blend (Full mono below threshold, blend above threshold).
Definition: SI4735.cpp:1133
SI4735::setRdsIntSource
void setRdsIntSource(uint8_t RDSNEWBLOCKB, uint8_t RDSNEWBLOCKA, uint8_t RDSSYNCFOUND, uint8_t RDSSYNCLOST, uint8_t RDSRECV)
Configures interrupt related to RDS.
Definition: SI4735.cpp:1974
AM_RSQ_STATUS
#define AM_RSQ_STATUS
Definition: SI4735.h:75
SI4735::getRdsReceived
bool getRdsReceived()
Get the Rds Received FIFO.
Definition: SI4735.h:1652
SI4735::powerUp
si473x_powerup powerUp
Definition: SI4735.h:1038
SI4735::currentMaximumFrequency
uint16_t currentMaximumFrequency
maximum frequency of the current band
Definition: SI4735.h:1013
si47x_rqs_status::raw
uint8_t raw[8]
Definition: SI4735.h:558
SI4735::getRdsText
char * getRdsText(void)
Gets the RDS Text when the message is of the Group Type 2 version A.
Definition: SI4735.cpp:2259
SI4735::setAutomaticGainControl
void setAutomaticGainControl(uint8_t AGCDIS, uint8_t AGCIDX)
Automatic Gain Control setup.
Definition: SI4735.cpp:1480
FM_RSQ_STATUS
#define FM_RSQ_STATUS
Definition: SI4735.h:45
SI4735::rdsTextAdress0A
int rdsTextAdress0A
rds_buffer0A current position
Definition: SI4735.h:997
SI4735::seekStationDown
void seekStationDown()
Search the previous station.
Definition: SI4735.h:1609
SI4735::getRdsSyncFound
bool getRdsSyncFound()
Get the Rds Sync Found.
Definition: SI4735.h:1672
FM_AGC_OVERRIDE
#define FM_AGC_OVERRIDE
Definition: SI4735.h:44
SI4735::getCurrentSNR
uint8_t getCurrentSNR()
Gets the current SNR metric (0–127 dB).
Definition: SI4735.h:1339
si47x_property::value
uint16_t value
Definition: SI4735.h:511
SI4735::getFirmwareFWMAJOR
uint8_t getFirmwareFWMAJOR()
RESP1 - Part Number (HEX)
Definition: SI4735.h:1464
SI4735::getSignalQualityInterrupt
bool getSignalQualityInterrupt()
Get the Signal Quality Interrupt status.
Definition: SI4735.h:1123
FM_BLEND_MULTIPATH_MONO_THRESHOLD
#define FM_BLEND_MULTIPATH_MONO_THRESHOLD
Definition: SI4735.h:62
FM_SEEK_START
#define FM_SEEK_START
Definition: SI4735.h:41
SI4735::getStatusValid
bool getStatusValid()
Gets the channel status.
Definition: SI4735.h:1195
SI4735::getRdsStatus
void getRdsStatus()
Gets RDS Status.
Definition: SI4735.cpp:2065
SI4735::setHardwareAudioMute
void setHardwareAudioMute(bool on)
Sets the Hardware Audio Mute.
Definition: SI4735.h:1938
SI4735::volumeUp
void volumeUp()
Set sound volume level Up
Definition: SI4735.cpp:1339
SI4735::setI2CLowSpeedMode
void setI2CLowSpeedMode(void)
Sets I2C bus to 10KHz.
Definition: SI4735.h:1867
si473x_gpio_ien::raw
uint16_t raw
Definition: SI4735.h:257
SI4735::firmwareInfo
si47x_firmware_information firmwareInfo
firmware information
Definition: SI4735.h:1032
SI4735::getCurrentVolume
uint8_t getCurrentVolume()
Definition: SI4735.h:1476
SI4735::digitalOutputSampleRate
void digitalOutputSampleRate(uint16_t DOSR)
Enables digital audio output and configures digital audio output sample rate in samples per second (s...
Definition: SI4735.cpp:1281
SI4735::getNext2Block
void getNext2Block(char *)
Process data received from group 2B.
Definition: SI4735.cpp:2190
SI4735::getProperty
int32_t getProperty(uint16_t propertyValue)
Gets a given property from the SI47XX.
Definition: SI4735.cpp:1041
SI4735::getFirmware
void getFirmware(void)
Gets firmware information.
Definition: SI4735.cpp:484
RX_VOLUME
#define RX_VOLUME
Definition: SI4735.h:125
AM_AUTOMATIC_VOLUME_CONTROL_MAX_GAIN
#define AM_AUTOMATIC_VOLUME_CONTROL_MAX_GAIN
Definition: SI4735.h:97
SI4735::controlMcuPin
int8_t controlMcuPin
Definition: SI4735.h:1046
MIN_DELAY_WAIT_SEND_LOOP
#define MIN_DELAY_WAIT_SEND_LOOP
Definition: SI4735.h:170
SI4735::setSSBBfo
void setSSBBfo(int offset)
Sets the SSB Beat Frequency Offset (BFO).
Definition: SI4735.cpp:2481
AM_SEEK_SNR_THRESHOLD
#define AM_SEEK_SNR_THRESHOLD
Definition: SI4735.h:114
SI4735::getFirmwarePATCHL
uint8_t getFirmwarePATCHL()
RESP4 - Returns the Patch ID High byte (HEX).
Definition: SI4735.h:1467
si4735_digital_output_sample_rate::DOSR
uint16_t DOSR
Definition: SI4735.h:953
SI4735::currentClockType
uint8_t currentClockType
Stores the current clock type used (Crystal or REF CLOCK)
Definition: SI4735.h:1021
SI4735::getFirmwareCHIPREV
uint8_t getFirmwareCHIPREV()
RESP7 - Returns the Component Minor Revision (ASCII).
Definition: SI4735.h:1470
SI4735::getStatus
void getStatus(uint8_t, uint8_t)
Gets the current status of the Si4735 (AM or FM)
Definition: SI4735.cpp:1397
POWER_DOWN
#define POWER_DOWN
Definition: SI4735.h:34
SI4735::sendSSBModeProperty
void sendSSBModeProperty()
Just send the property SSB_MOD to the device. Internal use (privete method).
Definition: SI4735.cpp:2725
SI4735::setFmBlendStereoThreshold
void setFmBlendStereoThreshold(uint8_t parameter)
Sets RSSI threshold for stereo blend (Full stereo above threshold, blend below threshold).
Definition: SI4735.cpp:1085
AM_CHANNEL_FILTER
#define AM_CHANNEL_FILTER
Definition: SI4735.h:96
SI473X_ANALOG_AUDIO
#define SI473X_ANALOG_AUDIO
Definition: SI4735.h:155
SI4735::setSSBDspAfc
void setSSBDspAfc(uint8_t DSP_AFCDIS)
Sets DSP AFC disable or enable.
Definition: SI4735.cpp:2555
GPIO_CTL
#define GPIO_CTL
Definition: SI4735.h:78
SI4735::frequencyDown
void frequencyDown()
Decrements the current frequency on current band/function by using the current step.
Definition: SI4735.cpp:741
SI4735::getStatusMULT
uint8_t getStatusMULT()
Get the Status the M U L T.
Definition: SI4735.h:1229
si47x_bandwidth_config::raw
uint8_t raw[2]
Definition: SI4735.h:879
SI4735::setRefClock
void setRefClock(uint16_t refclk)
Sets the frequency of the REFCLK from the output of the prescaler.
Definition: SI4735.cpp:527
SI4735::setSeekFmSpacing
void setSeekFmSpacing(uint16_t spacing)
Selects frequency spacingfor FM seek. Default is 100 kHz kHz spacing. There are only 3 valid values: ...
Definition: SI4735.cpp:1773
SI4735::getCurrentRssiDetectHigh
bool getCurrentRssiDetectHigh()
Checks if RSSI detected is high.
Definition: SI4735.h:1359
FM_BLEND_MULTIPATH_STEREO_THRESHOLD
#define FM_BLEND_MULTIPATH_STEREO_THRESHOLD
Definition: SI4735.h:61
SI4735::setSeekAmSpacing
void setSeekAmSpacing(uint16_t spacing)
Selects frequency spacingfor AM seek. Default is 10 kHz spacing.
Definition: SI4735.cpp:1759
GET_INT_STATUS
#define GET_INT_STATUS
Definition: SI4735.h:37
SI4735::rds_buffer0A
char rds_buffer0A[9]
RDS Basic tuning and switching information (Type 0 groups)
Definition: SI4735.h:992
SI4735::setSSBAvcDivider
void setSSBAvcDivider(uint8_t AVC_DIVIDER)
Sets AVC Divider.
Definition: SI4735.cpp:2600
REFCLK_FREQ
#define REFCLK_FREQ
Definition: SI4735.h:93
AM_SEEK_RSSI_THRESHOLD
#define AM_SEEK_RSSI_THRESHOLD
Definition: SI4735.h:115
SI4735::getFirmwareCMPMINOR
uint8_t getFirmwareCMPMINOR()
RESP6 - Returns the Component Major Revision (ASCII).
Definition: SI4735.h:1469
SSB_CURRENT_MODE
#define SSB_CURRENT_MODE
Definition: SI4735.h:163
FM_RDS_CONFIG
#define FM_RDS_CONFIG
Definition: SI4735.h:51
SI4735::getCommandResponse
void getCommandResponse(int num_of_bytes, uint8_t *response)
Returns with the command response.
Definition: SI4735.cpp:996
SI4735::currentWorkFrequency
uint16_t currentWorkFrequency
current frequency
Definition: SI4735.h:1014
SI4735::setFrequency
void setFrequency(uint16_t)
Set the frequency to the corrent function of the Si4735 (FM, AM or SSB)
Definition: SI4735.cpp:686
SI4735::seekStationProgress
void seekStationProgress(void(*showFunc)(uint16_t f), uint8_t up_down)
Seeks a station up or down.
Definition: SI4735.cpp:1696