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