nrfx 4.5.0
Loading...
Searching...
No Matches
PDM HAL

Hardware access layer for managing the Pulse Density Modulation (PDM) peripheral. More...

Data Structures

struct  nrf_pdm_filter_ctrl_t
 PDM fliter configuration. More...
 
struct  nrf_pdm_custom_ratio_t
 PDM custom ratio configuration structure. More...
 

Macros

#define NRF_PDM_INST_GET(idx)
 Macro for getting a pointer to the structure of registers of the PDM peripheral.
 
#define NRF_PDM_HAS_MCLKCONFIG   1
 Symbol indicating whether master clock source configuration is available.
 
#define NRF_PDM_HAS_RATIO_CONFIG   1
 Symbol indicating whether ratio configuration is available.
 
#define NRF_PDM_HAS_DMA_TASKS_EVENTS   1
 Symbol indicating whether PDM DMA tasks and events are present.
 
#define NRF_PDM_HAS_PDMCLKCTRL   1
 Symbol indicating whether PDM clock control register is available.
 
#define NRF_PDM_HAS_FREQ_1231K   1
 Symbol indicating whether 1231k PDM clock frequency is available.
 
#define NRF_PDM_HAS_FREQ_1280K   1
 Symbol indicating whether 1280k PDM clock frequency is available.
 
#define NRF_PDM_HAS_FREQ_1333K   1
 Symbol indicating whether 1333k PDM clock frequency is available.
 
#define NRF_PDM_HAS_PRESCALER   1
 Symbol indicating whether PDM prescaler register is available.
 
#define NRF_PDM_HAS_CLKSELECT   1
 Symbol indicating whether PDM clock select register is available.
 
#define NRF_PDM_HAS_RATIO32   1
 Symbol indicating whether PDM ratio of 32 configuration is available.
 
#define NRF_PDM_HAS_RATIO48   1
 Symbol indicating whether PDM ratio of 48 configuration is available.
 
#define NRF_PDM_HAS_RATIO50   1
 Symbol indicating whether PDM ratio of 50 configuration is available.
 
#define NRF_PDM_HAS_RATIO96   1
 Symbol indicating whether PDM ratio of 96 configuration is available.
 
#define NRF_PDM_HAS_RATIO100   1
 Symbol indicating whether PDM ratio of 100 configuration is available.
 
#define NRF_PDM_HAS_RATIO128   1
 Symbol indicating whether PDM ratio of 128 configuration is available.
 
#define NRF_PDM_HAS_RATIO150   1
 Symbol indicating whether PDM ratio of 150 configuration is available.
 
#define NRF_PDM_HAS_RATIO192   1
 Symbol indicating whether PDM ratio of 192 configuration is available.
 
#define NRF_PDM_HAS_FILTER   1
 Symbol indicating whether PDM filter registers are available.
 
#define NRF_PDM_HAS_CUSTOM_RATIO   1
 Symbol indicating whether PDM custom ratio configuration is available.
 
#define NRF_PDM_HAS_SELECTABLE_CLOCK   1
 Symbol indicating whether PDM has selectable clock source.
 
#define NRF_PDM_GAIN_MINIMUM   PDM_GAINL_GAINL_MinGain
 Minimum value of PDM gain.
 
#define NRF_PDM_GAIN_DEFAULT   PDM_GAINL_GAINL_DefaultGain
 Default value of PDM gain.
 
#define NRF_PDM_GAIN_MAXIMUM   PDM_GAINL_GAINL_MaxGain
 Maximum value of PDM gain.
 
#define NRF_PDM_PRESCALER_MIN   PDM_PRESCALER_DIVISOR_Min
 Minimum value of PDM prescaler.
 
#define NRF_PDM_PRESCALER_MAX   PDM_PRESCALER_DIVISOR_Max
 Maximum value of PDM prescaler.
 

Typedefs

typedef uint8_t nrf_pdm_gain_t
 PDM gain type. Describes gain value in 0.5 dB steps.
 

Enumerations

enum  nrf_pdm_task_t {
  NRF_PDM_TASK_START = offsetof(NRF_PDM_Type, TASKS_DMA.START) ,
  NRF_PDM_TASK_STOP = offsetof(NRF_PDM_Type, TASKS_DMA.STOP)
}
 PDM tasks. More...
 
enum  nrf_pdm_event_t {
  NRF_PDM_EVENT_STARTED = offsetof(NRF_PDM_Type, EVENTS_STARTED) ,
  NRF_PDM_EVENT_STOPPED = offsetof(NRF_PDM_Type, EVENTS_STOPPED) ,
  NRF_PDM_EVENT_END = offsetof(NRF_PDM_Type, EVENTS_DMA.END)
}
 PDM events. More...
 
enum  nrf_pdm_int_mask_t {
  NRF_PDM_INT_STARTED = PDM_INTENSET_STARTED_Msk ,
  NRF_PDM_INT_STOPPED = PDM_INTENSET_STOPPED_Msk ,
  NRF_PDM_INT_END = PDM_INTENSET_DMAEND_Msk
}
 PDM interrupt masks. More...
 
enum  nrf_pdm_freq_t {
  NRF_PDM_FREQ_1000K = PDM_PDMCLKCTRL_FREQ_1000K ,
  NRF_PDM_FREQ_1032K = PDM_PDMCLKCTRL_FREQ_Default ,
  NRF_PDM_FREQ_1067K = PDM_PDMCLKCTRL_FREQ_1067K ,
  NRF_PDM_FREQ_1231K = PDM_PDMCLKCTRL_FREQ_1231K ,
  NRF_PDM_FREQ_1280K = PDM_PDMCLKCTRL_FREQ_1280K ,
  NRF_PDM_FREQ_1333K = PDM_PDMCLKCTRL_FREQ_1333K
}
 PDM clock frequency. More...
 
