CI130X SDK API手册  2.2.0
本手册用于描述CI130X SDK各个组件和驱动API
结构体 | 枚举 | 函数

CI130X芯片PDM驱动 更多...

结构体

struct  pdm_adc_config_t
 PDM ADC配置 更多...
 
struct  pdm_alc_config_t
 PDM ALC设置结构体类型 更多...
 
struct  pdm_alc_use_config_t
 PDM简易版ALC配置 更多...
 

枚举

enum  pdm_mode_t {
  PDM_MODE_MASTER = 3,
  PDM_MODE_SLAVE = 0
}
 PDM 主从模式设置 更多...
 
enum  pdm_frame_1_2len_t {
  PDM_FRAME_LEN_32BIT = 3,
  PDM_FRAME_LEN_24BIT = 2
}
 PDM数据窗口的宽度 更多...
 
enum  pdm_valid_word_len_t {
  PDM_VALID_LEN_32BIT = 3,
  PDM_VALID_LEN_24BIT = 2,
  PDM_VALID_LEN_20BIT = 1,
  PDM_VALID_LEN_16BIT = 0
}
 PDM有效数据宽度 更多...
 
enum  pdm_i2s_data_famat_t {
  PDM_I2S_DATA_FORMAT_PCM_MODE = 3,
  PDM_I2S_DATA_FORMAT_I2S_MODE = 2,
  PDM_I2S_DATA_FORMAT_LJ_MODE = 1,
  PDM_I2S_DATA_FORMAT_RJ_MODE = 0
}
 PDM数据格式 更多...
 
enum  pdm_input_mode_t {
  PDM_INPUT_MODE_DIFF = 1,
  PDM_INPUT_MODE_SINGGLE_ENDED = 2
}
 PDM MIC输入端查分或者单端模式设置 更多...
 
enum  pdm_mic_amplify_t {
  PDM_MIC_AMP_0dB = 0,
  PDM_MIC_AMP_6dB = 1,
  PDM_MIC_AMP_13dB = 2,
  PDM_MIC_AMP_20dB = 3
}
 PDM MIC增益配置 更多...
 
enum  pdm_samplerate_t {
  PDM_SAMPLERATE_96K = 0,
  PDM_SAMPLERATE_48K = 1,
  PDM_SAMPLERATE_44_1K = 2,
  PDM_SAMPLERATE_32K = 3,
  PDM_SAMPLERATE_24K = 4,
  PDM_SAMPLERATE_16K = 5,
  PDM_SAMPLERATE_12K = 6,
  PDM_SAMPLERATE_8K = 7
}
 PDM采样率设置 更多...
 
enum  pdm_alc_hold_time_t {
  PDM_ALC_HOLD_TIME_0MS = 0,
  PDM_ALC_HOLD_TIME_2MS = 1,
  PDM_ALC_HOLD_TIME_4MS = 2,
  PDM_ALC_HOLD_TIME_8MS = 3,
  PDM_ALC_HOLD_TIME_16MS = 4,
  PDM_ALC_HOLD_TIME_32MS = 5,
  PDM_ALC_HOLD_TIME_64MS = 6,
  PDM_ALC_HOLD_TIME_128MS = 7,
  PDM_ALC_HOLD_TIME_256MS = 8,
  PDM_ALC_HOLD_TIME_512MS = 9,
  PDM_ALC_HOLD_TIME_1024mS = 10
}
 PDM ALC hold time设置 更多...
 
enum  pdm_alc_decay_time_t {
  PDM_ALC_DECAY_TIME_500US = 0,
  PDM_ALC_DECAY_TIME_1MS = 1,
  PDM_ALC_DECAY_TIME_2MS = 2,
  PDM_ALC_DECAY_TIME_4MS = 3,
  PDM_ALC_DECAY_TIME_8MS = 4,
  PDM_ALC_DECAY_TIME_16MS = 5,
  PDM_ALC_DECAY_TIME_32MS = 6,
  PDM_ALC_DECAY_TIME_64MS = 7,
  PDM_ALC_DECAY_TIME_128MS = 8,
  PDM_ALC_DECAY_TIME_256MS = 9,
  PDM_ALC_DECAY_TIME_512MS = 10
}
 PDM ALC decay time配置 更多...
 
