PSOC E8XXGP Device Support Library

General Description

Functions

cy_en_pdm_pcm_status_t Cy_PDM_PCM_Channel_Init (PDM_Type *base, cy_stc_pdm_pcm_channel_config_t const *channel_config, uint8_t channel_num)
 Initialize the PDM-PCM Channel. More...
 
void Cy_PDM_PCM_Channel_DeInit (PDM_Type *base, uint8_t channel_num)
 Uninitializes the PDM-PCM channel. More...
 
cy_en_pdm_pcm_status_t Cy_PDM_PCM_Init (PDM_Type *base, cy_stc_pdm_pcm_config_v2_t const *config)
 Initializes the PDM-PCM module. More...
 
void Cy_PDM_PCM_DeInit (PDM_Type *base)
 Uninitializes the PDM-PCM module. More...
 
cy_en_pdm_pcm_status_t Cy_PDM_PCM_test_Init (PDM_Type *base, cy_stc_pdm_pcm_config_v2_t const *config, cy_stc_test_config_t const *test_config)
 Initializes the PDM-PCM module test mode. More...
 
cy_en_pdm_pcm_status_t Cy_PDM_PCM_SetGain (PDM_Type *base, uint8_t channel_num, cy_en_pdm_pcm_gain_sel_t gain)
 Sets the gain factor for the given channel. More...
 
__STATIC_INLINE void Cy_PDM_PCM_Activate_Channel (PDM_Type *base, uint8_t channel_num)
 Activates the PDM-PCM channel. More...
 
__STATIC_INLINE void Cy_PDM_PCM_DeActivate_Channel (PDM_Type *base, uint8_t channel_num)
 DeActivates the PDM-PCM channel. More...
 
__STATIC_INLINE void Cy_PDM_PCM_SetRateSampling (PDM_Type *base, cy_en_pdm_pcm_halve_rate_sel_t rate)
 Sets Halve rate Sampling rate. More...
 
__STATIC_INLINE void Cy_PDM_PCM_Channel_Enable (PDM_Type *base, uint8_t channel_num)
 Enables the PDM-PCM data conversion. More...
 
__STATIC_INLINE void Cy_PDM_PCM_Channel_Disable (PDM_Type *base, uint8_t channel_num)
 Disables the PDM-PCM data conversion. More...
 
__STATIC_INLINE void Cy_PDM_PCM_Channel_Set_Cic_DecimCode (PDM_Type *base, uint8_t channel_num, cy_en_pdm_pcm_ch_cic_decimcode_t decimcode)
 Sets PDM-PCM CIC Filter Decimation code. More...
 
__STATIC_INLINE void Cy_PDM_PCM_Channel_Set_Fir0 (PDM_Type *base, uint8_t channel_num, cy_en_pdm_pcm_ch_fir0_decimcode_t decimcode, uint8_t scale)
 Sets PDM-PCM FIR0 Filter Decim code and Scale. More...
 
__STATIC_INLINE void Cy_PDM_PCM_Channel_Set_Fir1 (PDM_Type *base, uint8_t channel_num, cy_en_pdm_pcm_ch_fir1_decimcode_t decimcode, uint8_t scale)
 Sets PDM-PCM FIR1 Filter Decimation code and Scale. More...
 
__STATIC_INLINE void Cy_PDM_PCM_Channel_Set_DCblock (PDM_Type *base, uint8_t channel_num, cy_en_pdm_pcm_ch_dcblock_coef_t coef)
 Sets the DC blocker filter with programmable coefficient. More...
 
__STATIC_INLINE void Cy_PDM_PCM_Channel_SetInterruptMask (PDM_Type *base, uint8_t channel_num, uint32_t interrupt)
 Sets one or more PDM-PCM interrupt factor bits (sets the INTR_MASK register). More...
 
__STATIC_INLINE uint32_t Cy_PDM_PCM_Channel_GetInterruptMask (PDM_Type const *base, uint8_t channel_num)
 Returns the PDM-PCM interrupt mask (a content of the INTR_MASK register). More...
 
__STATIC_INLINE uint32_t Cy_PDM_PCM_Channel_GetInterruptStatusMasked (PDM_Type const *base, uint8_t channel_num)
 Reports the status of enabled (masked) PDM-PCM interrupt sources. More...
 