enum  nrf_pdm_ratio_t {
  NRF_PDM_RATIO_32X = PDM_RATIO_RATIO_Ratio32 ,
  NRF_PDM_RATIO_48X = PDM_RATIO_RATIO_Ratio48 ,
  NRF_PDM_RATIO_50X = PDM_RATIO_RATIO_Ratio50 ,
  NRF_PDM_RATIO_64X = PDM_RATIO_RATIO_Ratio64 ,
  NRF_PDM_RATIO_80X = PDM_RATIO_RATIO_Ratio80 ,
  NRF_PDM_RATIO_96X = PDM_RATIO_RATIO_Ratio96 ,
  NRF_PDM_RATIO_100X = PDM_RATIO_RATIO_Ratio100 ,
  NRF_PDM_RATIO_128X = PDM_RATIO_RATIO_Ratio128 ,
  NRF_PDM_RATIO_150X = PDM_RATIO_RATIO_Ratio150 ,
  NRF_PDM_RATIO_192X = PDM_RATIO_RATIO_Ratio192 ,
  NRF_PDM_RATIO_CUSTOM = PDM_RATIO_RATIO_Custom
}
 PDM ratio between PDM_CLK and output sample rate. More...
 
enum  nrf_pdm_mode_t {
  NRF_PDM_MODE_STEREO = PDM_MODE_OPERATION_Stereo ,
  NRF_PDM_MODE_MONO = PDM_MODE_OPERATION_Mono
}
 PDM operation mode. More...
 
enum  nrf_pdm_edge_t {
  NRF_PDM_EDGE_LEFTFALLING = PDM_MODE_EDGE_LeftFalling ,
  NRF_PDM_EDGE_LEFTRISING = PDM_MODE_EDGE_LeftRising
}
 PDM sampling mode. More...
 
enum  nrf_pdm_mclksrc_t {
  NRF_PDM_MCLKSRC_PCLK32M = PDM_MCLKCONFIG_SRC_PCLK32M ,
  NRF_PDM_MCLKSRC_ACLK = PDM_MCLKCONFIG_SRC_ACLK
}
 PDM clock source selection. More...
 
enum  nrf_pdm_sample_delay_t {
  NRF_PDM_SAMPLE_DELAY_NONE = PDM_FILTER_CTRL_DATASAMPLEDELAY_NoDelay ,
  NRF_PDM_SAMPLE_DELAY_LEFT = PDM_FILTER_CTRL_DATASAMPLEDELAY_DelayOnLeft ,
  NRF_PDM_SAMPLE_DELAY_RIGHT = PDM_FILTER_CTRL_DATASAMPLEDELAY_DelayOnRight ,
  NRF_PDM_SAMPLE_DELAY_BOTH = PDM_FILTER_CTRL_DATASAMPLEDELAY_DelayOnBoth
}
 PDM input data sample delay. More...
 
enum  nrf_pdm_filter_cic_t {
  NRF_PDM_FILTER_CIC_MSB_RANGE_0 = PDM_FILTER_CTRL_CICFILTERMSBCUSTOM_Range0 ,
  NRF_PDM_FILTER_CIC_MSB_RANGE_1 = PDM_FILTER_CTRL_CICFILTERMSBCUSTOM_Range1 ,
  NRF_PDM_FILTER_CIC_MSB_RANGE_2 = PDM_FILTER_CTRL_CICFILTERMSBCUSTOM_Range2 ,
  NRF_PDM_FILTER_CIC_MSB_RANGE_3 = PDM_FILTER_CTRL_CICFILTERMSBCUSTOM_Range3 ,
  NRF_PDM_FILTER_CIC_MSB_RANGE_4 = PDM_FILTER_CTRL_CICFILTERMSBCUSTOM_Range4 ,
  NRF_PDM_FILTER_CIC_MSB_RANGE_5 = PDM_FILTER_CTRL_CICFILTERMSBCUSTOM_Range5 ,
  NRF_PDM_FILTER_CIC_MSB_RANGE_6 = PDM_FILTER_CTRL_CICFILTERMSBCUSTOM_Range6 ,
  NRF_PDM_FILTER_CIC_MSB_RANGE_7 = PDM_FILTER_CTRL_CICFILTERMSBCUSTOM_Range7 ,
  NRF_PDM_FILTER_CIC_MSB_RANGE_8 = PDM_FILTER_CTRL_CICFILTERMSBCUSTOM_Range8 ,
  NRF_PDM_FILTER_CIC_MSB_RANGE_9 = PDM_FILTER_CTRL_CICFILTERMSBCUSTOM_Range9 ,
  NRF_PDM_FILTER_CIC_MSB_RANGE_10 = PDM_FILTER_CTRL_CICFILTERMSBCUSTOM_Range10 ,
  NRF_PDM_FILTER_CIC_MSB_RANGE_11 = PDM_FILTER_CTRL_CICFILTERMSBCUSTOM_Range11 ,
  NRF_PDM_FILTER_CIC_MSB_RANGE_12 = PDM_FILTER_CTRL_CICFILTERMSBCUSTOM_Range12 ,
  NRF_PDM_FILTER_CIC_MSB_RANGE_13 = PDM_FILTER_CTRL_CICFILTERMSBCUSTOM_Range13 ,
  NRF_PDM_FILTER_CIC_MSB_RANGE_14 = PDM_FILTER_CTRL_CICFILTERMSBCUSTOM_Range14 ,
  NRF_PDM_FILTER_CIC_MSB_RANGE_15 = PDM_FILTER_CTRL_CICFILTERMSBCUSTOM_Range15
}
 PDM CIC filter most significant bit. More...
 