enum  pdm_alc_attack_time_t {
  PDM_ALC_ATTACK_TIME_125US = 0,
  PDM_ALC_ATTACK_TIME_250US = 1,
  PDM_ALC_ATTACK_TIME_500US = 2,
  PDM_ALC_ATTACK_TIME_1MS = 3,
  PDM_ALC_ATTACK_TIME_2MS = 4,
  PDM_ALC_ATTACK_TIME_4MS = 5,
  PDM_ALC_ATTACK_TIME_8MS = 6,
  PDM_ALC_ATTACK_TIME_16MS = 7,
  PDM_ALC_ATTACK_TIME_32MS = 8,
  PDM_ALC_ATTACK_TIME_64MS = 9,
  PDM_ALC_ATTACK_TIME_128MS = 10
}
 PDM ALC attack time设置 更多...
 
enum  pdm_noise_gate_threshold_t {
  PDM_NOISE_GATE_THRE_39dB = 0,
  PDM_NOISE_GATE_THRE_45dB = 1,
  PDM_NOISE_GATE_THRE_51dB = 2,
  PDM_NOISE_GATE_THRE_57dB = 3
}
 PDM ALC noise gate门限 更多...
 
enum  pdm_gate_t {
  PDM_GATE_ENABLE = 1,
  PDM_GATE_DISABLE = 0
}
 PDM全局开关 更多...
 
enum  pdm_alc_pga_max_gain_t {
  PDM_ALC_PGA_MAX_GAIN__13_5dB = 0,
  PDM_ALC_PGA_MAX_GAIN__7_5dB = 1,
  PDM_ALC_PGA_MAX_GAIN__1_5dB = 2,
  PDM_ALC_PGA_MAX_GAIN_4_5dB = 3,
  PDM_ALC_PGA_MAX_GAIN_10_5dB = 4,
  PDM_ALC_PGA_MAX_GAIN_16_5dB = 5,
  PDM_ALC_PGA_MAX_GAIN_22_5dB = 6,
  PDM_ALC_PGA_MAX_GAIN_28_5dB = 7
}
 PDM ALC 最大增益设置 更多...
 
enum  pdm_alc_pga_min_gain_t {
  PDM_ALC_PGA_MIN_GAIN__18dB = 0,
  PDM_ALC_PGA_MIN_GAIN__12dB = 1,
  PDM_ALC_PGA_MIN_GAIN__6dB = 2,
  PDM_ALC_PGA_MIN_GAIN_0dB = 3,
  PDM_ALC_PGA_MIN_GAIN_6dB = 4,
  PDM_ALC_PGA_MIN_GAIN_12dB = 5,
  PDM_ALC_PGA_MIN_GAIN_18dB = 6,
  PDM_ALC_PGA_MIN_GAIN_24dB = 7
}
 PDM ALC 最小增益设置 更多...
 
enum  pdm_alc_level_t {
  PDM_ALC_LEVEL_0dB = 0x7fff,
  PDM_ALC_LEVEL__0_5dB = 0x78d6,
  PDM_ALC_LEVEL__1dB = 0x7213,
  PDM_ALC_LEVEL__1_5dB = 0x6bb1,
  PDM_ALC_LEVEL__2dB = 0x65ab,
  PDM_ALC_LEVEL__2_5dB = 0x5ffb,
  PDM_ALC_LEVEL__3dB = 0x5a9d,
  PDM_ALC_LEVEL__3_5dB = 0x558b,
  PDM_ALC_LEVEL__4dB = 0x50c2,
  PDM_ALC_LEVEL__4_5dB = 0x4c3e,
  PDM_ALC_LEVEL__5dB = 0x47fa,
  PDM_ALC_LEVEL__5_5dB = 0x43f3,
  PDM_ALC_LEVEL__6dB = 0x4026,
  PDM_ALC_LEVEL__6_5dB = 0x3c8f,
  PDM_ALC_LEVEL__7dB = 0x392c,
  PDM_ALC_LEVEL__7_5dB = 0x35f9,
  PDM_ALC_LEVEL__8dB = 0x32f4,
  PDM_ALC_LEVEL__8_5dB = 0x301b,
  PDM_ALC_LEVEL__9dB = 0x2d6a,
  PDM_ALC_LEVEL__9_5dB = 0x2adf,
  PDM_ALC_LEVEL__10dB = 0x2879,
  PDM_ALC_LEVEL__10_5dB = 0x2636,
  PDM_ALC_LEVEL__11dB = 0x2412,
  PDM_ALC_LEVEL__11_5dB = 0x220e,
  PDM_ALC_LEVEL__12dB = 0x2026,
  PDM_ALC_LEVEL__12_5dB = 0x1e5a,
  PDM_ALC_LEVEL__13dB = 0x2026,
  PDM_ALC_LEVEL__13_5dB = 0x1b0d,
  PDM_ALC_LEVEL__14dB = 0x1989,
  PDM_ALC_LEVEL__14_5dB = 0x181c,
  PDM_ALC_LEVEL__15dB = 0x16c2,
  PDM_ALC_LEVEL__15_5dB = 0x157c,
  PDM_ALC_LEVEL__16dB = 0x1449,
  PDM_ALC_LEVEL__16_5dB = 0x1326,
  PDM_ALC_LEVEL__17dB = 0x1214,
  PDM_ALC_LEVEL__17_5dB = 0x1111,
  PDM_ALC_LEVEL__18dB = 0x101d,
  PDM_ALC_LEVEL__18_5dB = 0x0f36,
  PDM_ALC_LEVEL__19dB = 0x0e5c,
  PDM_ALC_LEVEL__19_5dB = 0x0d8e
}
 
