PU2CLR SI4844 Arduino Library  1.0.9
Arduino Library for Si4844 Devices - By Ricardo Lima Caratti
Member Functions

Functions

void SI4844::setStatusInterruptFromDevice (bool value)
 Set the Data Status From Device. More...
 
bool SI4844::getDataStatusInterruptFromDevice ()
 Get the Data Status From Device. More...
 
uint8_t SI4844::getVolume ()
 Gets the current audio volume level. More...
 
char * SI4844::getBandMode ()
 Get the Band Mode. More...
 
char * SI4844::getStereoIndicator ()
 Get the Stereo Indicator. More...
 
void SI4844::setProperty (uint16_t propertyNumber, uint16_t parameter)
 Sends (sets) property to the SI48XX. More...
 
uint16_t SI4844::getProperty (uint16_t propertyNumber)
 Gets a given property from the SI4844. More...
 
void SI4844::sendCommand (uint8_t cmd, int parameter_size, const uint8_t *parameter)
 Sends a given command to the SI4844 device. More...
 
void SI4844::getCommandResponse (int response_size, uint8_t *response)
 Returns with the command response.
More...
 
void SI4844::setup (uint16_t resetPin, int interruptPin, byte defaultBand)
 Initiates the SI4844 instance and connect the device (SI4844) to Arduino. More...
 
void SI4844::debugDevice (uint16_t resetPin, uint16_t interruptPin, uint8_t defaultBand, void(*showFunc)(char *msg))
 Used to debug
More...
 
void SI4844::reset (void)
 Resets the SI4844 device. More...
 
void SI4844::powerDown (void)
 Power the device down. More...
 
void SI4844::powerUp (void)
 Power the device up. More...
 
void SI4844::setBand (byte)
 Sets a new band to the device. More...
 
void SI4844::changeVolume (char)
 Up or down the sound volume level. More...
 
void SI4844::volumeUp (void)
 Increases the volume level. More...
 
void SI4844::volumeDown (void)
 Decreases the volume level. More...
 
void SI4844::setVolume (byte)
 Sets the volume level. More...
 
uint8_t SI4844::getVolumeProperty ()
 Gets the current volume value stored in SI4844 device. More...
 
void SI4844::setBassTreble (uint8_t bass_treble)
 Set the sound volume level, bass and treble. More...
 
void SI4844::bassTrebleDown ()
 Less treble, more bass. More...
 
void SI4844::bassTrebleUp ()
 More treble, less bass. More...
 
si4844_audiomode_status_response SI4844::setAudioMode (uint8_t audiomode, uint8_t fm_mono, uint8_t adjpt_attn, uint8_t adjpt_steo, uint8_t opcode)
 Set audio mode. More...
 
void SI4844::audioMute (uint8_t value)
 Mutes the audio output. More...
 
void SI4844::setAudioMute (bool on)
 Mutes the audio output. More...
 
si4844_status_responseSI4844::getStatus (void)
 Get tune freq, band, and others information, status of the device. More...
 
si4844_firmware_responseSI4844::getFirmware (void)
 Get part number, chip revision, firmware, patch, and component revision numbers. More...
 
float SI4844::getFrequency (void)
 Get the current frequency of the radio in KHz. More...
 
bool SI4844::hasStatusChanged (void)
 Checks whether the SI4844 has its status changed. More...
 
void SI4844::resetStatus (void)
 set the interrupr status to false. It will turn true after next interrupr
More...
 
void SI4844::setCustomBand (byte, uint16_t, uint16_t, byte)
 This method allows you to customize the frequency range of a band. More...
 
void SI4844::setAmSoftMuteMaxAttenuation (uint8_t value)
 Sets AM Soft Mute Max Attenuation..
More...
 
void SI4844::setFmSoftMuteMaxAttenuation (uint8_t value)
 FM Soft Mute Maximum Attenuation. More...
 
void SI4844::setFmDeemphasis (uint8_t value)
 Sets de-emphasis time constant. More...
 