enum  nrf_pdm_filter_hp_pole_t {
  NRF_PDM_FILTER_HP_POLE_0_16_HZ = PDM_FILTER_HPPOLE_HPPOLE_p0p16 ,
  NRF_PDM_FILTER_HP_POLE_0_32_HZ = PDM_FILTER_HPPOLE_HPPOLE_p0p32 ,
  NRF_PDM_FILTER_HP_POLE_0_64_HZ = PDM_FILTER_HPPOLE_HPPOLE_p0p64 ,
  NRF_PDM_FILTER_HP_POLE_1_25_HZ = PDM_FILTER_HPPOLE_HPPOLE_p1p25 ,
  NRF_PDM_FILTER_HP_POLE_2_5_HZ = PDM_FILTER_HPPOLE_HPPOLE_p2p5 ,
  NRF_PDM_FILTER_HP_POLE_5_HZ = PDM_FILTER_HPPOLE_HPPOLE_p5 ,
  NRF_PDM_FILTER_HP_POLE_10_HZ = PDM_FILTER_HPPOLE_HPPOLE_p10 ,
  NRF_PDM_FILTER_HP_POLE_20_HZ = PDM_FILTER_HPPOLE_HPPOLE_p20 ,
  NRF_PDM_FILTER_HP_POLE_40_HZ = PDM_FILTER_HPPOLE_HPPOLE_p40 ,
  NRF_PDM_FILTER_HP_POLE_79_HZ = PDM_FILTER_HPPOLE_HPPOLE_p79 ,
  NRF_PDM_FILTER_HP_POLE_157_HZ = PDM_FILTER_HPPOLE_HPPOLE_p157 ,
  NRF_PDM_FILTER_HP_POLE_310_HZ = PDM_FILTER_HPPOLE_HPPOLE_p310 ,
  NRF_PDM_FILTER_HP_POLE_603_HZ = PDM_FILTER_HPPOLE_HPPOLE_p603 ,
  NRF_PDM_FILTER_HP_POLE_1152_HZ = PDM_FILTER_HPPOLE_HPPOLE_p1152 ,
  NRF_PDM_FILTER_HP_POLE_2110_HZ = PDM_FILTER_HPPOLE_HPPOLE_p2110
}
 PDM high pass filter -3dB gain pole frequency. More...
 
enum  nrf_pdm_filter_softcycles_t {
  NRF_PDM_FILTER_SOFTCYCLES_2 = PDM_FILTER_SOFTCYCLES_DISABLE_s2 ,
  NRF_PDM_FILTER_SOFTCYCLES_8 = PDM_FILTER_SOFTCYCLES_DISABLE_s8 ,
  NRF_PDM_FILTER_SOFTCYCLES_32 = PDM_FILTER_SOFTCYCLES_DISABLE_s32 ,
  NRF_PDM_FILTER_SOFTCYCLES_64 = PDM_FILTER_SOFTCYCLES_DISABLE_s64 ,
  NRF_PDM_FILTER_SOFTCYCLES_128 = PDM_FILTER_SOFTCYCLES_DISABLE_s128 ,
  NRF_PDM_FILTER_SOFTCYCLES_256 = PDM_FILTER_SOFTCYCLES_DISABLE_s256 ,
  NRF_PDM_FILTER_SOFTCYCLES_512 = PDM_FILTER_SOFTCYCLES_DISABLE_s512 ,
  NRF_PDM_FILTER_SOFTCYCLES_CUSTOM = PDM_FILTER_SOFTCYCLES_DISABLE_custom
}
 PDM number of cycles for soft mute transition. More...
 

Functions

NRF_STATIC_INLINE void nrf_pdm_task_trigger (NRF_PDM_Type *p_reg, nrf_pdm_task_t task)
 Function for triggering a PDM task.
 
NRF_STATIC_INLINE uint32_t nrf_pdm_task_address_get (NRF_PDM_Type const *p_reg, nrf_pdm_task_t task)
 Function for getting the address of a PDM task register.
 
NRF_STATIC_INLINE bool nrf_pdm_event_check (NRF_PDM_Type const *p_reg, nrf_pdm_event_t event)
 Function for retrieving the state of the PDM event.
 
NRF_STATIC_INLINE void nrf_pdm_event_clear (NRF_PDM_Type *p_reg, nrf_pdm_event_t event)
 Function for clearing a PDM event.
 
NRF_STATIC_INLINE uint32_t nrf_pdm_event_address_get (NRF_PDM_Type const *p_reg, nrf_pdm_event_t event)
 Function for getting the address of a PDM event register.
 
NRF_STATIC_INLINE void nrf_pdm_int_enable (NRF_PDM_Type *p_reg, uint32_t mask)
 Function for enabling PDM interrupts.
 
NRF_STATIC_INLINE uint32_t nrf_pdm_int_enable_check (NRF_PDM_Type const *p_reg, uint32_t mask)
 Function for checking if the specified interrupts are enabled.
 
NRF_STATIC_INLINE void nrf_pdm_int_disable (NRF_PDM_Type *p_reg, uint32_t mask)
 Function for disabling interrupts.
 
NRF_STATIC_INLINE void nrf_pdm_subscribe_set (NRF_PDM_Type *p_reg, nrf_pdm_task_t task, uint8_t channel)
 Function for setting the subscribe configuration for a given PDM task.
 
NRF_STATIC_INLINE void nrf_pdm_subscribe_clear (NRF_PDM_Type *p_reg, nrf_pdm_task_t task)
 Function for clearing the subscribe configuration for a given PDM task.
 
NRF_STATIC_INLINE uint32_t nrf_pdm_subscribe_get (NRF_PDM_Type const *p_reg, nrf_pdm_task_t task)
 Function for getting the subscribe configuration for a given PDM task.
 
NRF_STATIC_INLINE void nrf_pdm_publish_set (NRF_PDM_Type *p_reg, nrf_pdm_event_t event, uint8_t channel)
 Function for setting the publish configuration for a given PDM event.
 
NRF_STATIC_INLINE void nrf_pdm_publish_clear (NRF_PDM_Type *p_reg, nrf_pdm_event_t event)
 Function for clearing the publish configuration for a given PDM event.
 
NRF_STATIC_INLINE uint32_t nrf_pdm_publish_get (NRF_PDM_Type const *p_reg, nrf_pdm_event_t event)
 Function for getting the publish configuration for a given PDM event.
 
