amfm2 2.1.0.0
amfm2.h File Reference

This file contains API for AM/FM 2 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  amfm2_t
 AM/FM 2 Click context object. More...
 
struct  amfm2_cfg_t
 AM/FM 2 Click configuration object. More...
 
struct  amfm2_device_info_t
 AM/FM 2 Click device information object. More...
 

Macros

#define AMFM2_CMD_POWER_UP   0x01
 AM/FM 2 description command.
 
#define AMFM2_CMD_GET_REV   0x10
 
#define AMFM2_CMD_POWER_DOWN   0x11
 
#define AMFM2_CMD_SET_PROPERTY   0x12
 
#define AMFM2_CMD_GET_PROPERTY   0x13
 
#define AMFM2_CMD_GET_INT_STATUS   0x14
 
#define AMFM2_CMD_PATCH_ARGS   0x15
 
#define AMFM2_CMD_PATCH_DATA   0x16
 
#define AMFM2_CMD_TX_TUNE_FREQ   0x30
 
#define AMFM2_CMD_TX_TUNE_POWER   0x31
 
#define AMFM2_CMD_TX_TUNE_MEASURE   0x32
 
#define AMFM2_CMD_TX_TUNE_STATUS   0x33
 
#define AMFM2_CMD_TX_ASQ_STATUS   0x34
 
#define AMFM2_CMD_TX_RDS_BUFF   0x35
 
#define AMFM2_CMD_TX_TX_RDS_PS   0x36
 
#define AMFM2_CMD_GPIO_CTL   0x80
 
#define AMFM2_CMD_GPIO_SET   0x81
 
#define AMFM2_CMD_AM_TUNE_FREQ   0x40
 AM/FM 2 description AM/LW/SW Receiver commands.
 
#define AMFM2_CMD_AM_SEEK_START   0x41
 
#define AMFM2_CMD_AM_TUNE_STATUS   0x42
 
#define AMFM2_CMD_AM_RSQ_STATUS   0x43
 
#define AMFM2_CMD_AM_AGC_STATUS   0x47
 
#define AMFM2_CMD_AM_AGC_OVERRIDE   0x48
 
#define AMFM2_CMD_FM_TUNE_FREQ   0x20
 AM/FM 2 description FM/RDS Receiver commands.
 
#define AMFM2_CMD_FM_SEEK_START   0x21
 
#define AMFM2_CMD_FM_TUNE_STATUS   0x22
 
#define AMFM2_CMD_FM_RSQ_STATUS   0x23
 
#define AMFM2_CMD_FM_RDS_STATUS   0x24
 
#define AMFM2_CMD_FM_AGC_STATUS   0x27
 
#define AMFM2_CMD_FM_AGC_OVERRIDE   0x28
 
#define AMFM2_RSP_STATUS_CTS   0x80
 AM/FM 2 description respond status.
 
#define AMFM2_RSP_STATUS_ERROR   0x40
 
#define AMFM2_RSP_STATUS_RDSINT   0x04
 
#define AMFM2_RSP_STATUS_ASQINT   0x02
 
#define AMFM2_RSP_STATUS_STCINT   0x01
 
#define AMFM2_PWRUP_ARG_CTSIEN   0x80
 AM/FM 2 description arguments data value.
 
#define AMFM2_PWRUP_ARG_GPO2OEN   0x40
 
#define AMFM2_PWRUP_ARG_PATCH   0x20
 
#define AMFM2_PWRUP_ARG_XOSCEN   0x10
 
#define AMFM2_PWRUP_ARG_FUNC_FMRECEIVE   0x00
 
#define AMFM2_PWRUP_ARG_FUNC_QUERYLIBID   0x0F
 
#define AMFM2_PWRUP_ARG_OPMODE_ANALOGOUT   0x05
 
#define AMFM2_PWRUP_ARG_OPMODE_DIGITALOUT   0x0B
 
#define AMFM2_PWRUP_ARG_OPMODE_DIGITALOUTS   0xB0
 
#define AMFM2_FMTUNEFREQ_ARG_FREEZE   0x02
 
#define AMFM2_FMTUNEFREQ_ARG_FAST   0x01
 
#define AMFM2_FMSEEKSTART_ARG_SEEKUP   0x08
 
#define AMFM2_FMSEEKSTART_ARG_WRAP   0x04
 
#define AMFM2_FMTUNESTATUS_ARG_CANCEL   0x02
 
#define AMFM2_FMTUNESTATUS_ARG_INTACK   0x01
 
#define AMFM2_FMRSQSTATUS_ARG_INTACK   0x01
 
#define AMFM2_FMRDSSTATUS_ARG_STATUSONLY   0x04
 
#define AMFM2_FMRDSSTATUS_ARG_MTFIFO   0x02
 
