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