PU2CLR Si4735 Arduino Library 2.1.4
Arduino Library for Si47XX Devices - By Ricardo Lima Caratti
Loading...
Searching...
No Matches
SI4735 Class Reference

SI4735 Class. More...

#include <SI4735.h>

Public Member Functions

 SI4735 ()
 Construct a new SI4735::SI4735.
 
void reset (void)
 Reset the SI473X.
 
void waitToSend (void)
 Wait for the si473x is ready (Clear to Send (CTS) status bit have to be 1).
 
void setGpioCtl (uint8_t GPO1OEN, uint8_t GPO2OEN, uint8_t GPO3OEN)
 Enables output for GPO1, 2, and 3.
 
void setGpio (uint8_t GPO1LEVEL, uint8_t GPO2LEVEL, uint8_t GPO3LEVEL)
 Sets the output level (high or low) for GPO1, 2, and 3.
 
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.
 
void setup (uint8_t resetPin, uint8_t defaultFunction)
 Starts the Si473X device.
 
void setup (uint8_t resetPin, uint8_t ctsIntEnable, uint8_t defaultFunction, uint8_t audioMode=SI473X_ANALOG_AUDIO, uint8_t clockType=XOSCEN_CRYSTAL, uint8_t gpo2Enable=0)
 Starts the Si473X device.
 
void setRefClock (uint16_t refclk)
 Sets the frequency of the REFCLK from the output of the prescaler.
 
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.
 
int32_t getProperty (uint16_t propertyValue)
 Gets a given property from the SI47XX.
 
void setProperty (uint16_t propertyNumber, uint16_t param)
 Sets a given SI47XX device property.
 
void sendCommand (uint8_t cmd, int parameter_size, const uint8_t *parameter)
 Sends a given command to the SI47XX devices.
 
void getCommandResponse (int num_of_bytes, uint8_t *response)
 Returns with the command response.
 
si47x_status getStatusResponse ()
 Gets the first byte response.
 
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.
 
void radioPowerUp (void)
 Powerup the Si47XX.
 
void analogPowerUp (void)
 You have to call setPowerUp method before.
 
void powerDown (void)
 Moves the device from powerup to powerdown mode.
 
void setFrequency (uint16_t)
 Set the frequency to the corrent function of the Si4735 (FM, AM or SSB)
 
void getStatus (uint8_t, uint8_t)
 Gets the current status of the Si4735 (AM or FM)
 
uint16_t getFrequency (void)
 Gets the current frequency of the Si4735 (AM or FM)
 
bool getSignalQualityInterrupt ()
 Get the Signal Quality Interrupt status.
 
bool getRadioDataSystemInterrupt ()
 Get the Radio Data System (RDS) Interrupt status.
 
bool getTuneCompleteTriggered ()
 Get the Tune Complete status.
 
bool getStatusError ()
 Get the Status Error.
 
bool getStatusCTS ()
 Gets the Error flag Clear to Send.
 
bool getACFIndicator ()
 Returns true if the AFC rails (AFC Rail Indicator).
 
bool getBandLimit ()
 Returns true if a seek hit the band limit.
 
bool getStatusValid ()
 Gets the channel status.
 
uint8_t getReceivedSignalStrengthIndicator ()
 Returns the value of Received Signal Strength Indicator (dBμV).
 
uint8_t getStatusSNR ()
 Gets the SNR metric when tune is complete (dB)
 
uint8_t getStatusMULT ()
 Get the Status the M U L T.
 
uint16_t getAntennaTuningCapacitor ()
 Get the Antenna Tuning Capacitor value.
 
void getAutomaticGainControl ()
 Queries Automatic Gain Control STATUS.
 
void setAvcAmMaxGain ()
 Sets the Avc Am Max Gain to maximum gain (0x7800)
 
void setAvcAmMinGain ()
 Sets the Avc Am Max Gain to minimal gain (0x1000)
 
void setAvcAmDefaultGain ()
 Sets the Avc Am Max Gain to default gain (0x2A80)
 
void setAvcAmMaxGain (uint8_t gain=90)
 Sets the maximum gain for automatic volume control.
 
uint8_t getCurrentAvcAmMaxGain ()
 Get the current Avc Am Max Gain.
 
void setAmSoftMuteMaxAttenuation (uint8_t smattn=0)
 Sets the Am Soft Mute Max Attenuation.
 
void setSsbSoftMuteMaxAttenuation (uint8_t smattn=0)
 Sets the SSB Soft Mute Max Attenuation object.
 
void setSsbIfAgcReleaseRate (uint8_t param=140)
 Sets the number of milliseconds the low IF peak detector.
 
void setSsbIfAgcAttackRate (uint8_t param=4)
 Sets the IF AGC attack rate.
 
bool isAgcEnabled ()
 Checks if the AGC is enabled.
 
uint8_t getAgcGainIndex ()
 Gets the current AGC gain index.
 
void setAutomaticGainControl (uint8_t AGCDIS, uint8_t AGCIDX)
 Automatic Gain Control setup.
 
void setAGC (uint8_t AGCDIS, uint8_t AGCIDX)
 Automatic Gain Control setup (alternative name for setAutomaticGainControl )
 