enum  pdm_alc_cha_sel_t {
  PDM_ALC_CHA_R_ONLY = 0,
  PDM_ALC_CHA_L_ONLY,
  PDM_ALC_CHA_STEREO_ONLY,
  PDM_ALC_CHA_NONE
}
 PDM ALC通道选择 更多...
 
enum  pdm_cha_sel_t {
  PDM_LEFT_CHA = 0,
  PDM_RIGHT_CHA = 1
}
 inner CODEC通道设置 更多...
 

函数

void pdm_reset (void)
 当主频为168时,延时100us 更多...
 
void pdm_power_up (pdm_current_t current)
 PDM模块上电 更多...
 
void pdm_power_off (void)
 关闭PDM模块电源 更多...
 
void pdm_hightpass_config (pdm_gate_t gate, pdm_highpass_cut_off_t Hz)
 配置PDM模块的高通滤波器 更多...
 
void pdm_adc_enable (pdm_adc_config_t *ADC_Config)
 使能PDM中的ADC: 1.使用此函数之前先初始化PDM_ADC_Config_TypeDef结构体并填写参数; 2.ALCL_Gain和ALCR_Gain的上下限分别是28.5dB和-18dB,步长1.5。 更多...
 
void pdm_adc_disable (pdm_cha_sel_t cha, pdm_gate_t EN)
 关闭PDM中的ADC 更多...
 
void pdm_dac_enable (void)
 使能PDM中的DAC(-39 – 7 dB) 更多...
 
void pdm_dac_disable (pdm_cha_sel_t cha, pdm_gate_t EN)
 关闭DAC 更多...
 
void pdm_alc_disable (pdm_cha_sel_t cha, float ALC_Gain)
 
void pdm_adc_mode_set (pdm_mode_t mode, pdm_frame_1_2len_t frame_Len, pdm_valid_word_len_t word_len, pdm_i2s_data_famat_t data_fram)
 PDM作为ADC的模式选择 更多...
 
void pdm_dac_mode_set (pdm_mode_t mode, pdm_frame_1_2len_t frame_Len, pdm_valid_word_len_t word_len, pdm_i2s_data_famat_t data_fram)
 PDM作为DAC的模式选择 更多...
 
void pdm_dac_gain_set (int32_t l_gain, int32_t r_gain)
 配置PDM中的DAC增益,-39dB到7.5dB,步长1.5dB,真实为32档。 更多...
 
void pdm_left_alc_pro_mode_config (pdm_alc_config_t *ALC_Type)
 
void pdm_right_alc_pro_mode_config (pdm_alc_config_t *ALC_Type)
 
void pdm_left_alc_enable (pdm_gate_t gate, pdm_use_alc_control_pgagain_t is_alc_ctr_pga)
 
void pdm_right_alc_enable (pdm_gate_t gate, pdm_use_alc_control_pgagain_t is_alc_ctr_pga)
 
void pdm_noise_gate_set (pdm_cha_sel_t cha, pdm_noise_gate_threshold_t Threshold, pdm_gate_t gate)
 
void pdm_zero_cross_set (pdm_cha_sel_t cha, pdm_gate_t gate)
 
void pdm_87_5_fast_decrement_set (pdm_cha_sel_t cha, pdm_gate_t gate)
 
void pdm_alc_judge_sel (pdm_alc_judge_t judge)
 ALC判断的信号来自高通滤波器之前,还是之后 更多...
 
void pdm_pga_gain_config_via_reg27_28 (pdm_cha_sel_t cha, uint32_t gain)
 向PDM reg27 reg28寄存器写PGA的增益 更多...
 
pdm_mic_amplify_t pdm_get_mic_gain (pdm_cha_sel_t cha)
 获取PDM MIC增益的大小 更多...
 
void pdm_set_mic_gain (pdm_cha_sel_t cha, pdm_mic_amplify_t gain)
 向PDM MIC增益控制寄存器写值 更多...
 
void pdm_alc_left_config (pdm_alc_use_config_t *ALC_str)
 PDM ALC配置左通道 更多...
 