Detailed Description

Function Documentation

◆ setStatusInterruptFromDevice()

void SI4844::setStatusInterruptFromDevice ( bool  value)
inline

Set the Data Status From Device.

It is a flag that means the device triggered an interrupt.

You can use this function to back the flag status to false. This way you can check when the device triggers the next interrupt.

It is very useful when the user wants to control the interrupt instead of give this control to the library.

Parameters
valuetrue or false

◆ getDataStatusInterruptFromDevice()

bool SI4844::getDataStatusInterruptFromDevice ( )
inline

Get the Data Status From Device.

It returns true when the device has triggered an interrupt.

Returns
true or false

◆ getVolume()

uint8_t SI4844::getVolume ( )
inline

Gets the current audio volume level.

Returns
Volume level

◆ getBandMode()

char* SI4844::getBandMode ( )
inline

Get the Band Mode.

Returns
char* "FM", "AM" or "SW"

◆ getStereoIndicator()

char* SI4844::getStereoIndicator ( )
inline

Get the Stereo Indicator.

Returns
char* "ON" or "OFF"

◆ setProperty()

void SI4844::setProperty ( uint16_t  propertyNumber,
uint16_t  parameter 
)

Sends (sets) property to the SI48XX.

This method is used for others to send generic properties and params to SI4844

Parameters
propertyNumberproperty number (example: RX_VOLUME)
parameterproperty value that will be seted

◆ getProperty()

uint16_t SI4844::getProperty ( uint16_t  propertyNumber)

Gets a given property from the SI4844.

This method is used to get a given property from SI47XX

You might need to extract set of bits information from the returned value to know the real value

Parameters
propertyNumberproperty number (example: RX_VOLUME)
Returns
property value (the content of the property)

◆ sendCommand()

void SI4844::sendCommand ( uint8_t  cmd,
int  parameter_size,
const uint8_t *  parameter 
)

Sends a given command to the SI4844 device.

This function can be useful when you want to execute a SI4844 device command and it was not implemented by this library.

Also, you need to work with bit operators to compose the parameters of the command [ &(and), ˆ(xor), |(or) etc ].

See also
getCommandResponse, setProperty, getProperty
Parameters
cmdcommand number (see PROGRAMMING GUIDE)
parameter_sizeParameter size in bytes. Tell the number of argument used by the command.
parameteruint16_t byte array with the arguments of the command

◆ getCommandResponse()

void SI4844::getCommandResponse ( int  response_size,
uint8_t *  response 
)

Returns with the command response.

After a command is executed by the device, you can get the result (response) of the command by calling this method.

See also
sendCommand, setProperty
Parameters
response_sizenum of bytes returned by the command.
responsebyte array where the response will be stored.

◆ setup()

void SI4844::setup ( uint16_t  resetPin,
int  interruptPin,
byte  defaultBand 
)

Initiates the SI4844 instance and connect the device (SI4844) to Arduino.

Calling this library should be the first thing to do to control the SI4844.

If interruptPin is -1, it means you will control interrupt in your sketch.

In this case, you have to call interrupt_hundler() (see SI4844.h)

Parameters
resetPinarduino pin used to reset the device
interruptPininterruprPin arduino pin used to handle interrupt
defaultBandband that the radio should start

References SI4844::getFirmware(), and SI4844::reset().

◆ debugDevice()

void SI4844::debugDevice ( uint16_t  resetPin,
uint16_t  interruptPin,
uint8_t  defaultBand,
void(*)(char *msg)  showFunc 
)

Used to debug

use this function instead setup to check your implementation

Parameters
resetPinsame call setup;
interruptPinsame call setup
defaultBandsame call setup
showFuncfunction of your sketch that will be called to show something

References SI4844::getFirmware(), and SI4844::reset().

◆ reset()

void SI4844::reset ( void  )

Resets the SI4844 device.

Prepares the system to be started.

See also
pages 7, 8, 9 and 10 of the programming guide.

