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