amfm2 2.1.0.0
AM/FM 2 Click Driver

API for configuring and manipulating AM/FM 2 Click driver. More...

Topics

 AM/FM 2 Registers List
 List of registers of AM/FM 2 Click driver.
 
 AM/FM 2 Registers Settings
 Settings for registers of AM/FM 2 Click driver.
 
 AM/FM 2 MikroBUS Map
 MikroBUS pin mapping of AM/FM 2 Click driver.
 
 Amfm2_cmd
 

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

API for configuring and manipulating AM/FM 2 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ amfm2_cfg_setup()

void amfm2_cfg_setup ( amfm2_cfg_t * cfg)

AM/FM 2 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See amfm2_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ amfm2_check_clear_to_send()

err_t amfm2_check_clear_to_send ( amfm2_t * ctx)

AM/FM 2 check CTS function.

his function checks the status of the clear to send of the Si4732-A10, Broadcast AM/FM/SW/LW/RDS Radio Receiver on the AM/FM 2 Click board™.

Parameters
[in]ctx: Click context object. See amfm2_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ amfm2_check_rds_interrupt()

err_t amfm2_check_rds_interrupt ( amfm2_t * ctx)

AM/FM 2 check RDS interrupt function.

This function checks the status of the RDS interrupt of the Si4732-A10, Broadcast AM/FM/SW/LW/RDS Radio Receiver on the AM/FM 2 Click board™.

Parameters
[in]ctx: Click context object. See amfm2_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ amfm2_check_seek_tune_complete()

err_t amfm2_check_seek_tune_complete ( amfm2_t * ctx)

AM/FM 2 check CTS function.

This function checks the status of the clear to send of the Si4732-A10, Broadcast AM/FM/SW/LW/RDS Radio Receiver on the AM/FM 2 Click board™.

Parameters
[in]ctx: Click context object. See amfm2_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ amfm2_check_status_error()

err_t amfm2_check_status_error ( amfm2_t * ctx)

AM/FM 2 check status error function.

This function checks the status of the error of the Si4732-A10, Broadcast AM/FM/SW/LW/RDS Radio Receiver on the AM/FM 2 Click board™.

Parameters
[in]ctx: Click context object. See amfm2_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ amfm2_default_cfg()

err_t amfm2_default_cfg ( amfm2_t * ctx)

AM/FM 2 default configuration function.

This function executes a default configuration of AM/FM 2 click board.

Parameters
[in]ctx: Click context object. See amfm2_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ amfm2_generic_read()