__STATIC_INLINE uint32_t Cy_PDM_PCM_Channel_GetInterruptStatus (PDM_Type const *base, uint8_t channel_num)
 Reports the status of PDM-PCM interrupt sources (an INTR register). More...
 
__STATIC_INLINE void Cy_PDM_PCM_Channel_ClearInterrupt (PDM_Type *base, uint8_t channel_num, uint32_t interrupt)
 Clears one or more PDM-PCM interrupt statuses (sets an INTR register's bits). More...
 
__STATIC_INLINE void Cy_PDM_PCM_Channel_SetInterrupt (PDM_Type *base, uint8_t channel_num, uint32_t interrupt)
 Sets one or more interrupt source statuses (sets an INTR_SET register). More...
 
__STATIC_INLINE uint8_t Cy_PDM_PCM_Channel_GetNumInFifo (PDM_Type const *base, uint8_t channel_num)
 Reports the current number of used words in the output data FIFO. More...
 
__STATIC_INLINE uint32_t Cy_PDM_PCM_Channel_ReadFifo (PDM_Type const *base, uint8_t channel_num)
 Reads ("pops") one word from the output data FIFO. More...
 
__STATIC_INLINE void Cy_PDM_PCM_Channel_FreezeFifo (PDM_Type *base, uint8_t channel_num)
 Freezes the RX FIFO (Debug purpose). More...
 
__STATIC_INLINE void Cy_PDM_PCM_Channel_UnfreezeFifo (PDM_Type *base, uint8_t channel_num)
 Unfreezes the RX FIFO (Debug purpose). More...
 
__STATIC_INLINE uint32_t Cy_PDM_PCM_Channel_ReadFifoSilent (PDM_Type const *base, uint8_t channel_num)
 Reads the RX FIFO silent (without touching the FIFO function). More...
 
__STATIC_INLINE void Cy_PDM_PCM_DCBlock_Enable (PDM_Type *base, uint8_t channel_num)
 Enable DC Block Filter for the given channel. More...
 
__STATIC_INLINE void Cy_PDM_PCM_DCBlock_Disable (PDM_Type *base, uint8_t channel_num)
 Disable DC Block Filter for the given channel. More...
 
cy_en_pdm_pcm_status_t Cy_PDM_PCM_SetFIR0_Scale (PDM_Type *base, uint8_t channel_num, cy_en_pdm_pcm_gain_sel_t scale)
 Sets the FIR0 Scale factor for the given channel. More...
 
cy_en_pdm_pcm_status_t Cy_PDM_PCM_ApplyPCM_Gain (const int32_t *in_sample, int32_t gain_db, cy_en_pdm_pcm_format_t out_format, int32_t *out_sample)
 This function applies gain in software to one 24-bit PCM sample data output PCM format can be 24-bit or 16-bit, gain should be in the range of -40db to 40db. More...
 
__STATIC_INLINE bool Cy_PDM_PCM_Channel_GetCurrentState (PDM_Type const *base, uint8_t channel_num)
 Returns the current PDM-PCM state (active/stopped). More...
 

Function Documentation

◆ Cy_PDM_PCM_Channel_Init()

cy_en_pdm_pcm_status_t Cy_PDM_PCM_Channel_Init ( PDM_Type base,
cy_stc_pdm_pcm_channel_config_t const *  channel_config,
uint8_t  channel_num 
)

Initialize the PDM-PCM Channel.

Precondition
Make sure PDM-PCM is initialized before calling this function. Cy_PDM_PCM_Init
Parameters
baseThe pointer to the PDM-PCM instance address
channel_configThe pointer to a configuration structure.
channel_numThe channel number to be initialized.
Returns
error / status code. See cy_en_pdm_pcm_status_t.
Function Usage
uint8_t channel_num = 0U;
Cy_PDM_PCM_Channel_Init(PDM0, &channel_0_config, channel_num);
cy_en_pdm_pcm_status_t Cy_PDM_PCM_Channel_Init(PDM_Type *base, cy_stc_pdm_pcm_channel_config_t const *channel_config, uint8_t channel_num)
Initialize the PDM-PCM Channel.
Definition: cy_pdm_pcm_v2.c:79

◆ Cy_PDM_PCM_Channel_DeInit()

void Cy_PDM_PCM_Channel_DeInit ( PDM_Type base,
uint8_t  channel_num 
)

Uninitializes the PDM-PCM channel.

Parameters
baseThe pointer to the PDM-PCM instance address.
channel_numchannel number to be de initialized.
Function Usage
uint8_t channel_num = 0U;
Cy_PDM_PCM_Channel_DeInit(PDM0, &channel_0_config, channel_num);
void Cy_PDM_PCM_Channel_DeInit(PDM_Type *base, uint8_t channel_num)
Uninitializes the PDM-PCM channel.
Definition: cy_pdm_pcm_v2.c:294

◆ Cy_PDM_PCM_Init()

cy_en_pdm_pcm_status_t Cy_PDM_PCM_Init ( PDM_Type base,
cy_stc_pdm_pcm_config_v2_t const *  config 
)

Initializes the PDM-PCM module.

Parameters
baseThe pointer to the PDM-PCM instance address
configThe pointer to a configuration structure. cy_stc_pdm_pcm_config_v2_t
Returns
error / status code. See cy_en_pdm_pcm_status_t.
Function Usage
status = Cy_PDM_PCM_Init(PDM0, &pdm_0_config);
if(CY_PDM_PCM_SUCCESS != status)
{
//handle Error
}
@ CY_PDM_PCM_SUCCESS
Success status code.
Definition: cy_pdm_pcm_v2.h:287
cy_en_pdm_pcm_status_t Cy_PDM_PCM_Init(PDM_Type *base, cy_stc_pdm_pcm_config_v2_t const *config)
Initializes the PDM-PCM module.
Definition: cy_pdm_pcm_v2.c:142

◆ Cy_PDM_PCM_DeInit()

void Cy_PDM_PCM_DeInit ( PDM_Type base)

Uninitializes the PDM-PCM module.

Parameters
baseThe pointer to the PDM-PCM instance address.
Function Usage
void Cy_PDM_PCM_DeInit(PDM_Type *base)
Uninitializes the PDM-PCM module.
Definition: cy_pdm_pcm_v2.c:321

◆ Cy_PDM_PCM_test_Init()

cy_en_pdm_pcm_status_t Cy_PDM_PCM_test_Init ( PDM_Type base,
cy_stc_pdm_pcm_config_v2_t const *  config,
cy_stc_test_config_t const *  test_config 
)

Initializes the PDM-PCM module test mode.

Parameters
baseThe pointer to the PDM-PCM instance address
configThe pointer to a configuration structure. cy_stc_pdm_pcm_config_v2_t
test_configtest Mode configuration. cy_stc_test_config_t
Returns
error / status code. See cy_en_pdm_pcm_status_t.

◆ Cy_PDM_PCM_SetGain()

cy_en_pdm_pcm_status_t Cy_PDM_PCM_SetGain ( PDM_Type base,
uint8_t  channel_num,
cy_en_pdm_pcm_gain_sel_t  gain 
)

Sets the gain factor for the given channel.

Parameters
baseThe pointer to the PDM-PCM instance address.
channel_numThe channel number for gain setting.
gainGain value defined as cy_en_pdm_pcm_gain_scale_t

◆ Cy_PDM_PCM_Activate_Channel()

__STATIC_INLINE void Cy_PDM_PCM_Activate_Channel ( PDM_Type base,
uint8_t  channel_num 
)

Activates the PDM-PCM channel.

Parameters
baseThe pointer to the PDM-PCM instance address.
channel_numChannel number to be activated
Function Usage
uint8_t channel_num = 0U;
Cy_PDM_PCM_Activate_Channel(PDM0, channel_num);
__STATIC_INLINE void Cy_PDM_PCM_Activate_Channel(PDM_Type *base, uint8_t channel_num)
Activates the PDM-PCM channel.
Definition: cy_pdm_pcm_v2.h:641

◆ Cy_PDM_PCM_DeActivate_Channel()

__STATIC_INLINE void Cy_PDM_PCM_DeActivate_Channel ( PDM_Type base,
uint8_t  channel_num 
)

DeActivates the PDM-PCM channel.

Parameters
baseThe pointer to the PDM-PCM instance address.
channel_numChannel number to be deactivated
Function Usage
uint8_t channel_num = 0U;
Cy_PDM_PCM_DeActivate_Channel(PDM0, channel_num);
__STATIC_INLINE void Cy_PDM_PCM_DeActivate_Channel(PDM_Type *base, uint8_t channel_num)
DeActivates the PDM-PCM channel.
Definition: cy_pdm_pcm_v2.h:659

◆ Cy_PDM_PCM_SetRateSampling()

__STATIC_INLINE void Cy_PDM_PCM_SetRateSampling ( PDM_Type base,
cy_en_pdm_pcm_halve_rate_sel_t  rate 
)

Sets Halve rate Sampling rate.

Parameters
baseThe pointer to the PDM-PCM instance address.
rateHalve rate sampling or Full rate sampling cy_en_pdm_pcm_halve_rate_sel_t.
Function Usage
@ CY_PDM_PCM_RATE_FULL
Channel full.
Definition: cy_pdm_pcm_v2.h:192
__STATIC_INLINE void Cy_PDM_PCM_SetRateSampling(PDM_Type *base, cy_en_pdm_pcm_halve_rate_sel_t rate)
Sets Halve rate Sampling rate.
Definition: cy_pdm_pcm_v2.h:698

◆ Cy_PDM_PCM_Channel_Enable()

__STATIC_INLINE void Cy_PDM_PCM_Channel_Enable ( PDM_Type base,
uint8_t  channel_num 
)

Enables the PDM-PCM data conversion.

Parameters
baseThe pointer to the PDM-PCM instance address.
channel_numChannel number to be enabled
Function Usage
uint8_t channel_num = 0U;
Cy_PDM_PCM_Channel_Enable(PDM0, channel_num);
__STATIC_INLINE void Cy_PDM_PCM_Channel_Enable(PDM_Type *base, uint8_t channel_num)
Enables the PDM-PCM data conversion.
Definition: cy_pdm_pcm_v2.h:603

◆ Cy_PDM_PCM_Channel_Disable()

__STATIC_INLINE void Cy_PDM_PCM_Channel_Disable ( PDM_Type base,
uint8_t  channel_num 
)

Disables the PDM-PCM data conversion.

Parameters
baseThe pointer to the PDM-PCM instance address.
channel_numChannel number to be disabled
Function Usage
uint8_t channel_num = 0U;
Cy_PDM_PCM_Channel_Disable(PDM0, channel_num);
__STATIC_INLINE void Cy_PDM_PCM_Channel_Disable(PDM_Type *base, uint8_t channel_num)
Disables the PDM-PCM data conversion.
Definition: cy_pdm_pcm_v2.h:622

◆ Cy_PDM_PCM_Channel_Set_Cic_DecimCode()

__STATIC_INLINE void Cy_PDM_PCM_Channel_Set_Cic_DecimCode ( PDM_Type base,
uint8_t  channel_num,
cy_en_pdm_pcm_ch_cic_decimcode_t  decimcode 
)

Sets PDM-PCM CIC Filter Decimation code.

Parameters
baseThe pointer to the PDM-PCM instance address
channel_numChannel number for which the CIC filter Decimation code to be set
decimcodedecimation code value to be set. cy_en_pdm_pcm_ch_cic_decimcode_t.
Function Usage
uint8_t channel_num = 0U;
@ CY_PDM_PCM_CHAN_CIC_DECIM_8
CIC Filter PCM Frequency is 1/8 * PDM Frequency.
Definition: cy_pdm_pcm_v2.h:201
__STATIC_INLINE void Cy_PDM_PCM_Channel_Set_Cic_DecimCode(PDM_Type *base, uint8_t channel_num, cy_en_pdm_pcm_ch_cic_decimcode_t decimcode)
Sets PDM-PCM CIC Filter Decimation code.
Definition: cy_pdm_pcm_v2.h:719

◆ Cy_PDM_PCM_Channel_Set_Fir0()

__STATIC_INLINE void Cy_PDM_PCM_Channel_Set_Fir0 ( PDM_Type base,
uint8_t  channel_num,
cy_en_pdm_pcm_ch_fir0_decimcode_t  decimcode,
uint8_t  scale 
)

Sets PDM-PCM FIR0 Filter Decim code and Scale.

The FIR filter coefficients have no default values: the coefficients MUST be programmed BEFORE the filter is enabled. By Default FIR0 is disabled and is only used for 8Khz and 16 Khz sample frequencies. For other frequencies it is a pass through.

Parameters
baseThe pointer to the PDM-PCM instance address
channel_numChannel number for which the FIR0 Decimation code and the filter to be set.
decimcodeDecimation code value to be set. cy_en_pdm_pcm_ch_fir0_decimcode_t.
scaleScale value to be set.
Function Usage
uint8_t channel_num = 0U; // Channel number used.
uint8_t scale = 22U; // scale should be in the range of 1 to 31
@ CY_PDM_PCM_CHAN_FIR0_DECIM_4
FIR0 Filter PCM Frequency is 1/4 * PCM Frequency.
Definition: cy_pdm_pcm_v2.h:212
__STATIC_INLINE void Cy_PDM_PCM_Channel_Set_Fir0(PDM_Type *base, uint8_t channel_num, cy_en_pdm_pcm_ch_fir0_decimcode_t decimcode, uint8_t scale)
Sets PDM-PCM FIR0 Filter Decim code and Scale.
Definition: cy_pdm_pcm_v2.h:744

◆ Cy_PDM_PCM_Channel_Set_Fir1()

__STATIC_INLINE void Cy_PDM_PCM_Channel_Set_Fir1 ( PDM_Type base,
uint8_t  channel_num,
cy_en_pdm_pcm_ch_fir1_decimcode_t  decimcode,
uint8_t  scale 
)

Sets PDM-PCM FIR1 Filter Decimation code and Scale.

Parameters
baseThe pointer to the PDM-PCM instance address
channel_numChannel number for which the FIR1 Decimation code and the filter to be set.
decimcodeDecimation code value to be set. cy_en_pdm_pcm_ch_fir1_decimcode_t.
scaleScale value to be set.
Function Usage
uint8_t channel_num = 0U; // Channel number used.
uint8_t scale = 22U; // scale should be in the range of 1 to 31
@ CY_PDM_PCM_CHAN_FIR1_DECIM_2
FIR1 Filter PCM Frequency is 1/2 * PCM Frequency.
Definition: cy_pdm_pcm_v2.h:220
__STATIC_INLINE void Cy_PDM_PCM_Channel_Set_Fir1(PDM_Type *base, uint8_t channel_num, cy_en_pdm_pcm_ch_fir1_decimcode_t decimcode, uint8_t scale)
Sets PDM-PCM FIR1 Filter Decimation code and Scale.
Definition: cy_pdm_pcm_v2.h:767

◆ Cy_PDM_PCM_Channel_Set_DCblock()

__STATIC_INLINE void Cy_PDM_PCM_Channel_Set_DCblock ( PDM_Type base,
uint8_t  channel_num,
cy_en_pdm_pcm_ch_dcblock_coef_t  coef 
)

Sets the DC blocker filter with programmable coefficient.

The filter is used to remove a DC component.

Parameters
baseThe pointer to the PDM-PCM instance address
channel_numChannel number for which DC block coef to be set.
coefcoef value to be set. cy_en_pdm_pcm_ch_dcblock_coef_t.
Function Usage
uint8_t channel_num = 0U; // Channel number used.
@ CY_PDM_PCM_CHAN_DCBLOCK_CODE_8
DCBLOCK Filter alpha = 1 - (1/2^(12-3))
Definition: cy_pdm_pcm_v2.h:231
__STATIC_INLINE void Cy_PDM_PCM_Channel_Set_DCblock(PDM_Type *base, uint8_t channel_num, cy_en_pdm_pcm_ch_dcblock_coef_t coef)
Sets the DC blocker filter with programmable coefficient.
Definition: cy_pdm_pcm_v2.h:792

◆ Cy_PDM_PCM_Channel_SetInterruptMask()

__STATIC_INLINE void Cy_PDM_PCM_Channel_SetInterruptMask ( PDM_Type base,
uint8_t  channel_num,
uint32_t  interrupt 
)

Sets one or more PDM-PCM interrupt factor bits (sets the INTR_MASK register).

Parameters
baseThe pointer to the PDM-PCM instance address
channel_numChannel number
interruptInterrupt bit mask Interrupt Masks.
Function Usage
uint8_t channel_num = 0U;
/* CY_PDM_PCM_INTR_MASK defines mask for all available interrupt sources.
CY_PDM_PCM_INTR_RX_TRIGGER
CY_PDM_PCM_INTR_RX_FIR_OVERFLOW
CY_PDM_PCM_INTR_RX_OVERFLOW
CY_PDM_PCM_INTR_RX_IF_OVERFLOW
CY_PDM_PCM_INTR_RX_UNDERFLOW */
Cy_PDM_PCM_Channel_SetInterruptMask(PDM0, channel_num, CY_PDM_PCM_INTR_MASK);
__STATIC_INLINE void Cy_PDM_PCM_Channel_SetInterruptMask(PDM_Type *base, uint8_t channel_num, uint32_t interrupt)
Sets one or more PDM-PCM interrupt factor bits (sets the INTR_MASK register).
Definition: cy_pdm_pcm_v2.h:813

◆ Cy_PDM_PCM_Channel_GetInterruptMask()

__STATIC_INLINE uint32_t Cy_PDM_PCM_Channel_GetInterruptMask ( PDM_Type const *  base,
uint8_t  channel_num 
)

Returns the PDM-PCM interrupt mask (a content of the INTR_MASK register).

Parameters
baseThe pointer to the PDM-PCM instance address.
channel_numChannel number
Returns
The interrupt bit mask Interrupt Masks.

◆ Cy_PDM_PCM_Channel_GetInterruptStatusMasked()

__STATIC_INLINE uint32_t Cy_PDM_PCM_Channel_GetInterruptStatusMasked ( PDM_Type const *  base,
uint8_t  channel_num 
)

Reports the status of enabled (masked) PDM-PCM interrupt sources.

(an INTR_MASKED register).

Parameters
baseThe pointer to the PDM-PCM instance address.
channel_numChannel number
Returns
The interrupt bit mask Interrupt Masks.
Function Usage
uint8_t channel_num = 0U;
/* Cy_PDM_PCM_Init, Cy_PDM_PCM_Channel_Init and Cy_PDM_PCM_Channel_Enable are pre-requisites */
volatile uint32_t int_stat;
{
for(i=0; i < RX_FIFO_TRIG_LEVEL; i++)
{
int32_t data = (int32_t)Cy_PDM_PCM_Channel_ReadFifo(PDM0, ch);
// data can be stored and used as pcm data
}
}
Cy_PDM_PCM_Channel_ClearInterrupt(PDM0, channel_num, CY_PDM_PCM_INTR_MASK);
__STATIC_INLINE void Cy_PDM_PCM_Channel_ClearInterrupt(PDM_Type *base, uint8_t channel_num, uint32_t interrupt)
Clears one or more PDM-PCM interrupt statuses (sets an INTR register's bits).
Definition: cy_pdm_pcm_v2.h:893
__STATIC_INLINE uint32_t Cy_PDM_PCM_Channel_ReadFifo(PDM_Type const *base, uint8_t channel_num)
Reads ("pops") one word from the output data FIFO.
Definition: cy_pdm_pcm_v2.h:955
__STATIC_INLINE uint32_t Cy_PDM_PCM_Channel_GetInterruptStatusMasked(PDM_Type const *base, uint8_t channel_num)
Reports the status of enabled (masked) PDM-PCM interrupt sources.
Definition: cy_pdm_pcm_v2.h:852
#define CY_PDM_PCM_INTR_RX_TRIGGER
More entries in the RX FIFO than specified by Trigger Level.
Definition: cy_pdm_pcm_v2.h:147

◆ Cy_PDM_PCM_Channel_GetInterruptStatus()

__STATIC_INLINE uint32_t Cy_PDM_PCM_Channel_GetInterruptStatus ( PDM_Type const *  base,
uint8_t  channel_num 
)

Reports the status of PDM-PCM interrupt sources (an INTR register).

Parameters
baseThe pointer to the PDM-PCM instance address.
channel_numChannel number
Returns
The interrupt bit mask Interrupt Masks.
Function Usage
uint8_t channel_num = 0U;
/* Cy_PDM_PCM_Init, Cy_PDM_PCM_Channel_Init and Cy_PDM_PCM_Channel_Enable are pre-requisites */
volatile uint32_t int_stat;
{
for(i=0; i < RX_FIFO_TRIG_LEVEL; i++)
{
int32_t data = (int32_t)Cy_PDM_PCM_Channel_ReadFifo(PDM0, ch);
// data can be stored and used as pcm data
}
}
Cy_PDM_PCM_Channel_ClearInterrupt(PDM0, channel_num, CY_PDM_PCM_INTR_MASK);

◆ Cy_PDM_PCM_Channel_ClearInterrupt()

__STATIC_INLINE void Cy_PDM_PCM_Channel_ClearInterrupt ( PDM_Type base,
uint8_t  channel_num,
uint32_t  interrupt 
)

Clears one or more PDM-PCM interrupt statuses (sets an INTR register's bits).

Parameters
baseThe pointer to the PDM-PCM instance address
channel_numChannel number
interruptThe interrupt bit mask Interrupt Masks.
Function Usage
uint8_t channel_num = 0U;
/* CY_PDM_PCM_INTR_MASK defines mask for all available interrupt sources.
CY_PDM_PCM_INTR_RX_TRIGGER
CY_PDM_PCM_INTR_RX_FIR_OVERFLOW
CY_PDM_PCM_INTR_RX_OVERFLOW
CY_PDM_PCM_INTR_RX_IF_OVERFLOW
CY_PDM_PCM_INTR_RX_UNDERFLOW */
Cy_PDM_PCM_Channel_ClearInterrupt(PDM0, channel_num, CY_PDM_PCM_INTR_MASK);

◆ Cy_PDM_PCM_Channel_SetInterrupt()

__STATIC_INLINE void Cy_PDM_PCM_Channel_SetInterrupt ( PDM_Type base,
uint8_t  channel_num,
uint32_t  interrupt 
)

Sets one or more interrupt source statuses (sets an INTR_SET register).

Parameters
baseThe pointer to the PDM-PCM instance address.
channel_numChannel number
interruptThe interrupt bit mask Interrupt Masks.

◆ Cy_PDM_PCM_Channel_GetNumInFifo()

__STATIC_INLINE uint8_t Cy_PDM_PCM_Channel_GetNumInFifo ( PDM_Type const *  base,
uint8_t  channel_num 
)

Reports the current number of used words in the output data FIFO.

Parameters
baseThe pointer to the PDM-PCM instance address.
channel_numChannel number
Returns
The current number of used FIFO words (range is 0 - 63).
Function Usage
uint8_t channel_num = 0U; // Channel number used.
uint8_t num_in_fifo = Cy_PDM_PCM_Channel_GetNumInFifo(PDM0, channel_num);
__STATIC_INLINE uint8_t Cy_PDM_PCM_Channel_GetNumInFifo(PDM_Type const *base, uint8_t channel_num)
Reports the current number of used words in the output data FIFO.
Definition: cy_pdm_pcm_v2.h:935

◆ Cy_PDM_PCM_Channel_ReadFifo()

__STATIC_INLINE uint32_t Cy_PDM_PCM_Channel_ReadFifo ( PDM_Type const *  base,
uint8_t  channel_num 
)

Reads ("pops") one word from the output data FIFO.

Parameters
baseThe pointer to the PDM-PCM instance address.
channel_numChannel number
Returns
The data word read from the FIFO is returned.
Function Usage
uint8_t channel_num = 0U;
/* Cy_PDM_PCM_Init, Cy_PDM_PCM_Channel_Init and Cy_PDM_PCM_Channel_Enable are pre-requisites */
volatile uint32_t int_stat;
{
for(i=0; i < RX_FIFO_TRIG_LEVEL; i++)
{
int32_t data = (int32_t)Cy_PDM_PCM_Channel_ReadFifo(PDM0, ch);
// data can be stored and used as pcm data
}
}
Cy_PDM_PCM_Channel_ClearInterrupt(PDM0, channel_num, CY_PDM_PCM_INTR_MASK);

◆ Cy_PDM_PCM_Channel_FreezeFifo()

__STATIC_INLINE void Cy_PDM_PCM_Channel_FreezeFifo ( PDM_Type base,
uint8_t  channel_num 
)

Freezes the RX FIFO (Debug purpose).

Parameters
baseThe pointer to the PDM-PCM instance address.
channel_numChannel number
Function Usage
uint8_t channel_num = 0U; // Channel number used.
Cy_PDM_PCM_Channel_FreezeFifo(PDM0, channel_num);
__STATIC_INLINE void Cy_PDM_PCM_Channel_FreezeFifo(PDM_Type *base, uint8_t channel_num)
Freezes the RX FIFO (Debug purpose).
Definition: cy_pdm_pcm_v2.h:973

◆ Cy_PDM_PCM_Channel_UnfreezeFifo()

__STATIC_INLINE void Cy_PDM_PCM_Channel_UnfreezeFifo ( PDM_Type base,
uint8_t  channel_num 
)

Unfreezes the RX FIFO (Debug purpose).

Parameters
baseThe pointer to the PDM-PCM instance address.
channel_numChannel number
Function Usage
uint8_t channel_num = 0U; // Channel number used.
Cy_PDM_PCM_Channel_UnfreezeFifo(PDM0, channel_num);
__STATIC_INLINE void Cy_PDM_PCM_Channel_UnfreezeFifo(PDM_Type *base, uint8_t channel_num)
Unfreezes the RX FIFO (Debug purpose).
Definition: cy_pdm_pcm_v2.h:992

◆ Cy_PDM_PCM_Channel_ReadFifoSilent()

__STATIC_INLINE uint32_t Cy_PDM_PCM_Channel_ReadFifoSilent ( PDM_Type const *  base,
uint8_t  channel_num 
)

Reads the RX FIFO silent (without touching the FIFO function).

Parameters
basePointer to PDM-PCM instance address.
channel_numChannel number
Returns
Silent FIFO value is read and returned.
Function Usage
uint8_t channel_num = 0U; // Channel number used.
__STATIC_INLINE uint32_t Cy_PDM_PCM_Channel_ReadFifoSilent(PDM_Type const *base, uint8_t channel_num)
Reads the RX FIFO silent (without touching the FIFO function).
Definition: cy_pdm_pcm_v2.h:1012

◆ Cy_PDM_PCM_DCBlock_Enable()

__STATIC_INLINE void Cy_PDM_PCM_DCBlock_Enable ( PDM_Type base,
uint8_t  channel_num 
)

Enable DC Block Filter for the given channel.

Parameters
baseThe pointer to the PDM-PCM instance address.
channel_numThe channel number.

◆ Cy_PDM_PCM_DCBlock_Disable()

__STATIC_INLINE void Cy_PDM_PCM_DCBlock_Disable ( PDM_Type base,
uint8_t  channel_num 
)

Disable DC Block Filter for the given channel.

Parameters
baseThe pointer to the PDM-PCM instance address.
channel_numThe channel number.

◆ Cy_PDM_PCM_SetFIR0_Scale()

cy_en_pdm_pcm_status_t Cy_PDM_PCM_SetFIR0_Scale ( PDM_Type base,
uint8_t  channel_num,
cy_en_pdm_pcm_gain_sel_t  scale 
)

Sets the FIR0 Scale factor for the given channel.

Parameters
baseThe pointer to the PDM-PCM instance address.
channel_numThe channel number for gain setting.
scalescale value defined as cy_en_pdm_pcm_gain_scale_t

◆ Cy_PDM_PCM_ApplyPCM_Gain()

cy_en_pdm_pcm_status_t Cy_PDM_PCM_ApplyPCM_Gain ( const int32_t *  in_sample,
int32_t  gain_db,
cy_en_pdm_pcm_format_t  out_format,
int32_t *  out_sample 
)

This function applies gain in software to one 24-bit PCM sample data output PCM format can be 24-bit or 16-bit, gain should be in the range of -40db to 40db.

Parameters
in_sampleThe pointer to the 24-bit PCM input.
gain_dbThe gain to apply. must be within -40db to +40db.
out_formatPCM output format defined as cy_en_pdm_pcm_format_t
out_samplepointer to output PCM. For 16-bit out format, lower 16-bits holds data.

◆ Cy_PDM_PCM_Channel_GetCurrentState()

__STATIC_INLINE bool Cy_PDM_PCM_Channel_GetCurrentState ( PDM_Type const *  base,
uint8_t  channel_num 
)

Returns the current PDM-PCM state (active/stopped).

Parameters
baseThe pointer to the PDM-PCM instance address.
channel_numChannel number
Returns
true if channel is active, false when stopped.
Function Usage
uint8_t channel_num = 0U; // Channel number used.
bool channel_state = Cy_PDM_PCM_Channel_GetCurrentState(PDM0, channel_num);
__STATIC_INLINE bool Cy_PDM_PCM_Channel_GetCurrentState(PDM_Type const *base, uint8_t channel_num)
Returns the current PDM-PCM state (active/stopped).
Definition: cy_pdm_pcm_v2.h:679