NRF_STATIC_INLINE void nrf_pdm_enable (NRF_PDM_Type *p_reg)
 Function for enabling the PDM peripheral.
 
NRF_STATIC_INLINE void nrf_pdm_disable (NRF_PDM_Type *p_reg)
 Function for disabling the PDM peripheral.
 
NRF_STATIC_INLINE bool nrf_pdm_enable_check (NRF_PDM_Type const *p_reg)
 Function for checking if the PDM peripheral is enabled.
 
NRF_STATIC_INLINE void nrf_pdm_mode_set (NRF_PDM_Type *p_reg, nrf_pdm_mode_t pdm_mode, nrf_pdm_edge_t pdm_edge)
 Function for setting the PDM operation mode.
 
NRF_STATIC_INLINE void nrf_pdm_mode_get (NRF_PDM_Type const *p_reg, nrf_pdm_mode_t *p_pdm_mode, nrf_pdm_edge_t *p_pdm_edge)
 Function for getting the PDM operation mode.
 
NRF_STATIC_INLINE void nrf_pdm_clock_set (NRF_PDM_Type *p_reg, nrf_pdm_freq_t pdm_freq)
 Function for setting the PDM clock frequency.
 
NRF_STATIC_INLINE nrf_pdm_freq_t nrf_pdm_clock_get (NRF_PDM_Type const *p_reg)
 Function for getting the PDM clock frequency.
 
NRF_STATIC_INLINE void nrf_pdm_prescaler_set (NRF_PDM_Type *p_reg, uint32_t prescaler)
 Function for setting the PDM prescaler divisor.
 
NRF_STATIC_INLINE uint32_t nrf_pdm_prescaler_get (NRF_PDM_Type const *p_reg)
 Function for getting the PDM prescaler divisor.
 
NRF_STATIC_INLINE void nrf_pdm_psel_connect (NRF_PDM_Type *p_reg, uint32_t psel_clk, uint32_t psel_din)
 Function for setting up the PDM pins.
 
NRF_STATIC_INLINE void nrf_pdm_clk_pin_set (NRF_PDM_Type *p_reg, uint32_t pin)
 Function for setting the CLK pin.
 
NRF_STATIC_INLINE void nrf_pdm_din_pin_set (NRF_PDM_Type *p_reg, uint32_t pin)
 Function for setting the DIN pin.
 
NRF_STATIC_INLINE uint32_t nrf_pdm_clk_pin_get (NRF_PDM_Type const *p_reg)
 Function for getting the CLK pin selection.
 
NRF_STATIC_INLINE uint32_t nrf_pdm_din_pin_get (NRF_PDM_Type const *p_reg)
 Function for getting the DIN pin selection.
 
NRF_STATIC_INLINE void nrf_pdm_psel_disconnect (NRF_PDM_Type *p_reg)
 Function for disconnecting the PDM pins.
 
NRF_STATIC_INLINE void nrf_pdm_gain_set (NRF_PDM_Type *p_reg, nrf_pdm_gain_t gain_l, nrf_pdm_gain_t gain_r)
 Function for setting the PDM gain.
 
NRF_STATIC_INLINE void nrf_pdm_gain_get (NRF_PDM_Type const *p_reg, nrf_pdm_gain_t *p_gain_l, nrf_pdm_gain_t *p_gain_r)
 Function for getting the PDM gain.
 
NRF_STATIC_INLINE void nrf_pdm_buffer_set (NRF_PDM_Type *p_reg, uint32_t *p_buffer, uint32_t num)
 Function for setting the PDM sample buffer.
 
NRF_STATIC_INLINE uint32_t * nrf_pdm_buffer_get (NRF_PDM_Type const *p_reg)
 Function for getting the current PDM sample buffer address.
 
NRF_STATIC_INLINE void nrf_pdm_ratio_set (NRF_PDM_Type *p_reg, nrf_pdm_ratio_t ratio)
 Function for setting ratio between PDM_CLK and output sample rate.
 
NRF_STATIC_INLINE void nrf_pdm_custom_ratio_set (NRF_PDM_Type *p_reg, nrf_pdm_custom_ratio_t const *custom_ratio)
 Function for setting custom ratio between PDM_CLK and output sample rate and configuring filters accordingly.
 
NRF_STATIC_INLINE void nrf_pdm_mclksrc_configure (NRF_PDM_Type *p_reg, nrf_pdm_mclksrc_t mclksrc)
 Function for configuring PDM clock source.
 
NRF_STATIC_INLINE void nrf_pdm_filter_ctrl_set (NRF_PDM_Type *p_reg, nrf_pdm_filter_ctrl_t const *fctrl)
 Function for setting PDM filter configuration.
 
NRF_STATIC_INLINE void nrf_pdm_filter_ctrl_get (NRF_PDM_Type const *p_reg, nrf_pdm_filter_ctrl_t *fctrl)
 Function for getting PDM filter configuration.
 
NRF_STATIC_INLINE void nrf_pdm_filter_hp_pole_enable (NRF_PDM_Type *p_reg, bool enable)
 Function for enabling PDM high-pass filter gain pole.
 
NRF_STATIC_INLINE void nrf_pdm_filter_hp_pole_set (NRF_PDM_Type *p_reg, nrf_pdm_filter_hp_pole_t hppole)
 Function for setting PDM high-pass filter gain pole.
 
NRF_STATIC_INLINE nrf_pdm_filter_hp_pole_t nrf_pdm_filter_hp_pole_get (NRF_PDM_Type const *p_reg)
 Function for getting PDM high-pass filter gain pole.
 
NRF_STATIC_INLINE void nrf_pdm_filter_softmute_enable (NRF_PDM_Type *p_reg, bool enable)
 Function for enabling PDM filter soft mute function.
 
