audiodac 2.1.0.0
Audio DAC Click Driver

API for configuring and manipulating Audio DAC Click driver. More...

Topics

 Audio DAC Registers List
 List of registers of Audio DAC Click driver.
 
 Audio DAC Registers Settings
 Settings for registers of Audio DAC Click driver.
 
 Audio DAC MikroBUS Map
 MikroBUS pin mapping of Audio DAC Click driver.
 

Functions

void audiodac_cfg_setup (audiodac_cfg_t *cfg)
 Audio DAC configuration object setup function.
 
err_t audiodac_init (audiodac_t *ctx, audiodac_cfg_t *cfg)
 Audio DAC initialization function.
 
err_t audiodac_default_cfg (audiodac_t *ctx)
 Audio DAC default configuration function.
 
err_t audiodac_generic_write (audiodac_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Audio DAC I2C writing function.
 
err_t audiodac_generic_read (audiodac_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Audio DAC I2C reading function.
 
err_t audiodac_write_register (audiodac_t *ctx, uint8_t reg, uint8_t data_in)
 Audio DAC write register function.
 
err_t audiodac_read_register (audiodac_t *ctx, uint8_t reg, uint8_t *data_out)
 Audio DAC read register function.
 
void audiodac_mute_output (audiodac_t *ctx)
 Audio DAC mute output function.
 
void audiodac_unmute_output (audiodac_t *ctx)
 Audio DAC unmute output function.
 
uint8_t audiodac_get_gpio4_pin (audiodac_t *ctx)
 Audio DAC get gpio4 pin function.
 
err_t audiodac_select_page (audiodac_t *ctx, uint8_t page_num)
 Audio DAC select page function.
 
err_t audiodac_volume_control (audiodac_t *ctx, uint8_t channel, uint8_t volume)
 Audio DAC volume control function.
 

Detailed Description

API for configuring and manipulating Audio DAC 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

◆ audiodac_cfg_setup()

void audiodac_cfg_setup ( audiodac_cfg_t * cfg)

Audio DAC configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ audiodac_default_cfg()

err_t audiodac_default_cfg ( audiodac_t * ctx)

Audio DAC default configuration function.

This function executes a default configuration of Audio DAC click board.

Parameters
[in]ctx: Click context object. See audiodac_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.

◆ audiodac_generic_read()

err_t audiodac_generic_read ( audiodac_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Audio DAC 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 audiodac_t object definition for detailed explanation.
[in]reg: Start register address, for address auto increment OR it with AUDIODAC_AUTO_INCREMENT_ENABLE.
[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.

◆ audiodac_generic_write()

err_t audiodac_generic_write ( audiodac_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Audio DAC 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 audiodac_t object definition for detailed explanation.
[in]reg: Start register address, for address auto increment OR it with AUDIODAC_AUTO_INCREMENT_ENABLE.
[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.

◆ audiodac_get_gpio4_pin()

uint8_t audiodac_get_gpio4_pin ( audiodac_t * ctx)

Audio DAC get gpio4 pin function.

This function returns the GPIO4 pin logic state. The GPIO4 pin is mapped to auto mute flag output for both L and R channels by default.

Parameters
[in]ctx: Click context object. See audiodac_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ audiodac_init()

err_t audiodac_init ( audiodac_t * ctx,
audiodac_cfg_t * cfg )

Audio DAC initialization function.

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

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

◆ audiodac_mute_output()

void audiodac_mute_output ( audiodac_t * ctx)

Audio DAC mute output function.

This function performs soft mute output by setting the XSMT pin to low logic state.

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

◆ audiodac_read_register()

err_t audiodac_read_register ( audiodac_t * ctx,
uint8_t reg,
uint8_t * data_out )

Audio DAC read register function.

This function reads data byte from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See audiodac_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Output read data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ audiodac_select_page()

err_t audiodac_select_page ( audiodac_t * ctx,
uint8_t page_num )

Audio DAC select page function.

This function selects the register page.

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

◆ audiodac_unmute_output()

void audiodac_unmute_output ( audiodac_t * ctx)

Audio DAC unmute output function.

This function performs soft un-mute output by setting the XSMT pin to high logic state.

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

◆ audiodac_volume_control()

err_t audiodac_volume_control ( audiodac_t * ctx,
uint8_t channel,
uint8_t volume )

Audio DAC volume control function.

This function sets the volume level for the selected output channel.

Parameters
[in]ctx: Click context object. See audiodac_t object definition for detailed explanation.
[in]channel:
  • 0 - Both left and right channels,
  • 1 - Left channel,
  • 2 - Right channel.
[in]volume: Volume level [0-100], 0 - MUTE, 100 - MAX volume.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ audiodac_write_register()

err_t audiodac_write_register ( audiodac_t * ctx,
uint8_t reg,
uint8_t data_in )

Audio DAC write register function.

This function writes a data byte to the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See audiodac_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.