HPM SDK
HPMicro Software Development Kit
hpm_sgtl5000.c File Reference
#include "hpm_sgtl5000.h"

Macros

#define HPM_SGTL5000_MCLK_TOLERANCE   (4U)
 

Functions

hpm_stat_t sgtl_init (sgtl_context_t *context, sgtl_config_t *config)
 sgtl5000 initialize function. More...
 
hpm_stat_t sgtl_deinit (sgtl_context_t *context)
 
void sgtl_set_master_mode (sgtl_context_t *context, bool master)
 Set sgtl5000 as master or slave. More...
 
hpm_stat_t sgtl_enable_module (sgtl_context_t *context, sgtl_module_t module)
 Enable expected devices. More...
 
hpm_stat_t sgtl_disable_module (sgtl_context_t *context, sgtl_module_t module)
 Disable expected devices. More...
 
hpm_stat_t sgtl_set_data_route (sgtl_context_t *context, sgtl_route_t route)
 Set audio data route in sgtl5000. More...
 
hpm_stat_t sgtl_set_protocol (sgtl_context_t *context, sgtl_protocol_t protocol)
 Set the audio transfer protocol. More...
 
hpm_stat_t sgtl_set_volume (sgtl_context_t *context, sgtl_module_t module, uint32_t volume)
 Set the volume of different modules in sgtl5000. More...
 
uint32_t sgtl_get_volume (sgtl_context_t *context, sgtl_module_t module)
 Get the volume of different modules in sgtl5000. More...
 
hpm_stat_t sgtl_set_mute (sgtl_context_t *context, sgtl_module_t module, bool mute)
 Mute/unmute modules in sgtl5000. More...
 
static bool sgtl_check_clock_tolerance (uint32_t source, uint32_t target)
 
hpm_stat_t sgtl_config_data_format (sgtl_context_t *context, uint32_t mclk, uint32_t sample_rate, uint32_t bits)
 Configure the data format of audio data. More...
 
hpm_stat_t sgtl_set_pay (sgtl_context_t *context, uint32_t playSource)
 
hpm_stat_t sgtl_set_record (sgtl_context_t *context, uint32_t recordSource)
 select SGTL codec record source. More...
 
hpm_stat_t sgtl_write_reg (sgtl_context_t *context, uint16_t reg, uint16_t val)
 Write register to sgtl using I2C. More...
 
hpm_stat_t sgtl_read_reg (sgtl_context_t *context, uint16_t reg, uint16_t *val)
 Read register from sgtl using I2C. More...
 
hpm_stat_t sgtl_modify_reg (sgtl_context_t *context, uint16_t reg, uint16_t clr_mask, uint16_t val)
 Modify some bits in the register using I2C. More...
 

Macro Definition Documentation

◆ HPM_SGTL5000_MCLK_TOLERANCE

#define HPM_SGTL5000_MCLK_TOLERANCE   (4U)

Function Documentation

◆ sgtl_check_clock_tolerance()

static bool sgtl_check_clock_tolerance ( uint32_t  source,
uint32_t  target 
)
static

◆ sgtl_deinit()

hpm_stat_t sgtl_deinit ( sgtl_context_t context)

◆ sgtl_set_pay()

hpm_stat_t sgtl_set_pay ( sgtl_context_t context,
uint32_t  playSource 
)