PU2CLR SI4844 Arduino Library 1.1.6
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 */
250volatile static bool data_from_device;
251
252/**
253 * @brief Library handle interrupt
254 * @details Handling interruptions.
255 * @details Whenever the status of the ATDD changes, a hardware interrupt is triggered. For example, when you move the tuner
256 * @details potenciometer, the ATDD sends a signal to the Arduino pin (INTERRUPT_PIN). The same is true when the ATDD is capturing
257 * @details mono FM signal and has switched to stereo.
258 * @details You can control the interrupt process via your sketch intead of this library.
259 * @see setStatusInterruptFromDevice, getStatusInterruptFromDevice, setup
260 */
261#ifdef ESP8266 // if the controller is ESP8266, add IRAM_ATTR.
262 IRAM_ATTR
263#endif
264static void interrupt_hundler()
265{
266 data_from_device = true;
267}
268
269/**
270 * @brief SI4844 Class
271 *
272 * @details This class implements all functions to help you to control the Si4844 devices.
273 */
274
276{
277
278private:
279
280 si4844_status_response status_response;
281 si4844_firmware_response firmware_response;
282 uint16_t resetPin;
283 uint16_t interruptPin;
284 uint8_t currentBand = 0;
285
286 uint8_t xoscen = 1;
287 uint8_t xowait = 0;
288
289
290 inline void setClockLow(void) { Wire.setClock(10000); };
291 inline void setClockHigh(void) { Wire.setClock(50000); };
292 inline void waitInterrupt(void);
293 inline bool isClearToSend(void);
294 inline void waitToSend(void);
295
296 // SI4844 band description (FM = 0; AM = 1; SW = 2)
297 const char *bandmode_table[3] = {"FM", "AM", "SW"};
298 const char *stereo_indicator_table[2] = {"Off","On "};
299 char strFormattedCurrentFrequenct[8];
300
301 uint8_t volume = 30;
302 uint8_t bassTreble = 4;
303
304public :
305 /**
306 * @ingroup BF
307 * @brief Set the Data Status From Device
308 * @details It is a flag that means the device triggered an interrupt.
309 * @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.
310 * @details It is very useful when the user wants to control the interrupt instead of give this control to the library.
311 * @param value true or false
312 */
313 inline void setStatusInterruptFromDevice( bool value ) { data_from_device = value; };
314
315 /**
316 * @ingroup BF
317 * @brief Get the Data Status From Device
318 * @details It returns true when the device has triggered an interrupt.
319 * @return true or false
320 */
321 inline bool getDataStatusInterruptFromDevice() { return data_from_device; };
322
323
324 void setProperty(uint16_t propertyNumber, uint16_t parameter);
326 void sendCommand(uint8_t cmd, int parameter_size, const uint8_t *parameter);
327 void getCommandResponse(int response_size, uint8_t *response);
328
329 void setup(uint16_t resetPin, int interruptPin, byte defaultBand);
330 void debugDevice(uint16_t resetPin, uint16_t interruptPin, uint8_t defaultBand, void (*showFunc)(char *msg));
331 void reset(void );
332 void setBand(byte);
333
334 void changeVolume(char); // deprecated
335 void volumeUp(void);
336 void volumeDown(void);
337 void setVolume(byte);
338 void setBassTreble(uint8_t bass_treble);
339 void bassTrebleUp();
340 void bassTrebleDown();
341 void audioMute(uint8_t value);
342 void setAudioMute(bool on);
343
344 void setAmSoftMuteMaxAttenuation(uint8_t value);
345 void setFmSoftMuteMaxAttenuation(uint8_t value);
346 void setFmDeemphasis(uint8_t value);
347 void setFmSoftMuteRate(uint8_t value);
348 void setFmSoftMuteSlope(uint8_t value);
349
350 void setAmSoftMuteRate(uint8_t value);
351 void setAmSoftMuteSlope(uint8_t value);
352 void setAmSoftMuteSnrThreshold(uint8_t value);
353
354
355 void setBlendThresholdStereoIndicator(uint16_t value);
356
357 void setCrystalOscillatorEnable(uint8_t XOSCEN );
359 void setReferenceClockFrequency(uint16_t value);
360 void setReferenceClockPrescaler(uint16_t value);
361
362
363
364 si4844_audiomode_status_response
365 setAudioMode(uint8_t audiomode, uint8_t fm_mono, uint8_t adjpt_attn, uint8_t adjpt_steo, uint8_t opcode);
366
367 si4844_status_response *getStatus(void);
368 si4844_firmware_response *getFirmware(void);
369 // customize the frequency range of a band
370 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 );
371
372 void setDefaultBandIndx( uint8_t bandidx);
373
374 void powerDown(void);
375 void powerUp(void);
376
377 float getFrequency(void);
379 bool hasStatusChanged(void);
380 void resetStatus(void);
381
382 /**
383 * @ingroup GB1
384 * @brief Gets the current audio volume level
385 *
386 * @return Volume level
387 */
388 inline uint8_t getVolume() {return volume; };
390
391 /**
392 * @ingroup GB1
393 * @brief Get the Band Mode
394 * @return char* "FM", "AM" or "SW"
395 */
396 inline char * getBandMode(){ return (char *) bandmode_table[status_response.refined.BANDMODE]; };
397
398 /**
399 * @ingroup GB1
400 * @brief Get the Stereo Indicator
401 * @return char* "ON" or "OFF"
402 */
403 inline char * getStereoIndicator(){ return (char *) stereo_indicator_table[status_response.refined.STATION]; };
404
405 /**
406 * @ingroup GB1
407 * @brief Gets Band CFG0 (Band Detection Configuration).
408 * @details 0 = ATDD device detects band; 1 = Host detects band
409 * @return 0 = ATDD device detects band; 1 = Host detects band
410 */
411 inline uint16_t getStatusBCFG0() { return status_response.refined.BCFG0; };
412
413 /**
414 * @ingroup GB1
415 * @brief Gets Band CFG1 (Band Properties Priority)
416 * @return 0 = ATDD device accepts host customized band properties; 1 = ATDD device ignores host customized band properties
417 */
418 inline uint16_t getStatusBCFG1() { return status_response.refined.BCFG1; };
419
420 /**
421 * @ingroup GB1
422 * @brief Gets Stereo indicator.
423 * @details Applicable to Si4840/44 parts FM function only.
424 * @return 0 = Stereo off; 1 = Stereo on
425 */
426 inline uint16_t getStatusStereo() { return status_response.refined.STEREO; };
427
428
429 /**
430 * @ingroup GB1
431 * @brief Gets Station Indicator.
432 * @return 0 = Invalid Station; 1 = Valid Station
433 */
434 inline uint16_t getStatusStationIndicator() { return status_response.refined.STATION; };
435
436 /**
437 * @ingroup GB1
438 * @brief Gets Information Ready
439 * @details During power up case, the system controller should not display any of the channel frequency, band mode, band index,
440 * @details station, or stereo statuses until the INFORDY bit is set.
441 * @details The host controller should not display the channel frequency when CHFREQ remains zero even when INFORDY=1.
442 * @details 0 = Tune info not ready yet; 1 = Tune info ready (i.e., Band mode, band index, channel frequency, sta-tion, and stereo indicators)
443 * @return 0 = Tune info not ready yet; 1 = Tune info ready
444 */
445 inline uint16_t getStatusInformationReady() { return status_response.refined.INFORDY; };
446
447 /**
448 * @ingroup GB1
449 * @brief Gets the Channel Frequency.
450 * @details The channel frequency is a 16-bit word of 4 digits in BCD format:
451 * @details FM 0640..1090 (64.0–109.0 MHz)
452 * @details AM 0504..1750 (504–1750 kHz)
453 * @details SW4 *0230..2850 (2.3– 28.5 MHz)
454 * @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.
455 * @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.
456 * @return 0 = Tune info not ready yet; 1 = Tune info ready
457 */
458 inline uint16_t getRawChannelFrequency() { return status_response.rawStatus.CHFREQ; };
459
460 inline uint16_t getStatusHostPowerUp() { return status_response.refined.HOSTPWRUP; };
461 inline uint16_t getStatusHostReset() { return status_response.refined.HOSTRST; };
462
463 /**
464 * @ingroup GB1
465 * @brief Gets the current Band Mode
466 * @return 0 = FM mode; 1 = AM mode; 2 = SW mode
467 */
468 inline uint16_t getStatusBandMode() { return status_response.refined.BANDMODE; };
469
470 /**
471 * @ingroup GB1
472 * @brief Gets the current Band Index Detected.
473 * @return 0~19: FM band; 20~24: AM band; 25~40: SW band
474 */
475 inline uint16_t getStatusBandIndex() { return status_response.refined.BANDIDX; };
476
477
478
479 inline uint16_t getStatusCTS() { return status_response.refined.CTS; };
480
481
482 inline uint16_t getFirmwareReserved() { return firmware_response.refined.RESERVED; };
483 inline uint16_t getFirmwareErr() { return firmware_response.refined.ERR; };
484 inline uint16_t getFirmwareCTS() { return firmware_response.refined.CTS; };
485 inline uint16_t getFirmwarePartNumber() { return firmware_response.refined.PN; };
486 inline uint16_t getFirmwareMajorRevision() { return firmware_response.refined.FWMAJOR; };
487 inline uint16_t getFirmwareMinorRevision() { return firmware_response.refined.FWMINOR; };
488 inline uint16_t getFirmwareComponentMajorRevision() { return firmware_response.refined.CMPMAJOR; };
489 inline uint16_t getFirmwareComponentMinorRevision() { return firmware_response.refined.CMPMINOR; };
490 inline uint16_t getFirmwareChipRevision() { return firmware_response.refined.CHIPREV; };
491
492 void setResetPin(uint16_t resetPin);
493 void setInterruptPin(int interruptPin);
494
496 bool detectDevice();
497 void convertToChar(uint32_t value, char *strValue, uint8_t len, uint8_t dot, uint8_t separator, bool remove_leading_zeros = true);
498 char* getFormattedFrequency(uint8_t removeRightDigit = 0);
499
500};
#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
#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:276
uint16_t getFirmwareComponentMajorRevision()
Definition: SI4844.h:488
uint16_t getStatusHostPowerUp()
Definition: SI4844.h:460
uint16_t getFirmwareCTS()
Definition: SI4844.h:484
uint16_t getStatusCTS()
Definition: SI4844.h:479
uint16_t getFirmwareChipRevision()
Definition: SI4844.h:490
uint16_t getFirmwareErr()
Definition: SI4844.h:483
uint16_t getFirmwareMinorRevision()
Definition: SI4844.h:487
uint16_t getStatusHostReset()
Definition: SI4844.h:461
uint16_t getFirmwareComponentMinorRevision()
Definition: SI4844.h:489
uint16_t getFirmwareMajorRevision()
Definition: SI4844.h:486
uint16_t getFirmwarePartNumber()
Definition: SI4844.h:485
void setResetPin(uint16_t resetPin)
Definition: SI4844.cpp:182
void setDefaultBandIndx(uint8_t bandidx)
Definition: SI4844.cpp:278
void setInterruptPin(int interruptPin)
Definition: SI4844.cpp:189
uint16_t getFirmwareReserved()
Definition: SI4844.h:482
void setStatusInterruptFromDevice(bool value)
Set the Data Status From Device.
Definition: SI4844.h:313
bool getDataStatusInterruptFromDevice()
Get the Data Status From Device.
Definition: SI4844.h:321
void sendCommand(uint8_t cmd, int parameter_size, const uint8_t *parameter)
Sends a given command to the SI4844 device.
Definition: SI4844.cpp:96
void setProperty(uint16_t propertyNumber, uint16_t parameter)
Sends (sets) property to the SI48XX.
Definition: SI4844.cpp:25
void getCommandResponse(int response_size, uint8_t *response)
Returns with the command response.
Definition: SI4844.cpp:118
uint16_t getProperty(uint16_t propertyNumber)
Gets a given property from the SI4844.
Definition: SI4844.cpp:54
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:855
float getFrequency(void)
Get the current frequency of the radio in KHz.
Definition: SI4844.cpp:671
uint32_t getFrequencyInteger(void)
Get the current frequency of the radio in KHz in uint32_t (long integer) .
Definition: SI4844.cpp:717
uint16_t getStatusBCFG0()
Gets Band CFG0 (Band Detection Configuration).
Definition: SI4844.h:411
void setFmDeemphasis(uint8_t value)
Sets de-emphasis time constant.
Definition: SI4844.cpp:878
void changeVolume(char)
Up or down the sound volume level.
Definition: SI4844.cpp:404
si4844_firmware_response * getFirmware(void)
Get part number, chip revision, firmware, patch, and component revision numbers.
Definition: SI4844.cpp:643
void setFmSoftMuteRate(uint8_t value)
Sets the attack and decay rates when entering and leaving soft mute.
Definition: SI4844.cpp:891
void setAmSoftMuteSnrThreshold(uint8_t value)
Sets the SNR threshold to engage soft mute.
Definition: SI4844.cpp:962
uint16_t getStatusBandMode()
Gets the current Band Mode.
Definition: SI4844.h:468
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:906
void resetStatus(void)
set the interrupr status to false. It will turn true after next interrupr
Definition: SI4844.cpp:774
uint16_t getStatusBandIndex()
Gets the current Band Index Detected.
Definition: SI4844.h:475
si4844_status_response * getStatus(void)
Get tune freq, band, and others information, status of the device.
Definition: SI4844.cpp:610
uint8_t getVolume()
Gets the current audio volume level.
Definition: SI4844.h:388
uint16_t getStatusStationIndicator()
Gets Station Indicator.
Definition: SI4844.h:434
void bassTrebleUp()
More treble, less bass.
Definition: SI4844.cpp:514
void setBand(byte)
Sets a new band to the device.
Definition: SI4844.cpp:331
void setBassTreble(uint8_t bass_treble)
Set the sound volume level, bass and treble.
Definition: SI4844.cpp:495
void setReferenceClockFrequency(uint16_t value)
Sets the frequency of the REFCLK from the output of the prescaler.
Definition: SI4844.cpp:976
uint8_t getVolumeProperty()
Gets the current volume value stored in SI4844 device.
Definition: SI4844.cpp:471
void setBlendThresholdStereoIndicator(uint16_t value)
Sets the blend threshold for stereo indicator.
Definition: SI4844.cpp:919
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:798
void setVolume(byte)
Sets the volume level.
Definition: SI4844.cpp:454
void reset(void)
Resets the SI4844 device.
Definition: SI4844.cpp:246
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:949
uint16_t getStatusStereo()
Gets Stereo indicator.
Definition: SI4844.h:426
char * getStereoIndicator()
Get the Stereo Indicator.
Definition: SI4844.h:403
char * getBandMode()
Get the Band Mode.
Definition: SI4844.h:396
void setup(uint16_t resetPin, int interruptPin, byte defaultBand)
Initiates the SI4844 instance and connect the device (SI4844) to Arduino.
Definition: SI4844.cpp:152
uint16_t getRawChannelFrequency()
Gets the Channel Frequency.
Definition: SI4844.h:458
void powerUp(void)
Power the device up.
Definition: SI4844.cpp:288
void volumeUp(void)
Increases the volume level.
Definition: SI4844.cpp:429
void setCrystalOscillatorStabilizationWaitTime(uint8_t XOWAIT)
Sets Crystal Oscillator Stabilization Wait Time After Reset.
Definition: SI4844.cpp:317
void volumeDown(void)
Decreases the volume level.
Definition: SI4844.cpp:440
void setCrystalOscillatorEnable(uint8_t XOSCEN)
Sets Crystal Oscillator Enable.
Definition: SI4844.cpp:303
uint16_t getStatusInformationReady()
Gets Information Ready.
Definition: SI4844.h:445
uint16_t getStatusBCFG1()
Gets Band CFG1 (Band Properties Priority)
Definition: SI4844.h:418
void debugDevice(uint16_t resetPin, uint16_t interruptPin, uint8_t defaultBand, void(*showFunc)(char *msg))
Used to debug
Definition: SI4844.cpp:203
void audioMute(uint8_t value)
Mutes the audio output.
Definition: SI4844.cpp:583
void bassTrebleDown()
Less treble, more bass.
Definition: SI4844.cpp:503
void setFmSoftMuteMaxAttenuation(uint8_t value)
FM Soft Mute Maximum Attenuation.
Definition: SI4844.cpp:866
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:546
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:991
bool hasStatusChanged(void)
Checks whether the SI4844 has its status changed.
Definition: SI4844.cpp:765
void setAudioMute(bool on)
Mutes the audio output.
Definition: SI4844.cpp:594
void setAmSoftMuteRate(uint8_t value)
Sets the attack and decay rates when entering or leaving soft mute.
Definition: SI4844.cpp:935
void powerDown(void)
Power the device down.
Definition: SI4844.cpp:267
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:1058
bool detectDevice()
Checks communication with SI4844 via I2C.
Definition: SI4844.cpp:1005
uint8_t scanI2CBus(uint8_t *device, uint8_t limit)
Scans the I2C bus and returns the addresses of the devices found.
Definition: SI4844.cpp:1021
char * getFormattedFrequency(uint8_t removeRightDigit=0)
Gets Formatted Frequency.
Definition: SI4844.cpp:1096