NRF_STATIC_INLINE void nrf_pdm_filter_softcycles_set (NRF_PDM_Type *p_reg, nrf_pdm_filter_softcycles_t cycles)
 Function for setting PDM number of cycles used for soft mute transition.
 
NRF_STATIC_INLINE nrf_pdm_filter_softcycles_t nrf_pdm_filter_softcycles_get (NRF_PDM_Type const *p_reg)
 Function for getting PDM number of cycles used for soft mute transition.
 
NRF_STATIC_INLINE void nrf_pdm_filter_sampledelay_enable (NRF_PDM_Type *p_reg, bool enable)
 Function for enabling PDM input data sample delay.
 

Detailed Description

Hardware access layer for managing the Pulse Density Modulation (PDM) peripheral.

Macro Definition Documentation

◆ NRF_PDM_INST_GET

#define NRF_PDM_INST_GET ( idx)
Value:
NRFX_CONCAT_2(NRF_PDM, idx)
#define NRFX_CONCAT_2(p1, p2)
Macro for concatenating two tokens in macro expansion.
Definition nrfx_utils.h:143

Macro for getting a pointer to the structure of registers of the PDM peripheral.

Parameters
[in]idxPDM instance index.
Returns
Pointer to the structure of registers of the PDM peripheral.

Enumeration Type Documentation

◆ nrf_pdm_edge_t

PDM sampling mode.

Enumerator
NRF_PDM_EDGE_LEFTFALLING 

Left (or mono) is sampled on falling edge of PDM_CLK.

NRF_PDM_EDGE_LEFTRISING 

Left (or mono) is sampled on rising edge of PDM_CLK.

◆ nrf_pdm_event_t

PDM events.

Enumerator
NRF_PDM_EVENT_STARTED 

PDM transfer is started.

NRF_PDM_EVENT_STOPPED 

PDM transfer is finished.

NRF_PDM_EVENT_END 

The PDM has written the last sample specified by MAXCNT (or the last sample after a STOP task has been received) to Data RAM.

◆ nrf_pdm_filter_cic_t

PDM CIC filter most significant bit.

Enumerator
NRF_PDM_FILTER_CIC_MSB_RANGE_0 

OSR range low - 4 bits, OSR range high - 32 bits.

NRF_PDM_FILTER_CIC_MSB_RANGE_1 

OSR range low - 34 bits, OSR range high - 36 bits.

NRF_PDM_FILTER_CIC_MSB_RANGE_2 

OSR range low - 38 bits, OSR range high - 42 bits.

NRF_PDM_FILTER_CIC_MSB_RANGE_3 

OSR range low - 44 bits, OSR range high - 48 bits.

NRF_PDM_FILTER_CIC_MSB_RANGE_4 

OSR range low - 50 bits, OSR range high - 54 bits.

NRF_PDM_FILTER_CIC_MSB_RANGE_5 

OSR range low - 56 bits, OSR range high - 64 bits.

NRF_PDM_FILTER_CIC_MSB_RANGE_6 

OSR range low - 66 bits, OSR range high - 72 bits.

NRF_PDM_FILTER_CIC_MSB_RANGE_7 

OSR range low - 74 bits, OSR range high - 84 bits.

NRF_PDM_FILTER_CIC_MSB_RANGE_8 

OSR range low - 86 bits, OSR range high - 96 bits.

NRF_PDM_FILTER_CIC_MSB_RANGE_9 

OSR range low - 98 bits, OSR range high - 110 bits.

NRF_PDM_FILTER_CIC_MSB_RANGE_10 

OSR range low - 112 bits, OSR range high - 128 bits.

NRF_PDM_FILTER_CIC_MSB_RANGE_11 

OSR range low - 130 bits, OSR range high - 146 bits.

NRF_PDM_FILTER_CIC_MSB_RANGE_12 

OSR range low - 148 bits, OSR range high - 168 bits.

NRF_PDM_FILTER_CIC_MSB_RANGE_13 

OSR range low - 170 bits, OSR range high - 194 bits.

NRF_PDM_FILTER_CIC_MSB_RANGE_14 

OSR range low - 196 bits, OSR range high - 222 bits.

NRF_PDM_FILTER_CIC_MSB_RANGE_15 

OSR range low - 224 bits, OSR range high - 256 bits.

◆ nrf_pdm_filter_hp_pole_t

PDM high pass filter -3dB gain pole frequency.

Enumerator
NRF_PDM_FILTER_HP_POLE_0_16_HZ 

0.16 Hz.

NRF_PDM_FILTER_HP_POLE_0_32_HZ 

0.32 Hz.

NRF_PDM_FILTER_HP_POLE_0_64_HZ 

0.64 Hz.

NRF_PDM_FILTER_HP_POLE_1_25_HZ 

1.25 Hz.

NRF_PDM_FILTER_HP_POLE_2_5_HZ 

2.5 Hz.

NRF_PDM_FILTER_HP_POLE_5_HZ 

5 Hz.

NRF_PDM_FILTER_HP_POLE_10_HZ 

10 Hz.

NRF_PDM_FILTER_HP_POLE_20_HZ 

20 Hz.

NRF_PDM_FILTER_HP_POLE_40_HZ 

40 Hz.

NRF_PDM_FILTER_HP_POLE_79_HZ 

79 Hz.

NRF_PDM_FILTER_HP_POLE_157_HZ 

157 Hz.

NRF_PDM_FILTER_HP_POLE_310_HZ 

310 Hz.

NRF_PDM_FILTER_HP_POLE_603_HZ 

603 Hz.

NRF_PDM_FILTER_HP_POLE_1152_HZ 

1152 Hz.

NRF_PDM_FILTER_HP_POLE_2110_HZ 

2110 Hz.

◆ nrf_pdm_filter_softcycles_t

PDM number of cycles for soft mute transition.

Enumerator
NRF_PDM_FILTER_SOFTCYCLES_2 

2 filter source clock cycles.

NRF_PDM_FILTER_SOFTCYCLES_8 

