volume  2.0.0.0
Modules | Functions
Volume Click Driver

API for configuring and manipulating Volume Click driver. More...

Modules

 Volume MikroBUS Map
 MikroBUS pin mapping of Volume Click driver.
 
 Zce_state
 
 Mute_state
 

Functions

void volume_cfg_setup (volume_cfg_t *cfg)
 Volume configuration object setup function. More...
 
err_t volume_init (volume_t *ctx, volume_cfg_t *cfg)
 Volume initialization function. More...
 
void volume_default_cfg (volume_t *ctx)
 Volume default configuration function. More...
 
void volume_power_up (volume_t *ctx)
 Power Up function. More...
 
void volume_hw_mute (volume_t *ctx, uint8_t mute_state)
 Hardware MUTE function. More...
 
void volume_zero_crossing (volume_t *ctx, uint8_t zce_state)
 Zero Crossing option function. More...
 
err_t volume_set_vol_gain (volume_t *ctx, float volume_left_dB, float volume_right_dB)
 Set volume gain function. More...
 

Detailed Description

API for configuring and manipulating Volume Click driver.

Function Documentation

◆ volume_cfg_setup()

void volume_cfg_setup ( volume_cfg_t cfg)

Volume configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ volume_default_cfg()

void volume_default_cfg ( volume_t ctx)

Volume default configuration function.

This function executes a default configuration of Volume click board.

Parameters
[in]ctx: Click context object. See volume_t object definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ volume_hw_mute()

void volume_hw_mute ( volume_t ctx,
uint8_t  mute_state 
)

Hardware MUTE function.

This function performs hardware mute by setting the state of SEN pin.

Parameters
ctxClick object.
[in]mute_state:
  • 0x00 ( VOLUME_MUTE_ENABLE ) - Sets SEN pin low, thus enabling the mute option,
  • 0x01 ( VOLUME_MUTE_DISABLE ) - Sets SEN pin high, thus disabling the mute option.
Note
None.

◆ volume_init()

err_t volume_init ( volume_t ctx,
volume_cfg_t cfg 
)

Volume initialization function.

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

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

◆ volume_power_up()

void volume_power_up ( volume_t ctx)

Power Up function.

This function should be called upon initial power-up sequence. This sequence sets the serial shift register and the volume control register to zero and performs an offset calibration.

Parameters
ctxClick object.
Note
None.

◆ volume_set_vol_gain()

err_t volume_set_vol_gain ( volume_t ctx,
float  volume_left_dB,
float  volume_right_dB 
)

Set volume gain function.

This function sets a desired gain volume of left and right channel speaker.

Parameters
[in]ctx: Click context object.
[in]volume_left: Gain in [dB] on the left channel ranging from -96.0 to +31.5.
[in]volume_right: Gain in [dB] on the right channel ranging from -96.0 to +31.5.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
The step of the gain is 0.5 [dB], hence the values between will be rounded by the compiler.

◆ volume_zero_crossing()

void volume_zero_crossing ( volume_t ctx,
uint8_t  zce_state 
)

Zero Crossing option function.

This function enables the zero crossing option by setting the state of ZCE pin.

Parameters
ctxClick object.
[in]zce_state:
  • 0x00 ( VOLUME_ZCE_DISABLE ) - Sets ZCE pin low, thus disabling the zero crossing option,
  • 0x01 ( VOLUME_ZCE_ENABLE ) - Sets ZCE pin high, thus enabling the zero crossing option.
Note
None.