void setSsbAgcOverrite (uint8_t SSBAGCDIS, uint8_t SSBAGCNDX, uint8_t reserved=0)
 Automatic Gain Control setup.
 
void getCurrentReceivedSignalQuality (uint8_t INTACK)
 Queries the status of the Received Signal Quality (RSQ) of the current channel.
 
void getCurrentReceivedSignalQuality (void)
 Queries the status of the Received Signal Quality (RSQ) of the current channel (FM_RSQ_STATUS)
 
uint8_t getCurrentRSSI ()
 Get the current receive signal strength (0–127 dBμV)
 
uint8_t getCurrentSNR ()
 Gets the current SNR metric (0–127 dB).
 
bool getCurrentRssiDetectLow ()
 Checks if RSSI detected is LOW.
 
bool getCurrentRssiDetectHigh ()
 Checks if RSSI detected is high.
 
bool getCurrentSnrDetectLow ()
 Checks if SNR detect is low.
 
bool getCurrentSnrDetectHigh ()
 Checks if SNR detect is high.
 
bool getCurrentValidChannel ()
 Checks if the current channel is valid.
 
bool getCurrentAfcRailIndicator ()
 AFC Rail Indicator.
 
bool getCurrentSoftMuteIndicator ()
 Soft Mute Indicator.
 
uint8_t getCurrentStereoBlend ()
 Gets the value of the amount of stereo blend in % (100 = full stereo, 0 = full mono).
 
bool getCurrentPilot ()
 Checks the current pilot.
 
uint8_t getCurrentMultipath ()
 Gets the current Multipath.
 
uint8_t getCurrentSignedFrequencyOffset ()
 Gets the Signed frequency offset (kHz).
 
bool getCurrentMultipathDetectLow ()
 Get Multipath Detect Low.
 
bool getCurrentMultipathDetectHigh ()
 Gets the Current Multipath Detect High.
 
bool getCurrentBlendDetectInterrupt ()
 Gets the Current Blend Detect Interrupt.
 
uint8_t getFirmwarePN ()
 Returns the Firmware Part Number.
 
uint8_t getFirmwareFWMAJOR ()
 Returns the Firmware F W M A J O R.
 
uint8_t getFirmwareFWMINOR ()
 Returns the Firmware F W M I N O R.
 
uint8_t getFirmwarePATCHH ()
 Returns the Firmware P A T C H HIGH.
 
uint8_t getFirmwarePATCHL ()
 Returns the Firmware P A T C H LOW.
 
uint8_t getFirmwareCMPMAJOR ()
 Get the Firmware C M P M A J O R object.
 
uint8_t getFirmwareCMPMINOR ()
 RESP6 - Returns the Component Major Revision (ASCII).
 
uint8_t getFirmwareCHIPREV ()
 RESP8 - Returns the Chip Revision (ASCII)
 
void setVolume (uint8_t volume)
 Sets volume level (0 to 63)
 
uint8_t getVolume ()
 Gets the current volume level.
 
void volumeDown ()
 Set sound volume level Down.
 
void volumeUp ()
 Set sound volume level Up.
 
uint8_t getCurrentVolume ()
 Get the Current Volume.
 
void setVolumeUp ()
 Set the Volume Up.
 
void setVolumeDown ()
 Set the Volume Down.
 
void setAudioMode (uint8_t audioMode)
 Sets the Audio Mode. See table below.
 
void setAmDelayNB (uint16_t value)
 Sets the delay before applying impulse blanking.
 
void digitalOutputFormat (uint8_t OSIZE, uint8_t OMONO, uint8_t OMODE, uint8_t OFALL)
 Configures the digital audio output format.
 
void digitalOutputSampleRate (uint16_t DOSR)
 Enables digital audio output and configures digital audio output sample rate in samples per second (sps).
 
void setAudioMute (bool off)
 Sets the audio on or off.
 
void setAM ()
 Sets the radio to AM function. It means: LW MW and SW.
 
void setFM ()
 Sets the radio to FM function.
 
void setAM (uint16_t fromFreq, uint16_t toFreq, uint16_t intialFreq, uint16_t step)
 Sets the radio to AM (LW/MW/SW) function.
 
void setFM (uint16_t fromFreq, uint16_t toFreq, uint16_t initialFreq, uint16_t step)
 Sets the radio to FM function.
 
void setFMDeEmphasis (uint8_t parameter)
 Sets the FM Receive de-emphasis to 50 or 75 μs.
 
void setFmSoftMuteMaxAttenuation (uint8_t smattn=0)
 Sets the Fm Soft Mute Max Attenuation.
 
void setFmNoiseBlankThreshold (uint16_t parameter)
 Set the Fm Noise Blank Threshold.
 
void setFmNoiseBlank (uint16_t nb_rate=64, uint16_t nb_interval=55, uint16_t nb_irr_filter=300)
 Set the Fm Noise Blank.
 
void setFmNoiseBlankInterval (uint16_t parameter)
 Set the Fm Noise Blank Interval.
 
void setFmNoiseBlankRate (uint16_t parameter)
 Set the Fm Noise Blank Rate.
 