err_t amfm2_generic_read ( amfm2_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

AM/FM 2 I2C reading function.

This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See amfm2_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ amfm2_get_gp1()

uint8_t amfm2_get_gp1 ( amfm2_t * ctx)

AM/FM 2 get state of GP1 pin function.

This function gets states of the GP1 ( PWM ) pin of the Si4732-A10, Broadcast AM/FM/SW/LW/RDS Radio Receiver on the AM/FM 2 Click board™.

Parameters
[in]ctx: Click context object. See amfm2_t object definition for detailed explanation.
Returns
  • 0 - Low pin state,
  • 1 - High pin state.
Note
None.

◆ amfm2_get_gp2()

uint8_t amfm2_get_gp2 ( amfm2_t * ctx)

AM/FM 2 get state of GP2 pin function.

This function gets states of the GP2 ( INT ) pin of the Si4732-A10, Broadcast AM/FM/SW/LW/RDS Radio Receiver on the AM/FM 2 Click board™.

Parameters
[in]ctx: Click context object. See amfm2_t object definition for detailed explanation.
Returns
  • 0 - Low pin state,
  • 1 - High pin state.
Note
None.

◆ amfm2_get_response()

err_t amfm2_get_response ( amfm2_t * ctx,
uint8_t * rsp,
uint8_t rsp_len )

AM/FM 2 get response function.

This function set the desired command and accompanying arguments of the Si4732-A10, Broadcast AM/FM/SW/LW/RDS Radio Receiver on the AM/FM 2 Click board™.

Parameters
[in]ctx: Click context object. See amfm2_t object definition for detailed explanation.
[out]rsp: Response.
[in]rsp_len: Number of bytes of response.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ amfm2_get_rev()

err_t amfm2_get_rev ( amfm2_t * ctx,
amfm2_device_info_t * rev )

AM/FM 2 get revision information function.

This function reads the revision information of the Si4732-A10, Broadcast AM/FM/SW/LW/RDS Radio Receiver on the AM/FM 2 Click board™.

Parameters
[in]ctx: Click context object. See amfm2_t object definition for detailed explanation.
[out]rev: Revision information object. See amfm2_device_info_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ amfm2_get_tuning_freq()

err_t amfm2_get_tuning_freq ( amfm2_t * ctx,
float * frequency )

AM/FM 2 get tuning frequency function.

This function gets the FM tuning frequency of the Si4732-A10, Broadcast AM/FM/SW/LW/RDS Radio Receiver on the AM/FM 2 Click board™.

Parameters
[in]ctx: Click context object. See amfm2_t object definition for detailed explanation.
[out]frequency: Radio frequency [MHz].
[out]rsp: Response.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ amfm2_headphone_amp_disable()

void amfm2_headphone_amp_disable ( amfm2_t * ctx)

AM/FM 2 disable headphone amp function.

This function disables the headphone amplifier of the LM4910, Output Capacitor-less Stereo 35mW Headphone Amplifier on the AM/FM 2 Click board™.

Parameters
[in]ctx: Click context object. See amfm2_t object definition for detailed explanation.
Returns
Nothing.
Note
None.

◆ amfm2_headphone_amp_enable()

void amfm2_headphone_amp_enable ( amfm2_t * ctx)

AM/FM 2 enable headphone amp function.

This function enable the headphone amplifier of the LM4910, Output Capacitor-less Stereo 35mW Headphone Amplifier on the AM/FM 2 Click board™.

Parameters
[in]ctx: Click context object. See amfm2_t object definition for detailed explanation.
Returns
Nothing.
Note
None.

◆ amfm2_hw_reset()

void amfm2_hw_reset ( amfm2_t * ctx)

AM/FM 2 hardware reset function.

This function perform a hardware reset of the Si4732-A10, Broadcast AM/FM/SW/LW/RDS Radio Receiver on the AM/FM 2 Click board™.

Parameters
[in]ctx: Click context object. See amfm2_t object definition for detailed explanation.
Returns
Nothing.
Note
None.

◆ amfm2_init()

err_t amfm2_init ( amfm2_t * ctx,
amfm2_cfg_t * cfg )

AM/FM 2 initialization function.

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

Parameters
[out]ctx: Click context object. See amfm2_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See amfm2_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ amfm2_seek_station()

err_t amfm2_seek_station ( amfm2_t * ctx,
uint8_t * rsp )

AM/FM 2 seek station function.

This function searching for a valid radio frequency of the Si4732-A10, Broadcast AM/FM/SW/LW/RDS Radio Receiver on the AM/FM 2 Click board™.

Parameters
[in]ctx: Click context object. See amfm2_t object definition for detailed explanation.
[out]rsp: Response.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ amfm2_set_command()

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.

This function set the desired command and accompanying arguments of the Si4732-A10, Broadcast AM/FM/SW/LW/RDS Radio Receiver on the AM/FM 2 Click board™.

Parameters
[in]ctx: Click context object. See amfm2_t object definition for detailed explanation.
[in]cmd: Desired command.
[in]arg: Desired argument.
[in]arg_len: Number of bytes of argument.
[out]rsp: Response.
[in]rsp_len: Number of bytes of response.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ amfm2_set_rst()

void amfm2_set_rst ( amfm2_t * ctx,
uint8_t pin_state )

AM/FM 2 set state of RST pin function.

This function sets states of the RST pin of the Si4732-A10, Broadcast AM/FM/SW/LW/RDS Radio Receiver on the AM/FM 2 Click board™.

Parameters
[in]ctx: Click context object. See amfm2_t object definition for detailed explanation.
[in]pin_state: RST pin state.
Returns
Nothing.
Note
None.

◆ amfm2_set_volume()

err_t amfm2_set_volume ( amfm2_t * ctx,
uint8_t volume,
uint8_t * rsp )

AM/FM 2 set volume function.

This function sets the desired volume of the Si4732-A10, Broadcast AM/FM/SW/LW/RDS Radio Receiver on the AM/FM 2 Click board™.

Parameters
[in]ctx: Click context object. See amfm2_t object definition for detailed explanation.
[out]volume: Volume [0-63].
[out]rsp: Response.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ amfm2_sound_off()

err_t amfm2_sound_off ( amfm2_t * ctx,
uint8_t * rsp )

AM/FM 2 sound off function.

This function turns off the sound of the Si4732-A10, Broadcast AM/FM/SW/LW/RDS Radio Receiver on the AM/FM 2 Click board™.

Parameters
[in]ctx: Click context object. See amfm2_t object definition for detailed explanation.
[out]rsp: Response.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ amfm2_sound_on()

err_t amfm2_sound_on ( amfm2_t * ctx,
uint8_t * rsp )

AM/FM 2 sound on function.

This function turns on the sound of the Si4732-A10, Broadcast AM/FM/SW/LW/RDS Radio Receiver on the AM/FM 2 Click board™.

Parameters
[in]ctx: Click context object. See amfm2_t object definition for detailed explanation.
[out]rsp: Response.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ amfm2_tuning_freq()

err_t amfm2_tuning_freq ( amfm2_t * ctx,
float frequency,
uint8_t * rsp )

AM/FM 2 tuning frequency function.

This function selects the FM tuning frequency of the Si4732-A10, Broadcast AM/FM/SW/LW/RDS Radio Receiver on the AM/FM 2 Click board™.

Parameters
[in]ctx: Click context object. See amfm2_t object definition for detailed explanation.
[in]frequency: Desired radio frequency [64MHz–108MHz].
[out]rsp: Response.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ amfm2_tuning_freq_down()

err_t amfm2_tuning_freq_down ( amfm2_t * ctx,
uint8_t * rsp )

AM/FM 2 tuning frequency down function.

This function queries about the status of previous and selects the FM tuning frequency down of the Si4732-A10, Broadcast AM/FM/SW/LW/RDS Radio Receiver on the AM/FM 2 Click board™.

Parameters
[in]ctx: Click context object. See amfm2_t object definition for detailed explanation.
[out]rsp: Response.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ amfm2_tuning_freq_up()

err_t amfm2_tuning_freq_up ( amfm2_t * ctx,
uint8_t * rsp )

AM/FM 2 tuning frequency up function.

This function queries about the status of previous and selects the FM tuning frequency up of the Si4732-A10, Broadcast AM/FM/SW/LW/RDS Radio Receiver on the AM/FM 2 Click board™.

Parameters
[in]ctx: Click context object. See amfm2_t object definition for detailed explanation.
[out]rsp: Response.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ amfm2_wait_rsp()

err_t amfm2_wait_rsp ( amfm2_t * ctx)

AM/FM 2 wait response function.

This function wait for an response of the Si4732-A10, Broadcast AM/FM/SW/LW/RDS Radio Receiver on the AM/FM 2 Click board™.

Parameters
[in]ctx: Click context object. See amfm2_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ amfm2_write_data()

err_t amfm2_write_data ( amfm2_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

AM/FM 2 I2C writing function.

This function writes a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See amfm2_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.