8 filter source clock cycles.

NRF_PDM_FILTER_SOFTCYCLES_32 

32 filter source clock cycles.

NRF_PDM_FILTER_SOFTCYCLES_64 

64 filter source clock cycles.

NRF_PDM_FILTER_SOFTCYCLES_128 

128 filter source clock cycles.

NRF_PDM_FILTER_SOFTCYCLES_256 

256 filter source clock cycles.

NRF_PDM_FILTER_SOFTCYCLES_512 

512 filter source clock cycles.

NRF_PDM_FILTER_SOFTCYCLES_CUSTOM 

Custom number of filter source clock cycles.

◆ nrf_pdm_freq_t

PDM clock frequency.

Enumerator
NRF_PDM_FREQ_1000K 

PDM_CLK = 1.000 MHz.

NRF_PDM_FREQ_1032K 

PDM_CLK = 1.032 MHz.

NRF_PDM_FREQ_1067K 

PDM_CLK = 1.067 MHz.

NRF_PDM_FREQ_1231K 

PDM_CLK = 1.231 MHz.

NRF_PDM_FREQ_1280K 

PDM_CLK = 1.280 MHz.

NRF_PDM_FREQ_1333K 

PDM_CLK = 1.333 MHz.

◆ nrf_pdm_int_mask_t

PDM interrupt masks.

Enumerator
NRF_PDM_INT_STARTED 

Interrupt on EVENTS_STARTED event.

NRF_PDM_INT_STOPPED 

Interrupt on EVENTS_STOPPED event.

NRF_PDM_INT_END 

Interrupt on EVENTS_END event.

◆ nrf_pdm_mclksrc_t

PDM clock source selection.

Enumerator
NRF_PDM_MCLKSRC_PCLK32M 

32MHz peripheral clock.

NRF_PDM_MCLKSRC_ACLK 

Audio PLL clock.

◆ nrf_pdm_mode_t

PDM operation mode.

Enumerator
NRF_PDM_MODE_STEREO 

Sample and store one pair (Left + Right) of 16-bit samples per RAM word.

NRF_PDM_MODE_MONO 

Sample and store two successive Left samples (16 bit each) per RAM word.

◆ nrf_pdm_ratio_t

PDM ratio between PDM_CLK and output sample rate.

Enumerator
NRF_PDM_RATIO_32X 

Ratio of 32.

NRF_PDM_RATIO_48X 

Ratio of 48.

NRF_PDM_RATIO_50X 

Ratio of 50.

NRF_PDM_RATIO_64X 

Ratio of 64.

NRF_PDM_RATIO_80X 

Ratio of 80.

NRF_PDM_RATIO_96X 

Ratio of 96.

NRF_PDM_RATIO_100X 

Ratio of 100.

NRF_PDM_RATIO_128X 

Ratio of 128.

NRF_PDM_RATIO_150X 

Ratio of 150.

NRF_PDM_RATIO_192X 

Ratio of 192.

NRF_PDM_RATIO_CUSTOM 

Custom ratio.

◆ nrf_pdm_sample_delay_t

PDM input data sample delay.

Enumerator
NRF_PDM_SAMPLE_DELAY_NONE 

No delay added.

NRF_PDM_SAMPLE_DELAY_LEFT 

One clock cycle delay on left channel.

NRF_PDM_SAMPLE_DELAY_RIGHT 

One clock cycle delay on right channel.

NRF_PDM_SAMPLE_DELAY_BOTH 

One clock cycle delay on both channels.

◆ nrf_pdm_task_t

PDM tasks.

Enumerator
NRF_PDM_TASK_START 

Starts continuous PDM transfer.

NRF_PDM_TASK_STOP 

Stops PDM transfer.

Function Documentation

◆ nrf_pdm_buffer_get()

NRF_STATIC_INLINE uint32_t * nrf_pdm_buffer_get ( NRF_PDM_Type const * p_reg)

Function for getting the current PDM sample buffer address.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Pointer to the current sample buffer.

◆ nrf_pdm_buffer_set()

NRF_STATIC_INLINE void nrf_pdm_buffer_set ( NRF_PDM_Type * p_reg,
uint32_t * p_buffer,
uint32_t num )

Function for setting the PDM sample buffer.

The amount of allocated RAM depends on the operation mode.

  • For stereo mode: N 32-bit words.
  • For mono mode: Ceil(N/2) 32-bit words.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]p_bufferPointer to the RAM address where samples are to be written with EasyDMA.
[in]numNumber of samples to allocate memory for in EasyDMA mode.

◆ nrf_pdm_clk_pin_get()

NRF_STATIC_INLINE uint32_t nrf_pdm_clk_pin_get ( NRF_PDM_Type const * p_reg)

Function for getting the CLK pin selection.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
CLK pin selection;

◆ nrf_pdm_clk_pin_set()

NRF_STATIC_INLINE void nrf_pdm_clk_pin_set ( NRF_PDM_Type * p_reg,
uint32_t pin )

Function for setting the CLK pin.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]pinCLK pin number.

◆ nrf_pdm_clock_get()

NRF_STATIC_INLINE nrf_pdm_freq_t nrf_pdm_clock_get ( NRF_PDM_Type const * p_reg)

Function for getting the PDM clock frequency.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
PDM clock frequency.

◆ nrf_pdm_clock_set()

NRF_STATIC_INLINE void nrf_pdm_clock_set ( NRF_PDM_Type * p_reg,
nrf_pdm_freq_t pdm_freq )

Function for setting the PDM clock frequency.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]pdm_freqPDM clock frequency.

◆ nrf_pdm_custom_ratio_set()

NRF_STATIC_INLINE void nrf_pdm_custom_ratio_set ( NRF_PDM_Type * p_reg,
nrf_pdm_custom_ratio_t const * custom_ratio )

Function for setting custom ratio between PDM_CLK and output sample rate and configuring filters accordingly.