void pdm_alc_right_config (pdm_alc_use_config_t *ALC_str)
 PDM ALC配置左通道 更多...
 
void pdm_adc_dig_gain_set_left (uint8_t gain)
 
void pdm_adc_dig_gain_set_right (uint8_t gain)
 
void pdm_set_input_mode_left (pdm_input_mode_t mode)
 设置左通道的输入模式 更多...
 
void pdm_set_input_mode_right (pdm_input_mode_t mode)
 设置右通道的输入模式 更多...
 
void pdm_set_mic_gain_left (pdm_mic_amplify_t gain)
 设置左通道的MIC增益 更多...
 
void pdm_set_mic_gain_right (pdm_mic_amplify_t gain)
 设置右通道的MIC增益 更多...
 
uint8_t pdm_get_alc_gain_left (void)
 
uint8_t pdm_get_alc_gain_right (void)
 
void pdm_pga_gain_config_via_reg43_53 (pdm_cha_sel_t cha, uint32_t gain)
 
void pdm_pga_gain_config_via_reg43_53_db (pdm_cha_sel_t cha, float gain_db)
 
void pdm_pga_gain_config_via_reg27_28_db (pdm_cha_sel_t cha, float gain_db)
 
void pdm_hpout_mute (void)
 
void pdm_hpout_mute_disable (void)
 
void pdm_set_sample_rate (pdm_samplerate_t samplerate)
 
void pdm_left_mic_reinit (void)
 
void pdm_right_mic_reinit (void)
 

详细描述

CI130X芯片PDM驱动


结构体说明

◆ pdm_adc_config_t

struct pdm_adc_config_t

PDM ADC配置

成员变量
pdm_input_mode_t codec_adc_input_mode_l ADC L 输入模式选择
pdm_input_mode_t codec_adc_input_mode_r ADC R 输入模式选择
pdm_mic_amplify_t codec_adc_mic_amp_l MIC L 增益设置
pdm_mic_amplify_t codec_adc_mic_amp_r MIC R 增益设置
float pga_gain_l 不使能ALC的情况下,PGA L 的固定增益
float pga_gain_r 不使能ALC的情况下,PGA R 的固定增益

◆ pdm_alc_config_t

struct pdm_alc_config_t

PDM ALC设置结构体类型

成员变量
pdm_alc_mode_t alcmode ALC模式设置
pdm_alc_attack_time_t attacktime ALC attack time设置
pdm_alc_decay_time_t decaytime ALC decay time设置
pdm_alc_hold_time_t holdtime ALC hold time设置
pdm_alc_level_t max_level ALC max level设置
pdm_alc_pga_max_gain_t max_pga_gain ALC设置PGA的上限设置
pdm_alc_level_t min_level ALC min level设置
pdm_alc_pga_min_gain_t min_pga_gain ALC设置PGA的下限设置
float pga_gain 不使能ALC的情况下,PGA的增益设置
pdm_samplerate_t samplerate ALC采样率设置

◆ pdm_alc_use_config_t

struct pdm_alc_use_config_t

PDM简易版ALC配置

成员变量
pdm_gate_t alc_gate ALC开关
pdm_alc_pga_max_gain_t alc_maxgain ALC设置PGA增益上限设置
pdm_alc_pga_min_gain_t alc_mingain ALC设置PGA增益下限设置
pdm_alc_attack_time_t attack_time ALC attack time设置
pdm_alc_decay_time_t decay_time ALC decay time设置
uint16_t digt_gain 基本的数字增益
pdm_gate_t fast_decrece_87_5 过顶保护开关
pdm_alc_hold_time_t hold_time ALC hold time设置
pdm_alc_level_t max_level ALC max level设置
pdm_alc_level_t min_level ALC min level设置
pdm_gate_t noise_gate noise gate 开关
pdm_noise_gate_threshold_t noise_gate_threshold 噪声门限阈值
pdm_samplerate_t sample_rate ALC ALC的采样率设置
pdm_gate_t use_ci130x_alc 使用CI130X的ALC控制PDM还是使用其本身的ALC控制
pdm_gate_t zero_cross 过零检测开关

枚举类型说明

◆ pdm_alc_attack_time_t

PDM ALC attack time设置

枚举值
PDM_ALC_ATTACK_TIME_125US 

ALC attack time 125us

PDM_ALC_ATTACK_TIME_250US 

ALC attack time 250us

PDM_ALC_ATTACK_TIME_500US 

ALC attack time 500us

PDM_ALC_ATTACK_TIME_1MS 

ALC attack time 1ms

PDM_ALC_ATTACK_TIME_2MS 