void setFmNoiseBlankDelay (uint16_t parameter)
 Set the Fm Noise Blank Delay.
 
void setFmNoiseBlank_IIR_Filter (uint16_t parameter)
 Set the FmNoiseBlank IIR Filter.
 
void setAMDeEmphasis (uint8_t parameter)
 Sets the AM Receive de-emphasis to 50 or disable.
 
void setAMSoftMuteSlop (uint8_t parameter)
 Sets the AM attenuation slope during soft mute.
 
void setAMSoftMuteRate (uint8_t parameter)
 Sets the attack and decay rates when entering or leaving soft mute.
 
void setAMSoftMuteSnrThreshold (uint8_t parameter)
 Sets the SNR threshold to engage soft mute.
 
void setAMSoftMuteReleaseRate (uint8_t parameter)
 Sets the soft mute release rate.
 
void setAMSoftMuteAttackRate (uint16_t parameter)
 Sets the soft mute attack rate.
 
void setAmAgcAttackRate (uint16_t parameter)
 Sets the AGC attack rate.
 
void setAmAgcReleaseRate (uint16_t parameter)
 Sets the AGC release rate.
 
void setSsbAgcAttackRate (uint16_t parameter)
 Sets the AGC attack rate on SSB mode.
 
void setSsbAgcReleaseRate (uint16_t parameter)
 Sets the AGC Release rate on SSB mode.
 
void setAMFrontEndAgcControl (uint8_t MIN_GAIN_INDEX, uint8_t ATTN_BACKUP)
 Adjusts the AM AGC for external front-end attenuator and external front-end cascode LNA.
 
void setAmNoiseBlank (uint16_t nb_rate=64, uint16_t nb_interval=55, uint16_t nb_irr_filter=300)
 Set the Am Noise Blank.
 
bool isCurrentTuneFM ()
 
bool isCurrentTuneAM ()
 Returns true if the current function is AM (AM_TUNE_FREQ).
 
bool isCurrentTuneSSB ()
 Returns true if the current function is SSB (SSB_TUNE_FREQ).
 
void setBandwidth (uint8_t AMCHFLT, uint8_t AMPLFLT)
 Selects the bandwidth of the channel filter for AM reception.
 
void setFmBandwidth (uint8_t filter_value=0)
 Sets the Bandwith on FM mode.
 
uint8_t getTuneFrequecyFast ()
 Returns the FAST tuning status.
 
void setTuneFrequencyFast (uint8_t FAST)
 Sets the FAST Tuning.
 
uint8_t getTuneFrequecyFreeze ()
 Returns the FREEZE status.
 
void setTuneFrequencyFreze (uint8_t FREEZE)
 Sets Freeze Metrics During Alternate Frequency Jum.
 
void setTuneFrequencyAntennaCapacitor (uint16_t capacitor)
 Selects the tuning capacitor value.
 
void frequencyUp ()
 Increments the current frequency on current band/function by using the current step.
 
void frequencyDown ()
 Decrements the current frequency on current band/function by using the current step.
 
void setFrequencyUp ()
 Set the FrequencyUp.
 
void setFrequencyDown ()
 Set the Frequency Down.
 
void getFirmware (void)
 Gets firmware information.
 
void seekStation (uint8_t SEEKUP, uint8_t WRAP)
 Look for a station (Automatic tune)
 
void setMaxSeekTime (long time_in_ms)
 Sets the maximum time in milliseconds for seeking. The default value is 8000ms (8s).
 
void seekStationUp ()
 Search for the next station.
 
void seekStationDown ()
 Search the previous station.
 
void seekNextStation ()
 Search for the next station.
 
void seekPreviousStation ()
 Search the previous station.
 
void seekStationProgress (void(*showFunc)(uint16_t f), uint8_t up_down)
 Seeks a station up or down.
 
void seekStationProgress (void(*showFunc)(uint16_t f), bool(*stopSeking)(), uint8_t up_down)
 Seeks a station up or down.
 
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.
 
void setSeekAmSpacing (uint16_t spacing)
 Selects frequency spacingfor AM seek. Default is 10 kHz spacing.
 
void setSeekAmSrnThreshold (uint16_t value)
 Set the Seek Am Srn Threshold object.
 
void setSeekAmSNRThreshold (uint16_t value)
 Sets the SNR threshold for a valid AM Seek/Tune.
 
void setSeekAmRssiThreshold (uint16_t value)
 Sets the RSSI threshold for a valid AM Seek/Tune.
 
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.
 
void setSeekFmSpacing (uint16_t spacing)
 Selects frequency spacingfor FM seek. Default is 100 kHz (value 10) spacing. There are only 3 valid values: 5, 10, and 20.
 
void setSeekFmSrnThreshold (uint16_t value)
 Set the Seek Fm Srn Threshold object.
 
void setSeekFmSNRThreshold (uint16_t value)
 Sets the SNR threshold for a valid FM Seek/Tune.
 
void setSeekFmRssiThreshold (uint16_t value)
 Sets the RSSI threshold for a valid FM Seek/Tune.
 