Warning
Before calling this function, the caller must ensure that custom ratio configuration has been set using nrf_pdm_ratio_set.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]custom_ratioCustom ratio configuration.

◆ nrf_pdm_din_pin_get()

NRF_STATIC_INLINE uint32_t nrf_pdm_din_pin_get ( NRF_PDM_Type const * p_reg)

Function for getting the DIN pin selection.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
DIN pin selection;

◆ nrf_pdm_din_pin_set()

NRF_STATIC_INLINE void nrf_pdm_din_pin_set ( NRF_PDM_Type * p_reg,
uint32_t pin )

Function for setting the DIN pin.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]pinDIN pin number.

◆ nrf_pdm_disable()

NRF_STATIC_INLINE void nrf_pdm_disable ( NRF_PDM_Type * p_reg)

Function for disabling the PDM peripheral.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.

◆ nrf_pdm_enable()

NRF_STATIC_INLINE void nrf_pdm_enable ( NRF_PDM_Type * p_reg)

Function for enabling the PDM peripheral.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.

The PDM peripheral must be enabled before use.

◆ nrf_pdm_enable_check()

NRF_STATIC_INLINE bool nrf_pdm_enable_check ( NRF_PDM_Type const * p_reg)

Function for checking if the PDM peripheral is enabled.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Return values
trueThe PDM peripheral is enabled.
falseThe PDM peripheral is not enabled.

◆ nrf_pdm_event_address_get()

NRF_STATIC_INLINE uint32_t nrf_pdm_event_address_get ( NRF_PDM_Type const * p_reg,
nrf_pdm_event_t event )

Function for getting the address of a PDM event register.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventPDM event.
Returns
Address of the specified PDM event.

◆ nrf_pdm_event_check()

NRF_STATIC_INLINE bool nrf_pdm_event_check ( NRF_PDM_Type const * p_reg,
nrf_pdm_event_t event )

Function for retrieving the state of the PDM event.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent to be checked.
Return values
trueThe event has been generated.
falseThe event has not been generated.

◆ nrf_pdm_event_clear()

NRF_STATIC_INLINE void nrf_pdm_event_clear ( NRF_PDM_Type * p_reg,
nrf_pdm_event_t event )

Function for clearing a PDM event.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventPDM event.

◆ nrf_pdm_filter_ctrl_get()

NRF_STATIC_INLINE void nrf_pdm_filter_ctrl_get ( NRF_PDM_Type const * p_reg,
nrf_pdm_filter_ctrl_t * fctrl )

Function for getting PDM filter configuration.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]fctrlPointer to the structure to be filled with filter configuration.

◆ nrf_pdm_filter_ctrl_set()

NRF_STATIC_INLINE void nrf_pdm_filter_ctrl_set ( NRF_PDM_Type * p_reg,
nrf_pdm_filter_ctrl_t const * fctrl )

Function for setting PDM filter configuration.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]fctrlPointer to the structure with filter configuration to be set.

◆ nrf_pdm_filter_hp_pole_enable()

NRF_STATIC_INLINE void nrf_pdm_filter_hp_pole_enable ( NRF_PDM_Type * p_reg,
bool enable )

Function for enabling PDM high-pass filter gain pole.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]enableTrue if high-pass filter is to be enabled, false otherwise.

◆ nrf_pdm_filter_hp_pole_get()

NRF_STATIC_INLINE nrf_pdm_filter_hp_pole_t nrf_pdm_filter_hp_pole_get ( NRF_PDM_Type const * p_reg)

Function for getting PDM high-pass filter gain pole.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
High-pass filter gain pole.

◆ nrf_pdm_filter_hp_pole_set()

NRF_STATIC_INLINE void nrf_pdm_filter_hp_pole_set ( NRF_PDM_Type * p_reg,
nrf_pdm_filter_hp_pole_t hppole )

Function for setting PDM high-pass filter gain pole.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]hppoleHigh-pass filter gain pole.

◆ nrf_pdm_filter_sampledelay_enable()

NRF_STATIC_INLINE void nrf_pdm_filter_sampledelay_enable ( NRF_PDM_Type * p_reg,
bool enable )

Function for enabling PDM input data sample delay.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]enableTrue if sample delay is to be enabled, false otherwise.

◆ nrf_pdm_filter_softcycles_get()

NRF_STATIC_INLINE nrf_pdm_filter_softcycles_t nrf_pdm_filter_softcycles_get ( NRF_PDM_Type const * p_reg)

Function for getting PDM number of cycles used for soft mute transition.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Number of cycles.

◆ nrf_pdm_filter_softcycles_set()

NRF_STATIC_INLINE void nrf_pdm_filter_softcycles_set ( NRF_PDM_Type * p_reg,
nrf_pdm_filter_softcycles_t cycles )

Function for setting PDM number of cycles used for soft mute transition.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]cyclesNumber of cycles.

◆ nrf_pdm_filter_softmute_enable()

NRF_STATIC_INLINE void nrf_pdm_filter_softmute_enable ( NRF_PDM_Type * p_reg,
bool enable )

Function for enabling PDM filter soft mute function.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]enableTrue if soft mute function is to be enabled, false otherwise.

◆ nrf_pdm_gain_get()

NRF_STATIC_INLINE void nrf_pdm_gain_get ( NRF_PDM_Type const * p_reg,
nrf_pdm_gain_t * p_gain_l,
nrf_pdm_gain_t * p_gain_r )

Function for getting the PDM gain.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[out]p_gain_lLeft channel gain.
[out]p_gain_rRight channel gain.

◆ nrf_pdm_gain_set()

NRF_STATIC_INLINE void nrf_pdm_gain_set ( NRF_PDM_Type * p_reg,
nrf_pdm_gain_t gain_l,
nrf_pdm_gain_t gain_r )

Function for setting the PDM gain.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]gain_lLeft channel gain.
[in]gain_rRight channel gain.

◆ nrf_pdm_int_disable()

NRF_STATIC_INLINE void nrf_pdm_int_disable ( NRF_PDM_Type * p_reg,
uint32_t mask )

Function for disabling interrupts.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskMask of interrupts to be disabled. Use nrf_pdm_int_mask_t values for bit masking.

◆ nrf_pdm_int_enable()

NRF_STATIC_INLINE void nrf_pdm_int_enable ( NRF_PDM_Type * p_reg,
uint32_t mask )

Function for enabling PDM interrupts.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskMask of interrupts to be enabled. Use nrf_pdm_int_mask_t values for bit masking.

◆ nrf_pdm_int_enable_check()

NRF_STATIC_INLINE uint32_t nrf_pdm_int_enable_check ( NRF_PDM_Type const * p_reg,
uint32_t mask )

Function for checking if the specified interrupts are enabled.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskMask of interrupts to be checked. Use nrf_pdm_int_mask_t values for bit masking.
Returns
Mask of enabled interrupts.

◆ nrf_pdm_mclksrc_configure()

NRF_STATIC_INLINE void nrf_pdm_mclksrc_configure ( NRF_PDM_Type * p_reg,
nrf_pdm_mclksrc_t mclksrc )

Function for configuring PDM clock source.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]mclksrcClock source selection.

◆ nrf_pdm_mode_get()

NRF_STATIC_INLINE void nrf_pdm_mode_get ( NRF_PDM_Type const * p_reg,
nrf_pdm_mode_t * p_pdm_mode,
nrf_pdm_edge_t * p_pdm_edge )

Function for getting the PDM operation mode.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[out]p_pdm_modePDM operation mode.
[out]p_pdm_edgePDM sampling mode.

◆ nrf_pdm_mode_set()

NRF_STATIC_INLINE void nrf_pdm_mode_set ( NRF_PDM_Type * p_reg,
nrf_pdm_mode_t pdm_mode,
nrf_pdm_edge_t pdm_edge )

Function for setting the PDM operation mode.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]pdm_modePDM operation mode.
[in]pdm_edgePDM sampling mode.

◆ nrf_pdm_prescaler_get()

NRF_STATIC_INLINE uint32_t nrf_pdm_prescaler_get ( NRF_PDM_Type const * p_reg)

Function for getting the PDM prescaler divisor.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
PDM prescaler divisor.

◆ nrf_pdm_prescaler_set()

NRF_STATIC_INLINE void nrf_pdm_prescaler_set ( NRF_PDM_Type * p_reg,
uint32_t prescaler )

Function for setting the PDM prescaler divisor.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]prescalerPDM prescaler divisor.

◆ nrf_pdm_psel_connect()

NRF_STATIC_INLINE void nrf_pdm_psel_connect ( NRF_PDM_Type * p_reg,
uint32_t psel_clk,
uint32_t psel_din )

Function for setting up the PDM pins.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]psel_clkCLK pin number.
[in]psel_dinDIN pin number.

◆ nrf_pdm_psel_disconnect()

NRF_STATIC_INLINE void nrf_pdm_psel_disconnect ( NRF_PDM_Type * p_reg)

Function for disconnecting the PDM pins.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.

◆ nrf_pdm_publish_clear()

NRF_STATIC_INLINE void nrf_pdm_publish_clear ( NRF_PDM_Type * p_reg,
nrf_pdm_event_t event )

Function for clearing the publish configuration for a given PDM event.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent for which to clear the configuration.

◆ nrf_pdm_publish_get()

NRF_STATIC_INLINE uint32_t nrf_pdm_publish_get ( NRF_PDM_Type const * p_reg,
nrf_pdm_event_t event )

Function for getting the publish configuration for a given PDM event.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent for which to read the configuration.
Returns
PDM publish configuration.

◆ nrf_pdm_publish_set()

NRF_STATIC_INLINE void nrf_pdm_publish_set ( NRF_PDM_Type * p_reg,
nrf_pdm_event_t event,
uint8_t channel )

Function for setting the publish configuration for a given PDM event.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent for which to set the configuration.
[in]channelChannel through which to publish the event.

◆ nrf_pdm_ratio_set()

NRF_STATIC_INLINE void nrf_pdm_ratio_set ( NRF_PDM_Type * p_reg,
nrf_pdm_ratio_t ratio )

Function for setting ratio between PDM_CLK and output sample rate.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]ratioRatio between PDM_CLK and output sample rate.

◆ nrf_pdm_subscribe_clear()

NRF_STATIC_INLINE void nrf_pdm_subscribe_clear ( NRF_PDM_Type * p_reg,
nrf_pdm_task_t task )

Function for clearing the subscribe configuration for a given PDM task.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskTask for which to clear the configuration.

◆ nrf_pdm_subscribe_get()

NRF_STATIC_INLINE uint32_t nrf_pdm_subscribe_get ( NRF_PDM_Type const * p_reg,
nrf_pdm_task_t task )

Function for getting the subscribe configuration for a given PDM task.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskTask for which to read the configuration.
Returns
PDM subscribe configuration.

◆ nrf_pdm_subscribe_set()

NRF_STATIC_INLINE void nrf_pdm_subscribe_set ( NRF_PDM_Type * p_reg,
nrf_pdm_task_t task,
uint8_t channel )

Function for setting the subscribe configuration for a given PDM task.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskTask for which to set the configuration.
[in]channelChannel through which to subscribe events.

◆ nrf_pdm_task_address_get()

NRF_STATIC_INLINE uint32_t nrf_pdm_task_address_get ( NRF_PDM_Type const * p_reg,
nrf_pdm_task_t task )

Function for getting the address of a PDM task register.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskPDM task.
Returns
Address of the specified PDM task.

◆ nrf_pdm_task_trigger()

NRF_STATIC_INLINE void nrf_pdm_task_trigger ( NRF_PDM_Type * p_reg,
nrf_pdm_task_t task )

Function for triggering a PDM task.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskPDM task.