ALC attack time 2ms

PDM_ALC_ATTACK_TIME_4MS 

ALC attack time 4ms

PDM_ALC_ATTACK_TIME_8MS 

ALC attack time 8ms

PDM_ALC_ATTACK_TIME_16MS 

ALC attack time 16ms

PDM_ALC_ATTACK_TIME_32MS 

ALC attack time 32ms

PDM_ALC_ATTACK_TIME_64MS 

ALC attack time 64ms

PDM_ALC_ATTACK_TIME_128MS 

ALC attack time 128ms

◆ pdm_alc_cha_sel_t

PDM ALC通道选择

枚举值
PDM_ALC_CHA_R_ONLY 

ALC左通道

PDM_ALC_CHA_L_ONLY 

ALC右通道

PDM_ALC_CHA_STEREO_ONLY 

ALC两个通道

PDM_ALC_CHA_NONE 

ALC关闭

◆ pdm_alc_decay_time_t

PDM ALC decay time配置

枚举值
PDM_ALC_DECAY_TIME_500US 

ALC decay time 500us

PDM_ALC_DECAY_TIME_1MS 

ALC decay time 1ms

PDM_ALC_DECAY_TIME_2MS 

ALC decay time 2ms

PDM_ALC_DECAY_TIME_4MS 

ALC decay time 4ms

PDM_ALC_DECAY_TIME_8MS 

ALC decay time 8ms

PDM_ALC_DECAY_TIME_16MS 

ALC decay time 16ms

PDM_ALC_DECAY_TIME_32MS 

ALC decay time 32ms

PDM_ALC_DECAY_TIME_64MS 

ALC decay time 64ms

PDM_ALC_DECAY_TIME_128MS 

ALC decay time 128ms

PDM_ALC_DECAY_TIME_256MS 

ALC decay time 256ms

PDM_ALC_DECAY_TIME_512MS 

ALC decay time 512ms

◆ pdm_alc_hold_time_t

PDM ALC hold time设置

枚举值
PDM_ALC_HOLD_TIME_0MS 

ALC hold time 0

PDM_ALC_HOLD_TIME_2MS 

ALC hold time 2ms

PDM_ALC_HOLD_TIME_4MS 

ALC hold time 4ms

PDM_ALC_HOLD_TIME_8MS 

ALC hold time 8ms

PDM_ALC_HOLD_TIME_16MS 

ALC hold time 16ms

PDM_ALC_HOLD_TIME_32MS 

ALC hold time 32ms

PDM_ALC_HOLD_TIME_64MS 

ALC hold time 64ms

PDM_ALC_HOLD_TIME_128MS 

ALC hold time 128ms

PDM_ALC_HOLD_TIME_256MS 

ALC hold time 256ms

PDM_ALC_HOLD_TIME_512MS 

ALC hold time 512ms

PDM_ALC_HOLD_TIME_1024mS 

ALC hold time 1024ms

◆ pdm_alc_level_t

枚举值
PDM_ALC_LEVEL_0dB 
PDM_ALC_LEVEL__0_5dB 
PDM_ALC_LEVEL__1dB 
PDM_ALC_LEVEL__1_5dB 
PDM_ALC_LEVEL__2dB 
PDM_ALC_LEVEL__2_5dB 
PDM_ALC_LEVEL__3dB 
PDM_ALC_LEVEL__3_5dB 
PDM_ALC_LEVEL__4dB 
PDM_ALC_LEVEL__4_5dB 
PDM_ALC_LEVEL__5dB 
PDM_ALC_LEVEL__5_5dB 
PDM_ALC_LEVEL__6dB 
PDM_ALC_LEVEL__6_5dB 
PDM_ALC_LEVEL__7dB 
PDM_ALC_LEVEL__7_5dB 
PDM_ALC_LEVEL__8dB 
PDM_ALC_LEVEL__8_5dB 
PDM_ALC_LEVEL__9dB 
PDM_ALC_LEVEL__9_5dB 
PDM_ALC_LEVEL__10dB 
PDM_ALC_LEVEL__10_5dB 
PDM_ALC_LEVEL__11dB 
PDM_ALC_LEVEL__11_5dB 
PDM_ALC_LEVEL__12dB 
PDM_ALC_LEVEL__12_5dB 
PDM_ALC_LEVEL__13dB 
PDM_ALC_LEVEL__13_5dB 
PDM_ALC_LEVEL__14dB 
PDM_ALC_LEVEL__14_5dB 
PDM_ALC_LEVEL__15dB 
PDM_ALC_LEVEL__15_5dB 
PDM_ALC_LEVEL__16dB 
PDM_ALC_LEVEL__16_5dB 
PDM_ALC_LEVEL__17dB 
PDM_ALC_LEVEL__17_5dB 
PDM_ALC_LEVEL__18dB 
PDM_ALC_LEVEL__18_5dB 
PDM_ALC_LEVEL__19dB 
PDM_ALC_LEVEL__19_5dB 