#define AMFM2_FMRDSSTATUS_ARG_INTACK   0x01
 
#define AMFM2_FMAGCOVERRIDE_ARG_RFAGCDIS   0x01
 
#define AMFM2_GPIOCTL_ARG_GPO3OEN   0x08
 
#define AMFM2_GPIOCTL_ARG_GPO2OEN   0x04
 
#define AMFM2_GPIOCTL_ARG_GPO1OEN   0x02
 
#define AMFM2_GPIOSET_ARG_GPO3LEVEL   0x08
 
#define AMFM2_GPIOSET_ARG_GPO2LEVEL   0x04
 
#define AMFM2_GPIOSET_ARG_GPO1LEVEL   0x02
 
#define AMFM2_SET_VOLUME_MUTE   0
 AM/FM 2 description volume data value.
 
#define AMFM2_SET_VOLUME_MAX   63
 
#define AMFM2_PROP_GPOIEN_H   0x00
 AM/FM 2 description properties AMFM data value.
 
#define AMFM2_PROP_GPOIEN_L   0x01
 
#define AMFM2_PROP_DIGITALOUTFORMAT_H   0x01
 
#define AMFM2_PROP_DIGITALOUTFORMAT_L   0x02
 
#define AMFM2_PROP_DIGITALOUTSAMPLERATE_H   0x01
 
#define AMFM2_PROP_DIGITALOUTSAMPLERATE_L   0x04
 
#define AMFM2_PROP_REFCLKFREQ_H   0x02
 
#define AMFM2_PROP_REFCLKFREQ_L   0x01
 
#define AMFM2_PROP_REFCLKPRESCALE_H   0x02
 
#define AMFM2_PROP_REFCLKPRESCALE_L   0x02
 
#define AMFM2_PROP_RXVOLUME_H   0x40
 
#define AMFM2_PROP_RXVOLUME_L   0x00
 
#define AMFM2_PROP_RXHMUTE_H   0x40
 
#define AMFM2_PROP_RXHMUTE_L   0x01
 
#define AMFM2_PROP_FMDEEMPHASIS_H   0x11
 AM/FM 2 description properties AM data value.
 
#define AMFM2_PROP_FMDEEMPHASIS_L   0x00
 
#define AMFM2_PROP_AMDEEMPHASIS_H   0x31
 
#define AMFM2_PROP_AMDEEMPHASIS_L   0x00
 
#define AMFM2_PROP_FMCHANFILTER_H   0x11
 
#define AMFM2_PROP_FMCHANFILTER_L   0x02
 
#define AMFM2_PROP_AMCHANFILTER_H   0x31
 
#define AMFM2_PROP_AMCHANFILTER_L   0x02
 
#define AMFM2_PROP_AMRSQINTS_H   0x32
 
#define AMFM2_PROP_AMRSQINTS_L   0x00
 
#define AMFM2_PROP_AMNBRATE_H   0x39
 
#define AMFM2_PROP_AMNBRATE_L   0x02
 
#define AMFM2_PROP_AMNBIIRFILTER_H   0x39
 
#define AMFM2_PROP_AMNBIIRFILTER_L   0x03
 
#define AMFM2_PROP_AMNBDELAY_H   0x39
 
#define AMFM2_PROP_AMNBDELAY_L   0x04
 
#define AMFM2_PROP_FMBLENDSTEREOTHS_H   0x11
 AM/FM 2 description properties FM data value.
 
#define AMFM2_PROP_FMBLENDSTEREOTHS_L   0x05
 
#define AMFM2_PROP_FMBLENDMONOTHS_H   0x11
 
#define AMFM2_PROP_FMBLENDMONOTHS_L   0x06
 
#define AMFM2_PROP_FMNBDETECTTHS_H   0x19
 
#define AMFM2_PROP_FMNBDETECTTHS_L   0x00
 
#define AMFM2_PROP_FMNBINTERVAL_H   0x19
 
#define AMFM2_PROP_FMNBINTERVAL_L   0x01
 
#define AMFM2_PROP_FMNBRATE_H   0x19
 
#define AMFM2_PROP_FMNBRATE_L   0x02
 
#define AMFM2_PROP_FMNBIIRFILTER_H   0x19
 
#define AMFM2_PROP_FMNBIIRFILTER_L   0x03
 
#define AMFM2_PROP_FMNBDELAY_H   0x19
 
#define AMFM2_PROP_FMNBDELAY_L   0x04
 
#define AMFM2_PROPVALH_RSQREP   0x08
 AM/FM 2 description properties data value.
 
#define AMFM2_PROPVALH_RDSREP   0x04
 
#define AMFM2_PROPVALH_STCREP   0x01
 
#define AMFM2_PROPVALL_CTSIEN   0x80
 