void setFmBlendStereoThreshold (uint8_t parameter)
 Sets RSSI threshold for stereo blend (Full stereo above threshold, blend below threshold).
 
void setFmBlendMonoThreshold (uint8_t parameter)
 Sets RSSI threshold for mono blend (Full mono below threshold, blend above threshold).
 
void setFmBlendRssiStereoThreshold (uint8_t parameter)
 Sets RSSI threshold for stereo blend. (Full stereo above threshold, blend below threshold.)
 
void setFmBLendRssiMonoThreshold (uint8_t parameter)
 Sets RSSI threshold for mono blend (Full mono below threshold, blend above threshold).
 
void setFmBlendSnrStereoThreshold (uint8_t parameter)
 Sets SNR threshold for stereo blend (Full stereo above threshold, blend below threshold).
 
void setFmBLendSnrMonoThreshold (uint8_t parameter)
 Sets SNR threshold for mono blend (Full mono below threshold, blend above threshold).
 
void setFmBlendMultiPathStereoThreshold (uint8_t parameter)
 Sets multipath threshold for stereo blend (Full stereo below threshold, blend above threshold).
 
void setFmBlendMultiPathMonoThreshold (uint8_t parameter)
 Sets Multipath threshold for mono blend (Full mono above threshold, blend below threshold).
 
void setFmStereoOn ()
 Turn Off Stereo operation.
 
void setFmStereoOff ()
 Turn Off Stereo operation.
 
void RdsInit ()
 Starts the control member variables for RDS.
 
void clearRdsBuffer ()
 Starts the control member variables for RDS. It is an alias to RdsInit (a better name to RdsInit)
 
void setRdsIntSource (uint8_t RDSRECV, uint8_t RDSSYNCLOST, uint8_t RDSSYNCFOUND, uint8_t RDSNEWBLOCKA, uint8_t RDSNEWBLOCKB)
 Configures interrupt related to RDS.
 
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.
 
void rdsBeginQuery ()
 Retrieves the current RDS data to be utilized by other RDS functions.
 
bool getRdsReceived ()
 Get the Rds Received FIFO.
 
bool getRdsSyncLost ()
 Get the Rds Sync Lost object.
 
bool getRdsSyncFound ()
 Get the Rds Sync Found.
 
bool getRdsNewBlockA ()
 Get the Rds New Block A.
 
bool getRdsNewBlockB ()
 Get the Rds New Block B.
 
bool getRdsSync ()
 Get the Rds Sync.
 
bool getGroupLost ()
 Get the Group Lost.
 
uint8_t getNumRdsFifoUsed ()
 Get the Num Rds Fifo Used.
 
void setFifoCount (uint16_t value)
 Sets the minimum number of RDS groups stored in the RDS FIFO before RDSRECV is set.
 
bool getEndIndicatorGroupA ()
 Check if 0xD or 0xA special characters were received for group A.
 
void resetEndIndicatorGroupA ()
 Resets 0xD or 0xA special characters condition (makes it false)
 
bool getEndIndicatorGroupB ()
 Check if 0xD or 0xA special characters were received for group B.
 
void resetEndIndicatorGroupB ()
 Resets 0xD or 0xA special characters condition (makes it false)
 
void getRdsStatus ()
 Gets RDS Status.
 
void rdsClearFifo ()
 Empty FIFO.
 
void rdsClearInterrupt ()
 Clears RDSINT.
 
void setRdsConfig (uint8_t RDSEN, uint8_t BLETHA, uint8_t BLETHB, uint8_t BLETHC, uint8_t BLETHD)
 Sets RDS property.
 
uint16_t getRdsPI (void)
 Returns the programa type.
 
uint8_t getRdsGroupType (void)
 Returns the Group Type (extracted from the Block B)
 
uint8_t getRdsFlagAB (void)
 Returns the current Text Flag A/B

 
uint8_t getRdsVersionCode (void)
 Gets the version code (extracted from the Block B)
 
uint8_t getRdsProgramType (void)
 Returns the Program Type (extracted from the Block B)
 
uint8_t getRdsTextSegmentAddress (void)
 Returns the address of the text segment.
 
char * getRdsText (void)
 Gets the RDS Text when the message is of the Group Type 2 version A.
 
char * getRdsText0A (void)
 Gets the station name and other messages.
 
char * getRdsText2A (void)
 Gets the Text processed for the 2A group.
 
char * getRdsText2B (void)
 Gets the Text processed for the 2B group.
 
bool getRdsAllData (char **stationName, char **stationInformation, char **programInformation, char **utcTime)
 Gets Station Name, Station Information, Program Information and utcTime.
 
char * getRdsStationName (void)
 Gets the Station Name.
 
char * getRdsProgramInformation (void)
 Gets the Program Information (RT - Radio Text)
 
char * getRdsStationInformation (void)
 Gets the Station Information.
 
void mjdConverter (uint32_t mjd, uint32_t *year, uint32_t *month, uint32_t *day)
 Converts the MJD number to integers Year, month and day.
 
char * getRdsTime (void)
 Gets the RDS time and date when the Group type is 4.
 