◆ pdm_alc_pga_max_gain_t

PDM ALC 最大增益设置

枚举值
PDM_ALC_PGA_MAX_GAIN__13_5dB 

ALC设置PGA的增益上限为-13.5dB

PDM_ALC_PGA_MAX_GAIN__7_5dB 

ALC设置PGA的增益上限为-7.5dB

PDM_ALC_PGA_MAX_GAIN__1_5dB 

ALC设置PGA的增益上限为-1.5dB

PDM_ALC_PGA_MAX_GAIN_4_5dB 

ALC设置PGA的增益上限为4.5dB

PDM_ALC_PGA_MAX_GAIN_10_5dB 

ALC设置PGA的增益上限为10.5dB

PDM_ALC_PGA_MAX_GAIN_16_5dB 

ALC设置PGA的增益上限为16.5dB

PDM_ALC_PGA_MAX_GAIN_22_5dB 

ALC设置PGA的增益上限为22.5dB

PDM_ALC_PGA_MAX_GAIN_28_5dB 

ALC设置PGA的增益上限为28.5dB

◆ pdm_alc_pga_min_gain_t

PDM ALC 最小增益设置

枚举值
PDM_ALC_PGA_MIN_GAIN__18dB 

ALC设置PGA的增益下限为-18dB

PDM_ALC_PGA_MIN_GAIN__12dB 

ALC设置PGA的增益下限为-12dB

PDM_ALC_PGA_MIN_GAIN__6dB 

ALC设置PGA的增益下限为-6dB

PDM_ALC_PGA_MIN_GAIN_0dB 

ALC设置PGA的增益下限为0dB

PDM_ALC_PGA_MIN_GAIN_6dB 

ALC设置PGA的增益下限为6dB

PDM_ALC_PGA_MIN_GAIN_12dB 

ALC设置PGA的增益下限为12dB

PDM_ALC_PGA_MIN_GAIN_18dB 

ALC设置PGA的增益下限为18dB

PDM_ALC_PGA_MIN_GAIN_24dB 

ALC设置PGA的增益下限为24dB

◆ pdm_cha_sel_t

inner CODEC通道设置

枚举值
PDM_LEFT_CHA 

CODEC ALC左通道

PDM_RIGHT_CHA 

CODEC ALC右通道

◆ pdm_frame_1_2len_t

PDM数据窗口的宽度

枚举值
PDM_FRAME_LEN_32BIT 

数据窗口宽度为32bit

PDM_FRAME_LEN_24BIT 

数据窗口宽度为24bit

◆ pdm_gate_t

PDM全局开关

枚举值
PDM_GATE_ENABLE 

打开PDM

PDM_GATE_DISABLE 

关闭PDM

◆ pdm_i2s_data_famat_t

PDM数据格式

枚举值
PDM_I2S_DATA_FORMAT_PCM_MODE 

inner codec的数据格式为PCM格式

PDM_I2S_DATA_FORMAT_I2S_MODE 

inner codec的数据格式为标准I2S格式

PDM_I2S_DATA_FORMAT_LJ_MODE 

inner codec的数据格式为左对齐格式,slave模式下不支持

PDM_I2S_DATA_FORMAT_RJ_MODE 

inner codec的数据格式为右对齐格式

◆ pdm_input_mode_t

PDM MIC输入端查分或者单端模式设置

枚举值
PDM_INPUT_MODE_DIFF 

输入为差分输入模式

PDM_INPUT_MODE_SINGGLE_ENDED 

输入为单端输入模式

◆ pdm_mic_amplify_t

PDM MIC增益配置

枚举值
PDM_MIC_AMP_0dB 

MIC增益为0dB

PDM_MIC_AMP_6dB 

MIC增益为6dB

PDM_MIC_AMP_13dB 

MIC增益为13dB

PDM_MIC_AMP_20dB 

MIC增益为20dB

◆ pdm_mode_t

PDM 主从模式设置

枚举值
PDM_MODE_MASTER 

PDM主模式

PDM_MODE_SLAVE 

PDM从模式

◆ pdm_noise_gate_threshold_t

PDM ALC noise gate门限

枚举值
PDM_NOISE_GATE_THRE_39dB 

ALC噪声门限39dB

PDM_NOISE_GATE_THRE_45dB 

ALC噪声门限45dB