Referenced by SI4844::debugDevice(), SI4844::setBand(), and SI4844::setup().

◆ powerDown()

void SI4844::powerDown ( void  )

Power the device down.

Moves the SI4844 device from power up to power down mode.

See also
Si48XX ATDD PROGRAMMING GUIDE; AN610; page 45

◆ powerUp()

void SI4844::powerUp ( void  )

Power the device up.

Moves the SI4844 device from power down to power up

See also
Si48XX ATDD PROGRAMMING GUIDE; AN610; page 45

◆ setBand()

void SI4844::setBand ( byte  new_band)

Sets a new band to the device.

This method is used to select a band

See also
See Table 8. Pre-defined Band Table in Si48XX ATDD PROGRAMMING GUIDE; AN610; pages 17 and 18
Parameters
new_bandband number.

References SI4844::getStatus(), and SI4844::reset().

◆ changeVolume()

void SI4844::changeVolume ( char  command)

Up or down the sound volume level.

Deprecated:
Parameters
command'+' up and '-' down

◆ volumeUp()

void SI4844::volumeUp ( void  )

Increases the volume level.

◆ volumeDown()

void SI4844::volumeDown ( void  )

Decreases the volume level.

◆ setVolume()

void SI4844::setVolume ( byte  volumeLavel)

Sets the volume level.

Sets a value to the audio volume.

See also
Table 4, Si48XX ATDD PROGRAMMING GUIDE; AN610; page 11
Parameters
bytevolumeLevel (domain: 0 to 63)

◆ getVolumeProperty()

byte SI4844::getVolumeProperty ( )

Gets the current volume value stored in SI4844 device.

Use getVolume instead.

Returns
byte

◆ setBassTreble()

void SI4844::setBassTreble ( uint8_t  bass_treble)

Set the sound volume level, bass and treble.

bass_treble Description
0 Bass boost +4 (max)
1 Bass boost +3
2 Bass boost +2
3 Bass boost +1 (min)
4 Normal (No Bass/Treble effect) (Default) 5- Treble boost +1 (min)
6 Treble boost +2
7 Treble boost +3
8 Treble boost +4 (max)
See also
Si48XX ATDD PROGRAMMING GUIDE; AN610; pages 29, 35, 65 and 67
Parameters
bass_treblebass and treble (domain: 0 to 8). See table above

◆ bassTrebleDown()

void SI4844::bassTrebleDown ( )

Less treble, more bass.

◆ bassTrebleUp()

void SI4844::bassTrebleUp ( )

More treble, less bass.

◆ setAudioMode()

si4844_audiomode_status_response SI4844::setAudioMode ( uint8_t  audiomode,
uint8_t  fm_mono,
uint8_t  adjpt_attn,
uint8_t  adjpt_steo,
uint8_t  opcode 
)

Set audio mode.

See also
Si48XX ATDD PROGRAMMING GUIDE; AN610; page 21
Parameters
byteaudio_mode 0 = Digital volume mode (no bass/treble effect, volume levels from 0 to 63) 1 = Bass/treble mode (no digital volume control, fixed volume level at 59) 2 = Mixed mode 1 (bass/treble and digital volume coexist, max volume = 59) 3 = Mixed mode 2 (bass/treble and digital volume coexist, max volume = 63) Default is 3 (Mixed mode 2).
bytefm_mono 0 = Stereo audio output (default) 1 = Mono audio output
byteadjpt_attn Audio attention of adjacent tune wheel positions of a station 0 = {–2 dB, -0dB, –2 dB} i.e., adjacent points volume levels –2 dB (default) 1 = {–0 dB, -0dB, –0 dB} i.e., adjacent points same volume levels
byteadjpt_steo 0 = Adjacent points allow stereo separation and stereo indicator on (default) 1 = Adjacent points disable stereo separation and stereo indicator are off
byteopcode 0 = Set audio mode and settings 1 = Get current audio mode and settings without setting

◆ audioMute()

