fm 2.0.0.0
Public function

Functions

void fm_cfg_setup (fm_cfg_t *cfg)
 Config Object Initialization function.
 
FM_RETVAL fm_init (fm_t *ctx, fm_cfg_t *cfg)
 Initialization function.
 
void fm_default_cfg (fm_t *ctx)
 Click Default Configuration function.
 
void fm_generic_write (fm_t *ctx, uint16_t *reg_buf)
 Generic write function.
 
void fm_generic_read (fm_t *ctx, uint16_t *reg_buf)
 Reading all registers.
 
void fm_set_bits (uint16_t *register_buffer, uint16_t register_address, uint16_t bits_mask, uint16_t bits_value)
 Setting bits in specific register on a specific bit location.
 
uint8_t fm_set_seek_threshold (fm_t *ctx, uint16_t seek_threshold)
 Setting seek threshold value.
 
uint8_t fm_set_volume (fm_t *ctx, uint8_t volume_level)
 Setting volume value.
 
uint8_t fm_set_snr_threshold (fm_t *ctx, uint8_t snr_threshold)
 Setting seek SNR threshold value.
 
uint8_t fm_set_seek_impulse_detection_threshold (fm_t *ctx, uint8_t impulse_detection_threshold)
 Setting seek impulse detection threshold value.
 
uint8_t fm_get_errors_block_a (fm_t *ctx)
 Reading number of errors to be corrected.
 
uint8_t fm_get_received_signal_strength_indicator (fm_t *ctx)
 Reading recived strength indicator.
 
uint8_t fm_get_errors_block_b (fm_t *ctx)
 Reading number of errors to be corrected.
 
uint8_t fm_get_errors_block_c (fm_t *ctx)
 Reading number of errors to be corrected.
 
uint8_t fm_get_errors_block_d (fm_t *ctx)
 Reading number of errors to be corrected.
 
float fm_get_channel_frequency (fm_t *ctx)
 Calculating current channel frequency.
 
void fm_power_up (fm_t *ctx)
 Powering up device.
 
void fm_basic_settings (fm_t *ctx)
 Setting basic settings.
 
void fm_power_down (fm_t *ctx)
 Powering down device.
 
uint16_t fm_get_channel (fm_t *ctx)
 Reading CHANNEL bits.
 
void fm_tune_channel (fm_t *ctx, uint16_t channel)
 Setting CHANNEL bits.
 
uint8_t fm_tune (fm_t *ctx, float channel_frequency)
 Tunning radio station.
 
void fm_end_tune (fm_t *ctx)
 End tunning.
 
void fm_seek (fm_t *ctx)
 Start seeking radio station.
 
void fm_end_seek (fm_t *ctx)
 End seeking.
 
uint8_t fm_volume_up (fm_t *ctx)
 Increasing volume level.
 
uint8_t fm_volume_down (fm_t *ctx)
 Decreasing volume level.
 
void fm_mute_enable (fm_t *ctx)
 Enable mute.
 
void fm_mute_disable (fm_t *ctx)
 Disable mute.
 
uint8_t fm_fine_tune_up (fm_t *ctx)
 Fine tunning.
 
uint8_t fm_fine_tune_down (fm_t *ctx)
 Fine tunning.
 
uint8_t fm_get_int_pin (fm_t *ctx)
 Checking INT pin status.
 
uint8_t fm_get_an_pin (fm_t *ctx)
 Checking AN pin status.
 

Detailed Description

Function Documentation

◆ fm_basic_settings()

void fm_basic_settings ( fm_t * ctx)

Setting basic settings.

Parameters
ctxClick object.

@description This function sets basic settings to device This function sets optimal settings for device operation in Europe

◆ fm_cfg_setup()