PDM_NOISE_GATE_THRE_51dB 

ALC噪声门限51dB

PDM_NOISE_GATE_THRE_57dB 

ALC噪声门限57dB

◆ pdm_samplerate_t

PDM采样率设置

枚举值
PDM_SAMPLERATE_96K 

采样率为96K

PDM_SAMPLERATE_48K 

采样率为48K

PDM_SAMPLERATE_44_1K 

采样率为44.1K

PDM_SAMPLERATE_32K 

采样率为32K

PDM_SAMPLERATE_24K 

采样率为24K

PDM_SAMPLERATE_16K 

采样率为16K

PDM_SAMPLERATE_12K 

采样率为12K

PDM_SAMPLERATE_8K 

采样率为8K

◆ pdm_valid_word_len_t

PDM有效数据宽度

枚举值
PDM_VALID_LEN_32BIT 

有效数据宽度为32bit

PDM_VALID_LEN_24BIT 

有效数据宽度为24bit

PDM_VALID_LEN_20BIT 

有效数据宽度为20bit

PDM_VALID_LEN_16BIT 

有效数据宽度为16bit

函数说明

◆ pdm_87_5_fast_decrement_set()

void pdm_87_5_fast_decrement_set ( pdm_cha_sel_t  cha,
pdm_gate_t  gate 
)

◆ pdm_adc_dig_gain_set_left()

void pdm_adc_dig_gain_set_left ( uint8_t  gain)

◆ pdm_adc_dig_gain_set_right()

void pdm_adc_dig_gain_set_right ( uint8_t  gain)

◆ pdm_adc_disable()

void pdm_adc_disable ( pdm_cha_sel_t  cha,
pdm_gate_t  EN 
)

关闭PDM中的ADC

参数
cha左右通道、全部通道的选择;
EN选择是否关闭ADC

◆ pdm_adc_enable()

void pdm_adc_enable ( pdm_adc_config_t ADC_Config)

使能PDM中的ADC: 1.使用此函数之前先初始化PDM_ADC_Config_TypeDef结构体并填写参数; 2.ALCL_Gain和ALCR_Gain的上下限分别是28.5dB和-18dB,步长1.5。

参数
ADC_ConfigPDM_ADC_Config_TypeDef结构体指针

◆ pdm_adc_mode_set()

void pdm_adc_mode_set ( pdm_mode_t  mode,
pdm_frame_1_2len_t  frame_Len,
pdm_valid_word_len_t  word_len,
pdm_i2s_data_famat_t  data_fram 
)

PDM作为ADC的模式选择

参数
modeMaster模式或者Slave模式;
frame_Len数据宽度;
word_len有效数据长度;
data_fram数据格式

◆ pdm_alc_disable()

void pdm_alc_disable ( pdm_cha_sel_t  cha,
float  ALC_Gain 
)

◆ pdm_alc_judge_sel()

void pdm_alc_judge_sel ( pdm_alc_judge_t  judge)

ALC判断的信号来自高通滤波器之前,还是之后

参数
judge选择PDM的判断信号来自ALC之前还是之后

◆ pdm_alc_left_config()

void pdm_alc_left_config ( pdm_alc_use_config_t ALC_str)

PDM ALC配置左通道

参数
ALC_strpdm_alc_use_config_t类型结构体指针
ALC_cha需要开启的ALC通道配置

◆ pdm_alc_right_config()

void pdm_alc_right_config ( pdm_alc_use_config_t ALC_str)

PDM ALC配置左通道

参数
ALC_strpdm_alc_use_config_t类型结构体指针
ALC_cha需要开启的ALC通道配置

◆ pdm_dac_disable()

void pdm_dac_disable ( pdm_cha_sel_t  cha,
pdm_gate_t  EN 
)

关闭DAC

参数
cha声道选择
EN开关

◆ pdm_dac_enable()

void pdm_dac_enable ( void  )

使能PDM中的DAC(-39 – 7 dB)

参数
l_gainLeftADC中 HPDRV的增益,单位dB;
r_gainRightADC中 HPDRV的增益,单位dB。

◆ pdm_dac_gain_set()

void pdm_dac_gain_set ( int32_t  l_gain,
int32_t  r_gain 
)

配置PDM中的DAC增益,-39dB到7.5dB,步长1.5dB,真实为32档。

参数
l_gainLeftADC中 HPDRV的增益,0–100;
r_gainRightADC中 HPDRV的增益,0–100。

◆ pdm_dac_mode_set()

void pdm_dac_mode_set ( pdm_mode_t  mode,
pdm_frame_1_2len_t  frame_Len,
pdm_valid_word_len_t  word_len,
pdm_i2s_data_famat_t  data_fram 
)