void SI4844::audioMute ( uint8_t  value)

Mutes the audio output.

Parameters
valuevalue 0 = normal (no mute); 1 = Right side mute; 2; Left side mute; 3 = both side

◆ setAudioMute()

void SI4844::setAudioMute ( bool  on)

Mutes the audio output.

Parameters
boolon false = normal (no mute); true = mute

◆ getStatus()

si4844_status_response * SI4844::getStatus ( void  )

Get tune freq, band, and others information, status of the device.

Use this method only if you want to deal with that information by yourself.

This library has other methods to get that information easier.

Returns
a pointer to a structure type si4844_status_response

Referenced by SI4844::getFrequency(), SI4844::setBand(), and SI4844::setCustomBand().

◆ getFirmware()

si4844_firmware_response * SI4844::getFirmware ( void  )

Get part number, chip revision, firmware, patch, and component revision numbers.

You do not need to call this method. It is executed just once at setup methos.

There are other methods that give you that information.

See also
Si48XX ATDD PROGRAMMING GUIDE; AN610; page 22
Returns
a pointer to a structure type wirh the part number, chip revision, firmware revision, patch revision, and component revision numbers.

Referenced by SI4844::debugDevice(), and SI4844::setup().

◆ getFrequency()

float SI4844::getFrequency ( void  )

Get the current frequency of the radio in KHz.

For example: FM, 103900 KHz (103.9 MHz); SW, 7335 KHz (7.34 MHz, 41m)

Returns
float current frequency in KHz.

References SI4844::getStatus().

◆ hasStatusChanged()

bool SI4844::hasStatusChanged ( void  )

Checks whether the SI4844 has its status changed.

Actually it checks if the device triggered an external interruption due to some internal event.

For example: If you move the tuner, the status of the device is changed.

Returns
true or false

◆ resetStatus()

void SI4844::resetStatus ( void  )

set the interrupr status to false. It will turn true after next interrupr

◆ setCustomBand()

void SI4844::setCustomBand ( byte  bandIndex,
uint16_t  botton,
uint16_t  top,
byte  bandSpace 
)

This method allows you to customize the frequency range of a band.

The SI4844 can work from 2.3–28.5 MHz on SW, 64.0–109.0MHz on FM

You can configure the band index 40, for example, to work between 27 to 28 MHz.

See also
Si48XX ATDD PROGRAMMING GUIDE, pages 17, 18, 19 and 20.

(top – button)/(bandSpace) must be betwenn 50 and 230

Parameters
bandIndesPredefined band index (valid values: betwenn 0 and 40)
buttonBand Bottom Frequency Limit
topBand Top Frequency Limit
bandSpaceChannel Spacing (use 5 or 10 - On FM 10 = 100KHz)

References SI4844::getStatus().

◆ setAmSoftMuteMaxAttenuation()

void SI4844::setAmSoftMuteMaxAttenuation ( uint8_t  value)

Sets AM Soft Mute Max Attenuation..

Maximum attenuation to apply when in soft mute. Specified in units of dB. Default maximum attenuation is 16 dB.

Set to 0 to disable soft mute. Valid range: 0 - 63.

Parameters
valuenumber between 0 and 63

◆ setFmSoftMuteMaxAttenuation()

void SI4844::setFmSoftMuteMaxAttenuation ( uint8_t  value)

FM Soft Mute Maximum Attenuation.

Maximum attenuation to apply when in soft mute. Specified in units of dB. Default maximum attenuation is 16 dB.

Set to 0 to disable soft mute. Valid range: 0 - 31.

Parameters
valuenumber between 0 and 31

◆ setFmDeemphasis()

void SI4844::setFmDeemphasis ( uint8_t  value)

Sets de-emphasis time constant.

Sets the FM Receive de-emphasis to 50 or 75 μs. Default is 75 μs.

Parameters
value1 = 50 μs. Used in Europe, Australia, Japan, China; 2 = 75 μs. Used in USA