char * getRdsDateTime (void)
 Gets the RDS the Time and Date when the Group type is 4.
 
bool getRdsDateTime (uint16_t *year, uint16_t *month, uint16_t *day, uint16_t *hour, uint16_t *minute)
 Decodes the RDS time to LOCAL Julian Day and time.
 
void getNext2Block (char *)
 Process data received from group 2B.
 
void getNext4Block (char *)
 Process data received from group 2A.
 
void setSSBBfo (int offset)
 Sets the SSB Beat Frequency Offset (BFO).
 
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.
 
void setSSB (uint16_t fromFreq, uint16_t toFreq, uint16_t intialFreq, uint16_t step, uint8_t usblsb)
 
void setSSB (uint8_t usblsb)
 Set the radio to AM function.
 
void setSSBAudioBandwidth (uint8_t AUDIOBW)
 SSB Audio Bandwidth for SSB mode.
 
void setSSBAutomaticVolumeControl (uint8_t AVCEN)
 Sets SSB Automatic Volume Control (AVC) for SSB mode.
 
void setSSBSidebandCutoffFilter (uint8_t SBCUTFLT)
 Sets SBB Sideband Cutoff Filter for band pass and low pass filters.
 
void setSBBSidebandCutoffFilter (uint8_t SBCUTFLT)
 
void setSSBAvcDivider (uint8_t AVC_DIVIDER)
 Sets AVC Divider.
 
void setSSBDspAfc (uint8_t DSP_AFCDIS)
 Sets DSP AFC disable or enable.
 
void setSSBSoftMute (uint8_t SMUTESEL)
 Sets SSB Soft-mute Based on RSSI or SNR Selection:
 
void setNBFM ()
 Set the radio to FM function.
 
void setNBFM (uint16_t fromFreq, uint16_t toFreq, uint16_t initialFreq, uint16_t step)
 
void patchPowerUpNBFM ()
 This method can be used to prepare the device to apply NBFM patch.
 
void loadPatchNBFM (const uint8_t *patch_content, const uint16_t patch_content_size)
 Loads a given NBFM patch content.
 
void setFrequencyNBFM (uint16_t freq)
 Set the frequency to the corrent function of the Si4735 on NBFM mode.
 
si47x_firmware_query_library queryLibraryId ()
 Query the library information of the Si47XX device.
 
void patchPowerUp ()
 This method can be used to prepare the device to apply SSBRX patch.
 
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.
 
bool downloadCompressedPatch (const uint8_t *ssb_patch_content, const uint16_t ssb_patch_content_size, const uint16_t *cmd_0x15, const int16_t cmd_0x15_size)
 Deal with compressed SSB patch.
 
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.
 
void loadCompressedPatch (const uint8_t *ssb_patch_content, const uint16_t ssb_patch_content_size, const uint16_t *cmd_0x15, const int16_t cmd_0x15_size, uint8_t ssb_audiobw=1)
 Loads the SSB compressed patch content.
 
si4735_eeprom_patch_header downloadPatchFromEeprom (int eeprom_i2c_address)
 Transfers the content of a patch stored in an eeprom to the SI4735 device.
 
void ssbPowerUp ()
 This function can be useful for debug and test.
 
void setMaxDelayPowerUp (uint16_t ms)
 Set the Max Delay Power Up.
 
void setMaxDelaySetFrequency (uint16_t ms)
 Set the Max Delay after Set Frequency.
 
void setFrequencyStep (uint16_t step)
 Sets the current step value.
 
uint16_t getCurrentFrequency ()
 Gets the current frequency saved in memory.
 
void getStatus ()
 Gets the current status of the Si47XX (AM, FM or SSB)
 
void setDeviceI2CAddress (uint8_t senPin)
 Sets the I2C Bus Address.
 
int16_t getDeviceI2CAddress (uint8_t resetPin)
 I2C bus address setup.
 
void setDeviceOtherI2CAddress (uint8_t i2cAddr)
 Sets the other I2C Bus Address (for Si470X)
 
void setI2CLowSpeedMode (void)
 Sets I2C bus to 10kHz.
 
void setI2CStandardMode (void)
 Sets I2C bus to 100kHz.
 
void setI2CFastMode (void)
 Sets I2C bus to 400kHz.
 
void setI2CFastModeCustom (long value=500000)
 Sets the I2C bus to a given value. ATTENTION: use this function with caution.
 
void setAudioMuteMcuPin (int8_t pin)
 Sets the Audio Mute Mcu Pin.
 
void setHardwareAudioMute (bool on)
 Sets the Hardware Audio Mute.
 