PDM作为DAC的模式选择

参数
modeMaster模式或者Slave模式;
frame_Len数据宽度;
word_len有效数据长度;
data_fram数据格式

◆ pdm_get_alc_gain_left()

uint8_t pdm_get_alc_gain_left ( void  )

◆ pdm_get_alc_gain_right()

uint8_t pdm_get_alc_gain_right ( void  )

◆ pdm_get_mic_gain()

pdm_mic_amplify_t pdm_get_mic_gain ( pdm_cha_sel_t  cha)

获取PDM MIC增益的大小

参数
cha通道选择

◆ pdm_hightpass_config()

void pdm_hightpass_config ( pdm_gate_t  gate,
pdm_highpass_cut_off_t  Hz 
)

配置PDM模块的高通滤波器

参数
gate高通滤波器开关
Hz高通滤波器的截止频率

◆ pdm_hpout_mute()

void pdm_hpout_mute ( void  )

◆ pdm_hpout_mute_disable()

void pdm_hpout_mute_disable ( void  )

◆ pdm_left_alc_enable()

void pdm_left_alc_enable ( pdm_gate_t  gate,
pdm_use_alc_control_pgagain_t  is_alc_ctr_pga 
)

◆ pdm_left_alc_pro_mode_config()

void pdm_left_alc_pro_mode_config ( pdm_alc_config_t ALC_Type)

◆ pdm_left_mic_reinit()

void pdm_left_mic_reinit ( void  )

◆ pdm_noise_gate_set()

void pdm_noise_gate_set ( pdm_cha_sel_t  cha,
pdm_noise_gate_threshold_t  Threshold,
pdm_gate_t  gate 
)

◆ pdm_pga_gain_config_via_reg27_28()

void pdm_pga_gain_config_via_reg27_28 ( pdm_cha_sel_t  cha,
uint32_t  gain 
)

向PDM reg27 reg28寄存器写PGA的增益

参数
cha左通道或者右通道
gainPGA增益的大小

◆ pdm_pga_gain_config_via_reg27_28_db()

void pdm_pga_gain_config_via_reg27_28_db ( pdm_cha_sel_t  cha,
float  gain_db 
)

◆ pdm_pga_gain_config_via_reg43_53()

void pdm_pga_gain_config_via_reg43_53 ( pdm_cha_sel_t  cha,
uint32_t  gain 
)

◆ pdm_pga_gain_config_via_reg43_53_db()

void pdm_pga_gain_config_via_reg43_53_db ( pdm_cha_sel_t  cha,
float  gain_db 
)

◆ pdm_power_off()

void pdm_power_off ( void  )

关闭PDM模块电源

◆ pdm_power_up()

void pdm_power_up ( pdm_current_t  current)

PDM模块上电

参数
currentpre-charge/dis-charge的电流大小

◆ pdm_reset()

void pdm_reset ( void  )

当主频为168时,延时100us

参数
cnt延迟0.1毫秒 INNER PDM reset

◆ pdm_right_alc_enable()

void pdm_right_alc_enable ( pdm_gate_t  gate,
pdm_use_alc_control_pgagain_t  is_alc_ctr_pga 
)

◆ pdm_right_alc_pro_mode_config()

void pdm_right_alc_pro_mode_config ( pdm_alc_config_t ALC_Type)

◆ pdm_right_mic_reinit()

void pdm_right_mic_reinit ( void  )

◆ pdm_set_input_mode_left()

void pdm_set_input_mode_left ( pdm_input_mode_t  mode)

设置左通道的输入模式

参数
mode

◆ pdm_set_input_mode_right()

void pdm_set_input_mode_right ( pdm_input_mode_t  mode)

设置右通道的输入模式

参数
mode

◆ pdm_set_mic_gain()

void pdm_set_mic_gain ( pdm_cha_sel_t  cha,
pdm_mic_amplify_t  gain 
)

向PDM MIC增益控制寄存器写值

参数
cha左通道或者右通道
gainMIC增益的大小

◆ pdm_set_mic_gain_left()

void pdm_set_mic_gain_left ( pdm_mic_amplify_t  gain)

设置左通道的MIC增益

参数
gain

◆ pdm_set_mic_gain_right()

void pdm_set_mic_gain_right ( pdm_mic_amplify_t  gain)

设置右通道的MIC增益

参数
gain

◆ pdm_set_sample_rate()

void pdm_set_sample_rate ( pdm_samplerate_t  samplerate)

◆ pdm_zero_cross_set()

void pdm_zero_cross_set ( pdm_cha_sel_t  cha,
pdm_gate_t  gate 
)