void fm_cfg_setup ( fm_cfg_t * cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

@description This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ fm_default_cfg()

void fm_default_cfg ( fm_t * ctx)

Click Default Configuration function.

Parameters
ctxClick object.

@description This function executes default configuration for Fm click.

◆ fm_end_seek()

void fm_end_seek ( fm_t * ctx)

End seeking.

Parameters
ctxClick object.

@description This function ends seek by setting SEEK bit LOW This function must be called after fm_seek(); function This function must be executed after seek done interrupt flag This function can be executed before seek done interrupt flag

◆ fm_end_tune()

void fm_end_tune ( fm_t * ctx)

End tunning.

Parameters
ctxClick object.

@description This function ends tunning radio station by setting TUNE bit LOW This function must be executed after getting tune done interrupt flag This function can be executed before getting tune done interrupt flag

◆ fm_fine_tune_down()

uint8_t fm_fine_tune_down ( fm_t * ctx)

Fine tunning.

Parameters
ctxClick object.
Returns
0 if tuned frequency is in valid range; 1 if tuned frequency reached lower band limit @description This fine tunes frequency in smallest possible increments for spacing setting

◆ fm_fine_tune_up()

uint8_t fm_fine_tune_up ( fm_t * ctx)

Fine tunning.

Parameters
ctxClick object.
Returns
0 if tuned frequency is in valid range; 1 if tuned frequency reached upper band limit

@description This fine tunes frequency in smallest possible increments for spacing setting

◆ fm_generic_read()

void fm_generic_read ( fm_t * ctx,
uint16_t * reg_buf )

Reading all registers.

Parameters
ctxClick object.
reg_bufAll registers to be read are stored into reg_buf[ 16 ].

@description This function reads all registers in device starting from address 0x0A This function sorts all device registers in such manner that reg_buf[] can be used with fm_generic_write(); without change

◆ fm_generic_write()

void fm_generic_write ( fm_t * ctx,
uint16_t * reg_buf )

Generic write function.

Parameters
ctxClick object.
reg_bufAll registers to be written are stored into reg_buf[ 16 ].

@description This function writes all registers from device starting from address 0x02 This function should be used after fm_generic_read(); and fm_set_bits(); functions

◆ fm_get_an_pin()

uint8_t fm_get_an_pin ( fm_t * ctx)

Checking AN pin status.

Returns
int pin status - (0 or 1)

@description This function returns 0 if AN pin is LOW or 1 if AN pin is HIGH

◆ fm_get_channel()

uint16_t fm_get_channel ( fm_t * ctx)

Reading CHANNEL bits.

Parameters
ctxClick object.
Returns
channel - value of channel bits - bits [9:0]

@description This function reads CHANNEL bits from READCHAN register

◆ fm_get_channel_frequency()

float fm_get_channel_frequency ( fm_t * ctx)

Calculating current channel frequency.

Parameters
ctxClick object.
Returns
channel_frequency - current channel frequency in MHz

@description This function calculates current channel frequency based on band and space settings

◆ fm_get_errors_block_a()

uint8_t fm_get_errors_block_a ( fm_t * ctx)

Reading number of errors to be corrected.

Parameters
ctxClick object.
Returns
n_errors - value that represents number of errors to be corrected

@description This function returns BLERA error bits from status RSSI register This function returns 00h if 0 errors occured This function returns 01h if 1–2 errors occured This function returns 10h if 3–5 errors occured This function returns 11h if 6+ errors occured and correction is not possible.

◆ fm_get_errors_block_b()

uint8_t fm_get_errors_block_b ( fm_t * ctx)

Reading number of errors to be corrected.

Parameters
ctxClick object.
Returns
n_errors - value that represents number of errors to be corrected

@description This function returns BLERB error bits from read Channel register This function returns 00h if 0 errors occured This function returns 01h if 1–2 errors occured This function returns 10h if 3–5 errors occured This function returns 11h if 6+ errors occured and correction is not possible.

◆ fm_get_errors_block_c()

uint8_t fm_get_errors_block_c ( fm_t * ctx)

Reading number of errors to be corrected.

Parameters
ctxClick object.
Returns
n_errors - value that represents number of errors to be corrected

@description This function returns BLERC error bits from read Channel register This function returns 00h if 0 errors occured This function returns 01h if 1–2 errors occured This function returns 10h if 3–5 errors occured This function returns 11h if 6+ errors occured and correction is not possible.

◆ fm_get_errors_block_d()

uint8_t fm_get_errors_block_d ( fm_t * ctx)

Reading number of errors to be corrected.

Parameters
ctxClick object.
Returns
n_errors - value that represents number of errors to be corrected

@description This function returns BLERD error bits from read Channel register This function returns 00h if 0 errors occured This function returns 01h if 1–2 errors occured This function returns 10h if 3–5 errors occured This function returns 11h if 6+ errors occured and correction is not possible.

◆ fm_get_int_pin()

uint8_t fm_get_int_pin ( fm_t * ctx)

Checking INT pin status.

Parameters
ctxClick object.
Returns
int pin status - (0 or 1)

@description This function returns 0 if INT pin is LOW or 1 if INT pin is HIGH

◆ fm_get_received_signal_strength_indicator()

uint8_t fm_get_received_signal_strength_indicator ( fm_t * ctx)

Reading recived strength indicator.

Parameters
ctxClick object.
Returns
rssi_value - value of recived signal strength in dBuV

@description This function reads recived signal strength indicatior

◆ fm_init()

FM_RETVAL fm_init ( fm_t * ctx,
fm_cfg_t * cfg )

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.

@description This function initializes all necessary pins and peripherals used for this click.

◆ fm_mute_disable()

void fm_mute_disable ( fm_t * ctx)

Disable mute.

Parameters
ctxClick object.

@description This function disables mute

◆ fm_mute_enable()

void fm_mute_enable ( fm_t * ctx)

Enable mute.

Parameters
ctxClick object.

@description This function enables mute

◆ fm_power_down()

void fm_power_down ( fm_t * ctx)

Powering down device.

Parameters
ctxClick object.

@description This function powers down device

◆ fm_power_up()

void fm_power_up ( fm_t * ctx)

Powering up device.

Parameters
ctxClick object.

@description This function powers up device This function first selects 2 wire mode for I2C This function than enables crystal oscylator and waits for it to settle This function than sets ENABLE bit HIGH and DISABLE bit LOW and waits for device to powerup

◆ fm_seek()

void fm_seek ( fm_t * ctx)

Start seeking radio station.

Parameters
ctxClick object.

@description This function starts seeking radio stations according to basic seek setings This function seeks stations by seeking up and wraps to lower band limit upon reaching upper band limit if basic settings have not been changed

◆ fm_set_bits()

void fm_set_bits ( uint16_t * register_buffer,
uint16_t register_address,
uint16_t bits_mask,
uint16_t bits_value )

Setting bits in specific register on a specific bit location.

Parameters
ctxClick object.
register_bufferAll device registers are read into register_buffer[ 16 ].
register_addressAddress of the register whose bits are to be set.
bits_maskBits to be set must be masked first.
bits_valueValue of the bits in selected range.

@description This function is used to set bits in specific register on a specific position This function is used after fm_generic_read( uint16_t *register_buffer ) This function is used before fm_generic_write( uint16_t *register_buffer )

◆ fm_set_seek_impulse_detection_threshold()

uint8_t fm_set_seek_impulse_detection_threshold ( fm_t * ctx,
uint8_t impulse_detection_threshold )

Setting seek impulse detection threshold value.

Parameters
ctxClick object.
Returns
0 or 1

@description This function sets impulse detection threshold value This function sets SKCNT bits in System configuration 3 register This function returns 0 if threshold value is in valid range This function returns 1 if threshold value is not in valid range

◆ fm_set_seek_threshold()

uint8_t fm_set_seek_threshold ( fm_t * ctx,
uint16_t seek_threshold )

Setting seek threshold value.

Parameters
ctxClick object.
seek_thresholdValue of seek threshold.
Returns
0 or 1

@description This function sets seek threshold value This function returns 0 if threshold value is in valid range This function returns 1 if threshold value is not in valid range

◆ fm_set_snr_threshold()

uint8_t fm_set_snr_threshold ( fm_t * ctx,
uint8_t snr_threshold )

Setting seek SNR threshold value.

Parameters
ctxClick object.
Returns
0 or 1

@description This function sets seek SNR threshold value This function sets SKSNR bits in System configuration 3 register This function returns 0 if threshold value is in valid range This function returns 1 if threshold value is not in valid range

◆ fm_set_volume()

uint8_t fm_set_volume ( fm_t * ctx,
uint8_t volume_level )

Setting volume value.

Parameters
ctxClick object.
volume_levelDesired volume value
Returns
0 or 1

@description This function sets volume value (0-16) This function sets VOLUME bits [3:0] in System configuration 2 register This function returns 0 if volume value is in range This function returns 1 if volume value is not in range

◆ fm_tune()

uint8_t fm_tune ( fm_t * ctx,
float channel_frequency )

Tunning radio station.

Parameters
ctxClick object.
channel_frequency- frequency of the channel to be tuned
Returns
0 or 1

@description This function sets channel for desired radio station and sets tune enable bit This function returns 0 if radio station frequency is in valid range This function returns 1 if radio station frequency is not in valid range

◆ fm_tune_channel()

void fm_tune_channel ( fm_t * ctx,
uint16_t channel )

Setting CHANNEL bits.

Parameters
ctxClick object.
channel- value stored in channel bits - bits [9:0]

@description This function sets CHANNEL bits in CHANNEL register

◆ fm_volume_down()

uint8_t fm_volume_down ( fm_t * ctx)

Decreasing volume level.

Parameters
ctxClick object.
Returns
(o or 1)

@description This function decreases volume level This function returns 0 if volume level decreased This function returns 1 if volume level reached minimum value

◆ fm_volume_up()

uint8_t fm_volume_up ( fm_t * ctx)

Increasing volume level.

Parameters
ctxClick object.
Returns
(o or 1)

@description This function increases volume level This function returns 0 if volume level increased This function returns 1 if volume level reached maximum value