void convertToChar (uint16_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.
 
void removeUnwantedChar (char *str, int size)
 Removes unwanted character from char array.
 

Protected Member Functions

void waitInterrupr (void)
 
si47x_status getInterruptStatus ()
 Updates bits 6:0 of the status byte.
 
void sendProperty (uint16_t propertyNumber, uint16_t param)
 Sends (sets) property to the SI47XX.
 
void sendSSBModeProperty ()
 Just send the property SSB_MOD to the device. Internal use (privete method).
 
void disableFmDebug ()
 There is a debug feature that remains active in Si4704/05/3x-D60 firmware which can create periodic noise in audio.
 
void clearRdsBuffer2A ()
 Clear RDS buffer 2A (Radio Text / Program Information)
 
void clearRdsProgramInformation ()
 Clear RDS buffer 2A (Radio Text / Program Information)
 
void clearRdsBuffer2B ()
 Clear RDS buffer 2B (text / Station INformation 32 bytes)
 
void clearRdsStationInformation ()
 Clear RDS buffer 2B (text / Station INformation 32 bytes)
 
void clearRdsBuffer0A ()
 Clear RDS buffer 0A (text / Station Name)
 
void clearRdsStationName ()
 Clear RDS buffer 0A (text / Station Name)
 
void getSsbAgcStatus ()
 Queries SSB Automatic Gain Control STATUS.
 

Protected Attributes

char rds_buffer2A [65]
 RDS Radio Text buffer - Program Information.
 
char rds_buffer2B [33]
 RDS Radio Text buffer - Station Informaation.
 
char rds_buffer0A [9]
 RDS Basic tuning and switching information (Type 0 groups)
 
char rds_time [25]
 RDS date time received information.
 
int rdsTextAdress2A
 rds_buffer2A current position
 
int rdsTextAdress2B
 rds_buffer2B current position
 
int rdsTextAdress0A
 rds_buffer0A current position
 
bool rdsEndGroupA = false
 
bool rdsEndGroupB = false
 
int16_t deviceAddress = SI473X_ADDR_SEN_LOW
 Stores the current I2C bus address.
 
uint16_t maxDelaySetFrequency = MAX_DELAY_AFTER_SET_FREQUENCY
 Stores the maximum delay after set frequency command (in ms).
 
uint16_t maxDelayAfterPouwerUp = MAX_DELAY_AFTER_POWERUP
 Stores the maximum delay you have to setup after a power up command (in ms).
 
unsigned long maxSeekTime = MAX_SEEK_TIME
 Stores the maximum time (ms) for a seeking process. Defines the maximum seeking time.
 
uint8_t lastTextFlagAB
 
uint8_t resetPin
 pin used on Arduino Board to RESET the Si47XX device
 
uint8_t currentTune
 tell the current tune (FM, AM or SSB)
 
uint16_t currentMinimumFrequency
 minimum frequency of the current band
 
uint16_t currentMaximumFrequency
 maximum frequency of the current band
 
uint16_t currentWorkFrequency
 current frequency
 
uint16_t currentStep
 Stores the current step used to increment or decrement the frequency.
 
uint8_t lastMode = -1
 Stores the last mode used.
 
uint8_t currentAvcAmMaxGain = DEFAULT_CURRENT_AVC_AM_MAX_GAIN
 Stores the current Automatic Volume Control Gain for AM.
 
uint8_t currentClockType = XOSCEN_CRYSTAL
 Stores the current clock type used (Crystal or REF CLOCK)
 
uint8_t ctsIntEnable = 0
 
uint8_t gpo2Enable = 0
 
uint16_t refClock = 32768
 Frequency of Reference Clock in Hz.
 
uint16_t refClockPrescale = 1
 Prescaler for Reference Clock (divider).
 
uint8_t refClockSourcePin = 0
 0 = RCLK pin is clock source; 1 = DCLK pin is clock source.
 
si47x_frequency currentFrequency
 data structure to get current frequency
 
si47x_set_frequency currentFrequencyParams
 
si47x_rqs_status currentRqsStatus
 current Radio SIgnal Quality status
 
si47x_response_status currentStatus
 current device status
 
si47x_firmware_information firmwareInfo
 firmware information
 
si47x_rds_status currentRdsStatus
 current RDS status
 
si47x_agc_status currentAgcStatus
 current AGC status
 
si47x_ssb_mode currentSSBMode
 indicates if USB or LSB
 
si473x_powerup powerUp
 
uint8_t volume = 32
 Stores the current vlume setup (0-63).
 
uint8_t currentAudioMode = SI473X_ANALOG_AUDIO
 Current audio mode used (ANALOG or DIGITAL or both)
 
uint8_t currentSsbStatus
 
int8_t audioMuteMcuPin = -1
 

Detailed Description

SI4735 Class.

SI4735 Class definition

This class implements all functions to help you to control the Si47XX devices. This library was built based on “Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0)”. It also can be used on all members of the SI473X family respecting, of course, the features available for each IC version. These functionalities can be seen in the comparison matrix shown in table 1 (Product Family Function); pages 2 and 3 of the programming guide.

Author
PU2CLR - Ricardo Lima Caratti

Constructor & Destructor Documentation

◆ SI4735()

SI4735::SI4735 ( )

Construct a new SI4735::SI4735.

This class has a set of functions that can help you to build your receiver based on Si47XX IC family.

This library uses the I²C communication protocol and implements most of the functions offered by Si47XX (BROADCAST AM / FM / SW / LW RADIO RECEIVER) IC family from Silicon Labs.

Currently you have more than 120 functions implemented to control the Si47XX devices. These functions are listed and documented here.

Some methods were implemented using inline resource. Inline methods are implemented in SI4735.h

