fm 2.0.0.0
fm.h File Reference

This file contains API for FM Click driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  fm_t
 Click ctx object definition. More...
 
struct  fm_cfg_t
 Click configuration structure definition. More...
 

Macros

#define FM_MAP_MIKROBUS(cfg, mikrobus)
 
#define FM_RETVAL   uint8_t
 
#define FM_OK   0x00
 
#define FM_INIT_ERROR   0xFF
 
#define DEFAULT_SLAVE_ADDRESS   0x10
 
#define FM_DEVICE_ID   0x000E
 
#define FM_CHIP_ID   0x000F
 
#define FM_POWER_CONFIGURATION   0x0000
 
#define FM_CHANNEL   0x0001
 
#define FM_SYSTEM_CONFIGURATION_1   0x0002
 
#define FM_SYSTEM_CONFIGURATION_2   0x0003
 
#define FM_SYSTEM_CONFIGURATION_3   0x0004
 
#define FM_TEST_1   0x0005
 
#define FM_TEST_2   0x0006
 
#define FM_BOOT_CONFIGURATION   0x0007
 
#define FM_STATUS_RSSI   0x0008
 
#define FM_READ_CHANNEL   0x0009
 
#define FM_RDS_A   0x000A
 
#define FM_RDS_B   0x000B
 
#define FM_RDS_C   0x000C
 
#define FM_RDS_D   0x000D
 
#define FM_SOFTMUTE_MASK   0x7FFF
 
#define FM_SOFTMUTE_ENABLE   0x0000
 
#define FM_SOFTMUTE_DISABLE   0x8000
 
#define FM_MUTE_MASK   0xBFFF
 
#define FM_MUTE_ENABLE   0x0000
 
#define FM_MUTE_DISABLE   0x4000
 
#define FM_STEREO_MASK   0xDFFF
 
#define FM_STEREO   0x0000
 
#define FM_FORCE_MONO   0x2000
 
#define FM_RDS_MODE_MASK   0xF7FF
 
#define FM_RDS_MODE_STANDARD   0x0000
 
#define FM_RDS_MODE_VERBOSE   0x0800
 
#define FM_SEEK_MODE_MASK   0xFBFF
 
#define FM_SEEK_MODE_WRAP   0x0000
 
#define FM_SEEK_MODE_STOP   0x0400
 
#define FM_SEEK_DIRECTION_MASK   0xFDFF
 
#define FM_SEEK_DIRECTION_DOWN   0x0000
 
#define FM_SEEK_DIRECTION_UP   0x0200
 
#define FM_SEEK_MASK   0xFEFF
 
#define FM_SEEK_DISABLE   0x0000
 
#define FM_SEEK_ENABLE   0x0100
 
#define FM_POWERUP_DISABLE_MASK   0xFFBF
 
#define FM_POWERUP_DISABLE_LOW   0x0000
 
#define FM_POWERUP_DISABLE_HIGH   0x0040
 
#define FM_POWERUP_ENABLE_MASK   0xFFFE
 
#define FM_POWERUP_ENABLE_LOW   0x0000
 
#define FM_POWERUP_ENABLE_HIGH   0x0001
 
#define FM_TUNE_MASK   0x7FFF
 
#define FM_TUNE_DISABLE   0x0000
 
#define FM_TUNE_ENABLE   0x8000
 
#define FM_RDS_INTERRUPT_MASK   0x7FFF
 
#define FM_RDS_INTERRUPT_DISABLE   0x0000
 
#define FM_RDS_INTERRUPT_ENABLE   0x8000
 
#define FM_SEEK_TUNE_COMPLETE_INTERRUPT_MASK   0xBFFF
 
#define FM_SEEK_TUNE_COMPLETE_INTERRUPT_DISABLE   0x0000
 
#define FM_SEEK_TUNE_COMPLETE_INTERRUPT_ENABLE   0x4000
 
#define FM_RDS_MASK   0xEFFF
 
#define FM_RDS_DISABLE   0x0000
 
#define FM_RDS_ENABLE   0x1000
 
#define FM_DE_EMPHASIS_MASK   0xF7FF
 
#define FM_DE_EMPHASIS_USA   0x0000
 
#define FM_DE_EMPHASIS_EUROPE_AUSTRALIA_JAPAN   0x0800
 
#define FM_AGC_MASK   0xFBFF
 
#define FM_AGC_ENABLE   0x0000
 
#define FM_AGC_DISABLE   0x0400
 