#define AMFM2_PROPVALL_ERRIEN   0x40
 
#define AMFM2_PROPVALL_RSQIEN   0x08
 
#define AMFM2_PROPVALL_RDSIEN   0x04
 
#define AMFM2_PROPVALL_STCIEN   0x01
 
#define AMFM2_PROPVALL_OFALL   0x80
 
#define AMFM2_PROPVALL_LMUTE   0x02
 
#define AMFM2_PROPVALL_RMUTE   0x01
 
#define AMFM2_DEVICE_ADDRESS_GND   0x11
 AM/FM 2 device address setting.
 
#define AMFM2_DEVICE_ADDRESS_VCC   0x63
 
#define AMFM2_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  amfm2_return_value_t { AMFM2_OK = 0 , AMFM2_ERROR = -1 }
 AM/FM 2 Click return value data. More...
 

Functions

void amfm2_cfg_setup (amfm2_cfg_t *cfg)
 AM/FM 2 configuration object setup function.
 
err_t amfm2_init (amfm2_t *ctx, amfm2_cfg_t *cfg)
 AM/FM 2 initialization function.
 
err_t amfm2_default_cfg (amfm2_t *ctx)
 AM/FM 2 default configuration function.
 
err_t amfm2_write_data (amfm2_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 AM/FM 2 I2C writing function.
 
err_t amfm2_generic_read (amfm2_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 AM/FM 2 I2C reading function.
 
void amfm2_hw_reset (amfm2_t *ctx)
 AM/FM 2 hardware reset function.
 
void amfm2_headphone_amp_enable (amfm2_t *ctx)
 AM/FM 2 enable headphone amp function.
 
void amfm2_headphone_amp_disable (amfm2_t *ctx)
 AM/FM 2 disable headphone amp function.
 
uint8_t amfm2_get_gp1 (amfm2_t *ctx)
 AM/FM 2 get state of GP1 pin function.
 
uint8_t amfm2_get_gp2 (amfm2_t *ctx)
 AM/FM 2 get state of GP2 pin function.
 
void amfm2_set_rst (amfm2_t *ctx, uint8_t pin_state)
 AM/FM 2 set state of RST pin function.
 
err_t amfm2_wait_rsp (amfm2_t *ctx)
 AM/FM 2 wait response function.
 
err_t amfm2_set_command (amfm2_t *ctx, uint8_t cmd, uint8_t *arg, uint8_t arg_len, uint8_t *rsp, uint8_t rsp_len)
 AM/FM 2 set command function.
 
err_t amfm2_get_response (amfm2_t *ctx, uint8_t *rsp, uint8_t rsp_len)
 AM/FM 2 get response function.
 
err_t amfm2_get_rev (amfm2_t *ctx, amfm2_device_info_t *rev)
 AM/FM 2 get revision information function.
 
err_t amfm2_seek_station (amfm2_t *ctx, uint8_t *rsp)
 AM/FM 2 seek station function.
 
err_t amfm2_set_volume (amfm2_t *ctx, uint8_t volume, uint8_t *rsp)
 AM/FM 2 set volume function.
 
err_t amfm2_sound_off (amfm2_t *ctx, uint8_t *rsp)
 AM/FM 2 sound off function.
 
err_t amfm2_sound_on (amfm2_t *ctx, uint8_t *rsp)
 AM/FM 2 sound on function.
 
err_t amfm2_tuning_freq_up (amfm2_t *ctx, uint8_t *rsp)
 AM/FM 2 tuning frequency up function.
 
err_t amfm2_tuning_freq_down (amfm2_t *ctx, uint8_t *rsp)
 AM/FM 2 tuning frequency down function.
 
err_t amfm2_tuning_freq (amfm2_t *ctx, float frequency, uint8_t *rsp)
 AM/FM 2 tuning frequency function.
 
err_t amfm2_get_tuning_freq (amfm2_t *ctx, float *frequency)
 AM/FM 2 get tuning frequency function.
 
err_t amfm2_check_clear_to_send (amfm2_t *ctx)
 AM/FM 2 check CTS function.
 
err_t amfm2_check_seek_tune_complete (amfm2_t *ctx)
 AM/FM 2 check CTS function.
 
err_t amfm2_check_status_error (amfm2_t *ctx)
 AM/FM 2 check status error function.
 
err_t amfm2_check_rds_interrupt (amfm2_t *ctx)
 AM/FM 2 check RDS interrupt function.
 

Detailed Description

This file contains API for AM/FM 2 Click Driver.

Enumeration Type Documentation

◆ amfm2_return_value_t

AM/FM 2 Click return value data.

Predefined enum values for driver return values.

Enumerator
AMFM2_OK 
AMFM2_ERROR