IMPORTANT: According to Si47XX PROGRAMMING GUIDE; AN332 (REV 1.0); page 207, "For write operations, the system controller next sends a data byte on SDIO, which is captured by the device on rising edges of SCLK. The device acknowledges each data byte by driving SDIO low for one cycle on the next falling edge of SCLK. The system controller may write up to 8 data bytes in a single 2-wire transaction. The first byte is a command, and the next seven bytes are arguments. Writing more than 8 bytes results in unpredictable device behavior". If you extend this library, remember the 8 byte restriction.

Member Function Documentation

◆ waitInterrupr()

void SI4735::waitInterrupr ( void  )
protected

◆ setFmNoiseBlankThreshold()

void SI4735::setFmNoiseBlankThreshold ( uint16_t  parameter)
inline

Set the Fm Noise Blank Threshold.

Sets the threshold for detecting impulses in dB above the noise floor. The CTS bit (and optional interrupt) is set when it is safe to send the next command.

Parameters
parameter(from 0 to 90. default is 10)

◆ setFmNoiseBlank()

void SI4735::setFmNoiseBlank ( uint16_t  nb_rate = 64,
uint16_t  nb_interval = 55,
uint16_t  nb_irr_filter = 300 
)
inline

Set the Fm Noise Blank.

Sets Noise blanking rate in 100 Hz units

Sets the Interval in micro-seconds that original samples are replaced by sample-hold clean samples.

Sets the bandwidth of the noise floor estimator.

ATTENTION: It works on SI474X. It may not work on SI473X devices.

Parameters
nb_rateNoise blanking rate in 100 Hz units. Default value is 64.
nb_intervalInterval in micro-seconds that original samples are replaced by interpolated clean samples. Default value is 55 μs.
nb_irr_filterSets the bandwidth of the noise floor estimator. Default value is 300.

◆ setFmNoiseBlankInterval()

void SI4735::setFmNoiseBlankInterval ( uint16_t  parameter)
inline

Set the Fm Noise Blank Interval.

Interval in micro-seconds that original samples are replaced by interpolated clean samples.

Parameters
parameter( from 8 to 48. default value is 24)

◆ setFmNoiseBlankRate()

void SI4735::setFmNoiseBlankRate ( uint16_t  parameter)
inline

Set the Fm Noise Blank Rate.

Noise blanking rate in 100 Hz units.

Parameters
parameter( from 1 to 64. default value is 64)

◆ setFmNoiseBlankDelay()

void SI4735::setFmNoiseBlankDelay ( uint16_t  parameter)
inline

Set the Fm Noise Blank Delay.

Delay in micro-seconds before applying impulse blanking to the original samples.

Parameters
parameter( from 125 to 219. default value is 170)

◆ setFmNoiseBlank_IIR_Filter()

void SI4735::setFmNoiseBlank_IIR_Filter ( uint16_t  parameter)
inline

Set the FmNoiseBlank IIR Filter.

Sets the bandwidth of the noise floor estimator.

Parameters
parameter(from 300 to 1600. default value is 300)

◆ setAmNoiseBlank()

void SI4735::setAmNoiseBlank ( uint16_t  nb_rate = 64,
uint16_t  nb_interval = 55,
uint16_t  nb_irr_filter = 300 
)
inline

Set the Am Noise Blank.

Sets Noise blanking rate in 100 Hz units

Sets the Interval in micro-seconds that original samples are replaced by sample-hold clean samples.

Sets the bandwidth of the noise floor estimator.

ATTENTION: It works on SI474X. It may not work on SI473X devices.

Parameters
nb_rateNoise blanking rate in 100 Hz units. Default value is 64.
nb_intervalInterval in micro-seconds that original samples are replaced by interpolated clean samples. Default value is 55 μs.
nb_irr_filterSets the bandwidth of the noise floor estimator. Default value is 300.

◆ isCurrentTuneFM()

bool SI4735::isCurrentTuneFM ( )
inline

◆ setFmBandwidth()

void SI4735::setFmBandwidth ( uint8_t  filter_value = 0)
inline

Sets the Bandwith on FM mode.

Selects bandwidth of channel filter applied at the demodulation stage. Default is automatic which means the device automatically selects proper channel filter.

| Filter | Description |

| ----— | ----------—|

| 0 | Automatically select proper channel filter (Default) |

| 1 | Force wide (110 kHz) channel filter |

| 2 | Force narrow (84 kHz) channel filter |

| 3 | Force narrower (60 kHz) channel filter |

| 4 | Force narrowest (40 kHz) channel filter |

Parameters
filter_value

Field Documentation

◆ rds_buffer2A

char SI4735::rds_buffer2A[65]
protected

RDS Radio Text buffer - Program Information.

Referenced by clearRdsBuffer2A(), clearRdsProgramInformation(), getRdsText(), and getRdsText2A().

◆ rds_buffer2B

char SI4735::rds_buffer2B[33]
protected

RDS Radio Text buffer - Station Informaation.

Referenced by clearRdsBuffer2B(), clearRdsStationInformation(), and getRdsText2B().

◆ rds_buffer0A

