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 {
200  struct
201  {
202  // ARG1
203  uint8_t FUNC : 4; //!< Function (0 = FM Receive; 1–14 = Reserved; 15 = Query Library ID)
204  uint8_t XOSCEN : 1; //!< Crystal Oscillator Enable (0 = crystal oscillator disabled; 1 = Use crystal oscillator and and OPMODE=ANALOG AUDIO) .
205  uint8_t PATCH : 1; //!< Patch Enable (0 = Boot normally; 1 = Copy non-volatile memory to RAM).
206  uint8_t GPO2OEN : 1; //!< GPO2 Output Enable (0 = GPO2 output disabled; 1 = GPO2 output enabled).
207  uint8_t CTSIEN : 1; //!< CTS Interrupt Enable (0 = CTS interrupt disabled; 1 = CTS interrupt enabled).
208  // ARG2
209  uint8_t OPMODE; //!< Application Setting. See page 65
210  } arg; //!< Refined powerup parameters
211  uint8_t raw[2]; //!< Raw powerup parameters data. Same arg memory position. So, same content.
212 } si473x_powerup;
213 
214 /**
215  * @ingroup group01
216  *
217  * @brief Data type for Enables output for GPO1, GPO2 and GPO3
218  *
219  * @details GPO1, 2, and 3 can be configured for output (Hi-Z or active drive) by setting the GPO1OEN, GPO2OEN, and GPO3OEN bit.
220  *
221  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); page 82 and 144
222  */
223 typedef union
224 {
225  struct
226  {
227  uint8_t DUMMY1 : 1; //!< Always write 0.
228  uint8_t GPO1OEN : 1; //!< GPO1 Output Enable.
229  uint8_t GPO2OEN : 1; //!< GPO2 Output Enable.
230  uint8_t GPO3OEN : 1; //!< GPO3 Output Enable.
231  uint8_t DUMMY2 : 4; //!< Always write 0.
232  } arg; //!< Refined powerup parameters
234 } si473x_gpio;
235 
236 /**
237  * @ingroup group01
238  *
239  * @brief Data type for Configuring the sources for the GPO2/INT interrupt pin
240  *
241  * @details Valid sources are the lower 8 bits of the STATUS byte, including CTS, ERR, RSQINT, and STCINT bits.
242  *
243  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); page 146
244  */
245 typedef union
246 {
247  struct
248  {
249  uint8_t STCIEN : 1; //!< Seek/Tune Complete Interrupt Enable (0 or 1).
250  uint8_t DUMMY1 : 2; //!< Always write 0.
251  uint8_t RSQIEN : 1; //!< RSQ Interrupt Enable (0 or 1).
252  uint8_t DUMMY2 : 2; //!< Always write 0.
253  uint8_t ERRIEN : 1; //!< ERR Interrupt Enable (0 or 1).
254  uint8_t CTSIEN : 1; //!< CTS Interrupt Enable (0 or 1).
255  uint8_t STCREP : 1; //!< STC Interrupt Repeat (0 or 1).
256  uint8_t DUMMY3 : 2; //!< Always write 0.
257  uint8_t RSQREP : 1; //!< RSQ Interrupt Repeat (0 or 1).
258  uint8_t DUMMY4 : 4; //!< Always write 0.
259  } arg;
261 } si473x_gpio_ien;
262 
263 /**
264  * @ingroup group01
265  *
266  * @brief Represents how the frequency is stored in the si4735.
267  * @details It helps to convert frequency in uint16_t to two bytes (uint8_t) (FREQL and FREQH)
268  */
269 typedef union
270 {
271  struct
272  {
273  uint8_t FREQL; //!< Tune Frequency Low byte.
274  uint8_t FREQH; //!< Tune Frequency High byte.
275  } raw; //!< Raw data that represents the frequency stored in the Si47XX device.
276  uint16_t value; //!< frequency (integer value)
277 } si47x_frequency;
278 
279 /**
280  * @ingroup group01
281  * @brief Antenna Tuning Capacitor data type manupulation
282  */
283 typedef union
284 {
285  struct
286  {
287  uint8_t ANTCAPL; //!< Antenna Tuning Capacitor High byte
288  uint8_t ANTCAPH; //!< Antenna Tuning Capacitor Low byte
289  } raw;
291 } si47x_antenna_capacitor;
292 
293 /**
294  * @ingroup group01
295  *
296  * @brief AM Tune frequency data type command (AM_TUNE_FREQ command)
297  *
298  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 135
299  */
300 typedef union
301 {
302  struct
303  {
304  uint8_t FAST : 1; //!< ARG1 - FAST Tuning. If set, executes fast and invalidated tune. The tune status will not be accurate.
305  uint8_t FREEZE : 1; //!< Valid only for FM (Must be 0 to AM)
306  uint8_t DUMMY1 : 4; //!< Always set 0
307  uint8_t USBLSB : 2; //!< SSB Upper Side Band (USB) and Lower Side Band (LSB) Selection. 10 = USB is selected; 01 = LSB is selected.
308  uint8_t FREQH; //!< ARG2 - Tune Frequency High byte.
309  uint8_t FREQL; //!< ARG3 - Tune Frequency Low byte.
310  uint8_t ANTCAPH; //!< ARG4 - Antenna Tuning Capacitor High byte.
311  uint8_t ANTCAPL; //!< ARG5 - Antenna Tuning Capacitor Low byte. Note used for FM.
312  } arg;
314 } si47x_set_frequency;
315 
316 /**
317  * @ingroup group01
318  *
319  * @brief Seek frequency (automatic tuning). ARG1
320  *
321  * @details Represents searching for a valid frequency data type AM and FM.
322  * @details When AM, the searching data have to be complemented by si47x_seek_am_complement.
323  *
324  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 72 and 137
325  * @see si47x_seek_am_complement
326  */
327 typedef union
328 {
329  struct
330  {
331  uint8_t RESERVED1 : 2;
332  uint8_t WRAP : 1; //!< Determines whether the seek should Wrap = 1, or Halt = 0 when it hits the band limit.
333  uint8_t SEEKUP : 1; //!< Determines the direction of the search, either UP = 1, or DOWN = 0.
334  uint8_t RESERVED2 : 4;
335  } arg;
337 } si47x_seek;
338 
339 /**
340  * @ingroup group01
341  *
342  * @brief Seek frequency (automatic tuning) AM complement (ARG2, ARG3, ARG4 and ARG5)
343  *
344  * @details Represents AM complement searching information for a valid frequency data type.
345  *
346  * @see @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 72 and 137
347  */
348 typedef struct
349 {
350  uint8_t ARG2; // Always 0.
351  uint8_t ARG3; // Always 0.
354 } si47x_seek_am_complement;
355 
356 /**
357  * @ingroup group01 status response structure
358  *
359  * @brief Status response data representation
360  *
361  * @details Represents searching for a valid frequency data type.
362  */
363 typedef union
364 {
365  struct
366  {
367  uint8_t STCINT : 1; //!< 1 = Tune complete has been triggered.
368  uint8_t DUMMY1 : 1; //!< Reserved (Values may vary).
369  uint8_t RDSINT : 1; //!< 1 = Radio data system interrupt has been triggered.
370  uint8_t RSQINT : 1; //!< 1 = Received Signal Quality measurement has been triggered.
371  uint8_t DUMMY2 : 2; //!< Reserved (Values may vary).
372  uint8_t ERR : 1; //!< 1 = Error.
373  uint8_t CTS : 1; //!< 0 = Wait before sending next command; 1 = Clear to send next command.
374  } refined;
376 } si47x_status;
377 
378 /**
379  * @ingroup group01
380  *
381  * @brief Response status command
382  *
383  * @details Response data from a query status command
384  *
385  * @see Si47XX PROGRAMMING GUIDE; pages 73 and
386  */
387 typedef union
388 {
389  struct
390  {
391  // Status
392  uint8_t STCINT : 1; //!< Seek/Tune Complete Interrupt; 1 = Tune complete has been triggered.
393  uint8_t DUMMY1 : 1;
394  uint8_t RDSINT : 1; //!< Radio Data System (RDS) Interrup; 0 = interrupt has not been triggered.
395  uint8_t RSQINT : 1; //!< Received Signal Quality Interrupt; 0 = interrupt has not been triggered.
396  uint8_t DUMMY2 : 2;
397  uint8_t ERR : 1; //!< Error. 0 = No error 1 = Error
398  uint8_t CTS : 1; //!< Clear to Send.
399  // RESP1
400  uint8_t VALID : 1; //!< Valid Channel
401  uint8_t AFCRL : 1; //!< AFC Rail Indicator
402  uint8_t DUMMY3 : 5;
403  uint8_t BLTF : 1; //!< Reports if a seek hit the band limit
404  // RESP2
405  uint8_t READFREQH; //!< Read Frequency High byte.
406  // RESP3
407  uint8_t READFREQL; //!< Read Frequency Low byte.
408  // RESP4
409  uint8_t RSSI; //!< Received Signal Strength Indicator (dBμV)
410  // RESP5
411  uint8_t SNR; //!< This byte contains the SNR metric when tune is complete (dB).
412  // RESP6
413  uint8_t MULT; //!< If FM, contains the multipath metric when tune is complete; IF AM READANTCAPH (tuning capacitor value high byte)
414  // RESP7
415  uint8_t READANTCAP; //!< If FM, contains the current antenna tuning capacitor value; IF AM READANTCAPL (tuning capacitor value low byte)
416  } resp;
417  uint8_t raw[8]; //!< Check it
418 } si47x_response_status;
419 
420 /**
421  * @ingroup group01
422  *
423  * @brief Data representation for Firmware Information (GET_REV)
424  *
425  * @details The part number, chip revision, firmware revision, patch revision and component revision numbers.
426  *
427  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 66 and 131
428  */
429 typedef union
430 {
431  struct
432  {
433  // status ("RESP0")
434  uint8_t STCINT : 1;
435  uint8_t DUMMY1 : 1;
436  uint8_t RDSINT : 1;
437  uint8_t RSQINT : 1;
438  uint8_t DUMMY2 : 2;
439  uint8_t ERR : 1;
440  uint8_t CTS : 1;
441  uint8_t PN; //!< RESP1 - Final 2 digits of Part Number (HEX).
442  uint8_t FWMAJOR; //!< RESP2 - Firmware Major Revision (ASCII).
443  uint8_t FWMINOR; //!< RESP3 - Firmware Minor Revision (ASCII).
444  uint8_t PATCHH; //!< RESP4 - Patch ID High byte (HEX).
445  uint8_t PATCHL; //!< RESP5 - Patch ID Low byte (HEX).
446  uint8_t CMPMAJOR; //!< RESP6 - Component Major Revision (ASCII).
447  uint8_t CMPMINOR; //!< RESP7 - Component Minor Revision (ASCII).
448  uint8_t CHIPREV; //!< RESP8 - Chip Revision (ASCII).
449  // RESP9 to RESP15 not used
450  } resp;
452 } si47x_firmware_information;
453 
454 /**
455  * @ingroup group01
456  *
457  * @brief Firmware Query Library ID response.
458  *
459  * @details Used to represent the response of a power up command with FUNC = 15 (patch)
460  *
461  * To confirm that the patch is compatible with the internal device library revision, the library
462  * revision should be confirmed by issuing the POWER_UP command with Function = 15 (query library ID)
463  *
464  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); page 12
465  */
466 typedef union
467 {
468  struct
469  {
470  // status ("RESP0")
471  uint8_t STCINT : 1;
472  uint8_t DUMMY1 : 1;
473  uint8_t RDSINT : 1;
474  uint8_t RSQINT : 1;
475  uint8_t DUMMY2 : 2;
476  uint8_t ERR : 1;
477  uint8_t CTS : 1;
478  uint8_t PN; //!< RESP1 - Final 2 digits of Part Number (HEX).
479  uint8_t FWMAJOR; //!< RESP2 - Firmware Major Revision (ASCII).
480  uint8_t FWMINOR; //!< RESP3 - Firmware Minor Revision (ASCII).
481  uint8_t RESERVED1; //!< RESP4 - Reserved, various values.
482  uint8_t RESERVED2; //!< RESP5 - Reserved, various values.
483  uint8_t CHIPREV; //!< RESP6 - Chip Revision (ASCII).
484  uint8_t LIBRARYID; //!< RESP7 - Library Revision (HEX).
485  // RESP9 to RESP15 not used
486  } resp;
488 } si47x_firmware_query_library;
489 
490 /**
491  * @ingroup group01
492  *
493  * @brief Seek station status
494  *
495  * @details Status of FM_TUNE_FREQ or FM_SEEK_START commands or Status of AM_TUNE_FREQ or AM_SEEK_START commands.
496  *
497  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 73 and 139
498  */
499 typedef union
500 {
501  struct
502  {
503  uint8_t INTACK : 1; //!< If set, clears the seek/tune complete interrupt status indicator.
504  uint8_t CANCEL : 1; //!< If set, aborts a seek currently in progress.
505  uint8_t RESERVED2 : 6;
506  } arg;
508 } si47x_tune_status;
509 
510 /**
511  * @ingroup group01
512  *
513  * @brief Data type to deal with SET_PROPERTY command
514  *
515  * @details Property Data type (help to deal with SET_PROPERTY command on si473X)
516  */
517 typedef union
518 {
519  struct
520  {
521  uint8_t byteLow;
522  uint8_t byteHigh;
523  } raw;
525 } si47x_property;
526 
527 /**
528  * @ingroup group01
529  *
530  * @brief Radio Signal Quality data representation
531  *
532  * @details Data type for status information about the received signal quality (FM_RSQ_STATUS and AM_RSQ_STATUS)
533  *
534  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 75 and
535  */
536 typedef union
537 {
538  struct
539  {
540  // status ("RESP0")
541  uint8_t STCINT : 1;
542  uint8_t DUMMY1 : 1;
543  uint8_t RDSINT : 1;
544  uint8_t RSQINT : 1;
545  uint8_t DUMMY2 : 2;
546  uint8_t ERR : 1;
547  uint8_t CTS : 1;
548  // RESP1
549  uint8_t RSSIILINT : 1; //!< RSSI Detect Low.
550  uint8_t RSSIHINT : 1; //!< RSSI Detect High.
551  uint8_t SNRLINT : 1; //!< SNR Detect Low.
552  uint8_t SNRHINT : 1; //!< SNR Detect High.
553  uint8_t MULTLINT : 1; //!< Multipath Detect Low
554  uint8_t MULTHINT : 1; //!< Multipath Detect High
555  uint8_t DUMMY3 : 1;
556  uint8_t BLENDINT : 1; //!< Blend Detect Interrupt.
557  // RESP2
558  uint8_t VALID : 1; //!< Valid Channel.
559  uint8_t AFCRL : 1; //!< AFC Rail Indicator.
560  uint8_t DUMMY4 : 1;
561  uint8_t SMUTE : 1; //!< Soft Mute Indicator. Indicates soft mute is engaged.
562  uint8_t DUMMY5 : 4;
563  // RESP3
564  uint8_t STBLEND : 7; //!< Indicates amount of stereo blend in% (100 = full stereo, 0 = full mono).
565  uint8_t PILOT : 1; //!< Indicates stereo pilot presence.
566  // RESP4 to RESP7
567  uint8_t RSSI; //!< RESP4 - Contains the current receive signal strength (0–127 dBμV).
568  uint8_t SNR; //!< RESP5 - Contains the current SNR metric (0–127 dB).
569  uint8_t MULT; //!< RESP6 - Contains the current multipath metric. (0 = no multipath; 100 = full multipath)
570  uint8_t FREQOFF; //!< RESP7 - Signed frequency offset (kHz).
571  } resp;
573 } si47x_rqs_status;
574 
575 /**
576  * @ingroup group01
577  * @brief Adjusts the AM AGC for external front-end attenuator and external front-end cascode LNA.
578  * @see Si47XX PROAMMING GUIDE; AN332 (REV 1.0); page 168
579  */
580 typedef union
581 {
582  struct
583  {
584  uint8_t ATTN_BACKUP;
585  uint8_t MIN_GAIN_INDEX;
586  } field;
588 } si47x_frontend_agc_control;
589 
590 /**
591  * @ingroup group01
592  *
593  * @brief Data type for RDS Status command and response information
594  *
595  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 77 and 78
596  * @see Also https://en.wikipedia.org/wiki/Radio_Data_System
597  */
598 typedef union
599 {
600  struct
601  {
602  uint8_t INTACK : 1; // Interrupt Acknowledge; 0 = RDSINT status preserved; 1 = Clears RDSINT.
603  uint8_t MTFIFO : 1; // Empty FIFO; 0 = If FIFO not empty; 1 = Clear RDS Receive FIFO.
604  uint8_t STATUSONLY : 1; // Determines if data should be removed from the RDS FIFO.
605  uint8_t dummy : 5;
606  } arg;
608 } si47x_rds_command;
609 
610 /**
611  * @ingroup group01
612  *
613  * @brief Response data type for current channel and reads an entry from the RDS FIFO.
614  *
615  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 77 and 78
616  */
617 typedef union
618 {
619  struct
620  {
621  // status ("RESP0")
622  uint8_t STCINT : 1;
623  uint8_t DUMMY1 : 1;
624  uint8_t RDSINT : 1;
625  uint8_t RSQINT : 1;
626  uint8_t DUMMY2 : 2;
627  uint8_t ERR : 1;
628  uint8_t CTS : 1;
629  // RESP1
630  uint8_t RDSRECV : 1; //!< RDS Received; 1 = FIFO filled to minimum number of groups set by RDSFIFOCNT.
631  uint8_t RDSSYNCLOST : 1; //!< RDS Sync Lost; 1 = Lost RDS synchronization.
632  uint8_t RDSSYNCFOUND : 1; //!< RDS Sync Found; 1 = Found RDS synchronization.
633  uint8_t DUMMY3 : 1;
634  uint8_t RDSNEWBLOCKA : 1; //!< RDS New Block A; 1 = Valid Block A data has been received.
635  uint8_t RDSNEWBLOCKB : 1; //!< RDS New Block B; 1 = Valid Block B data has been received.
636  uint8_t DUMMY4 : 2;
637  // RESP2
638  uint8_t RDSSYNC : 1; //!< RDS Sync; 1 = RDS currently synchronized.
639  uint8_t DUMMY5 : 1;
640  uint8_t GRPLOST : 1; //!< Group Lost; 1 = One or more RDS groups discarded due to FIFO overrun.
641  uint8_t DUMMY6 : 5;
642  // RESP3 to RESP11
643  uint8_t RDSFIFOUSED; //!< RESP3 - RDS FIFO Used; Number of groups remaining in the RDS FIFO (0 if empty).
644  uint8_t BLOCKAH; //!< RESP4 - RDS Block A; HIGH byte
645  uint8_t BLOCKAL; //!< RESP5 - RDS Block A; LOW byte
646  uint8_t BLOCKBH; //!< RESP6 - RDS Block B; HIGH byte
647  uint8_t BLOCKBL; //!< RESP7 - RDS Block B; LOW byte
648  uint8_t BLOCKCH; //!< RESP8 - RDS Block C; HIGH byte
649  uint8_t BLOCKCL; //!< RESP9 - RDS Block C; LOW byte
650  uint8_t BLOCKDH; //!< RESP10 - RDS Block D; HIGH byte
651  uint8_t BLOCKDL; //!< RESP11 - RDS Block D; LOW byte
652  // RESP12 - Blocks A to D Corrected Errors.
653  // 0 = No errors;
654  // 1 = 1–2 bit errors detected and corrected;
655  // 2 = 3–5 bit errors detected and corrected.
656  // 3 = Uncorrectable.
657  uint8_t BLED : 2;
658  uint8_t BLEC : 2;
659  uint8_t BLEB : 2;
660  uint8_t BLEA : 2;
661  } resp;
663 } si47x_rds_status;
664 
665 /**
666  * @ingroup group01
667  *
668  * @brief FM_RDS_INT_SOURCE property data type
669  *
670  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); page 103
671  * @see also https://en.wikipedia.org/wiki/Radio_Data_System
672  */
673 typedef union
674 {
675  struct
676  {
677  uint8_t RDSRECV : 1; //!< If set, generate RDSINT when RDS FIFO has at least FM_RDS_INT_FIFO_COUNT entries.
678  uint8_t RDSSYNCLOST : 1; //!< If set, generate RDSINT when RDS loses synchronization.
679  uint8_t RDSSYNCFOUND : 1; //!< f set, generate RDSINT when RDS gains synchronization.
680  uint8_t DUMMY1 : 1; //!< Always write to 0.
681  uint8_t RDSNEWBLOCKA : 1; //!< If set, generate an interrupt when Block A data is found or subsequently changed
682  uint8_t RDSNEWBLOCKB : 1; //!< If set, generate an interrupt when Block B data is found or subsequently changed
683  uint8_t DUMMY2 : 5; //!< Reserved - Always write to 0.
684  uint8_t DUMMY3 : 5; //!< Reserved - Always write to 0.
685  } refined;
687 } si47x_rds_int_source;
688 
689 /**
690  * @ingroup group01
691  *
692  * @brief Data type for FM_RDS_CONFIG Property
693  *
694  * IMPORTANT: all block errors must be less than or equal the associated block error threshold for the group
695  * to be stored in the RDS FIFO.
696  * 0 = No errors; 1 = 1–2 bit errors detected and corrected; 2 = 3–5 bit errors detected and corrected; 3 = Uncorrectable.
697  * Recommended Block Error Threshold options:
698  * 2,2,2,2 = No group stored if any errors are uncorrected.
699  * 3,3,3,3 = Group stored regardless of errors.
700  * 0,0,0,0 = No group stored containing corrected or uncorrected errors.
701  * 3,2,3,3 = Group stored with corrected errors on B, regardless of errors on A, C, or D.
702  *
703  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 58 and 104
704  */
705 typedef union
706 {
707  struct
708  {
709  uint8_t RDSEN : 1; //!< 1 = RDS Processing Enable.
710  uint8_t DUMMY1 : 7;
711  uint8_t BLETHD : 2; //!< Block Error Threshold BLOCKD
712  uint8_t BLETHC : 2; //!< Block Error Threshold BLOCKC.
713  uint8_t BLETHB : 2; //!< Block Error Threshold BLOCKB.
714  uint8_t BLETHA : 2; //!< Block Error Threshold BLOCKA.
715  } arg;
717 } si47x_rds_config;
718 
719 /**
720  * @ingroup group01
721  *
722  * @brief Block A data type
723  */
724 typedef union
725 {
726  struct
727  {
728  uint16_t pi;
729  } refined;
730  struct
731  {
732  uint8_t highValue; // Most Significant uint8_t first
733  uint8_t lowValue;
734  } raw;
735 } si47x_rds_blocka;
736 
737 /**
738  * @ingroup group01
739  *
740  * @brief Block B data type
741  *
742  * @details For GCC on System-V ABI on 386-compatible (32-bit processors), the following stands:
743  *
744  * 1) Bit-fields are allocated from right to left (least to most significant).
745  * 2) A bit-field must entirely reside in a storage unit appropriate for its declared type.
746  * Thus a bit-field never crosses its unit boundary.
747  * 3) Bit-fields may share a storage unit with other struct/union members, including members that are not bit-fields.
748  * Of course, struct members occupy different parts of the storage unit.
749  * 4) Unnamed bit-fields' types do not affect the alignment of a structure or union, although individual
750  * bit-fields' member offsets obey the alignment constraints.
751  *
752  * @see also Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 78 and 79
753  * @see also https://en.wikipedia.org/wiki/Radio_Data_System
754  */
755 typedef union
756 {
757  struct
758  {
759  uint16_t address : 2; // Depends on Group Type and Version codes. If 0A or 0B it is the Text Segment Address.
760  uint16_t DI : 1; // Decoder Controll bit
761  uint16_t MS : 1; // Music/Speech
762  uint16_t TA : 1; // Traffic Announcement
763  uint16_t programType : 5; // PTY (Program Type) code
764  uint16_t trafficProgramCode : 1; // (TP) => 0 = No Traffic Alerts; 1 = Station gives Traffic Alerts
765  uint16_t versionCode : 1; // (B0) => 0=A; 1=B
766  uint16_t groupType : 4; // Group Type code.
767  } group0;
768  struct
769  {
770  uint16_t address : 4; // Depends on Group Type and Version codes. If 2A or 2B it is the Text Segment Address.
771  uint16_t textABFlag : 1; // Do something if it chanhes from binary "0" to binary "1" or vice-versa
772  uint16_t programType : 5; // PTY (Program Type) code
773  uint16_t trafficProgramCode : 1; // (TP) => 0 = No Traffic Alerts; 1 = Station gives Traffic Alerts
774  uint16_t versionCode : 1; // (B0) => 0=A; 1=B
775  uint16_t groupType : 4; // Group Type code.
776  } group2;
777  struct
778  {
779  uint16_t content : 4; // Depends on Group Type and Version codes.
780  uint16_t textABFlag : 1; // Do something if it chanhes from binary "0" to binary "1" or vice-versa
781  uint16_t programType : 5; // PTY (Program Type) code
782  uint16_t trafficProgramCode : 1; // (TP) => 0 = No Traffic Alerts; 1 = Station gives Traffic Alerts
783  uint16_t versionCode : 1; // (B0) => 0=A; 1=B
784  uint16_t groupType : 4; // Group Type code.
785  } refined;
786  struct
787  {
788  uint8_t lowValue;
789  uint8_t highValue; // Most Significant byte first
790  } raw;
791 } si47x_rds_blockb;
792 
793 /*
794  *
795  *
796  * Group type 4A ( RDS Date and Time)
797  * When group type 4A is used by the station, it shall be transmitted every minute according to EN 50067.
798  * This Structure uses blocks 2,3 and 5 (B,C,D)
799  *
800  * Commented due to “Crosses boundary” on GCC 32-bit plataform.
801  */
802 /*
803 typedef union {
804  struct
805  {
806  uint32_t offset : 5; // Local Time Offset
807  uint32_t offset_sense : 1; // Local Offset Sign ( 0 = + , 1 = - )
808  uint32_t minute : 6; // UTC Minutes
809  uint32_t hour : 5; // UTC Hours
810  uint32_t mjd : 17; // Modified Julian Day Code
811  } refined;
812  uint8_t raw[6];
813 } si47x_rds_date_time;
814 */
815 
816 /**
817  * @ingroup group01
818  *
819  * Group type 4A ( RDS Date and Time)
820  * When group type 4A is used by the station, it shall be transmitted every minute according to EN 50067.
821  * This Structure uses blocks 2,3 and 5 (B,C,D)
822  *
823  * ATTENTION:
824  * To make it compatible with 8, 16 and 32 bits platforms and avoid Crosses boundary, it was necessary to
825  * split minute and hour representation.
826  */
827 typedef union
828 {
829  struct
830  {
831  uint8_t offset : 5; // Local Time Offset
832  uint8_t offset_sense : 1; // Local Offset Sign ( 0 = + , 1 = - )
833  uint8_t minute1 : 2; // UTC Minutes - 2 bits less significant (void “Crosses boundary”).
834  uint8_t minute2 : 4; // UTC Minutes - 4 bits more significant (void “Crosses boundary”)
835  uint8_t hour1 : 4; // UTC Hours - 4 bits less significant (void “Crosses boundary”)
836  uint8_t hour2 : 1; // UTC Hours - 4 bits more significant (void “Crosses boundary”)
837  uint32_t mjd : 17; // Modified Julian Day Code
838  } refined;
840 } si47x_rds_date_time;
841 
842 /**
843  * @ingroup group01
844  *
845  * AGC data types
846  * FM / AM and SSB structure to AGC
847  *
848  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); For FM page 80; for AM page 142
849  * @see AN332 REV 0.8 Universal Programming Guide Amendment for SI4735-D60 SSB and NBFM patches; page 18.
850  */
851 typedef union
852 {
853  struct
854  {
855  // status ("RESP0")
856  uint8_t STCINT : 1;
857  uint8_t DUMMY1 : 1;
858  uint8_t RDSINT : 1; // Not used for AM/SSB
859  uint8_t RSQINT : 1;
860  uint8_t DUMMY2 : 2;
861  uint8_t ERR : 1;
862  uint8_t CTS : 1;
863  // RESP1
864  uint8_t AGCDIS : 1; // This bit indicates if the AGC is enabled or disabled. 0 = AGC enabled; 1 = AGC disabled.
865  uint8_t DUMMY : 7;
866  // RESP2
867  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.
868  } refined;
870 } si47x_agc_status;
871 
872 /**
873  * @ingroup group01
874  *
875  * If FM, Overrides AGC setting by disabling the AGC and forcing the LNA to have a certain gain that ranges between 0
876  * (minimum attenuation) and 26 (maximum attenuation).
877  * If AM, overrides the AGC setting by disabling the AGC and forcing the gain index that ranges between 0
878  *
879  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); For FM page 81; for AM page 143
880  */
881 typedef union
882 {
883  struct
884  {
885  // ARG1
886  uint8_t AGCDIS : 1; // if set to 1 indicates if the AGC is disabled. 0 = AGC enabled; 1 = AGC disabled.
887  uint8_t DUMMY : 7;
888  // ARG2
889  uint8_t AGCIDX; // AGC Index; If AMAGCDIS = 1, this byte forces the AGC gain index; 0 = Minimum attenuation (max gain)
890  } arg;
892 } si47x_agc_overrride;
893 
894 /**
895  * @ingroup group01
896  *
897  * The bandwidth of the AM channel filter data type
898  * AMCHFLT values: 0 = 6 kHz Bandwidth
899  * 1 = 4 kHz Bandwidth
900  * 2 = 3 kHz Bandwidth
901  * 3 = 2 kHz Bandwidth
902  * 4 = 1 kHz Bandwidth
903  * 5 = 1.8 kHz Bandwidth
904  * 6 = 2.5 kHz Bandwidth, gradual roll off
905  * 7–15 = Reserved (Do not use)
906  *
907  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 125 and 151
908  */
909 typedef union
910 {
911  struct
912  {
913  uint8_t AMCHFLT : 4; //!< Selects the bandwidth of the AM channel filter.
914  uint8_t DUMMY1 : 4;
915  uint8_t AMPLFLT : 1; //!< Enables the AM Power Line Noise Rejection Filter.
916  uint8_t DUMMY2 : 7;
917  } param;
919 } si47x_bandwidth_config; // AM_CHANNEL_FILTER
920 
921 /**
922  * @ingroup group01
923  *
924  * SSB - datatype for SSB_MODE (property 0x0101)
925  *
926  * @see AN332 REV 0.8 UNIVERSAL PROGRAMMING GUIDE; page 24
927  */
928 typedef union
929 {
930  struct
931  {
932  uint8_t AUDIOBW : 4; //!< 0 = 1.2kHz (default); 1=2.2kHz; 2=3kHz; 3=4kHz; 4=500Hz; 5=1kHz
933  uint8_t SBCUTFLT : 4; //!< SSB side band cutoff filter for band passand low pass filter
934  uint8_t AVC_DIVIDER : 4; //!< set 0 for SSB mode; set 3 for SYNC mode;
935  uint8_t AVCEN : 1; //!< SSB Automatic Volume Control (AVC) enable; 0=disable; 1=enable (default);
936  uint8_t SMUTESEL : 1; //!< SSB Soft-mute Based on RSSI or SNR
937  uint8_t DUMMY1 : 1; //!< Always write 0;
938  uint8_t DSP_AFCDIS : 1; //!< 0=SYNC MODE, AFC enable; 1=SSB MODE, AFC disable.
939  } param;
941 } si47x_ssb_mode;
942 
943 /**
944  * @ingroup group01
945  *
946  * @brief Digital audio output format data structure (Property 0x0102. DIGITAL_OUTPUT_FORMAT).
947  *
948  * @details Used to configure: DCLK edge, data format, force mono, and sample precision.
949  *
950  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); page 195.
951  */
952 typedef union
953 {
954  struct
955  {
956  uint8_t OSIZE : 2; //!< Digital Output Audio Sample Precision (0=16 bits, 1=20 bits, 2=24 bits, 3=8bits).
957  uint8_t OMONO : 1; //!< Digital Output Mono Mode (0=Use mono/stereo blend ).
958  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).
959  uint8_t OFALL : 1; //!< Digital Output DCLK Edge (0 = use DCLK rising edge, 1 = use DCLK falling edge)
960  uint8_t dummy : 8; //!< Always 0.
961  } refined;
963 } si4735_digital_output_format;
964 
965 /**
966  * @ingroup group01
967  * @brief patch header stored in a eeprom
968  * @details This data type represents o header of a eeprom with a patch content
969  * @details This structure will be used to read an eeprom generated by leo sketch SI47XX_09_SAVE_SSB_PATCH_EEPROM.ino.
970  * @details The sketch SI47XX_09_SAVE_SSB_PATCH_EEPROM can be found on Examples/SI47XX_TOOLS folder
971  */
972 typedef union
973 {
974  struct
975  {
976  uint8_t reserved[8]; // Not used
977  uint8_t status[8]; // Note used
978  uint8_t patch_id[14]; // Patch name
979  uint16_t patch_size; // Patch size (in bytes)
980  } refined;
982 } si4735_eeprom_patch_header;
983 
984 /**
985  * @ingroup group01
986  *
987  * @brief Digital audio output sample structure (Property 0x0104. DIGITAL_OUTPUT_SAMPLE_RATE).
988  *
989  * @details Used to enable digital audio output and to configure the digital audio output sample rate in samples per second (sps).
990  *
991  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); page 196.
992  */
993 typedef struct
994 {
995  uint16_t DOSR; // Digital Output Sample Rate(32–48 ksps .0 to disable digital audio output).
996 } si4735_digital_output_sample_rate; // Maybe not necessary
997 
998 volatile static bool data_from_si4735; /** @ingroup group04 store the interrupt status */
999 
1000 /**
1001  * @brief Interrupt Function
1002  *
1003  * @details this function just set the volatile static bool data_from_si4735 to true;
1004  *
1005  * If you are using interrupt feature, this function will be called by the system, not by you.
1006  * If you are not using interrupt feature, please, ignore the compile message:
1007  * "warning: 'void interrupt_hundler()' defined but not used [-Wunused-function]"
1008  */
1009 static void interrupt_hundler()
1010 {
1011  data_from_si4735 = true;
1012 };
1013 
1014 /**********************************************************************
1015  * SI4735 Class definition
1016  **********************************************************************/
1017 
1018 /**
1019  * @brief SI4735 Class
1020  *
1021  * @details This class implements all functions to help you to control the Si47XX devices.
1022  * This library was built based on “Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0)”.
1023  * It also can be used on all members of the SI473X family respecting, of course, the features available
1024  * for each IC version. These functionalities can be seen in the comparison matrix shown in
1025  * table 1 (Product Family Function); pages 2 and 3 of the programming guide.
1026  *
1027  * @author PU2CLR - Ricardo Lima Caratti
1028  */
1029 class SI4735
1030 {
1031 protected:
1032  char rds_buffer2A[65]; //!< RDS Radio Text buffer - Program Information
1033  char rds_buffer2B[33]; //!< RDS Radio Text buffer - Station Informaation
1034  char rds_buffer0A[9]; //!< RDS Basic tuning and switching information (Type 0 groups)
1035  char rds_time[20]; //!< RDS date time received information
1036 
1037  int rdsTextAdress2A; //!< rds_buffer2A current position
1038  int rdsTextAdress2B; //!< rds_buffer2B current position
1039  int rdsTextAdress0A; //!< rds_buffer0A current position
1040 
1041  int16_t deviceAddress = SI473X_ADDR_SEN_LOW; //!< Stores the current I2C bus address.
1042 
1043  // Delays
1044  uint16_t maxDelaySetFrequency = MAX_DELAY_AFTER_SET_FREQUENCY; //!< Stores the maximum delay after set frequency command (in ms).
1045  uint16_t maxDelayAfterPouwerUp = MAX_DELAY_AFTER_POWERUP; //!< Stores the maximum delay you have to setup after a power up command (in ms).
1046  unsigned long maxSeekTime = MAX_SEEK_TIME; //!< Stores the maximum time (ms) for a seeking process. Defines the maximum seeking time.
1047 
1049  uint8_t resetPin; //!< pin used on Arduino Board to RESET the Si47XX device
1050  uint8_t interruptPin; //!< pin used on Arduino Board to control interrupt. If -1, interrupt is no used.
1051 
1052  uint8_t currentTune; //!< tell the current tune (FM, AM or SSB)
1053 
1054  uint16_t currentMinimumFrequency; //!< minimum frequency of the current band
1055  uint16_t currentMaximumFrequency; //!< maximum frequency of the current band
1056  uint16_t currentWorkFrequency; //!< current frequency
1057 
1058  uint16_t currentStep; //!< Stores the current step used to increment or decrement the frequency.
1059 
1060  uint8_t lastMode = -1; //!< Stores the last mode used.
1061 
1062  uint8_t currentAvcAmMaxGain = 48; //!< Stores the current Automatic Volume Control Gain for AM. Default value is 48.
1063  uint8_t currentClockType = XOSCEN_CRYSTAL; //!< Stores the current clock type used (Crystal or REF CLOCK)
1064  uint8_t currentInterruptEnable = 0; //!< If you are using interrupt, this variable stores 1.
1065 
1066  uint16_t refClock = 31768; //!< Frequency of Reference Clock in Hz.
1067  uint16_t refClockPrescale = 1; //!< Prescaler for Reference Clock (divider).
1068  uint8_t refClockSourcePin = 0; //!< 0 = RCLK pin is clock source; 1 = DCLK pin is clock source.
1069 
1070  si47x_frequency currentFrequency; //!< data structure to get current frequency
1071  si47x_set_frequency currentFrequencyParams;
1072  si47x_rqs_status currentRqsStatus; //!< current Radio SIgnal Quality status
1073  si47x_response_status currentStatus; //!< current device status
1074  si47x_firmware_information firmwareInfo; //!< firmware information
1075  si47x_rds_status currentRdsStatus; //!< current RDS status
1076  si47x_agc_status currentAgcStatus; //!< current AGC status
1077  si47x_ssb_mode currentSSBMode; //!< indicates if USB or LSB
1078 
1079  si473x_powerup powerUp;
1080 
1081  uint8_t volume = 32; //!< Stores the current vlume setup (0-63).
1082 
1083  uint8_t currentAudioMode = SI473X_ANALOG_AUDIO; //!< Current audio mode used (ANALOG or DIGITAL or both)
1086 
1087  void waitInterrupr(void);
1088  si47x_status getInterruptStatus();
1089 
1090  void setGpioCtl(uint8_t GPO1OEN, uint8_t GPO2OEN, uint8_t GPO3OEN);
1091  void setGpio(uint8_t GPO1LEVEL, uint8_t GPO2LEVEL, uint8_t GPO3LEVEL);
1092  void setGpioIen(uint8_t STCIEN, uint8_t RSQIEN, uint8_t ERRIEN, uint8_t CTSIEN, uint8_t STCREP, uint8_t RSQREP);
1093 
1094  void sendProperty(uint16_t propertyNumber, uint16_t param);
1095 
1096  void sendSSBModeProperty();
1097  void disableFmDebug();
1098  void clearRdsBuffer2A();
1099  void clearRdsBuffer2B();
1100  void clearRdsBuffer0A();
1101 
1102  void getSsbAgcStatus();
1103  void setSsbAgcOverrite(uint8_t SSBAGCDIS, uint8_t SSBAGCNDX);
1104 
1105 public:
1106  SI4735();
1107  void reset(void);
1108  void waitToSend(void);
1109 
1110  void setup(uint8_t resetPin, uint8_t defaultFunction);
1111  void setup(uint8_t resetPin, int interruptPin, uint8_t defaultFunction, uint8_t audioMode = SI473X_ANALOG_AUDIO, uint8_t clockType = XOSCEN_CRYSTAL);
1112 
1113  void setRefClock(uint16_t refclk);
1114  void setRefClockPrescaler(uint16_t prescale, uint8_t rclk_sel = 0);
1115 
1117 
1118  /**
1119  * @ingroup group10 Generic set and get property
1120  *
1121  * @brief Sets a given SI47XX device property
1122  *
1123  * @details Sets the Si47XX device with a given attribute.
1124  * @details You might need to use the bit operations or some bit field structure to set right the values.
1125  * @details Used this function instead of the sendProperty.
1126  *
1127  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 55, 69, 124 and 134.
1128  * @see getProperty, sendProperty
1129  * @param propertyNumber
1130  * @param param pamameter value
1131  */
1132  inline void setProperty(uint16_t propertyNumber, uint16_t param)
1133  {
1134  sendProperty(propertyNumber, param);
1135  };
1136 
1137  void sendCommand(uint8_t cmd, int parameter_size, const uint8_t *parameter);
1138  void getCommandResponse(int num_of_bytes, uint8_t *response);
1139  si47x_status getStatusResponse();
1140 
1141  void setPowerUp(uint8_t CTSIEN, uint8_t GPO2OEN, uint8_t PATCH, uint8_t XOSCEN, uint8_t FUNC, uint8_t OPMODE);
1142  void radioPowerUp(void);
1143  void analogPowerUp(void);
1144  void powerDown(void);
1145 
1146  void setFrequency(uint16_t);
1147 
1148  void getStatus(uint8_t, uint8_t);
1149 
1150  uint16_t getFrequency(void);
1151 
1152  /**
1153  * STATUS RESPONSE
1154  * Set of methods to get current status information. Call them after getStatus or getFrequency or seekStation
1155  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 63
1156  */
1157 
1158  /**
1159  * @ingroup group08
1160  * @brief Get the Signal Quality Interrupt status
1161  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 63
1162  * @return RDSINT status
1163  */
1165  {
1166  return currentStatus.resp.RSQINT;
1167  };
1168 
1169  /**
1170  * @ingroup group08
1171  * @brief Get the Radio Data System (RDS) Interrupt status
1172  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); page 63
1173  * @return RDSINT status
1174  */
1176  {
1177  return currentStatus.resp.RDSINT;
1178  };
1179 
1180  /**
1181  * @ingroup group08
1182  * @brief Get the Tune Complete status
1183  * @details Seek/Tune Complete Interrupt; 1 = Tune complete has been triggered.
1184  * @return STCINT status
1185  */
1187  {
1188  return currentStatus.resp.STCINT;
1189  };
1190 
1191  /**
1192  * @ingroup group08
1193  * @brief Get the Status Error
1194  * @details Return the Error flag (true or false) of status of the least Tune or Seek
1195  * @return Error flag
1196  */
1197  inline bool getStatusError()
1198  {
1199  return currentStatus.resp.ERR;
1200  };
1201 
1202  /**
1203  * @ingroup group08
1204  * @brief Gets the Error flag Clear to Send
1205  *
1206  * @return CTS
1207  */
1208  inline bool getStatusCTS() { return currentStatus.resp.CTS; };
1209 
1210  /**
1211  * @ingroup group08
1212  * @brief Returns true if the AFC rails (AFC Rail Indicator).
1213  *
1214  * @return true
1215  */
1216  inline bool getACFIndicator()
1217  {
1218  return currentStatus.resp.AFCRL;
1219  };
1220 
1221  /**
1222  * @ingroup group08
1223  * @brief Returns true if a seek hit the band limit
1224  *
1225  * @details (WRAP = 0 in FM_START_SEEK) or wrapped to the original frequency(WRAP = 1).
1226  *
1227  * @return BLTF
1228  */
1229  inline bool getBandLimit()
1230  {
1231  return currentStatus.resp.BLTF;
1232  };
1233 
1234  /**
1235  * @ingroup group08
1236  * @brief Gets the channel status
1237  *
1238  * @details Returns true if the channel is currently valid as determined by the seek/tune properties (0x1403, 0x1404, 0x1108)
1239  *
1240  * @return true
1241  * @return false
1242  */
1243  inline bool getStatusValid()
1244  {
1245  return currentStatus.resp.VALID;
1246  };
1247 
1248  /**
1249  * @ingroup group08
1250  * @brief Returns the value of Received Signal Strength Indicator (dBμV).
1251  *
1252  * @return uint8_t
1253  */
1255  {
1256  return currentStatus.resp.RSSI;
1257  };
1258 
1259  /**
1260  * @ingroup group08
1261  * @brief Gets the SNR metric when tune is complete (dB)
1262  *
1263  * @details Returns the value of the SNR metric when tune is complete (dB).
1264  *
1265  * @return uint8_t
1266  */
1268  {
1269  return currentStatus.resp.SNR;
1270  };
1271 
1272  /**
1273  * @ingroup group08
1274  * @brief Get the Status the M U L T
1275  *
1276  * @details Returns the value containing the multipath metric when tune is complete.
1277  *
1278  * @return uint8_t
1279  */
1281  {
1282  return currentStatus.resp.MULT;
1283  };
1284 
1285  /**
1286  * @ingroup group17
1287  * @brief Get the Antenna Tuning Capacitor value
1288  * @details Returns the current antenna tuning capacitor value. The tuning capacitance is 95 fF x READANTCAP + 7 pF.
1289  * @details ON AM or SSB mode, the MULT attribute sotores the high byte of READANTCAP and the attribute READANTCAP by itself stores the low byte.
1290  *
1291  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 74,74, 140 and 141.
1292  * @return uint8_t capacitance
1293  */
1295  {
1296  si47x_antenna_capacitor cap;
1297 
1298  if (currentTune == FM_TUNE_FREQ)
1299  return currentStatus.resp.READANTCAP;
1300  else
1301  {
1302  cap.raw.ANTCAPL = currentStatus.resp.READANTCAP; // On AM it is the low byte the READANTCAP value
1303  cap.raw.ANTCAPH = currentStatus.resp.MULT; // On AM it is the high byte the READANTCAP value
1304  return cap.value;
1305  }
1306  };
1307 
1308  void getAutomaticGainControl(); //!< Queries Automatic Gain Control STATUS
1309 
1310  /**
1311  * @ingroup group17
1312  * @brief Sets the Avc Am Max Gain to 48dB
1313  *
1314  */
1315  inline void setAvcAmMaxGain()
1316  {
1317  sendProperty(AM_AUTOMATIC_VOLUME_CONTROL_MAX_GAIN, ((currentAvcAmMaxGain = 48) * 340));
1318  };
1319 
1320  void setAvcAmMaxGain(uint8_t gain); //!< Sets the maximum gain for automatic volume control.
1321 
1322  /**
1323  * @ingroup group17
1324  * @brief Get the current Avc Am Max Gain
1325  *
1326  * @return uint8_t Current AVC gain index value
1327  */
1329  {
1330  return currentAvcAmMaxGain;
1331  };
1332 
1333  /**
1334  * @ingroup group17
1335  * @brief Sets the Am Soft Mute Max Attenuation
1336  *
1337  * @details This function can be useful to disable Soft Mute. The value 0 disable soft mute.
1338  * @details Specified in units of dB. Default maximum attenuation is 8 dB. It works for AM and SSB.
1339  *
1340  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); page 158.
1341  *
1342  * @param smattn Maximum attenuation to apply when in soft mute
1343  */
1344  inline void setAmSoftMuteMaxAttenuation(uint8_t smattn = 0)
1345  {
1346  sendProperty(AM_SOFT_MUTE_MAX_ATTENUATION, smattn);
1347  };
1348 
1349  /**
1350  * @ingroup group17
1351  * @brief Sets the SSB Soft Mute Max Attenuation object
1352  *
1353  * @details Sets maximum attenuation during soft mute (dB). Set to 0 to disable soft mute.
1354  * @details Specified in units of dB. Default maximum attenuation is 8 dB.
1355  * @details You can use setAmSoftMuteMaxAttenuation instead. Same AM property values.
1356  * @param smattn Maximum attenuation to apply when in soft mute.
1357  */
1358  inline void setSsbSoftMuteMaxAttenuation(uint8_t smattn = 0)
1359  {
1360  sendProperty(SSB_SOFT_MUTE_MAX_ATTENUATION, smattn);
1361  };
1362 
1363  /**
1364  * @ingroup group08
1365  * @brief Checks if the AGC is enabled
1366  *
1367  * @return true if the AGC is enabled
1368  */
1369  inline bool isAgcEnabled()
1370  {
1371  return !currentAgcStatus.refined.AGCDIS;
1372  };
1373 
1374  /**
1375  * @ingroup group08
1376  * @brief Gets the current AGC gain index
1377  *
1378  * @return uint8_t The current AGC gain index.
1379  */
1381  {
1382  return currentAgcStatus.refined.AGCIDX;
1383  };
1384 
1385  void setAutomaticGainControl(uint8_t AGCDIS, uint8_t AGCIDX);
1386 
1387  void getCurrentReceivedSignalQuality(uint8_t INTACK);
1389 
1390  // AM and FM
1391 
1392  /**
1393  * @ingroup group08
1394  * @brief Get the current receive signal strength (0–127 dBμV)
1395  *
1396  * @return uint8_t a value between 0 to 127
1397  */
1399  {
1400  return currentRqsStatus.resp.RSSI;
1401  };
1402 
1403  /**
1404  * @ingroup group08
1405  * @brief Gets the current SNR metric (0–127 dB).
1406  *
1407  * @return uint8_t SNR value in dB (0-127)
1408  */
1410  {
1411  return currentRqsStatus.resp.SNR;
1412  };
1413 
1414  /**
1415  * @ingroup group08
1416  * @brief Checks if RSSI detected is LOW.
1417  *
1418  * @return true if RSSI is low
1419  */
1421  {
1422  return currentRqsStatus.resp.RSSIILINT;
1423  };
1424 
1425  /**
1426  * @ingroup group08
1427  * @brief Checks if RSSI detected is high
1428  *
1429  * @return true if RSSI detected is high
1430  */
1432  {
1433  return currentRqsStatus.resp.RSSIHINT;
1434  };
1435 
1436  /**
1437  * @ingroup group08
1438  * @brief Checks if SNR detect is low
1439  *
1440  * @return true if SNR detected is low
1441  */
1443  {
1444  return currentRqsStatus.resp.SNRLINT;
1445  };
1446 
1447  /**
1448  * @ingroup group08
1449  * @brief Checks if SNR detect is high
1450  *
1451  * @return true if SNR detect is high
1452  */
1454  {
1455  return currentRqsStatus.resp.SNRHINT;
1456  };
1457 
1458  /**
1459  * @ingroup group08
1460  * @brief Checks if the current channel is valid
1461  *
1462  * @return true if the current channel is valid
1463  */
1465  {
1466  return currentRqsStatus.resp.VALID;
1467  };
1468 
1469  /**
1470  * @ingroup group08
1471  * @brief AFC Rail Indicator
1472  *
1473  * @return true or false
1474  */
1476  {
1477  return currentRqsStatus.resp.AFCRL;
1478  };
1479 
1480  /**
1481  * @ingroup group08
1482  * @brief Soft Mute Indicator.
1483  *
1484  * @details Indicates soft mute is engaged.
1485  *
1486  * @return true if soft mute indicates is engaged.
1487  */
1489  {
1490  return currentRqsStatus.resp.SMUTE;
1491  };
1492 
1493  // Just FM
1494 
1495  /**
1496  * @ingroup group08
1497  * @brief Gets the value of the amount of stereo blend in % (100 = full stereo, 0 = full mono).
1498  *
1499  * @return uint8_t value (0 to 100)
1500  */
1502  {
1503  return currentRqsStatus.resp.STBLEND;
1504  };
1505 
1506  /**
1507  * @ingroup group08
1508  * @brief Checks the current pilot
1509  *
1510  * @details Indicates stereo pilot presence.
1511  *
1512  * @return true if stereo pilot presence has detected
1513  */
1514  inline bool getCurrentPilot()
1515  {
1516  return currentRqsStatus.resp.PILOT;
1517  };
1518 
1519  /**
1520  * @ingroup group08
1521  * @brief Gets the current Multipath
1522  *
1523  * @details Contains the current multipath metric. (0 = no multipath; 100 = full multipath)
1524  *
1525  * @return uint8_t value (0 to 100)
1526  */
1528  {
1529  return currentRqsStatus.resp.MULT;
1530  };
1531 
1532  /**
1533  * @ingroup group08
1534  * @brief Gets the Signed frequency offset (kHz).
1535  *
1536  * @return uint8_t
1537  */
1539  return currentRqsStatus.resp.FREQOFF;
1540  };
1541 
1542  /**
1543  * @ingroup group08
1544  * @brief Get Multipath Detect Low
1545  *
1546  * @return true
1547  * @return false
1548  */
1550  return currentRqsStatus.resp.MULTLINT;
1551  };
1552 
1553  /**
1554  * @ingroup group08
1555  * @brief Gets the Current Multipath Detect High
1556  *
1557  * @return true
1558  * @return false
1559  */
1561  return currentRqsStatus.resp.MULTHINT;
1562  };
1563 
1564  /**
1565  * @ingroup group08
1566  * @brief Gets the Current Blend Detect Interrupt
1567  *
1568  * @return true
1569  * @return false
1570  */
1572  return currentRqsStatus.resp.BLENDINT;
1573  };
1574 
1575  /*
1576  * FIRMWARE RESPONSE
1577  *
1578  * See Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); page 66
1579  */
1580 
1581  /**
1582  * @ingroup group06
1583  * @brief Returns the Firmware Part Number
1584  *
1585  * @return uint8_t
1586  */
1588  return firmwareInfo.resp.PN;
1589  };
1590 
1591  /**
1592  * @ingroup group06
1593  * @brief Returns the Firmware F W M A J O R
1594  *
1595  * @return uint8_t
1596  */
1598  return firmwareInfo.resp.FWMAJOR;
1599  };
1600 
1601  /**
1602  * @ingroup group06
1603  * @brief Returns the Firmware F W M I N O R
1604  *
1605  * @return uint8_t
1606  */
1608  return firmwareInfo.resp.FWMINOR;
1609  };
1610 
1611  /**
1612  * @ingroup group06
1613  * @brief Returns the Firmware P A T C H HIGH
1614  *
1615  * @return uint8_t
1616  */
1618  return firmwareInfo.resp.PATCHH;
1619  };
1620 
1621  /**
1622  * @ingroup group06
1623  * @brief Returns the Firmware P A T C H LOW
1624  *
1625  * @return uint8_t
1626  */
1628  return firmwareInfo.resp.PATCHL;
1629  };
1630 
1631  /**
1632  * @ingroup group06
1633  * @brief Get the Firmware C M P M A J O R object
1634  *
1635  * @return uint8_t
1636  */
1638  return firmwareInfo.resp.CMPMAJOR;
1639  }; //!< RESP6 - Returns the Component Major Revision (ASCII).
1640 
1641  /**
1642  * @ingroup group06
1643  * @brief Returns the Component Minor Revision (ASCII) (RESP7)
1644  *
1645  * @return uint8_t
1646  */
1648  return firmwareInfo.resp.CMPMINOR;
1649  };
1650 
1651  /**
1652  * @ingroup group06
1653  * @brief RESP8 - Returns the Chip Revision (ASCII)
1654  *
1655  * @return uint8_t
1656  */
1658  return firmwareInfo.resp.CHIPREV;
1659  };
1660 
1661  void setVolume(uint8_t volume);
1662  uint8_t getVolume();
1663  void volumeDown();
1664  void volumeUp();
1665 
1666  /**
1667  * @ingroup group13 Audio volume
1668  * @brief Get the Current Volume
1669  * @details Returns the current volume level.
1670  * @return uint8_t
1671  */
1672  inline uint8_t getCurrentVolume() { return volume; };
1673 
1674  /**
1675  * @ingroup group13 Audio volume
1676  * @brief Set the Volume Up
1677  * @details Same volumeUp()
1678  * @see volumeUp
1679  */
1680  inline void setVolumeUp() { volumeUp(); };
1681  /**
1682  * @ingroup group13 Audio volume
1683  * @brief Set the Volume Down
1684  * @details Same volumeDown()
1685  * @return voi
1686  */
1687  inline void setVolumeDown() { volumeDown(); };
1688 
1689  /**
1690  * @ingroup group13 Digital Audio setup
1691  * @brief Sets the Audio Mode. See table below.
1692  * @details If you want to change the audio mode, call this function before call setAM(), setFM() or setSSB().
1693  * @details Sets the Si47XX device to use ANALOG or DIGITAL audio output. The table below show the valid values.
1694  * @details This function will only take effect after calling setAM(), setFM() or setSSB().
1695  *
1696  *
1697  * | Macro | Value (Binary) | Description |
1698  * | ----- | ----- | ----------- |
1699  * | SI473X_ANALOG_AUDIO | 0b00000101 | Analog Audio Inputs |
1700  * | SI473X_DIGITAL_AUDIO1 | 0b00001011 | Digital audio output (DCLK, LOUT/DFS, ROUT/DIO) |
1701  * | SI473X_DIGITAL_AUDIO2 | 0b10110000 | Digital audio outputs (DCLK, DFS, DIO) |
1702  * | SI473X_DIGITAL_AUDIO3 | 0b10110101 | Analog and digital audio outputs (LOUT/ROUT and DCLK, DFS,DIO) |
1703  *
1704  * @see setAM(), setFM(), setSSB().
1705  * @param audioMode One of the values options above
1706  */
1707  inline void setAudioMode(uint8_t audioMode)
1708  {
1709  currentAudioMode = audioMode;
1710  };
1711 
1712  /**
1713  * @ingroup group13 Audio Noise Blank Delay
1714  * @brief Sets the delay before applying impulse blanking
1715  * @details Delay in micro-sonds before applying impulse blanking to the original samples. Default value is 172.
1716  *
1717  * @param value Delay in micro-seconds
1718  */
1719  inline void setAmDelayNB(uint16_t value) {
1720  sendProperty(AM_NB_DELAY, value);
1721  }
1722 
1723  void digitalOutputFormat(uint8_t OSIZE, uint8_t OMONO, uint8_t OMODE, uint8_t OFALL);
1724  void digitalOutputSampleRate(uint16_t DOSR);
1725 
1726  void setAudioMute(bool off); // if true mute the audio; else unmute
1727 
1728  void setAM();
1729  void setFM();
1730  void setAM(uint16_t fromFreq, uint16_t toFreq, uint16_t intialFreq, uint16_t step);
1731  void setFM(uint16_t fromFreq, uint16_t toFreq, uint16_t initialFreq, uint16_t step);
1732 
1733  /**
1734  * @ingroup group08
1735  * @brief Sets the FM Receive de-emphasis to 50 or 75 μs.
1736  * @details valid parameters are 1 = 50 μs. Usedin Europe, Australia, Japan; 2 = 75 μs. Used in USA (default)
1737  *
1738  * @param parameter 1 or 2 (default 1 - USA)
1739  */
1740  inline void setFMDeEmphasis(uint8_t parameter)
1741  {
1742  sendProperty(FM_DEEMPHASIS, parameter);
1743  };
1744 
1745 
1746  /**
1747  * @ingroup group08
1748  * @brief Sets the AM Receive de-emphasis to 50 or disable.
1749  * @details valid parameters are 1 = 50 μs. Usedin urope, Australia, Japan; 2 = 75 μs. Used in USA (default)
1750  *
1751  * @param parameter 1 = enable or 0 = disable
1752  */
1753  inline void setAMDeEmphasis(uint8_t parameter)
1754  {
1755  sendProperty(AM_DEEMPHASIS, parameter);
1756  };
1757 
1758  /**
1759  * @ingroup group08
1760  * @brief Sets the AM attenuation slope during soft mute
1761  * @details Configures attenuation slope during soft mute in dB attenuation per dB SNR below the soft mute SNR threshold.
1762  * @details Soft mute attenuation is the minimum of SMSLOPEx(SMTHR–SNR) and SMATTN.
1763  * @details The default slope is 1 dB/dB for AMRX component 5.0 or later and 2 dB/dB for AMRX component 3.0 or earlier.
1764  *
1765  * @see setAmSoftMuteMaxAttenuation
1766  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0);
1767  * @param parameter the valid values are 1–5 (default 1).
1768  */
1769  inline void setAMSoftMuteSlop(uint8_t parameter)
1770  {
1771  sendProperty(AM_SOFT_MUTE_SLOPE, parameter);
1772  };
1773 
1774 
1775  /**
1776  * @ingroup group08
1777  * @brief Sets the attack and decay rates when entering or leaving soft mute.
1778  * @details The value specified is multiplied by 4.35 dB/s to come up with the actual attack rate
1779  * @details The default rate is 278 dB/s.
1780  * @see setAmSoftMuteMaxAttenuation
1781  * @see Si47XX PRORAMMING GUIDE; AN332 (REV 1.0);
1782  * @param parameter The valid values are 1-255 ( Default is ~64 - [64 x 4.35 = 278] )
1783  */
1784  inline void setAMSoftMuteRate(uint8_t parameter)
1785  {
1786  sendProperty(AM_SOFT_MUTE_RATE, parameter);
1787  };
1788 
1789 
1790  /**
1791  * @ingroup group08
1792  * @brief Sets the SNR threshold to engage soft mute
1793  * @details Whenever the SNR for a tuned frequency drops below this threshold the AM reception will go in soft mute,
1794  * @details provided soft mute max attenuation property is non-zero. The default value is 8dB
1795  * @see setAmSoftMuteMxAttenuation
1796  * @see Si47XX PROAMMING GUIDE; AN332 (REV 1.0);
1797  * @param parameter 0-63 (default is 8)
1798  */
1799  inline void setAMSoftMuteSnrThreshold(uint8_t parameter)
1800  {
1801  sendProperty(AM_SOFT_MUTE_SNR_THRESHOLD, parameter);
1802  };
1803 
1804  /**
1805  * @ingroup group08
1806  * @brief Sets the soft mute release rate.
1807  * @details Smaller values provide slower release and larger values provide faster release. The default is 8192 (approximately 8000 dB/s).
1808  * @see setAmSoftMuteMxAttenuation
1809  * @see Si47XX PROAMMING GUIDE; AN332 (REV 1.0);
1810  * @param parameter 1–32767
1811  */
1812  inline void setAMSoftMuteReleaseRate(uint8_t parameter)
1813  {
1814  sendProperty(AM_SOFT_MUTE_RELEASE_RATE, parameter);
1815  };
1816 
1817  /**
1818  * @ingroup group08
1819  * @brief Sets the soft mute attack rate.
1820  * @details Smaller values provide slower attack and larger values provide faster attack.
1821  * @see setAmSoftMuteMxAttenuation
1822  * @see Si47XX PROAMMING GUIDE; AN332 (REV 1.0);
1823  * @param parameter 1–32767 (The default is 8192 (approximately 8000 dB/s)
1824  */
1825  inline void setAMSoftMuteAttackRate(uint16_t parameter)
1826  {
1827  sendProperty(AM_SOFT_MUTE_ATTACK_RATE, parameter);
1828  };
1829 
1830  /**
1831  * @ingroup group08
1832  * @brief Sets the AGC attack rate.
1833  * @details Large values provide slower attack, and smaller values provide faster attack..
1834  * @see setAmAgcAttackRate
1835  * @see Si47XX PROAMMING GUIDE; AN332 (REV 1.2); page 167
1836  * @param parameter Range: 4–248 (The default is 0x04)
1837  */
1838  inline void setAmAgcAttackRate(uint16_t parameter)
1839  {
1840  sendProperty(AM_AGC_ATTACK_RATE, parameter);
1841  };
1842 
1843  /**
1844  * @ingroup group08
1845  * @brief Sets the AGC release rate.
1846  * @details Larger values provide slower release, and smaller values provide faster release.
1847  * @see setAmAgcReleaseRate
1848  * @see Si47XX PROAMMING GUIDE; AN332 (REV 1.2); page 168
1849  * @param parameter Range: 4–248 (The default is 0x8C)
1850  */
1851  inline void setAmAgcReleaseRate(uint16_t parameter)
1852  {
1853  sendProperty(AM_AGC_RELEASE_RATE, parameter);
1854  };
1855 
1856  /**
1857  * @ingroup group17
1858  * @brief Sets the AGC attack rate on SSB mode.
1859  * @details Large values provide slower attack, and smaller values provide faster attack..
1860  * @see setSsbAgcAttackRate
1861  * @see AN332 REV 0.8 UNIVERSAL PROGRAMMING GUIDE; page 29
1862  * @param parameter Range: 4–248 (The default is 0x04)
1863  */
1864  inline void setSsbAgcAttackRate(uint16_t parameter)
1865  {
1866  sendProperty(SSB_RF_AGC_ATTACK_RATE, parameter);
1867  };
1868 
1869  /**
1870  * @ingroup group17
1871  * @brief Sets the AGC Release rate on SSB mode.
1872  * @details Larger values provide slower release, and smaller values provide faster release.
1873  * @see setSsbAgcAttackRate
1874  * @see AN332 REV 0.8 UNIVERSAL PROGRAMMING GUIDE; page 29
1875  * @param parameter Range: 4–248 (The default is 0x18)
1876  */
1877  inline void setSsbAgcReleaseRate(uint16_t parameter)
1878  {
1879  sendProperty(SSB_RF_AGC_RELEASE_RATE, parameter);
1880  };
1881 
1882  /**
1883  * @ingroup group08
1884  * @brief Adjusts the AM AGC for external front-end attenuator and external front-end cascode LNA.
1885  * @details This property contains two fields: MIN_GAIN_INDEX and ATTN_BACKUP.
1886  * @details MIN_GAIN_INDEX impacts sensitivity and U/D performance. Lower values improve sensitivity, but degrade
1887  * @details far away blocker U/D performance.
1888  * @details Higher values degrade sensitivity, but improve U/D. With MIN_GAIN_INDEX=19 and Si4743 EVB reference
1889  * @details design, the Si474x provides sensitivity of 28dBuV typical and U/D exceeding 55dB on far away blockers.
1890  * @details With MIN_GAIN_INDEX=24, the Si474x provides sensitivity of 34dBuV typical and U/D approaching 70dB on
1891  * @details far away blockers.
1892  * @see Si47XX PROAMMING GUIDE; AN332 (REV 1.0); page 168
1893  * @param MIN_GAIN_INDEX Values below 19 have minimal sensitivity improvement; Higher values degrade sensitivity, but improve U/D.
1894  * @param ATTN_BACKUP ???
1895  */
1896  inline void setAMFrontEndAgcControl(uint8_t MIN_GAIN_INDEX, uint8_t ATTN_BACKUP)
1897  {
1898  si47x_frontend_agc_control param;
1899 
1900  param.field.MIN_GAIN_INDEX = MIN_GAIN_INDEX;
1901  param.field.ATTN_BACKUP = ATTN_BACKUP;
1902 
1903  sendProperty(AM_FRONTEND_AGC_CONTROL, param.word);
1904  };
1905 
1906 
1907  /* @ingroup group08 Check FM mode status
1908  * @brief Returns true if the current function is FM (FM_TUNE_FREQ).
1909  *
1910  * @return true if the current function is FM (FM_TUNE_FREQ).
1911  */
1912  inline bool isCurrentTuneFM()
1913  {
1914  return (currentTune == FM_TUNE_FREQ);
1915  }
1916 
1917  /**
1918  * @ingroup group08 Check AM mode status
1919  *
1920  * @brief Returns true if the current function is AM (AM_TUNE_FREQ).
1921  *
1922  * @return true if the current function is AM (AM_TUNE_FREQ).
1923  */
1924  inline bool isCurrentTuneAM()
1925  {
1926  return (currentTune == AM_TUNE_FREQ);
1927  }
1928 
1929  /**
1930  * @ingroup group08 Check SSB mode status
1931  *
1932  * @brief Returns true if the current function is SSB (SSB_TUNE_FREQ).
1933  *
1934  * @return true if the current function is SSB (SSB_TUNE_FREQ).
1935  */
1936  inline bool isCurrentTuneSSB()
1937  {
1938  return (currentTune == SSB_TUNE_FREQ);
1939  }
1940 
1941  void setBandwidth(uint8_t AMCHFLT, uint8_t AMPLFLT);
1942 
1943  /**
1944  * @ingroup group08 Tune Frequency
1945  * @brief Returns the FAST tuning status
1946  *
1947  * @retrn uint8_t
1948  */
1950  return currentFrequencyParams.arg.FAST;
1951  };
1952 
1953  /**
1954  * @ingroup group08 Tune Frequency
1955  * @brief Sets the FAST Tuning.
1956  * @details If set, excutes fast and invalidated tune. Theune status will not be accurate
1957  *
1958  * @param FAST
1959  */
1960  inline void setTuneFrequencyFast (uint8_t FAST) {
1961  currentFrequencyParams.arg.FAST = FAST;
1962  };
1963 
1964  /**
1965  * @ingroup group08 Tune Frequency
1966  * @brief Returns the FREEZE status
1967  *
1968  * @return unt8_t
1969  */
1971  return currentFrequencyParams.arg.FREEZE;
1972  };
1973 
1974  /**
1975  * @ingroup group08 Tune Frequency
1976  * @brief Sets Freeze Metrics During Alternate Frequency Jum.
1977  * @details Only on FM mode
1978  *
1979  * @param FREEZE
1980  */
1981  inline void setTuneFrequencyFreze(uint8_t FREEZE) {
1982  currentFrequencyParams.arg.FREEZE = FREEZE;
1983  };
1984 
1985 
1986  void setTuneFrequencyAntennaCapacitor(uint16_t capacitor);
1987 
1988  void frequencyUp();
1989  void frequencyDown();
1990 
1991  /**
1992  * @ingroup group08 Tune Frequency
1993  * @brief Set the FrequencyUp
1994  * @details Same frequencyUp
1995  * @see frequencyUp
1996  */
1997  inline void setFrequencyUp() { frequencyUp(); };
1998 
1999  /**
2000  * @ingroup group08 Tune Frequency
2001  * @brief Set the Frequency Down
2002  * @details same frequencyDown
2003  * @see frequencyDown
2004  */
2005  inline void setFrequencyDown() { frequencyDown(); };
2006 
2007  void getFirmware(void);
2008 
2009  void seekStation(uint8_t SEEKUP, uint8_t WRAP); // See WRAP parameter
2010 
2011  /**
2012  * @ingroup group08 Seek
2013  * @brief Sets the maximum time in milliseconds for seeking. The default value is 8000ms (8s).
2014  * @details Depending on the bandwidth, your reception conditions or step configuration, the seek process can take a long time.
2015  * @details This function sets a time limit for seeking process and back the control to the system if the time runs out.
2016  *
2017  * @addindex Seek
2018  *
2019  * @param time_in_ms time in milliseconds.
2020  */
2021  inline void setMaxSeekTime(long time_in_ms)
2022  {
2023  this->maxSeekTime = time_in_ms;
2024  };
2025 
2026  /**
2027  * @ingroup group08 Seek
2028  *
2029  * @brief Search for the next station
2030  * @details Seek a station up. Stop when a station is found or the frequency has reached the upper limit
2031  * @see seekStation, seekStationProgress, setSeekAmLimits setSeekFmLimits
2032  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 124, 137, 139, 278
2033  */
2034  inline void seekStationUp()
2035  {
2036  seekStationProgress(NULL, SEEK_UP);
2037  };
2038 
2039  /**
2040  * @ingroup group08 Seek
2041  *
2042  * @brief Search the previous station
2043  * @details Seek a station Down. Stop when a station is found or the frequency has reached the lower limit
2044  * @see seekStation, seekStationProgress, setSeekAmLimits, setSeekFmLimits
2045  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 124, 137, 139, 278
2046  */
2047  inline void seekStationDown()
2048  {
2049  seekStationProgress(NULL, SEEK_DOWN);
2050  };
2051 
2052  void seekNextStation();
2053  void seekPreviousStation();
2054 
2055  void seekStationProgress(void (*showFunc)(uint16_t f), uint8_t up_down);
2056  void seekStationProgress(void (*showFunc)(uint16_t f), bool (*stopSeking)(), uint8_t up_down);
2057 
2058  // AM Seek property configurations
2059  void setSeekAmLimits(uint16_t bottom, uint16_t top);
2060  void setSeekAmSpacing(uint16_t spacing);
2061  void setSeekAmSrnThreshold(uint16_t value);
2062  void setSeekAmRssiThreshold(uint16_t value);
2063 
2064  // FM Seek property configurations
2065  void setSeekFmLimits(uint16_t bottom, uint16_t top);
2066  void setSeekFmSpacing(uint16_t spacing);
2067  void setSeekFmSrnThreshold(uint16_t value);
2068  void setSeekFmRssiThreshold(uint16_t value);
2069 
2070  void setFmBlendStereoThreshold(uint8_t parameter);
2071  void setFmBlendMonoThreshold(uint8_t parameter);
2072  void setFmBlendRssiStereoThreshold(uint8_t parameter);
2073  void setFmBLendRssiMonoThreshold(uint8_t parameter);
2074  void setFmBlendSnrStereoThreshold(uint8_t parameter);
2075  void setFmBLendSnrMonoThreshold(uint8_t parameter);
2076  void setFmBlendMultiPathStereoThreshold(uint8_t parameter);
2077  void setFmBlendMultiPathMonoThreshold(uint8_t parameter);
2078  void setFmStereoOn();
2079  void setFmStereoOff();
2080 
2081  void RdsInit();
2082  void setRdsIntSource(uint8_t RDSNEWBLOCKB, uint8_t RDSNEWBLOCKA, uint8_t RDSSYNCFOUND, uint8_t RDSSYNCLOST, uint8_t RDSRECV);
2083  void getRdsStatus(uint8_t INTACK, uint8_t MTFIFO, uint8_t STATUSONLY);
2084  void getRdsStatus();
2085 
2086  /**
2087  * @ingroup group16 RDS
2088  * @brief Get the Rds Received FIFO
2089  * @details if FIFO is 1, it means the minimum number of groups was filled
2090  * @return true if minimum number of groups was filled.
2091  */
2092  inline bool getRdsReceived()
2093  {
2094  return currentRdsStatus.resp.RDSRECV;
2095  };
2096 
2097  /**
2098  * @ingroup group16 RDS
2099  * @brief Get the Rds Sync Lost object
2100  * @details returns true (1) if Lost RDS synchronization is detected.
2101  * @return true if Lost RDS synchronization detected.
2102  */
2103  inline bool getRdsSyncLost()
2104  {
2105  return currentRdsStatus.resp.RDSSYNCLOST;
2106  };
2107 
2108  /**
2109  * @ingroup group16 RDS
2110  * @brief Get the Rds Sync Found
2111  * @details return true if found RDS synchronization
2112  * @return true if found RDS synchronization
2113  */
2114  inline bool getRdsSyncFound()
2115  {
2116  return currentRdsStatus.resp.RDSSYNCFOUND;
2117  };
2118 
2119  /**
2120  * @ingroup group16 RDS
2121  * @brief Get the Rds New Block A
2122  *
2123  * @details Returns true if valid Block A data has been received.
2124  * @return true or false
2125  */
2126  inline bool getRdsNewBlockA()
2127  {
2128  return currentRdsStatus.resp.RDSNEWBLOCKA;
2129  };
2130 
2131  /**
2132  * @ingroup group16 RDS
2133  * @brief Get the Rds New Block B
2134  * @details Returns true if valid Block B data has been received.
2135  * @return true or false
2136  */
2137  inline bool getRdsNewBlockB()
2138  {
2139  return currentRdsStatus.resp.RDSNEWBLOCKB;
2140  };
2141 
2142  /**
2143  * @ingroup group16 RDS
2144  * @brief Get the Rds Sync
2145  * @details Returns true if RDS currently synchronized.
2146  * @return true or false
2147  */
2148  inline bool getRdsSync()
2149  {
2150  return currentRdsStatus.resp.RDSSYNC;
2151  };
2152 
2153  /**
2154  * @ingroup group16 RDS
2155  * @brief Get the Group Lost
2156  * @details Returns true if one or more RDS groups discarded due to FIFO overrun.
2157  * @return true or false
2158  */
2159  inline bool getGroupLost()
2160  {
2161  return currentRdsStatus.resp.GRPLOST;
2162  };
2163 
2164  /**
2165  * @brief Get the Num Rds Fifo Used
2166  * @details Return the number of RDS FIFO used
2167  * @return uint8_t Total RDS FIFO used
2168  */
2170  {
2171  return currentRdsStatus.resp.RDSFIFOUSED;
2172  };
2173 
2174  void setRdsConfig(uint8_t RDSEN, uint8_t BLETHA, uint8_t BLETHB, uint8_t BLETHC, uint8_t BLETHD);
2175  uint16_t getRdsPI(void);
2176  uint8_t getRdsGroupType(void);
2177  uint8_t getRdsFlagAB(void);
2178  uint8_t getRdsVersionCode(void);
2179  uint8_t getRdsProgramType(void);
2181 
2182  char *getRdsText(void);
2183  char *getRdsText0A(void); // Gets the Station name
2184  char *getRdsText2A(void); // Gets the Radio Text
2185  char *getRdsText2B(void);
2186 
2187  char *getRdsTime(void);
2188 
2189  void getNext2Block(char *);
2190  void getNext4Block(char *);
2191 
2192  void setSSBBfo(int offset);
2193  void setSSBConfig(uint8_t AUDIOBW, uint8_t SBCUTFLT, uint8_t AVC_DIVIDER, uint8_t AVCEN, uint8_t SMUTESEL, uint8_t DSP_AFCDIS);
2194  void setSSB(uint16_t fromFreq, uint16_t toFreq, uint16_t intialFreq, uint16_t step, uint8_t usblsb);
2195  void setSSB(uint8_t usblsb);
2196  void setSSBAudioBandwidth(uint8_t AUDIOBW);
2197  void setSSBAutomaticVolumeControl(uint8_t AVCEN);
2198  void setSBBSidebandCutoffFilter(uint8_t SBCUTFLT);
2199  void setSSBAvcDivider(uint8_t AVC_DIVIDER);
2200  void setSSBDspAfc(uint8_t DSP_AFCDIS);
2201  void setSSBSoftMute(uint8_t SMUTESEL);
2202 
2203  si47x_firmware_query_library queryLibraryId();
2204  void patchPowerUp();
2205  bool downloadPatch(const uint8_t *ssb_patch_content, const uint16_t ssb_patch_content_size);
2206  void loadPatch(const uint8_t *ssb_patch_content, const uint16_t ssb_patch_content_size, uint8_t ssb_audiobw = 1);
2207  si4735_eeprom_patch_header downloadPatchFromEeprom(int eeprom_i2c_address);
2208  void ssbPowerUp();
2209 
2210  /**
2211  * @ingroup group06 Si47XX device Power Up
2212  * @brief Set the Max Delay Power Up
2213  * @details Sets the delay needed in ms after a powerup command (default is 10ms).
2214  * @details Some crystal oscillator might need more time to become stable (500 ms is the recommended).
2215  * @details Low values make the load SSB patch faster. However, it can make the system unstable.
2216  *
2217  * @see MAX_DELAY_AFTER_POWERUP
2218  * @param ms delay in ms
2219  */
2220  inline void setMaxDelayPowerUp(uint16_t ms)
2221  {
2222  this->maxDelayAfterPouwerUp = ms;
2223  }
2224 
2225  /**
2226  * @ingroup group08 Tune Frequency
2227  * @brief Set the Max Delay after Set Frequency
2228  *
2229  * @details After the set frequency command, the system need a time to get ready to the next set frequency (default value 30ms).
2230  * @details Why the waitToSend() does not work in this case? No idea for while!
2231  * @details A low value makes the getFrequency command inaccurate.
2232  *
2233  * @see MAX_DELAY_AFTER_POWERUP
2234  * @param ms
2235  */
2236  inline void setMaxDelaySetFrequency(uint16_t ms)
2237  {
2238  this->maxDelaySetFrequency = ms;
2239  }
2240 
2241  /**
2242  * @ingroup group08 Tune Frequency step
2243  *
2244  * @brief Sets the current step value.
2245  *
2246  * @details This function does not check the limits of the current band. Please, don't take a step bigger than your legs.
2247  * @details Example:
2248  * @code
2249  * setFM(6400,10800,10390,10);
2250  * setFrequencyStep(100); // the step will be 1MHz (you are using FM mode)
2251  * .
2252  * .
2253  * .
2254  * setAM(7000,7600,7100,5);
2255  * setFrequencyStep(1); // the step will be 1kHz (you are usin AM or SSB mode)
2256  * @endcode
2257  *
2258  * @see setFM()
2259  * @see setAM()
2260  * @see setSSB()
2261  *
2262  * @param step if you are using FM, 10 means 100kHz. If you are using AM 10 means 10kHz
2263  * For AM, 1 (1kHz) to 1000 (1MHz) are valid values.
2264  * For FM 5 (50kHz), 10 (100kHz) and 100 (1MHz) are valid values.
2265  */
2266  inline void setFrequencyStep(uint16_t step)
2267  {
2268  this->currentStep = step;
2269  }
2270 
2271  /**
2272  * @ingroup group08 Frequency
2273  *
2274  * @brief Gets the current frequency saved in memory.
2275  *
2276  * @details Unlike getFrequency, this method gets the current frequency recorded after the last setFrequency command.
2277  * @details This method avoids bus traffic and CI processing.
2278  * @details However, you can not get others status information like RSSI.
2279  *
2280  * @see getFrequency()
2281  */
2283  {
2284  return this->currentWorkFrequency;
2285  }
2286 
2287  /**
2288  * @ingroup group08 Si47XX device Status
2289  *
2290  * @brief Gets the current status of the Si47XX (AM, FM or SSB)
2291  *
2292  * @see Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); pages 73 (FM) and 139 (AM)
2293  */
2294  inline void getStatus()
2295  {
2296  getStatus(0, 1);
2297  }
2298 
2299  void setDeviceI2CAddress(uint8_t senPin);
2301  void setDeviceOtherI2CAddress(uint8_t i2cAddr);
2302 
2303  /*******************************************************************************
2304  * The functions below modify the clock frequency for I2C communication.
2305  * 100kHz is usually the baseline.
2306  * Use one of these funcition if you have problem on you default configuration.
2307  *******************************************************************************/
2308 
2309  /**
2310  * @ingroup group18 MCU I2C Speed
2311  * @brief Sets I2C bus to 10kHz
2312  */
2313  inline void setI2CLowSpeedMode(void)
2314  {
2315  Wire.setClock(10000);
2316  };
2317 
2318  /**
2319  * @ingroup group18 MCU I2C Speed
2320  *
2321  * @brief Sets I2C bus to 100kHz
2322  */
2323  inline void setI2CStandardMode(void) { Wire.setClock(100000); };
2324 
2325  /**
2326  * @ingroup group18 MCU I2C Speed
2327  *
2328  * @brief Sets I2C bus to 400kHz
2329  */
2330  inline void setI2CFastMode(void)
2331  {
2332  Wire.setClock(400000);
2333  };
2334 
2335  /**
2336  * @ingroup group18 MCU I2C Speed
2337  *
2338  * @brief Sets the I2C bus to a given value.
2339  * ATTENTION: use this function with cation
2340  *
2341  * @param value in Hz. For example: The values 500000 sets the bus to 500kHz.
2342  */
2343  inline void setI2CFastModeCustom(long value = 500000) { Wire.setClock(value); };
2344 
2345  /**
2346  * @ingroup group18 MCU External Audio Mute
2347  *
2348  * @brief Sets the Audio Mute Mcu Pin
2349  * @details This function sets the mcu digital pin you want to use to control the external audio mute circuit.
2350  * @details Some users may be uncomfortable with the loud popping of the speaker during some transitions caused by some SI47XX commands.
2351  * @details This problem occurs during the transition from the power down to power up.
2352  * @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.
2353  * @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.
2354  *
2355  * @see setHardwareAudioMute
2356  * @param pin if 0 ou greater sets the MCU digital pin will be used to control de external circuit.
2357  */
2358  inline void setAudioMuteMcuPin(int8_t pin)
2359  {
2360  audioMuteMcuPin = pin;
2361  pinMode(audioMuteMcuPin, OUTPUT);
2362  };
2363 
2364  /**
2365  * @ingroup group18 MCU External Audio Mute
2366  *
2367  * @brief Sets the Hardware Audio Mute
2368  * @details Turns the Hardware audio mute on or off
2369  *
2370  * @see setAudioMuteMcuPin
2371  *
2372  * @param on True or false
2373  */
2374  inline void setHardwareAudioMute(bool on)
2375  {
2376  digitalWrite(audioMuteMcuPin, on);
2377  delayMicroseconds(300);
2378  }
2379 };
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:2244
SSB_SOFT_MUTE_MAX_ATTENUATION
#define SSB_SOFT_MUTE_MAX_ATTENUATION
Definition: SI4735.h:140
SI4735::currentSsbStatus
uint8_t currentSsbStatus
Definition: SI4735.h:1084
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:546
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:1064
SI4735::getStatusResponse
si47x_status getStatusResponse()
Gets the first byte response.
Definition: SI4735.cpp:1546
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:3011
SI4735::currentFrequency
si47x_frequency currentFrequency
data structure to get current frequency
Definition: SI4735.h:1070
SI4735::setMaxDelayPowerUp
void setMaxDelayPowerUp(uint16_t ms)
Set the Max Delay Power Up.
Definition: SI4735.h:2220
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:2937
SI4735::seekStationUp
void seekStationUp()
Search for the next station.
Definition: SI4735.h:2034
SI4735::interruptPin
uint8_t interruptPin
pin used on Arduino Board to control interrupt. If -1, interrupt is no used.
Definition: SI4735.h:1050
SI4735::lastMode
uint8_t lastMode
Stores the last mode used.
Definition: SI4735.h:1060
MAX_DELAY_AFTER_SET_FREQUENCY
#define MAX_DELAY_AFTER_SET_FREQUENCY
Definition: SI4735.h:168
SI4735::setProperty
void setProperty(uint16_t propertyNumber, uint16_t param)
Sets a given SI47XX device property.
Definition: SI4735.h:1132
SSB_BFO
#define SSB_BFO
Definition: SI4735.h:132
SI4735::refClockPrescale
uint16_t refClockPrescale
Prescaler for Reference Clock (divider).
Definition: SI4735.h:1067
SI4735::isCurrentTuneAM
bool isCurrentTuneAM()
Returns true if the current function is AM (AM_TUNE_FREQ).
Definition: SI4735.h:1924
SI4735::setFmStereoOn
void setFmStereoOn()
Turn Off Stereo operation.
Definition: SI4735.cpp:1748
SI4735::setFmStereoOff
void setFmStereoOff()
Turn Off Stereo operation.
Definition: SI4735.cpp:1738
SI4735::rds_time
char rds_time[20]
RDS date time received information.
Definition: SI4735.h:1035
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:862
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:1392
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:2170
SI4735::getRdsText0A
char * getRdsText0A(void)
Gets the station name and other messages.
Definition: SI4735.cpp:2354
SI4735::setSsbAgcOverrite
void setSsbAgcOverrite(uint8_t SSBAGCDIS, uint8_t SSBAGCNDX)
Automatic Gain Control setup.
Definition: SI4735.cpp:2850
SI4735::getCurrentRSSI
uint8_t getCurrentRSSI()
Get the current receive signal strength (0–127 dBμV)
Definition: SI4735.h:1398
SI4735::setSeekFmSrnThreshold
void setSeekFmSrnThreshold(uint16_t value)
Sets the SNR threshold for a valid FM Seek/Tune.
Definition: SI4735.cpp:1422
SI4735::getReceivedSignalStrengthIndicator
uint8_t getReceivedSignalStrengthIndicator()
Returns the value of Received Signal Strength Indicator (dBμV).
Definition: SI4735.h:1254
SI4735::refClockSourcePin
uint8_t refClockSourcePin
0 = RCLK pin is clock source; 1 = DCLK pin is clock source.
Definition: SI4735.h:1068
SI4735::setAvcAmMaxGain
void setAvcAmMaxGain(uint8_t gain)
Sets the maximum gain for automatic volume control.
Definition: SI4735.cpp:1077
SI4735::maxSeekTime
unsigned long maxSeekTime
Stores the maximum time (ms) for a seeking process. Defines the maximum seeking time.
Definition: SI4735.h:1046
GPO_IEN
#define GPO_IEN
Definition: SI4735.h:131
SI4735::setSsbAgcAttackRate
void setSsbAgcAttackRate(uint16_t parameter)
Sets the AGC attack rate on SSB mode.
Definition: SI4735.h:1864
AM_CURRENT_MODE
#define AM_CURRENT_MODE
Definition: SI4735.h:162
SI4735::getVolume
uint8_t getVolume()
Gets the current volume level.
Definition: SI4735.cpp:1868
AM_TUNE_FREQ
#define AM_TUNE_FREQ
Definition: SI4735.h:72
SI4735::getFirmwarePATCHL
uint8_t getFirmwarePATCHL()
Returns the Firmware P A T C H LOW.
Definition: SI4735.h:1627
SI4735::rds_buffer2B
char rds_buffer2B[33]
RDS Radio Text buffer - Station Informaation.
Definition: SI4735.h:1033
SI4735::setHardwareAudioMute
void setHardwareAudioMute(bool on)
Sets the Hardware Audio Mute.
Definition: SI4735.h:2374
SI4735::setVolumeDown
void setVolumeDown()
Set the Volume Down.
Definition: SI4735.h:1687
SI4735::isCurrentTuneFM
bool isCurrentTuneFM()
Definition: SI4735.h:1912
XOSCEN_CRYSTAL
#define XOSCEN_CRYSTAL
Definition: SI4735.h:173
SI4735::getRdsPI
uint16_t getRdsPI(void)
Returns the programa type.
Definition: SI4735.cpp:2154
si4735_digital_output_format::raw
uint16_t raw
Definition: SI4735.h:962
FM_AGC_STATUS
#define FM_AGC_STATUS
Definition: SI4735.h:43
SI4735::currentStatus
si47x_response_status currentStatus
current device status
Definition: SI4735.h:1073
si47x_frontend_agc_control::word
uint16_t word
Definition: SI4735.h:587
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:1062
si47x_rds_date_time::raw
uint8_t raw[6]
Definition: SI4735.h:839
SI4735::setAMSoftMuteReleaseRate
void setAMSoftMuteReleaseRate(uint8_t parameter)
Sets the soft mute release rate.
Definition: SI4735.h:1812
SI4735::getCurrentMultipathDetectHigh
bool getCurrentMultipathDetectHigh()
Gets the Current Multipath Detect High.
Definition: SI4735.h:1560
SI4735::getSignalQualityInterrupt
bool getSignalQualityInterrupt()
Get the Signal Quality Interrupt status.
Definition: SI4735.h:1164
SI4735::setFrequencyUp
void setFrequencyUp()
Set the FrequencyUp.
Definition: SI4735.h:1997
SSB_RF_AGC_ATTACK_RATE
#define SSB_RF_AGC_ATTACK_RATE
Definition: SI4735.h:142
SI4735::getFrequency
uint16_t getFrequency(void)
Gets the current frequency of the Si4735 (AM or FM)
Definition: SI4735.cpp:938
AM_AGC_RELEASE_RATE
#define AM_AGC_RELEASE_RATE
Definition: SI4735.h:117
SI4735::getCurrentSnrDetectHigh
bool getCurrentSnrDetectHigh()
Checks if SNR detect is high.
Definition: SI4735.h:1453
SI4735::setSeekAmSpacing
void setSeekAmSpacing(uint16_t spacing)
Selects frequency spacingfor AM seek. Default is 10 kHz spacing.
Definition: SI4735.cpp:1378
FM_RDS_STATUS
#define FM_RDS_STATUS
Definition: SI4735.h:46
si47x_set_frequency::raw
uint8_t raw[5]
Definition: SI4735.h:313
SI4735::currentRqsStatus
si47x_rqs_status currentRqsStatus
current Radio SIgnal Quality status
Definition: SI4735.h:1072
si47x_rds_int_source::raw
uint8_t raw[2]
Definition: SI4735.h:686
SI4735::setSsbAgcReleaseRate
void setSsbAgcReleaseRate(uint16_t parameter)
Sets the AGC Release rate on SSB mode.
Definition: SI4735.h:1877
AM_AGC_OVERRIDE
#define AM_AGC_OVERRIDE
Definition: SI4735.h:77
si47x_rds_config::raw
uint8_t raw[2]
Definition: SI4735.h:716
SI4735::setFM
void setFM()
Sets the radio to FM function.
Definition: SI4735.cpp:794
SI4735::setAMFrontEndAgcControl
void setAMFrontEndAgcControl(uint8_t MIN_GAIN_INDEX, uint8_t ATTN_BACKUP)
Adjusts the AM AGC for external front-end attenuator and external front-end cascode LNA.
Definition: SI4735.h:1896
SI4735::getCurrentMultipath
uint8_t getCurrentMultipath()
Gets the current Multipath.
Definition: SI4735.h:1527
si47x_tune_status::raw
uint8_t raw
Definition: SI4735.h:507
FM_SEEK_TUNE_SNR_THRESHOLD
#define FM_SEEK_TUNE_SNR_THRESHOLD
Definition: SI4735.h:68
SI4735::getFirmwareCHIPREV
uint8_t getFirmwareCHIPREV()
RESP8 - Returns the Chip Revision (ASCII)
Definition: SI4735.h:1657
SI4735::setVolume
void setVolume(uint8_t volume)
Sets volume level (0 to 63)
Definition: SI4735.cpp:1834
SI4735::getRdsTextSegmentAddress
uint8_t getRdsTextSegmentAddress(void)
Returns the address of the text segment.
Definition: SI4735.cpp:2209
SI4735::seekStationProgress
void seekStationProgress(void(*showFunc)(uint16_t f), uint8_t up_down)
Seeks a station up or down.
Definition: SI4735.cpp:1257
SSB_AGC_OVERRIDE
#define SSB_AGC_OVERRIDE
Definition: SI4735.h:87
si47x_status::raw
uint8_t raw
Definition: SI4735.h:375
SI4735::powerDown
void powerDown(void)
Moves the device from powerup to powerdown mode.
Definition: SI4735.cpp:463
SI4735::getACFIndicator
bool getACFIndicator()
Returns true if the AFC rails (AFC Rail Indicator).
Definition: SI4735.h:1216
SI4735::getCurrentReceivedSignalQuality
void getCurrentReceivedSignalQuality(void)
Queries the status of the Received Signal Quality (RSQ) of the current channel (FM_RSQ_STATUS)
Definition: SI4735.cpp:1146
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:1648
SI4735::getTuneFrequecyFreeze
uint8_t getTuneFrequecyFreeze()
Returns the FREEZE status.
Definition: SI4735.h:1970
SI4735::setDeviceOtherI2CAddress
void setDeviceOtherI2CAddress(uint8_t i2cAddr)
Sets the onther I2C Bus Address (for Si470X)
Definition: SI4735.cpp:294
SI4735::seekPreviousStation
void seekPreviousStation()
Search the previous station.
Definition: SI4735.cpp:1220
SI4735::getAgcGainIndex
uint8_t getAgcGainIndex()
Gets the current AGC gain index.
Definition: SI4735.h:1380
SI4735::setAMSoftMuteSnrThreshold
void setAMSoftMuteSnrThreshold(uint8_t parameter)
Sets the SNR threshold to engage soft mute.
Definition: SI4735.h:1799
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:1796
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::getRdsReceived
bool getRdsReceived()
Get the Rds Received FIFO.
Definition: SI4735.h:2092
SI4735::frequencyUp
void frequencyUp()
Increments the current frequency on current band/function by using the current step.
Definition: SI4735.cpp:730
SI4735::currentRdsStatus
si47x_rds_status currentRdsStatus
current RDS status
Definition: SI4735.h:1075
SI4735::setAudioMuteMcuPin
void setAudioMuteMcuPin(int8_t pin)
Sets the Audio Mute Mcu Pin.
Definition: SI4735.h:2358
SI4735::getCurrentSignedFrequencyOffset
uint8_t getCurrentSignedFrequencyOffset()
Gets the Signed frequency offset (kHz).
Definition: SI4735.h:1538
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:1504
SI4735::currentSSBMode
si47x_ssb_mode currentSSBMode
indicates if USB or LSB
Definition: SI4735.h:1077
SI4735::setSsbSoftMuteMaxAttenuation
void setSsbSoftMuteMaxAttenuation(uint8_t smattn=0)
Sets the SSB Soft Mute Max Attenuation object.
Definition: SI4735.h:1358
SI4735::audioMuteMcuPin
int8_t audioMuteMcuPin
Definition: SI4735.h:1085
GPIO_SET
#define GPIO_SET
Definition: SI4735.h:79
SI4735::setTuneFrequencyAntennaCapacitor
void setTuneFrequencyAntennaCapacitor(uint16_t capacitor)
Selects the tuning capacitor value.
Definition: SI4735.cpp:652
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:2187
SI4735::setAmSoftMuteMaxAttenuation
void setAmSoftMuteMaxAttenuation(uint8_t smattn=0)
Sets the Am Soft Mute Max Attenuation.
Definition: SI4735.h:1344
SI4735::getCurrentAfcRailIndicator
bool getCurrentAfcRailIndicator()
AFC Rail Indicator.
Definition: SI4735.h:1475
SI4735::analogPowerUp
void analogPowerUp(void)
You have to call setPowerUp method before.
Definition: SI4735.cpp:448
SI4735::getFirmwarePN
uint8_t getFirmwarePN()
Returns the Firmware Part Number.
Definition: SI4735.h:1587
si47x_frequency::value
uint16_t value
frequency (integer value)
Definition: SI4735.h:276
SI4735::getAutomaticGainControl
void getAutomaticGainControl()
Queries Automatic Gain Control STATUS.
Definition: SI4735.cpp:998
SI4735::getCurrentRssiDetectLow
bool getCurrentRssiDetectLow()
Checks if RSSI detected is LOW.
Definition: SI4735.h:1420
SI4735::setSSBSoftMute
void setSSBSoftMute(uint8_t SMUTESEL)
Sets SSB Soft-mute Based on RSSI or SNR Selection:
Definition: SI4735.cpp:2642
si47x_seek_am_complement::ANTCAPH
uint8_t ANTCAPH
Definition: SI4735.h:352
AM_SOFT_MUTE_RELEASE_RATE
#define AM_SOFT_MUTE_RELEASE_RATE
Definition: SI4735.h:109
SI4735::deviceAddress
int16_t deviceAddress
Stores the current I2C bus address.
Definition: SI4735.h:1041
SI4735::setMaxDelaySetFrequency
void setMaxDelaySetFrequency(uint16_t ms)
Set the Max Delay after Set Frequency.
Definition: SI4735.h:2236
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:2602
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::getCurrentValidChannel
bool getCurrentValidChannel()
Checks if the current channel is valid.
Definition: SI4735.h:1464
SI4735::setAM
void setAM()
Sets the radio to AM function. It means: LW MW and SW.
Definition: SI4735.cpp:769
SI4735::ssbPowerUp
void ssbPowerUp()
This function can be useful for debug and test.
Definition: SI4735.cpp:2953
MAX_DELAY_AFTER_POWERUP
#define MAX_DELAY_AFTER_POWERUP
Definition: SI4735.h:169
AM_SOFT_MUTE_ATTACK_RATE
#define AM_SOFT_MUTE_ATTACK_RATE
Definition: SI4735.h:110
SI4735::setFrequencyStep
void setFrequencyStep(uint16_t step)
Sets the current step value.
Definition: SI4735.h:2266
SI4735::clearRdsBuffer2A
void clearRdsBuffer2A()
Clear RDS buffer 2A (text)
Definition: SI4735.cpp:1933
FM_BLEND_STEREO_THRESHOLD
#define FM_BLEND_STEREO_THRESHOLD
Definition: SI4735.h:55
SI4735::getCurrentFrequency
uint16_t getCurrentFrequency()
Gets the current frequency saved in memory.
Definition: SI4735.h:2282
SI4735::getRdsNewBlockA
bool getRdsNewBlockA()
Get the Rds New Block A.
Definition: SI4735.h:2126
SI4735::getStatusSNR
uint8_t getStatusSNR()
Gets the SNR metric when tune is complete (dB)
Definition: SI4735.h:1267
SI4735::setAMSoftMuteRate
void setAMSoftMuteRate(uint8_t parameter)
Sets the attack and decay rates when entering or leaving soft mute.
Definition: SI4735.h:1784
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:2021
SI4735::setAMSoftMuteSlop
void setAMSoftMuteSlop(uint8_t parameter)
Sets the AM attenuation slope during soft mute.
Definition: SI4735.h:1769
SI4735::loadPatch
void loadPatch(const uint8_t *ssb_patch_content, const uint16_t ssb_patch_content_size, uint8_t ssb_audiobw=1)
Loads a given SSB patch content.
Definition: SI4735.cpp:3068
SI4735::getStatus
void getStatus(uint8_t, uint8_t)
Gets the current status of the Si4735 (AM or FM)
Definition: SI4735.cpp:960
SI4735::setFmBlendMonoThreshold
void setFmBlendMonoThreshold(uint8_t parameter)
Sets RSSI threshold for mono blend (Full mono below threshold, blend above threshold).
Definition: SI4735.cpp:1632
SI4735::currentMinimumFrequency
uint16_t currentMinimumFrequency
minimum frequency of the current band
Definition: SI4735.h:1054
SI4735::seekStationProgress
void seekStationProgress(void(*showFunc)(uint16_t f), bool(*stopSeking)(), uint8_t up_down)
Seeks a station up or down.
Definition: SI4735.cpp:1312
SI4735::volume
uint8_t volume
Stores the current vlume setup (0-63).
Definition: SI4735.h:1081
SI4735::volumeDown
void volumeDown()
Set sound volume level Down
Definition: SI4735.cpp:1894
SI4735::getBandLimit
bool getBandLimit()
Returns true if a seek hit the band limit.
Definition: SI4735.h:1229
SI4735::setFmBlendMultiPathStereoThreshold
void setFmBlendMultiPathStereoThreshold(uint8_t parameter)
Sets multipath threshold for stereo blend (Full stereo below threshold, blend above threshold).
Definition: SI4735.cpp:1712
SI4735::getFirmwarePATCHH
uint8_t getFirmwarePATCHH()
Returns the Firmware P A T C H HIGH.
Definition: SI4735.h:1617
SI4735::rdsTextAdress2B
int rdsTextAdress2B
rds_buffer2B current position
Definition: SI4735.h:1038
SI4735::rdsTextAdress2A
int rdsTextAdress2A
rds_buffer2A current position
Definition: SI4735.h:1037
SI4735::SI4735
SI4735()
Construct a new SI4735::SI4735.
Definition: SI4735.cpp:59
SI4735::setAMSoftMuteAttackRate
void setAMSoftMuteAttackRate(uint16_t parameter)
Sets the soft mute attack rate.
Definition: SI4735.h:1825
si473x_powerup::raw
uint8_t raw[2]
Raw powerup parameters data. Same arg memory position. So, same content.
Definition: SI4735.h:211
SI4735::getRdsTime
char * getRdsTime(void)
Gets the RDS time and date when the Group type is 4.
Definition: SI4735.cpp:2454
FM_RDS_INT_SOURCE
#define FM_RDS_INT_SOURCE
Definition: SI4735.h:49
si473x_gpio::raw
uint8_t raw
Definition: SI4735.h:233
si47x_rds_command::raw
uint8_t raw
Definition: SI4735.h:607
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:357
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:824
AM_SEEK_FREQ_SPACING
#define AM_SEEK_FREQ_SPACING
Definition: SI4735.h:113
AM_SOFT_MUTE_SNR_THRESHOLD
#define AM_SOFT_MUTE_SNR_THRESHOLD
Definition: SI4735.h:108
SI4735::maxDelayAfterPouwerUp
uint16_t maxDelayAfterPouwerUp
Stores the maximum delay you have to setup after a power up command (in ms).
Definition: SI4735.h:1045
SI4735::setSSBAudioBandwidth
void setSSBAudioBandwidth(uint8_t AUDIOBW)
SSB Audio Bandwidth for SSB mode.
Definition: SI4735.cpp:2721
SI4735::currentFrequencyParams
si47x_set_frequency currentFrequencyParams
Definition: SI4735.h:1071
SI4735::setSBBSidebandCutoffFilter
void setSBBSidebandCutoffFilter(uint8_t SBCUTFLT)
Sets SBB Sideband Cutoff Filter for band pass and low pass filters.
Definition: SI4735.cpp:2691
DIGITAL_OUTPUT_FORMAT
#define DIGITAL_OUTPUT_FORMAT
Definition: SI4735.h:91
SI4735::setAmAgcReleaseRate
void setAmAgcReleaseRate(uint16_t parameter)
Sets the AGC release rate.
Definition: SI4735.h:1851
SI4735::getSsbAgcStatus
void getSsbAgcStatus()
Queries SSB Automatic Gain Control STATUS.
Definition: SI4735.cpp:2823
SI4735::setFmBLendSnrMonoThreshold
void setFmBLendSnrMonoThreshold(uint8_t parameter)
Sets SNR threshold for mono blend (Full mono below threshold, blend above threshold).
Definition: SI4735.cpp:1696
SI4735::getRdsText2A
char * getRdsText2A(void)
Gets the Text processed for the 2A group.
Definition: SI4735.cpp:2387
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:1999
SI4735::setFmBlendSnrStereoThreshold
void setFmBlendSnrStereoThreshold(uint8_t parameter)
Sets SNR threshold for stereo blend (Full stereo above threshold, blend below threshold).
Definition: SI4735.cpp:1680
SI4735::setSeekAmRssiThreshold
void setSeekAmRssiThreshold(uint16_t value)
Sets the RSSI threshold for a valid AM Seek/Tune.
Definition: SI4735.cpp:1436
SI4735::waitInterrupr
void waitInterrupr(void)
Interrupt handle.
Definition: SI4735.cpp:73
si47x_seek_am_complement::ANTCAPL
uint8_t ANTCAPL
Definition: SI4735.h:353
SI4735::seekNextStation
void seekNextStation()
Search for the next station.
Definition: SI4735.cpp:1205
SSB_AGC_STATUS
#define SSB_AGC_STATUS
Definition: SI4735.h:86
si47x_rds_status::raw
uint8_t raw[13]
Definition: SI4735.h:662
SI4735::isAgcEnabled
bool isAgcEnabled()
Checks if the AGC is enabled.
Definition: SI4735.h:1369
SI4735
SI4735 Class.
Definition: SI4735.h:1029
SI4735::resetPin
uint8_t resetPin
pin used on Arduino Board to RESET the Si47XX device
Definition: SI4735.h:1049
SI4735::getCurrentRssiDetectHigh
bool getCurrentRssiDetectHigh()
Checks if RSSI detected is high.
Definition: SI4735.h:1431
si4735_eeprom_patch_header::raw
uint8_t raw[32]
Definition: SI4735.h:981
SI4735::getRdsSync
bool getRdsSync()
Get the Rds Sync.
Definition: SI4735.h:2148
AM_TUNE_STATUS
#define AM_TUNE_STATUS
Definition: SI4735.h:74
si47x_seek_am_complement::ARG2
uint8_t ARG2
Definition: SI4735.h:350
SI4735::setup
void setup(uint8_t resetPin, uint8_t defaultFunction)
Starts the Si473X device.
Definition: SI4735.cpp:623
SI4735::setSSB
void setSSB(uint8_t usblsb)
Set the radio to AM function.
Definition: SI4735.cpp:2744
si47x_seek::raw
uint8_t raw
Definition: SI4735.h:336
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:1066
SI4735::getDeviceI2CAddress
int16_t getDeviceI2CAddress(uint8_t resetPin)
I2C bus address setup.
Definition: SI4735.cpp:235
SI4735::setSeekFmRssiThreshold
void setSeekFmRssiThreshold(uint16_t value)
Sets the RSSI threshold for a valid FM Seek/Tune.
Definition: SI4735.cpp:1450
SI4735::seekStationDown
void seekStationDown()
Search the previous station.
Definition: SI4735.h:2047
si47x_agc_overrride::raw
uint8_t raw[2]
Definition: SI4735.h:891
SI4735::getStatusCTS
bool getStatusCTS()
Gets the Error flag Clear to Send.
Definition: SI4735.h:1208
SI4735::getGroupLost
bool getGroupLost()
Get the Group Lost.
Definition: SI4735.h:2159
SI4735::isCurrentTuneSSB
bool isCurrentTuneSSB()
Returns true if the current function is SSB (SSB_TUNE_FREQ).
Definition: SI4735.h:1936
SI4735::getFirmwareCMPMAJOR
uint8_t getFirmwareCMPMAJOR()
Get the Firmware C M P M A J O R object.
Definition: SI4735.h:1637
SI4735::getCurrentReceivedSignalQuality
void getCurrentReceivedSignalQuality(uint8_t INTACK)
Queries the status of the Received Signal Quality (RSQ) of the current channel.
Definition: SI4735.cpp:1099
SI4735::setAudioMode
void setAudioMode(uint8_t audioMode)
Sets the Audio Mode. See table below.
Definition: SI4735.h:1707
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:1363
SI4735::getNext4Block
void getNext4Block(char *)
Process data received from group 2A.
Definition: SI4735.cpp:2295
SI4735::setSSB
void setSSB(uint16_t fromFreq, uint16_t toFreq, uint16_t intialFreq, uint16_t step, uint8_t usblsb)
Definition: SI4735.cpp:2776
AM_SEEK_START
#define AM_SEEK_START
Definition: SI4735.h:73
si47x_antenna_capacitor::value
uint16_t value
Definition: SI4735.h:290
SI4735::getStatusError
bool getStatusError()
Get the Status Error.
Definition: SI4735.h:1197
AM_SOFT_MUTE_SLOPE
#define AM_SOFT_MUTE_SLOPE
Definition: SI4735.h:106
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:571
SI4735::setSSBAutomaticVolumeControl
void setSSBAutomaticVolumeControl(uint8_t AVCEN)
Sets SSB Automatic Volume Control (AVC) for SSB mode.
Definition: SI4735.cpp:2657
SI4735::setFrequencyDown
void setFrequencyDown()
Set the Frequency Down.
Definition: SI4735.h:2005
si47x_agc_status::raw
uint8_t raw[3]
Definition: SI4735.h:869
SI4735::rds_buffer2A
char rds_buffer2A[65]
RDS Radio Text buffer - Program Information.
Definition: SI4735.h:1032
AM_FRONTEND_AGC_CONTROL
#define AM_FRONTEND_AGC_CONTROL
Definition: SI4735.h:118
SI4735::reset
void reset(void)
Reset the SI473X
Definition: SI4735.cpp:308
REFCLK_PRESCALE
#define REFCLK_PRESCALE
Definition: SI4735.h:94
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:2896
si47x_seek_am_complement::ARG3
uint8_t ARG3
Definition: SI4735.h:351
SI4735::getCurrentMultipathDetectLow
bool getCurrentMultipathDetectLow()
Get Multipath Detect Low.
Definition: SI4735.h:1549
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:2225
SI4735::setSeekAmSrnThreshold
void setSeekAmSrnThreshold(uint16_t value)
Sets the SNR threshold for a valid AM Seek/Tune.
Definition: SI4735.cpp:1406
FM_SEEK_FREQ_SPACING
#define FM_SEEK_FREQ_SPACING
Definition: SI4735.h:67
AM_AGC_ATTACK_RATE
#define AM_AGC_ATTACK_RATE
Definition: SI4735.h:116
FM_BLEND_SNR_STEREO_THRESHOLD
#define FM_BLEND_SNR_STEREO_THRESHOLD
Definition: SI4735.h:59
SI4735::getRdsText2B
char * getRdsText2B(void)
Gets the Text processed for the 2B group.
Definition: SI4735.cpp:2420
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:2087
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:1044
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::getRadioDataSystemInterrupt
bool getRadioDataSystemInterrupt()
Get the Radio Data System (RDS) Interrupt status.
Definition: SI4735.h:1175
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:1472
SSB_MODE
#define SSB_MODE
Definition: SI4735.h:133
SI4735::clearRdsBuffer2B
void clearRdsBuffer2B()
Clear RDS buffer 2B (text)
Definition: SI4735.cpp:1946
AM_AGC_STATUS
#define AM_AGC_STATUS
Definition: SI4735.h:76
SI4735::clearRdsBuffer0A
void clearRdsBuffer0A()
Clear RDS buffer 0A (text)
Definition: SI4735.cpp:1958
SI4735::currentAgcStatus
si47x_agc_status currentAgcStatus
current AGC status
Definition: SI4735.h:1076
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:1052
SI4735::getStatus
void getStatus()
Gets the current status of the Si47XX (AM, FM or SSB)
Definition: SI4735.h:2294
SI4735::setFmBlendMultiPathMonoThreshold
void setFmBlendMultiPathMonoThreshold(uint8_t parameter)
Sets Multipath threshold for mono blend (Full mono above threshold, blend below threshold).
Definition: SI4735.cpp:1728
FM_SEEK_BAND_TOP
#define FM_SEEK_BAND_TOP
Definition: SI4735.h:66
SI4735::getFirmwareCMPMINOR
uint8_t getFirmwareCMPMINOR()
RESP6 - Returns the Component Major Revision (ASCII).
Definition: SI4735.h:1647
SSB_RF_AGC_RELEASE_RATE
#define SSB_RF_AGC_RELEASE_RATE
Definition: SI4735.h:143
AM_SEEK_BAND_TOP
#define AM_SEEK_BAND_TOP
Definition: SI4735.h:112
SI4735::radioPowerUp
void radioPowerUp(void)
Powerup the Si47XX.
Definition: SI4735.cpp:413
SI4735::getNumRdsFifoUsed
uint8_t getNumRdsFifoUsed()
Get the Num Rds Fifo Used.
Definition: SI4735.h:2169
si47x_response_status::raw
uint8_t raw[8]
Check it.
Definition: SI4735.h:417
GET_REV
#define GET_REV
Definition: SI4735.h:33
SI4735::setAutomaticGainControl
void setAutomaticGainControl(uint8_t AGCDIS, uint8_t AGCIDX)
Automatic Gain Control setup.
Definition: SI4735.cpp:1043
si47x_ssb_mode::raw
uint8_t raw[2]
Definition: SI4735.h:940
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:1851
SI4735::getCurrentAvcAmMaxGain
uint8_t getCurrentAvcAmMaxGain()
Get the current Avc Am Max Gain.
Definition: SI4735.h:1328
SI4735::setTuneFrequencyFreze
void setTuneFrequencyFreze(uint8_t FREEZE)
Sets Freeze Metrics During Alternate Frequency Jum.
Definition: SI4735.h:1981
SI4735::RdsInit
void RdsInit()
Starts the control member variables for RDS.
Definition: SI4735.cpp:1919
si47x_firmware_information::raw
uint8_t raw[9]
Definition: SI4735.h:451
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:1763
SI4735::currentStep
uint16_t currentStep
Stores the current step used to increment or decrement the frequency.
Definition: SI4735.h:1058
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:3098
si47x_firmware_query_library::raw
uint8_t raw[8]
Definition: SI4735.h:487
SI4735::lastTextFlagAB
uint8_t lastTextFlagAB
Definition: SI4735.h:1048
SI4735::getFirmwareFWMINOR
uint8_t getFirmwareFWMINOR()
Returns the Firmware F W M I N O R.
Definition: SI4735.h:1607
SI4735::currentAudioMode
uint8_t currentAudioMode
Current audio mode used (ANALOG or DIGITAL or both)
Definition: SI4735.h:1083
SI4735::setFMDeEmphasis
void setFMDeEmphasis(uint8_t parameter)
Sets the FM Receive de-emphasis to 50 or 75 μs.
Definition: SI4735.h:1740
SI4735::setAMDeEmphasis
void setAMDeEmphasis(uint8_t parameter)
Sets the AM Receive de-emphasis to 50 or disable.
Definition: SI4735.h:1753
SI4735::setVolumeUp
void setVolumeUp()
Set the Volume Up.
Definition: SI4735.h:1680
SI4735::seekStation
void seekStation(uint8_t SEEKUP, uint8_t WRAP)
Look for a station (Automatic tune)
Definition: SI4735.cpp:1162
FM_SEEK_TUNE_RSSI_THRESHOLD
#define FM_SEEK_TUNE_RSSI_THRESHOLD
Definition: SI4735.h:69
SI4735::getFirmwareFWMAJOR
uint8_t getFirmwareFWMAJOR()
Returns the Firmware F W M A J O R.
Definition: SI4735.h:1597
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:1664
SI4735::setI2CFastMode
void setI2CFastMode(void)
Sets I2C bus to 400kHz.
Definition: SI4735.h:2330
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:2045
AM_RSQ_STATUS
#define AM_RSQ_STATUS
Definition: SI4735.h:75
SI4735::powerUp
si473x_powerup powerUp
Definition: SI4735.h:1079
SI4735::currentMaximumFrequency
uint16_t currentMaximumFrequency
maximum frequency of the current band
Definition: SI4735.h:1055
SI4735::getCurrentStereoBlend
uint8_t getCurrentStereoBlend()
Gets the value of the amount of stereo blend in % (100 = full stereo, 0 = full mono).
Definition: SI4735.h:1501
SI4735::setAvcAmMaxGain
void setAvcAmMaxGain()
Sets the Avc Am Max Gain to 48dB.
Definition: SI4735.h:1315
si47x_rqs_status::raw
uint8_t raw[8]
Definition: SI4735.h:572
AM_NB_DELAY
#define AM_NB_DELAY
Definition: SI4735.h:123
AM_DEEMPHASIS
#define AM_DEEMPHASIS
Definition: SI4735.h:95
SI4735::getRdsText
char * getRdsText(void)
Gets the RDS Text when the message is of the Group Type 2 version A.
Definition: SI4735.cpp:2330
FM_RSQ_STATUS
#define FM_RSQ_STATUS
Definition: SI4735.h:45
SI4735::rdsTextAdress0A
int rdsTextAdress0A
rds_buffer0A current position
Definition: SI4735.h:1039
SI4735::setI2CStandardMode
void setI2CStandardMode(void)
Sets I2C bus to 100kHz.
Definition: SI4735.h:2323
SI4735::getStatusValid
bool getStatusValid()
Gets the channel status.
Definition: SI4735.h:1243
SI4735::setI2CLowSpeedMode
void setI2CLowSpeedMode(void)
Sets I2C bus to 10kHz.
Definition: SI4735.h:2313
FM_AGC_OVERRIDE
#define FM_AGC_OVERRIDE
Definition: SI4735.h:44
si47x_property::value
uint16_t value
Definition: SI4735.h:524
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::getRdsStatus
void getRdsStatus()
Gets RDS Status.
Definition: SI4735.cpp:2136
SI4735::volumeUp
void volumeUp()
Set sound volume level Up
Definition: SI4735.cpp:1880
si473x_gpio_ien::raw
uint16_t raw
Definition: SI4735.h:260
SI4735::firmwareInfo
si47x_firmware_information firmwareInfo
firmware information
Definition: SI4735.h:1074
SI4735::getRdsNewBlockB
bool getRdsNewBlockB()
Get the Rds New Block B.
Definition: SI4735.h:2137
SI4735::getAntennaTuningCapacitor
uint16_t getAntennaTuningCapacitor()
Get the Antenna Tuning Capacitor value.
Definition: SI4735.h:1294
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:1820
AM_SOFT_MUTE_RATE
#define AM_SOFT_MUTE_RATE
Definition: SI4735.h:105
SI4735::getNext2Block
void getNext2Block(char *)
Process data received from group 2B.
Definition: SI4735.cpp:2261
SI4735::getStatusMULT
uint8_t getStatusMULT()
Get the Status the M U L T.
Definition: SI4735.h:1280
SI4735::getProperty
int32_t getProperty(uint16_t propertyValue)
Gets a given property from the SI47XX.
Definition: SI4735.cpp:1572
SI4735::setAmAgcAttackRate
void setAmAgcAttackRate(uint16_t parameter)
Sets the AGC attack rate.
Definition: SI4735.h:1838
SI4735::getFirmware
void getFirmware(void)
Gets firmware information.
Definition: SI4735.cpp:485
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::setTuneFrequencyFast
void setTuneFrequencyFast(uint8_t FAST)
Sets the FAST Tuning.
Definition: SI4735.h:1960
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:2553
AM_SEEK_SNR_THRESHOLD
#define AM_SEEK_SNR_THRESHOLD
Definition: SI4735.h:114
SI4735::getCurrentSnrDetectLow
bool getCurrentSnrDetectLow()
Checks if SNR detect is low.
Definition: SI4735.h:1442
si4735_digital_output_sample_rate::DOSR
uint16_t DOSR
Definition: SI4735.h:995
SI4735::currentClockType
uint8_t currentClockType
Stores the current clock type used (Crystal or REF CLOCK)
Definition: SI4735.h:1063
SI4735::getCurrentSNR
uint8_t getCurrentSNR()
Gets the current SNR metric (0–127 dB).
Definition: SI4735.h:1409
POWER_DOWN
#define POWER_DOWN
Definition: SI4735.h:34
SI4735::getCurrentVolume
uint8_t getCurrentVolume()
Get the Current Volume.
Definition: SI4735.h:1672
SI4735::sendSSBModeProperty
void sendSSBModeProperty()
Just send the property SSB_MOD to the device. Internal use (privete method).
Definition: SI4735.cpp:2797
SI4735::setFmBlendStereoThreshold
void setFmBlendStereoThreshold(uint8_t parameter)
Sets RSSI threshold for stereo blend (Full stereo above threshold, blend below threshold).
Definition: SI4735.cpp:1616
AM_CHANNEL_FILTER
#define AM_CHANNEL_FILTER
Definition: SI4735.h:96
SI4735::setI2CFastModeCustom
void setI2CFastModeCustom(long value=500000)
Sets the I2C bus to a given value. ATTENTION: use this function with cation.
Definition: SI4735.h:2343
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:2627
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:747
SI4735::getCurrentBlendDetectInterrupt
bool getCurrentBlendDetectInterrupt()
Gets the Current Blend Detect Interrupt.
Definition: SI4735.h:1571
SI4735::setAmDelayNB
void setAmDelayNB(uint16_t value)
Sets the delay before applying impulse blanking.
Definition: SI4735.h:1719
si47x_bandwidth_config::raw
uint8_t raw[2]
Definition: SI4735.h:918
SI4735::setRefClock
void setRefClock(uint16_t refclk)
Sets the frequency of the REFCLK from the output of the prescaler.
Definition: SI4735.cpp:528
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:1347
SI4735::getTuneFrequecyFast
uint8_t getTuneFrequecyFast()
Returns the FAST tuning status.
Definition: SI4735.h:1949
FM_BLEND_MULTIPATH_STEREO_THRESHOLD
#define FM_BLEND_MULTIPATH_STEREO_THRESHOLD
Definition: SI4735.h:61
SI4735::getCurrentSoftMuteIndicator
bool getCurrentSoftMuteIndicator()
Soft Mute Indicator.
Definition: SI4735.h:1488
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:1034
SI4735::setSSBAvcDivider
void setSSBAvcDivider(uint8_t AVC_DIVIDER)
Sets AVC Divider.
Definition: SI4735.cpp:2672
REFCLK_FREQ
#define REFCLK_FREQ
Definition: SI4735.h:93
SI4735::getTuneCompleteTriggered
bool getTuneCompleteTriggered()
Get the Tune Complete status.
Definition: SI4735.h:1186
AM_SEEK_RSSI_THRESHOLD
#define AM_SEEK_RSSI_THRESHOLD
Definition: SI4735.h:115
SSB_CURRENT_MODE
#define SSB_CURRENT_MODE
Definition: SI4735.h:163
SI4735::getRdsSyncLost
bool getRdsSyncLost()
Get the Rds Sync Lost object.
Definition: SI4735.h:2103
FM_RDS_CONFIG
#define FM_RDS_CONFIG
Definition: SI4735.h:51
SI4735::setBandwidth
void setBandwidth(uint8_t AMCHFLT, uint8_t AMPLFLT)
Selects the bandwidth of the channel filter for AM reception.
Definition: SI4735.cpp:898
SI4735::getCurrentPilot
bool getCurrentPilot()
Checks the current pilot.
Definition: SI4735.h:1514
SI4735::getRdsSyncFound
bool getRdsSyncFound()
Get the Rds Sync Found.
Definition: SI4735.h:2114
SI4735::getCommandResponse
void getCommandResponse(int num_of_bytes, uint8_t *response)
Returns with the command response.
Definition: SI4735.cpp:1526
SI4735::currentWorkFrequency
uint16_t currentWorkFrequency
current frequency
Definition: SI4735.h:1056
SI4735::setFrequency
void setFrequency(uint16_t)
Set the frequency to the corrent function of the Si4735 (FM, AM or SSB)
Definition: SI4735.cpp:692