PU2CLR SI4844 Arduino Library 1.1.7
Arduino Library for Si4844 Devices - By Ricardo Lima Caratti
Loading...
Searching...
No Matches
SI4844.h
Go to the documentation of this file.
1/**
2 * @brief SI4844 ARDUINO LIBRARY
3 *
4 * @details This is an Arduino library for the SI4822, SI4826, SI4827, SI4840, 4844A, and 4844B, 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/SI4844>
9 *
10 * @see https://pu2clr.github.io/SI4844/
11 * @see github.com
12 *
13 * @author PU2CLR - Ricardo Lima Caratti
14 * @date 2019-2020
15 */
16
17#include <Arduino.h>
18#include <Wire.h>
19
20#define SI4844_ADDRESS 0x11
21
22// English...: Si4844 Commands
23// Portuguese: Comando usado no Si4844
24// Reference.: Si48XX ATDD PROGRAMMING GUIDE, page 12
25#define ATDD_POWER_DOWN 0x11
26#define ATDD_POWER_UP 0xE1
27#define ATDD_AUDIO_MODE 0xE2
28#define GET_REV 0x10
29#define ATDD_XOSCEN 0x80
30#define ATDD_XOWAIT 0x40
31#define ATDD_GET_STATUS 0xE0
32
33#define SET_PROPERTY 0x12
34#define GET_PROPERTY 0x13
35#define RX_VOLUME 0x4000
36#define RX_HARD_MUTE 0x4001
37#define RX_BASS_TREBLE 0x4002
38#define RX_ACTUAL_VOLUME 0x4003
39
40#define FM_SOFT_MUTE_MAX_ATTENUATION 0x1302
41#define AM_SOFT_MUTE_MAX_ATTENUATION 0x3302
42#define FM_DEEMPHASIS 0x1100 // You can use setProperty(FM_DEEMPHASIS, value);
43#define FM_SOFT_MUTE_RATE 0x1300 // You can use setProperty(FM_SOFT_MUTE_RATE, value);
44#define FM_SOFT_MUTE_SLOPE 0x1301 // You can use setProperty(FM_SOFT_MUTE_SLOPE, value);
45#define FM_STEREO_IND_BLEND_THRESHOLD 0x1207 // You can use setProperty(FM_STEREO_IND_BLEND_THRESHOLD, value);
46#define FM_BLEND_RSSI_STEREO_THRESHOLD 0x1800 // You can use setProperty(FM_BLEND_RSSI_STEREO_THRESHOLD, value);
47#define FM_BLEND_RSSI_MONO_THRESHOLD 0x1801 // You can use setProperty(FM_BLEND_RSSI_MONO_THRESHOLD, value);
48
49#define REFCLK_FREQ 0x0201 // You can use setProperty(REFCLK_FREQ, value);
50#define REFCLK_PRESCALE 0x0202 // You can use setProperty(REFCLK_PRESCALE, value);
51
52#define AM_SOFT_MUTE_RATE 0x3300
53#define AM_SOFT_MUTE_SLOPE 0x3301
54#define AM_SOFT_MUTE_SNR_THRESHOLD 0x3303
55
56
57
58
59/** @defgroup GA1 Union and Structures
60 * @section GA1
61 *
62 * @brief SI4844 data representation
63 *
64 * @details The goal of this approach is separating data from code.
65 * The SI4844 works with many internal data that can be represented by data structure
66 * or defined data type in C/C++.
67 */
68
69
70/**
71 * @ingroup GA1
72 * @brief Configures band parameter
73 * @details Represents searching for a valid frequency data type.
74 * @see Page 18 of the Si48XX ATDD PROGRAMMING GUIDE - AN610
75 */
76
77typedef union {
78 struct {
79 uint8_t BANDIDX:6; // Band Index to Set. See Table 8. Pre-defined Band Table
80 uint8_t XOWAIT: 1; // Crystal Oscillator Stabilization Wait Time After Reset. 0 = 600 ms; 1 = 900 ms
81 uint8_t XOSCEN: 1; // Crystal Oscillator Enable. 0 = Use external RCLK; 1 = Use crystal oscillator (XTALI and XTALO with external 32.768 kHz crystal).
82 } refined;
84} si4844_arg_band_index;
85
86/**
87 * @ingroup GA1
88 * @brief Configures all SI48XX parameters
89 * @details Represents searching for a valid frequency data type.
90 * @see Page 18 of the Si48XX ATDD PROGRAMMING GUIDE - AN610
91 */
92typedef union {
93 struct
94 {
95 uint8_t BANDIDX : 6; // Band Index to Set. See Table 8. Pre-defined Band Table
96 uint8_t XOWAIT : 1; // Crystal Oscillator Stabilization Wait Time After Reset. 0 = 600 ms; 1 = 900 ms
97 uint8_t XOSCEN : 1; // Crystal Oscillator Enable. 0 = Use external RCLK; 1 = Use crystal oscillator (XTALI and XTALO with external 32.768 kHz crystal).
98 uint8_t BANDBOT_HIGH; // Band Bottom Frequency Limit; FM 6400..10900 (64.0–109.0 MHz); AM 510..1750 (510–1750 kHz); SW 2300..28500 (2.3–28.5 MHz)
99 uint8_t BANDBOT_LOW; // Band Bottom Frequency Limit; FM 6400..10900 (64.0–109.0 MHz); AM 510..1750 (510–1750 kHz); SW 2300..28500 (2.3–28.5 MHz)
100 uint8_t BANDTOP_HIGH; // Band Top Frequency Limit; FM 6400..10900 (64.0–109.0 MHz); AM 510..1750 (510–1750 kHz); SW 2300..28500 (2.3–28.5 MHz)
101 uint8_t BANDTOP_LOW; // Band Top Frequency Limit; FM 6400..10900 (64.0–109.0 MHz); AM 510..1750 (510–1750 kHz); SW 2300..28500 (2.3–28.5 MHz)
102 uint8_t CHSPC; // Channel Spacing; FM 10 (e.g.,100 kHz); AM 9 or 10 (e.g., 9 kHz or 10 kHz); SW 5 (e.g., 5 kHz)
103 uint8_t DUMMY : 5; // Set it to 00000
104 uint8_t DFBAND : 1; // Default Band Settings; 0 = Allow host controller to override the band property settings; 1 = Force to use tuner default band property settings (Applicable to Si4827 part only)
105 uint8_t UNI_AM : 1; // Universal AM Band. 0 = Disable universal AM band (default AFC range of 1.1 kHz); 1 = Enable universal AM band (wider AFC range in tuning); Applicable to Si4827 and Si4844B parts and AMRX mode only
106 uint8_t TVFREQ : 1; // TV Audio Channel Frequency Display; 0 = Disable TV audio channel frequency display format; 1 = Enable TV audio channel frequency display format; Applicable to Si4827 and Si4844B parts and FMRX mode only
107 } refined;
109} SI4844_arg_band;
110
111/**
112 * @ingroup GA1
113 * @brief Status
114 * @details Represents searching for a valid frequency data type.
115 */
116typedef union {
117 struct
118 {
119 uint8_t D_0 : 1;
120 uint8_t D_1 : 1;
121 uint8_t D_2 : 1;
122 uint8_t D_3 : 1;
123 uint8_t D_4 : 1;
124 uint8_t ERR : 1; //!< 1 = Error.
125 uint8_t CTS : 1; //!< 0 = Wait before sending next command; 1 = Clear to send next command.
126 } refined;
128} si4844_status;
129
130/**
131 * @ingroup GA1
132 * @brief Device Status
133 * @details The structure below represents the four bytes response got by command ATDD_GET_STATUS
134 * @see PROGRAMMING GUIDE, pages 14 and 15
135 */
136typedef struct
137{
138 uint8_t BCFG0 : 1; // Bit 0
139 uint8_t BCFG1 : 1; // bit 1
140 uint8_t STEREO : 1; // bit 2
141 uint8_t STATION : 1; // bit 3
142 uint8_t INFORDY : 1; // bit 4
143 uint8_t HOSTPWRUP : 1; // bit 5
144 uint8_t HOSTRST : 1; // bit 6
145 uint8_t CTS : 1; // bit 7
146 uint8_t BANDIDX : 6; // Form bit 0 to 5
147 uint8_t BANDMODE : 2; // From bit 6 to 7
148 uint8_t d2 : 4; // Frequency digit 2
149 uint8_t d1 : 4; // Frequency digit 1
150 uint8_t d4 : 4; // Frequency digit 4
151 uint8_t d3 : 4; // frequency digit 3
152} si4844_get_status;
153
154typedef struct {
157} si4844_get_channel_frequency;
158
159/**
160 * @ingroup GA1
161 * @brief Status response
162 * @see See Si48XX ATDD PROGRAMMING GUIDE, pages 14 and 15
163*/
164typedef union {
165 si4844_get_status refined;
166 si4844_get_channel_frequency rawStatus;
168} si4844_status_response;
169
170/**
171 * @ingroup GA1
172 * @brief Firmware Information
173 * @see Si48XX ATDD PROGRAMMING GUIDE, page 22.
174 */
175typedef struct
176{
177 uint8_t RESERVED : 6; // Bit 0 to 5
178 uint8_t ERR : 1; // bit 6
179 uint8_t CTS : 1; // bit 2
180 uint8_t PN; // Final 2 digits of Part Number (HEX).
181 uint8_t FWMAJOR; // Firmware Major Revision (ASCII).
182 uint8_t FWMINOR; // Firmware Minor Revision (ASCII).
183 uint8_t CMPMAJOR; // Component Major Revision (ASCII).
184 uint8_t CMPMINOR; // Component Minor Revision (ASCII).
185 uint8_t CHIPREV; // Chip Revision (ASCII).
186} si4844_firmware_info;
187
188/**
189 * @brief Firmware Response
190 *
191 */
192typedef union {
193 si4844_firmware_info refined;
195} si4844_firmware_response;
196
197/**
198 * @ingroup GA1
199 * @brief Audio Mode
200 */
201typedef union {
202 struct
203 {
204 uint8_t AUDIOMODE : 2;
205 uint8_t FM_MONO : 1;
206 uint8_t ADJPT_ATTN : 1;
207 uint8_t ADJPT_STEO : 1;
208 uint8_t Reserved : 2;
209 uint8_t OPCODE : 1;
210 } arg1;
212} si4844_audiomode;
213
214/**
215 * @ingroup GA1
216 * @brief Audio Status Response
217 */
218typedef union {
219 struct {
220 uint8_t AUDIOMODE:2;
221 uint8_t FM_MONO:1;
222 uint8_t ADJPT_ATTN:1;
223 uint8_t ADJPT_STEO:1;
224 uint8_t Reserved:1;
225 uint8_t ERR:1;
226 uint8_t CTS:1;
227 } status;
229} si4844_audiomode_status_response;
230
231/**
232 * @brief Data type to deal with SET_PROPERTY command
233 *
234 * @details Property Data type (help to deal with SET_PROPERTY command on si473X)
235 */
236typedef union {
237 struct
238 {
239 uint8_t byteLow;
240 uint8_t byteHigh;
241 } raw;
243} si4844_property;
244
245/**
246 * @brief Interrupt status
247 * @details This variable must be true every time an interruption occurs and then must return to the false every time an action resulting from the interruption is performed.
248 * @details The variable below indicates a change of the ATDD status. When it occurs, it means the system needs to process some action (for example show on LCD this change).
249 * @see interrupt_hundler() function in SI44.cpp.
250 */
251volatile static bool data_from_device;
252
253
254/**
255 * @brief SI4844 Class
256 *
257 * @details This class implements all functions to help you to control the Si4844 devices.
258 */
259
261{
262
263private:
264
265 si4844_status_response status_response;
266 si4844_firmware_response firmware_response;
270
274
275
276
277 /**
278 * @ingroup BF
279 * @brief Sets hight clock speed to be used on I2C bus
280 * @param clock (10000 = 10kHz; 50000 = 50kHz; 100000 = 100kHz ... )
281 */
282 inline void setClockSpeed(uint16_t clock) { this->clockSpeed = clock; };
283
284 /**
285 * @ingroup BF
286 * @brief Sets I2C bus speed to 10kHz
287 */
288 inline void setClockLow(void) { Wire.setClock(10000); };
289
290 /**
291 * @ingroup BF
292 * @brief Sets I2C bus speed to hight previous defined speed
293 * @see setClockSpeed
294 */
295 inline void setClockHigh() { Wire.setClock(this->clockSpeed); };
296
297
298 inline void waitInterrupt(void);
299 inline bool isClearToSend(void);
300 inline void waitToSend(void);
301
302
303 // SI4844 band description (FM = 0; AM = 1; SW = 2)
304 const char *bandmode_table[3] = {"FM", "AM", "SW"};
305 const char *stereo_indicator_table[2] = {"Off","On "};
307
310
311public :
312 /**
313 * @ingroup BF
314 * @brief Set the Data Status From Device
315 * @details It is a flag that means the device triggered an interrupt.
316 * @details You can use this function to back the flag status to false. This way you can check when the device triggers the next interrupt.
317 * @details It is very useful when the user wants to control the interrupt instead of give this control to the library.
318 * @param value true or false
319 */
320 inline void setStatusInterruptFromDevice( bool value ) { data_from_device = value; };
321
322 /**
323 * @ingroup BF
324 * @brief Get the Data Status From Device
325 * @details It returns true when the device has triggered an interrupt.
326 * @return true or false
327 */
329
330
331 void setProperty(uint16_t propertyNumber, uint16_t parameter);
333 void sendCommand(uint8_t cmd, int parameter_size, const uint8_t *parameter);
334 void getCommandResponse(int response_size, uint8_t *response);
335
336 void setup(uint16_t resetPin, int interruptPin, int8_t defaultBand = 0, uint32_t hightClockSpeed = 50000);
337 void debugDevice(uint16_t resetPin, uint16_t interruptPin, uint8_t defaultBand, void (*showFunc)(char *msg));
338 void reset(void );
339 void setBand(byte);
340
341 void changeVolume(char); // deprecated
342 void volumeUp(void);
343 void volumeDown(void);
344 void setVolume(byte);
345 void setBassTreble(uint8_t bass_treble);
346 void bassTrebleUp();
347 void bassTrebleDown();
348 void audioMute(uint8_t value);
349 void setAudioMute(bool on);
350
351 void setAmSoftMuteMaxAttenuation(uint8_t value);
352 void setFmSoftMuteMaxAttenuation(uint8_t value);
353 void setFmDeemphasis(uint8_t value);
354 void setFmSoftMuteRate(uint8_t value);
355 void setFmSoftMuteSlope(uint8_t value);
356
357 void setAmSoftMuteRate(uint8_t value);
358 void setAmSoftMuteSlope(uint8_t value);
359 void setAmSoftMuteSnrThreshold(uint8_t value);
360
361
362 void setBlendThresholdStereoIndicator(uint16_t value);
363
364 void setCrystalOscillatorEnable(uint8_t XOSCEN );
366 void setReferenceClockFrequency(uint16_t value);
367 void setReferenceClockPrescaler(uint16_t value);
368
369
370
371 si4844_audiomode_status_response
372 setAudioMode(uint8_t audiomode, uint8_t fm_mono, uint8_t adjpt_attn, uint8_t adjpt_steo, uint8_t opcode);
373
374 si4844_status_response *getStatus(void);
375 si4844_firmware_response *getFirmware(void);
376 // customize the frequency range of a band
377 void setCustomBand(uint8_t bandIndex, uint16_t botton, uint16_t top, uint8_t bandSpace, uint8_t dfband = 0, uint8_t uni_am = 0, uint8_t tvreq = 0 );
378
379 void setDefaultBandIndx( uint8_t bandidx);
380
381 void powerDown(void);
382 void powerUp(void);
383
384 float getFrequency(void);
386 bool hasStatusChanged(void);
387 void resetStatus(void);
388
389 /**
390 * @ingroup GB1
391 * @brief Gets the current audio volume level
392 *
393 * @return Volume level
394 */
395 inline uint8_t getVolume() {return volume; };
397
398 /**
399 * @ingroup GB1
400 * @brief Get the Band Mode
401 * @return char* "FM", "AM" or "SW"
402 */
403 inline char * getBandMode(){ return (char *) bandmode_table[status_response.refined.BANDMODE]; };
404
405 /**
406 * @ingroup GB1
407 * @brief Get the Stereo Indicator
408 * @return char* "ON" or "OFF"
409 */
410 inline char * getStereoIndicator(){ return (char *) stereo_indicator_table[status_response.refined.STATION]; };
411
412 /**
413 * @ingroup GB1
414 * @brief Gets Band CFG0 (Band Detection Configuration).
415 * @details 0 = ATDD device detects band; 1 = Host detects band
416 * @return 0 = ATDD device detects band; 1 = Host detects band
417 */
418 inline uint16_t getStatusBCFG0() { return status_response.refined.BCFG0; };
419
420 /**
421 * @ingroup GB1
422 * @brief Gets Band CFG1 (Band Properties Priority)
423 * @return 0 = ATDD device accepts host customized band properties; 1 = ATDD device ignores host customized band properties
424 */
425 inline uint16_t getStatusBCFG1() { return status_response.refined.BCFG1; };
426
427 /**
428 * @ingroup GB1
429 * @brief Gets Stereo indicator.
430 * @details Applicable to Si4840/44 parts FM function only.
431 * @return 0 = Stereo off; 1 = Stereo on
432 */
433 inline uint16_t getStatusStereo() { return status_response.refined.STEREO; };
434
435
436 /**
437 * @ingroup GB1
438 * @brief Gets Station Indicator.
439 * @return 0 = Invalid Station; 1 = Valid Station
440 */
441 inline uint16_t getStatusStationIndicator() { return status_response.refined.STATION; };
442
443 /**
444 * @ingroup GB1
445 * @brief Gets Information Ready
446 * @details During power up case, the system controller should not display any of the channel frequency, band mode, band index,
447 * @details station, or stereo statuses until the INFORDY bit is set.
448 * @details The host controller should not display the channel frequency when CHFREQ remains zero even when INFORDY=1.
449 * @details 0 = Tune info not ready yet; 1 = Tune info ready (i.e., Band mode, band index, channel frequency, sta-tion, and stereo indicators)
450 * @return 0 = Tune info not ready yet; 1 = Tune info ready
451 */
452 inline uint16_t getStatusInformationReady() { return status_response.refined.INFORDY; };
453
454 /**
455 * @ingroup GB1
456 * @brief Gets the Channel Frequency.
457 * @details The channel frequency is a 16-bit word of 4 digits in BCD format:
458 * @details FM 0640..1090 (64.0–109.0 MHz)
459 * @details AM 0504..1750 (504–1750 kHz)
460 * @details SW4 *0230..2850 (2.3– 28.5 MHz)
461 * @details For FM band, if the China TV channel audio sub-carrier display feature is enabled, the CHFREQ bit[15] MSB = 1 means the host controller needs to add an additional 50 kHz for the channel frequency.
462 * @details For SW band, the CHFREQ bit[15] MSB = 1 means the host controller needs to add an additional 5 kHz for the channel frequency.
463 * @return 0 = Tune info not ready yet; 1 = Tune info ready
464 */
465 inline uint16_t getRawChannelFrequency() { return status_response.rawStatus.CHFREQ; };
466
467 inline uint16_t getStatusHostPowerUp() { return status_response.refined.HOSTPWRUP; };
468 inline uint16_t getStatusHostReset() { return status_response.refined.HOSTRST; };
469
470 /**
471 * @ingroup GB1
472 * @brief Gets the current Band Mode
473 * @return 0 = FM mode; 1 = AM mode; 2 = SW mode
474 */
475 inline uint16_t getStatusBandMode() { return status_response.refined.BANDMODE; };
476
477 /**
478 * @ingroup GB1
479 * @brief Gets the current Band Index Detected.
480 * @return 0~19: FM band; 20~24: AM band; 25~40: SW band
481 */
482 inline uint16_t getStatusBandIndex() { return status_response.refined.BANDIDX; };
483
484
485
486 inline uint16_t getStatusCTS() { return status_response.refined.CTS; };
487
488
489 inline uint16_t getFirmwareReserved() { return firmware_response.refined.RESERVED; };
490 inline uint16_t getFirmwareErr() { return firmware_response.refined.ERR; };
491 inline uint16_t getFirmwareCTS() { return firmware_response.refined.CTS; };
492 inline uint16_t getFirmwarePartNumber() { return firmware_response.refined.PN; };
493 inline uint16_t getFirmwareMajorRevision() { return firmware_response.refined.FWMAJOR; };
494 inline uint16_t getFirmwareMinorRevision() { return firmware_response.refined.FWMINOR; };
495 inline uint16_t getFirmwareComponentMajorRevision() { return firmware_response.refined.CMPMAJOR; };
496 inline uint16_t getFirmwareComponentMinorRevision() { return firmware_response.refined.CMPMINOR; };
497 inline uint16_t getFirmwareChipRevision() { return firmware_response.refined.CHIPREV; };
498
499 void setResetPin(uint16_t resetPin);
500 void setInterruptPin(int interruptPin);
501
503 bool detectDevice();
504 void convertToChar(uint32_t value, char *strValue, uint8_t len, uint8_t dot, uint8_t separator, bool remove_leading_zeros = true);
505 char* getFormattedFrequency(uint8_t removeRightDigit = 0, uint8_t thousandsSeparator = ',');
506
507};
void interrupt_hundler()
Library handle interrupt.
Definition: SI4844.cpp:27
#define FM_SOFT_MUTE_RATE
Definition: SI4844.h:43
#define AM_SOFT_MUTE_SLOPE
Definition: SI4844.h:53
uint16_t value
Definition: SI4844.h:242
#define AM_SOFT_MUTE_MAX_ATTENUATION
Definition: SI4844.h:41
#define FM_STEREO_IND_BLEND_THRESHOLD
Definition: SI4844.h:45
#define RX_HARD_MUTE
Definition: SI4844.h:36
#define REFCLK_PRESCALE
Definition: SI4844.h:50
#define RX_ACTUAL_VOLUME
Definition: SI4844.h:38
#define ATDD_GET_STATUS
Definition: SI4844.h:31
#define ATDD_POWER_DOWN
Definition: SI4844.h:25
si4844_firmware_info refined
Definition: SI4844.h:193
uint8_t raw[9]
Definition: SI4844.h:194
#define FM_SOFT_MUTE_MAX_ATTENUATION
Definition: SI4844.h:40
#define SET_PROPERTY
Definition: SI4844.h:33
#define GET_REV
Definition: SI4844.h:28
#define ATDD_POWER_UP
Definition: SI4844.h:26
#define FM_DEEMPHASIS
Definition: SI4844.h:42
#define AM_SOFT_MUTE_SNR_THRESHOLD
Definition: SI4844.h:54
#define AM_SOFT_MUTE_RATE
Definition: SI4844.h:52
uint16_t dummy
Definition: SI4844.h:155
#define SI4844_ADDRESS
SI4844 ARDUINO LIBRARY
Definition: SI4844.h:20
#define GET_PROPERTY
Definition: SI4844.h:34
#define REFCLK_FREQ
Definition: SI4844.h:49
static volatile bool data_from_device
Interrupt status.
Definition: SI4844.h:251
#define RX_VOLUME
Definition: SI4844.h:35
#define RX_BASS_TREBLE
Definition: SI4844.h:37
uint16_t CHFREQ
Definition: SI4844.h:156
#define ATDD_AUDIO_MODE
Definition: SI4844.h:27
SI4844 Class.
Definition: SI4844.h:261
const char * stereo_indicator_table[2]
Definition: SI4844.h:305
uint8_t currentBand
Definition: SI4844.h:269
uint16_t getFirmwareComponentMajorRevision()
Definition: SI4844.h:495
uint8_t volume
Definition: SI4844.h:308
uint16_t getStatusHostPowerUp()
Definition: SI4844.h:467
uint16_t getFirmwareCTS()
Definition: SI4844.h:491
uint16_t getStatusCTS()
Definition: SI4844.h:486
uint16_t resetPin
Definition: SI4844.h:267
uint16_t getFirmwareChipRevision()
Definition: SI4844.h:497
uint16_t getFirmwareErr()
Definition: SI4844.h:490
const char * bandmode_table[3]
Definition: SI4844.h:304
uint16_t getFirmwareMinorRevision()
Definition: SI4844.h:494
uint32_t clockSpeed
Definition: SI4844.h:273
si4844_firmware_response firmware_response
Definition: SI4844.h:266
uint8_t xowait
Definition: SI4844.h:272
uint16_t getStatusHostReset()
Definition: SI4844.h:468
uint16_t getFirmwareComponentMinorRevision()
Definition: SI4844.h:496
uint8_t xoscen
Definition: SI4844.h:271
uint16_t getFirmwareMajorRevision()
Definition: SI4844.h:493
uint16_t getFirmwarePartNumber()
Definition: SI4844.h:492
char strFormattedCurrentFrequenct[8]
Definition: SI4844.h:306
uint16_t interruptPin
Definition: SI4844.h:268
void setDefaultBandIndx(uint8_t bandidx)
Definition: SI4844.cpp:311
si4844_status_response status_response
Definition: SI4844.h:265
uint8_t bassTreble
Definition: SI4844.h:309
uint16_t getFirmwareReserved()
Definition: SI4844.h:489
void setClockSpeed(uint16_t clock)
Sets hight clock speed to be used on I2C bus.
Definition: SI4844.h:282
void setStatusInterruptFromDevice(bool value)
Set the Data Status From Device.
Definition: SI4844.h:320
bool getDataStatusInterruptFromDevice()
Get the Data Status From Device.
Definition: SI4844.h:328
void waitInterrupt(void)
Waiting for an external interrupt.
Definition: SI4844.cpp:151
void setClockLow(void)
Sets I2C bus speed to 10kHz.
Definition: SI4844.h:288
bool isClearToSend(void)
Checks the CTS status.
Definition: SI4844.cpp:407
void waitToSend(void)
Wait for the ATDD become Clear to Send.
Definition: SI4844.cpp:423
void sendCommand(uint8_t cmd, int parameter_size, const uint8_t *parameter)
Sends a given command to the SI4844 device.
Definition: SI4844.cpp:114
void setResetPin(uint16_t resetPin)
Sets the MCU RESET pin.
Definition: SI4844.cpp:210
void setProperty(uint16_t propertyNumber, uint16_t parameter)
Sends (sets) property to the SI48XX.
Definition: SI4844.cpp:43
void getCommandResponse(int response_size, uint8_t *response)
Returns with the command response.
Definition: SI4844.cpp:136
void setInterruptPin(int interruptPin)
Sets the MCU Interrupt pin.
Definition: SI4844.cpp:222
void setClockHigh()
Sets I2C bus speed to hight previous defined speed.
Definition: SI4844.h:295
uint16_t getProperty(uint16_t propertyNumber)
Gets a given property from the SI4844.
Definition: SI4844.cpp:72
uint8_t raw
Definition: SI4844.h:211
uint8_t BCFG1
Definition: SI4844.h:139
uint8_t raw
Definition: SI4844.h:127
uint8_t CHIPREV
Definition: SI4844.h:185
uint8_t CMPMINOR
Definition: SI4844.h:184
uint8_t HOSTPWRUP
Definition: SI4844.h:143
uint8_t FWMAJOR
Definition: SI4844.h:181
uint8_t STEREO
Definition: SI4844.h:140
uint8_t PN
Definition: SI4844.h:180
uint8_t CMPMAJOR
Definition: SI4844.h:183
uint8_t raw[4]
Definition: SI4844.h:167
uint8_t d1
Definition: SI4844.h:149
uint8_t raw[7]
Definition: SI4844.h:108
uint8_t ERR
Definition: SI4844.h:178
uint8_t RESERVED
Definition: SI4844.h:177
uint8_t d3
Definition: SI4844.h:151
uint8_t HOSTRST
Definition: SI4844.h:144
uint8_t BANDMODE
Definition: SI4844.h:147
uint8_t d4
Definition: SI4844.h:150
si4844_get_status refined
Definition: SI4844.h:165
uint8_t raw
Definition: SI4844.h:228
uint8_t raw
Definition: SI4844.h:83
uint8_t STATION
Definition: SI4844.h:141
uint8_t BANDIDX
Definition: SI4844.h:146
uint8_t CTS
Definition: SI4844.h:179
uint8_t FWMINOR
Definition: SI4844.h:182
si4844_get_channel_frequency rawStatus
Definition: SI4844.h:166
uint8_t d2
Definition: SI4844.h:148
uint8_t INFORDY
Definition: SI4844.h:142
uint8_t CTS
Definition: SI4844.h:145
uint8_t BCFG0
Definition: SI4844.h:138
void setAmSoftMuteMaxAttenuation(uint8_t value)
Sets AM Soft Mute Max Attenuation..
Definition: SI4844.cpp:887
float getFrequency(void)
Get the current frequency of the radio in KHz.
Definition: SI4844.cpp:704
uint32_t getFrequencyInteger(void)
Get the current frequency of the radio in KHz in uint32_t (long integer) .
Definition: SI4844.cpp:750
uint16_t getStatusBCFG0()
Gets Band CFG0 (Band Detection Configuration).
Definition: SI4844.h:418
void setup(uint16_t resetPin, int interruptPin, int8_t defaultBand=0, uint32_t hightClockSpeed=50000)
Initiates the SI4844 instance and connect the device (SI4844) to Arduino.
Definition: SI4844.cpp:171
void setFmDeemphasis(uint8_t value)
Sets de-emphasis time constant.
Definition: SI4844.cpp:910
void changeVolume(char)
Up or down the sound volume level.
Definition: SI4844.cpp:437
si4844_firmware_response * getFirmware(void)
Get part number, chip revision, firmware, patch, and component revision numbers.
Definition: SI4844.cpp:676
void setFmSoftMuteRate(uint8_t value)
Sets the attack and decay rates when entering and leaving soft mute.
Definition: SI4844.cpp:923
void setAmSoftMuteSnrThreshold(uint8_t value)
Sets the SNR threshold to engage soft mute.
Definition: SI4844.cpp:994
uint16_t getStatusBandMode()
Gets the current Band Mode.
Definition: SI4844.h:475
void setFmSoftMuteSlope(uint8_t value)
Configures attenuation slope during soft mute in dB attenuation per dB SNR below the soft mute SNR th...
Definition: SI4844.cpp:938
void resetStatus(void)
set the interrupr status to false. It will turn true after next interrupr
Definition: SI4844.cpp:807
uint16_t getStatusBandIndex()
Gets the current Band Index Detected.
Definition: SI4844.h:482
si4844_status_response * getStatus(void)
Get tune freq, band, and others information, status of the device.
Definition: SI4844.cpp:643
uint8_t getVolume()
Gets the current audio volume level.
Definition: SI4844.h:395
uint16_t getStatusStationIndicator()
Gets Station Indicator.
Definition: SI4844.h:441
void bassTrebleUp()
More treble, less bass.
Definition: SI4844.cpp:547
void setBand(byte)
Sets a new band to the device.
Definition: SI4844.cpp:364
void setBassTreble(uint8_t bass_treble)
Set the sound volume level, bass and treble.
Definition: SI4844.cpp:528
void setReferenceClockFrequency(uint16_t value)
Sets the frequency of the REFCLK from the output of the prescaler.
Definition: SI4844.cpp:1008
uint8_t getVolumeProperty()
Gets the current volume value stored in SI4844 device.
Definition: SI4844.cpp:504
void setBlendThresholdStereoIndicator(uint16_t value)
Sets the blend threshold for stereo indicator.
Definition: SI4844.cpp:951
void setCustomBand(uint8_t bandIndex, uint16_t botton, uint16_t top, uint8_t bandSpace, uint8_t dfband=0, uint8_t uni_am=0, uint8_t tvreq=0)
This method allows you to customize the frequency range of a band.
Definition: SI4844.cpp:831
void setVolume(byte)
Sets the volume level.
Definition: SI4844.cpp:487
void reset(void)
Resets the SI4844 device.
Definition: SI4844.cpp:279
void setAmSoftMuteSlope(uint8_t value)
Configures attenuation slope during soft mute in dB attenuation per dB SNR below the soft mute SNR th...
Definition: SI4844.cpp:981
uint16_t getStatusStereo()
Gets Stereo indicator.
Definition: SI4844.h:433
char * getStereoIndicator()
Get the Stereo Indicator.
Definition: SI4844.h:410
char * getBandMode()
Get the Band Mode.
Definition: SI4844.h:403
uint16_t getRawChannelFrequency()
Gets the Channel Frequency.
Definition: SI4844.h:465
void powerUp(void)
Power the device up.
Definition: SI4844.cpp:321
void volumeUp(void)
Increases the volume level.
Definition: SI4844.cpp:462
void setCrystalOscillatorStabilizationWaitTime(uint8_t XOWAIT)
Sets Crystal Oscillator Stabilization Wait Time After Reset.
Definition: SI4844.cpp:350
void volumeDown(void)
Decreases the volume level.
Definition: SI4844.cpp:473
void setCrystalOscillatorEnable(uint8_t XOSCEN)
Sets Crystal Oscillator Enable.
Definition: SI4844.cpp:336
uint16_t getStatusInformationReady()
Gets Information Ready.
Definition: SI4844.h:452
uint16_t getStatusBCFG1()
Gets Band CFG1 (Band Properties Priority)
Definition: SI4844.h:425
void debugDevice(uint16_t resetPin, uint16_t interruptPin, uint8_t defaultBand, void(*showFunc)(char *msg))
Used to debug
Definition: SI4844.cpp:236
void audioMute(uint8_t value)
Mutes the audio output.
Definition: SI4844.cpp:616
void bassTrebleDown()
Less treble, more bass.
Definition: SI4844.cpp:536
void setFmSoftMuteMaxAttenuation(uint8_t value)
FM Soft Mute Maximum Attenuation.
Definition: SI4844.cpp:898
si4844_audiomode_status_response setAudioMode(uint8_t audiomode, uint8_t fm_mono, uint8_t adjpt_attn, uint8_t adjpt_steo, uint8_t opcode)
Set audio mode.
Definition: SI4844.cpp:579
void setReferenceClockPrescaler(uint16_t value)
Sets the number used by the prescaler to divide the external reference clock frequency down to the in...
Definition: SI4844.cpp:1023
bool hasStatusChanged(void)
Checks whether the SI4844 has its status changed.
Definition: SI4844.cpp:798
void setAudioMute(bool on)
Mutes the audio output.
Definition: SI4844.cpp:627
void setAmSoftMuteRate(uint8_t value)
Sets the attack and decay rates when entering or leaving soft mute.
Definition: SI4844.cpp:967
void powerDown(void)
Power the device down.
Definition: SI4844.cpp:300
char * getFormattedFrequency(uint8_t removeRightDigit=0, uint8_t thousandsSeparator=',')
Gets Formatted Frequency.
Definition: SI4844.cpp:1128
void convertToChar(uint32_t value, char *strValue, uint8_t len, uint8_t dot, uint8_t separator, bool remove_leading_zeros=true)
Converts a number to a char array.
Definition: SI4844.cpp:1090
bool detectDevice()
Checks communication with SI4844 via I2C.
Definition: SI4844.cpp:1037
uint8_t scanI2CBus(uint8_t *device, uint8_t limit)
Scans the I2C bus and returns the addresses of the devices found.
Definition: SI4844.cpp:1053