#define FM_STEREO_MONO_BLEND_LEVEL_MASK   0xFF3F
 
#define FM_STEREO_MONO_BLEND_LEVEL_31_49_RSSI   0x0000
 
#define FM_STEREO_MONO_BLEND_LEVEL_37_55_RSSI   0x0040
 
#define FM_STEREO_MONO_BLEND_LEVEL_19_37_RSSI   0x0080
 
#define FM_STEREO_MONO_BLEND_LEVEL_25_43_RSSI   0x00C0
 
#define FM_GPIO3_MASK   0xFFCF
 
#define FM_GPIO3_HIGH_IMPENDANCE   0x0000
 
#define FM_GPIO3_MONO_STEREO_INDICATOR   0x0001
 
#define FM_GPIO3_LOW   0x0002
 
#define FM_GPIO3_HIGH   0x0003
 
#define FM_GPIO2_MASK   0xFFF3
 
#define FM_GPIO2_HIGH_IMPEDANCE   0x0000
 
#define FM_GPIO2_STC_RDS_INTERRUPT   0x0004
 
#define FM_GPIO2_LOW   0x0008
 
#define FM_GPIO2_HIGH   0x000C
 
#define FM_GPIO1_MASK   0xFFFC
 
#define FM_GPIO1_HIGH_IMPEDANCE   0x0000
 
#define FM_GPIO1_RESERVED   0x0001
 
#define FM_GPIO1_LOW   0x0002
 
#define FM_GPIO1_HIGH   0x0003
 
#define FM_BAND_MASK   0xFF3F
 
#define FM_BAND_USA_EUROPE_87P5_108_MHZ   0x0000
 
#define FM_BAND_JAPAN_WIDE_76_108_MHZ   0x0040
 
#define FM_BAND_JAPAN_76_90_MHZ   0x0080
 
#define FM_BAND_RESERVED   0x00C0
 
#define FM_CHANNEL_SPACING_MASK   0xFFCF
 
#define FM_CHANNEL_SPACING_USA_AUSTRALIA_200_KHZ   0x0000
 
#define FM_CHANNEL_SPACING_EUROPE_JAPAN_100_KHZ   0x0010
 
#define FM_CHANNEL_SPACING_50_KHZ   0x0020
 
#define FM_SOFTMUTE_ATTACK_RECOVER_RATE_MASK   0x3FFF
 
#define FM_SOFTMUTE_ATTACK_RECOVER_RATE_FASTEST   0x0000
 
#define FM_SOFTMUTE_ATTACK_RECOVER_RATE_FAST   0x4000
 
#define FM_SOFTMUTE_ATTACK_RECOVER_RATE_SLOW   0x8000
 
#define FM_SOFTMUTE_ATTACK_RECOVER_RATE_SLOWEST   0xC000
 
#define FM_SOFTMUTE_ATTENUATION_MASK   0xCFFF
 
#define FM_SOFTMUTE_ATTENUATION_16_DB   0x0000
 
#define FM_SOFTMUTE_ATTENUATION_14_DB   0x1000
 
#define FM_SOFTMUTE_ATTENUATION_12_DB   0x2000
 
#define FM_SOFTMUTE_ATTENUATION_10_DB   0x3000
 
#define FM_EXTENDED_VOLUME_RANGE_MASK   0xFEFF
 
#define FM_EXTENDED_VOLUME_RANGE_DISABLED   0x0000
 
#define FM_EXTENDED_VOLUME_RANGE_ENABLED   0x0100
 
#define FM_CRYSTAL_OSCYLATOR_MASK   0x7FFF
 
#define FM_CRYSTAL_OSCYLATOR_DISABLE   0x0000
 
#define FM_CRYSTAL_OSCYLATOR_ENABLE   0x8000
 
#define FM_AUDIO_HIGH_Z_MASK   0xBFFF
 
#define FM_AUDIO_HIGH_Z_DISABLE   0x0000
 
#define FM_AUDIO_HIGH_Z_ENABLE   0x4000
 
#define FM_RDS_READY_MASK   0x8000
 
#define FM_SEEK_TUNE_COMPLETE_MASK   0x4000
 
#define FM_SEEK_FAIL_BAND_LIMIT_MASK   0x2000
 
#define FM_AFC_RAIL_MASK   0x1000
 
#define FM_RDS_SYNCHRONIZED_MASK   0x0800
 
#define FM_STEREO_MONO_INDICATOR_MASK   0x0100
 

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

This file contains API for FM Click driver.