char SI4735::rds_buffer0A[9]
protected

RDS Basic tuning and switching information (Type 0 groups)

Referenced by clearRdsBuffer0A(), clearRdsStationName(), and getRdsText0A().

◆ rds_time

char SI4735::rds_time[25]
protected

RDS date time received information.

Referenced by getRdsDateTime(), and getRdsTime().

◆ rdsTextAdress2A

int SI4735::rdsTextAdress2A
protected

rds_buffer2A current position

Referenced by getRdsText(), and getRdsText2A().

◆ rdsTextAdress2B

int SI4735::rdsTextAdress2B
protected

rds_buffer2B current position

Referenced by getRdsText2B().

◆ rdsTextAdress0A

int SI4735::rdsTextAdress0A
protected

rds_buffer0A current position

Referenced by getRdsText0A().

◆ rdsEndGroupA

bool SI4735::rdsEndGroupA = false
protected

◆ rdsEndGroupB

bool SI4735::rdsEndGroupB = false
protected

◆ deviceAddress

int16_t SI4735::deviceAddress = SI473X_ADDR_SEN_LOW
protected

Stores the current I2C bus address.

◆ maxDelaySetFrequency

uint16_t SI4735::maxDelaySetFrequency = MAX_DELAY_AFTER_SET_FREQUENCY
protected

Stores the maximum delay after set frequency command (in ms).

◆ maxDelayAfterPouwerUp

uint16_t SI4735::maxDelayAfterPouwerUp = MAX_DELAY_AFTER_POWERUP
protected

Stores the maximum delay you have to setup after a power up command (in ms).

◆ maxSeekTime

unsigned long SI4735::maxSeekTime = MAX_SEEK_TIME
protected

Stores the maximum time (ms) for a seeking process. Defines the maximum seeking time.

Referenced by setMaxSeekTime().

◆ lastTextFlagAB

uint8_t SI4735::lastTextFlagAB
protected

◆ resetPin

uint8_t SI4735::resetPin
protected

pin used on Arduino Board to RESET the Si47XX device

◆ currentTune

uint8_t SI4735::currentTune
protected

tell the current tune (FM, AM or SSB)

◆ currentMinimumFrequency

uint16_t SI4735::currentMinimumFrequency
protected

minimum frequency of the current band

◆ currentMaximumFrequency

uint16_t SI4735::currentMaximumFrequency
protected

maximum frequency of the current band

◆ currentWorkFrequency

uint16_t SI4735::currentWorkFrequency
protected

current frequency

◆ currentStep

uint16_t SI4735::currentStep
protected

Stores the current step used to increment or decrement the frequency.

◆ lastMode

uint8_t SI4735::lastMode = -1
protected

Stores the last mode used.

◆ currentAvcAmMaxGain

uint8_t SI4735::currentAvcAmMaxGain = DEFAULT_CURRENT_AVC_AM_MAX_GAIN
protected

Stores the current Automatic Volume Control Gain for AM.

◆ currentClockType

uint8_t SI4735::currentClockType = XOSCEN_CRYSTAL
protected

Stores the current clock type used (Crystal or REF CLOCK)

◆ ctsIntEnable

uint8_t SI4735::ctsIntEnable = 0
protected

◆ gpo2Enable

uint8_t SI4735::gpo2Enable = 0
protected

◆ refClock

uint16_t SI4735::refClock = 32768
protected

Frequency of Reference Clock in Hz.

◆ refClockPrescale

uint16_t SI4735::refClockPrescale = 1
protected

Prescaler for Reference Clock (divider).

◆ refClockSourcePin

uint8_t SI4735::refClockSourcePin = 0
protected

0 = RCLK pin is clock source; 1 = DCLK pin is clock source.

◆ currentFrequency

si47x_frequency SI4735::currentFrequency
protected

data structure to get current frequency

◆ currentFrequencyParams

si47x_set_frequency SI4735::currentFrequencyParams
protected

◆ currentRqsStatus

si47x_rqs_status SI4735::currentRqsStatus
protected

current Radio SIgnal Quality status

◆ currentStatus

si47x_response_status SI4735::currentStatus
protected

current device status

◆ firmwareInfo

si47x_firmware_information SI4735::firmwareInfo
protected

firmware information

◆ currentRdsStatus

si47x_rds_status SI4735::currentRdsStatus
protected

current RDS status

◆ currentAgcStatus

si47x_agc_status SI4735::currentAgcStatus
protected

current AGC status

◆ currentSSBMode

si47x_ssb_mode SI4735::currentSSBMode
protected

indicates if USB or LSB

◆ powerUp

si473x_powerup SI4735::powerUp
protected

◆ volume

uint8_t SI4735::volume = 32
protected

Stores the current vlume setup (0-63).

◆ currentAudioMode

uint8_t SI4735::currentAudioMode = SI473X_ANALOG_AUDIO
protected

Current audio mode used (ANALOG or DIGITAL or both)

◆ currentSsbStatus

uint8_t SI4735::currentSsbStatus
protected

◆ audioMuteMcuPin

int8_t SI4735::audioMuteMcuPin = -1
protected

The documentation for this class was generated from the following files: