PDM HALY

group nrfy_pdm

Hardware access layer with cache and barrier support for managing the PDM peripheral.

Functions

NRFY_STATIC_INLINE void nrfy_pdm_periph_configure(NRF_PDM_Type *p_reg, nrfy_pdm_config_t const *p_config)

Function for configuring the PDM.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • p_config[in] Pointer to the peripheral configuration structure.

NRFY_STATIC_INLINE void nrfy_pdm_int_init(NRF_PDM_Type *p_reg, uint32_t mask, uint8_t irq_priority, bool enable)

Function for initializing the specified PDM interrupts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of interrupts to be initialized.

  • irq_priority[in] Interrupt priority.

  • enable[in] True if the interrupts are to be enabled, false otherwise.

NRFY_STATIC_INLINE void nrfy_pdm_int_uninit(NRF_PDM_Type *p_reg)

Function for uninitializing the PDM interrupts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

NRFY_STATIC_INLINE uint32_t nrfy_pdm_events_process(NRF_PDM_Type *p_reg, uint32_t mask, nrfy_pdm_buffer_t *p_buffer)

Function for processing the specified PDM events.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of events to be processed, created by NRFY_EVENT_TO_INT_BITMASK().

  • p_buffer[in] Pointer to the structure containing buffer associated with the last reception. Can be NULL.

Returns:

Mask of events that were generated and processed. To be checked against the result of NRFY_EVENT_TO_INT_BITMASK().

NRFY_STATIC_INLINE void nrfy_pdm_buffer_set(NRF_PDM_Type *p_reg, nrfy_pdm_buffer_t const *p_buffer)

Function for setting the PDM sampling buffer.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • p_buffer[in] Pointer to the structure containing reception buffer.

NRFY_STATIC_INLINE void nrfy_pdm_start(NRF_PDM_Type *p_reg, nrfy_pdm_buffer_t const *p_buffer)

Function for starting the PDM sampling.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • p_buffer[in] Pointer to the structure containing reception buffer if the reception is to be blocking. NULL for non-blocking receptions.

NRFY_STATIC_INLINE void nrfy_pdm_abort(NRF_PDM_Type *p_reg, nrfy_pdm_buffer_t const *p_buffer)

Function for aborting PDM transaction.

Parameters:
  • p_reg[in] Pointer to thr structure of registers of the peripheral.

  • p_buffer[in] Pointer to the structure containing reception buffer if the reception is to be blocking. NULL for non-blocking receptions.

NRFY_STATIC_INLINE void nrfy_pdm_pins_set(NRF_PDM_Type *p_reg, nrfy_pdm_pins_t *p_pins)

Function for setting the PDM pins configuration.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • p_pins[out] Pointer to the PDM pin configurartion structure.

NRFY_STATIC_INLINE void nrfy_pdm_pins_get(NRF_PDM_Type const *p_reg, nrfy_pdm_pins_t *p_pins)

Function for getting the PDM pins configuration.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • p_pins[out] Pointer to the structure to be filled with PDM pins configuration.

NRFY_STATIC_INLINE void nrfy_pdm_task_trigger(NRF_PDM_Type *p_reg, nrf_pdm_task_t task)

@refhal{nrf_pdm_task_trigger}

NRFY_STATIC_INLINE uint32_t nrfy_pdm_task_address_get(NRF_PDM_Type const *p_reg, nrf_pdm_task_t task)

@refhal{nrf_pdm_task_address_get}

NRFY_STATIC_INLINE bool nrfy_pdm_event_check(NRF_PDM_Type const *p_reg, nrf_pdm_event_t event)

@refhal{nrf_pdm_event_check}

NRFY_STATIC_INLINE void nrfy_pdm_event_clear(NRF_PDM_Type *p_reg, nrf_pdm_event_t event)

@refhal{nrf_pdm_event_clear}

NRFY_STATIC_INLINE uint32_t nrfy_pdm_event_address_get(NRF_PDM_Type const *p_reg, nrf_pdm_event_t event)

@refhal{nrf_pdm_event_address_get}

NRFY_STATIC_INLINE void nrfy_pdm_int_enable(NRF_PDM_Type *p_reg, uint32_t mask)

@refhal{nrf_pdm_int_enable}

NRFY_STATIC_INLINE uint32_t nrfy_pdm_int_enable_check(NRF_PDM_Type const *p_reg, uint32_t mask)

@refhal{nrf_pdm_int_enable_check}

NRFY_STATIC_INLINE void nrfy_pdm_int_disable(NRF_PDM_Type *p_reg, uint32_t mask)

@refhal{nrf_pdm_int_disable}

NRFY_STATIC_INLINE void nrfy_pdm_subscribe_set(NRF_PDM_Type *p_reg, nrf_pdm_task_t task, uint8_t channel)

@refhal{nrf_pdm_subscribe_set}

NRFY_STATIC_INLINE void nrfy_pdm_subscribe_clear(NRF_PDM_Type *p_reg, nrf_pdm_task_t task)

@refhal{nrf_pdm_subscribe_clear}

NRFY_STATIC_INLINE void nrfy_pdm_publish_set(NRF_PDM_Type *p_reg, nrf_pdm_event_t event, uint8_t channel)

@refhal{nrf_pdm_publish_set}

NRFY_STATIC_INLINE void nrfy_pdm_publish_clear(NRF_PDM_Type *p_reg, nrf_pdm_event_t event)

@refhal{nrf_pdm_publish_clear}

NRFY_STATIC_INLINE void nrfy_pdm_enable(NRF_PDM_Type *p_reg)

@refhal{nrf_pdm_enable}

NRFY_STATIC_INLINE void nrfy_pdm_disable(NRF_PDM_Type *p_reg)

@refhal{nrf_pdm_disable}

NRFY_STATIC_INLINE bool nrfy_pdm_enable_check(NRF_PDM_Type const *p_reg)

@refhal{nrf_pdm_enable_check}

NRFY_STATIC_INLINE void nrfy_pdm_mode_set(NRF_PDM_Type *p_reg, nrf_pdm_mode_t pdm_mode, nrf_pdm_edge_t pdm_edge)

@refhal{nrf_pdm_mode_set}

NRFY_STATIC_INLINE void nrfy_pdm_mode_get(NRF_PDM_Type const *p_reg, nrf_pdm_mode_t *p_pdm_mode, nrf_pdm_edge_t *p_pdm_edge)

@refhal{nrf_pdm_mode_get}

NRFY_STATIC_INLINE void nrfy_pdm_clock_set(NRF_PDM_Type *p_reg, nrf_pdm_freq_t pdm_freq)

@refhal{nrf_pdm_clock_set}

NRFY_STATIC_INLINE nrf_pdm_freq_t nrfy_pdm_clock_get(NRF_PDM_Type const *p_reg)

@refhal{nrf_pdm_clock_get}

NRFY_STATIC_INLINE void nrfy_pdm_pin_disconnect(NRF_PDM_Type *p_reg)

@refhal{nrf_pdm_psel_disconnect}

NRFY_STATIC_INLINE void nrfy_pdm_gain_set(NRF_PDM_Type *p_reg, nrf_pdm_gain_t gain_l, nrf_pdm_gain_t gain_r)

@refhal{nrf_pdm_gain_set}

NRFY_STATIC_INLINE void nrfy_pdm_gain_get(NRF_PDM_Type const *p_reg, nrf_pdm_gain_t *p_gain_l, nrf_pdm_gain_t *p_gain_r)

@refhal{nrf_pdm_gain_get}

NRFY_STATIC_INLINE uint32_t *nrfy_pdm_buffer_get(NRF_PDM_Type const *p_reg)

@refhal{nrf_pdm_buffer_get}

struct nrfy_pdm_buffer_t
#include <nrfy_pdm.h>

Structure describing reception buffer.

Public Members

int16_t *p_buff

Pointer to the data buffer.

uint16_t length

Data buffer lenght.

struct nrfy_pdm_pins_t
#include <nrfy_pdm.h>

PDM pins configuration structure.

Public Members

uint32_t clk_pin

CLK pin number.

uint32_t din_pin

DIN pin number.

struct nrfy_pdm_config_t
#include <nrfy_pdm.h>

PDM configuration structure.

Public Members

nrf_pdm_mode_t mode

Interface operation mode.

nrf_pdm_edge_t edge

Sampling mode.

nrfy_pdm_pins_t pins

Pin configuration structure.

nrf_pdm_freq_t clock_freq

Clock frequency.

nrf_pdm_gain_t gain_l

Left channel gain.

nrf_pdm_gain_t gain_r

Right channel gain.

bool skip_psel_cfg

Skip pin selection configuration.

When set to true, the driver does not modify pin select registers in the peripheral. Those registers are supposed to be set up externally before the driver is initialized.

Note

When both GPIO configuration and pin selection are to be skipped, the structure fields that specify pins can be omitted, as they are ignored anyway.