Hardware abstraction layer for accessing the pulse density modulation (PDM) peripheral. More...
Macros |
|
| #define | NRF_PDM_GAIN_MINIMUM 0x00 |
| #define | NRF_PDM_GAIN_DEFAULT 0x28 |
| #define | NRF_PDM_GAIN_MAXIMUM 0x50 |
Enumerations |
|
| enum |
nrf_pdm_task_t
{
NRF_PDM_TASK_START = offsetof(NRF_PDM_Type, TASKS_START), NRF_PDM_TASK_STOP = offsetof(NRF_PDM_Type, TASKS_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_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_END_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 } |
|
PDM clock frequency.
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...
|
|
Functions |
|
| __STATIC_INLINE void | nrf_pdm_task_trigger ( nrf_pdm_task_t pdm_task) |
|
Function for triggering a PDM task.
More...
|
|
| __STATIC_INLINE uint32_t | nrf_pdm_task_address_get ( nrf_pdm_task_t pdm_task) |
|
Function for getting the address of a PDM task register.
More...
|
|
| __STATIC_INLINE bool | nrf_pdm_event_check ( nrf_pdm_event_t pdm_event) |
|
Function for getting the state of a PDM event.
More...
|
|
| __STATIC_INLINE void | nrf_pdm_event_clear ( nrf_pdm_event_t pdm_event) |
|
Function for clearing a PDM event.
More...
|
|
| __STATIC_INLINE volatile uint32_t * | nrf_pdm_event_address_get ( nrf_pdm_event_t pdm_event) |
|
Function for getting the address of a PDM event register.
More...
|
|
| __STATIC_INLINE void | nrf_pdm_int_enable (uint32_t pdm_int_mask) |
|
Function for enabling PDM interrupts.
More...
|
|
| __STATIC_INLINE bool | nrf_pdm_int_enable_check (uint32_t pdm_int_mask) |
|
Function for retrieving the state of PDM interrupts.
More...
|
|
| __STATIC_INLINE void | nrf_pdm_int_disable (uint32_t pdm_int_mask) |
|
Function for disabling interrupts.
More...
|
|
| __STATIC_INLINE void | nrf_pdm_enable (void) |
|
Function for enabling the PDM peripheral.
More...
|
|
| __STATIC_INLINE void | nrf_pdm_disable (void) |
|
Function for disabling the PDM peripheral.
|
|
| __STATIC_INLINE bool | nrf_pdm_enable_check (void) |
|
Function for checking if the PDM peripheral is enabled.
More...
|
|
| __STATIC_INLINE void | nrf_pdm_mode_set ( nrf_pdm_mode_t pdm_mode, nrf_pdm_edge_t pdm_edge) |
|
Function for setting the PDM operation mode.
More...
|
|
| __STATIC_INLINE void | nrf_pdm_mode_get ( nrf_pdm_mode_t *p_pdm_mode, nrf_pdm_edge_t *p_pdm_edge) |
|
Function for getting the PDM operation mode.
More...
|
|
| __STATIC_INLINE void | nrf_pdm_clock_set ( nrf_pdm_freq_t pdm_freq) |
|
Function for setting the PDM clock frequency.
More...
|
|
| __STATIC_INLINE nrf_pdm_freq_t | nrf_pdm_clock_get (void) |
|
Function for getting the PDM clock frequency.
|
|
| __STATIC_INLINE void | nrf_pdm_psel_connect (uint32_t psel_clk, uint32_t psel_din) |
|
Function for setting up the PDM pins.
More...
|
|
| __STATIC_INLINE void | nrf_pdm_psel_disconnect () |
|
Function for disconnecting the PDM pins.
|
|
| __STATIC_INLINE void | nrf_pdm_gain_set (nrf_pdm_gain_t gain_l, nrf_pdm_gain_t gain_r) |
|
Function for setting the PDM gain.
More...
|
|
| __STATIC_INLINE void | nrf_pdm_gain_get (nrf_pdm_gain_t *p_gain_l, nrf_pdm_gain_t *p_gain_r) |
|
Function for getting the PDM gain.
More...
|
|
| __STATIC_INLINE void | nrf_pdm_buffer_set (uint32_t *p_buffer, uint32_t num) |
|
Function for setting the PDM sample buffer.
More...
|
|
| __STATIC_INLINE uint32_t * | nrf_pdm_buffer_get () |
|
Function for getting the current PDM sample buffer address.
More...
|
|
Detailed Description
Hardware abstraction layer for accessing the pulse density modulation (PDM) peripheral.
Enumeration Type Documentation
| enum nrf_pdm_edge_t |
| enum nrf_pdm_event_t |
| enum nrf_pdm_freq_t |
| enum nrf_pdm_int_mask_t |
| enum nrf_pdm_mode_t |
| enum nrf_pdm_task_t |
Function Documentation
| __STATIC_INLINE uint32_t* nrf_pdm_buffer_get | ( | ) |
Function for getting the current PDM sample buffer address.
- Returns
- Pointer to the current sample buffer.
| __STATIC_INLINE void nrf_pdm_buffer_set | ( | uint32_t * | p_buffer , |
| uint32_t | num | ||
| ) |
Function for setting the PDM sample buffer.
- Parameters
-
[in] p_buffer Pointer to the RAM address where samples should be written with EasyDMA. [in] num Number of samples to allocate memory for in EasyDMA mode.
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.
| __STATIC_INLINE void nrf_pdm_clock_set | ( | nrf_pdm_freq_t | pdm_freq | ) |
Function for setting the PDM clock frequency.
- Parameters
-
[in] pdm_freq PDM clock frequency.
| __STATIC_INLINE void nrf_pdm_enable | ( | void | ) |
Function for enabling the PDM peripheral.
The PDM peripheral must be enabled before use.
| __STATIC_INLINE bool nrf_pdm_enable_check | ( | void | ) |
Function for checking if the PDM peripheral is enabled.
- Return values
-
true If the PDM peripheral is enabled. false If the PDM peripheral is not enabled.
| __STATIC_INLINE volatile uint32_t* nrf_pdm_event_address_get | ( | nrf_pdm_event_t | pdm_event | ) |
Function for getting the address of a PDM event register.
- Parameters
-
[in] pdm_event PDM event.
- Returns
- Address of the specified PDM event.
| __STATIC_INLINE bool nrf_pdm_event_check | ( | nrf_pdm_event_t | pdm_event | ) |
Function for getting the state of a PDM event.
- Parameters
-
[in] pdm_event PDM event.
- Returns
- State of the specified PDM event.
| __STATIC_INLINE void nrf_pdm_event_clear | ( | nrf_pdm_event_t | pdm_event | ) |
Function for clearing a PDM event.
- Parameters
-
[in] pdm_event PDM event.
| __STATIC_INLINE void nrf_pdm_gain_get | ( | nrf_pdm_gain_t * | p_gain_l , |
| nrf_pdm_gain_t * | p_gain_r | ||
| ) |
Function for getting the PDM gain.
- Parameters
-
[out] p_gain_l Left channel gain. [out] p_gain_r Right channel gain.
| __STATIC_INLINE void nrf_pdm_gain_set | ( | nrf_pdm_gain_t | gain_l , |
| nrf_pdm_gain_t | gain_r | ||
| ) |
Function for setting the PDM gain.
- Parameters
-
[in] gain_l Left channel gain. [in] gain_r Right channel gain.
| __STATIC_INLINE void nrf_pdm_int_disable | ( | uint32_t | pdm_int_mask | ) |
Function for disabling interrupts.
- Parameters
-
pdm_int_mask Interrupts to disable.
| __STATIC_INLINE void nrf_pdm_int_enable | ( | uint32_t | pdm_int_mask | ) |
Function for enabling PDM interrupts.
- Parameters
-
[in] pdm_int_mask Interrupts to enable.
| __STATIC_INLINE bool nrf_pdm_int_enable_check | ( | uint32_t | pdm_int_mask | ) |
Function for retrieving the state of PDM interrupts.
- Parameters
-
[in] pdm_int_mask Interrupts to check.
- Return values
-
true If all specified interrupts are enabled. false If at least one of the given interrupts is not enabled.
| __STATIC_INLINE void nrf_pdm_mode_get | ( | nrf_pdm_mode_t * | p_pdm_mode , |
| nrf_pdm_edge_t * | p_pdm_edge | ||
| ) |
Function for getting the PDM operation mode.
- Parameters
-
[out] p_pdm_mode PDM operation mode. [out] p_pdm_edge PDM sampling mode.
| __STATIC_INLINE void nrf_pdm_mode_set | ( | nrf_pdm_mode_t | pdm_mode , |
| nrf_pdm_edge_t | pdm_edge | ||
| ) |
Function for setting the PDM operation mode.
- Parameters
-
[in] pdm_mode PDM operation mode. [in] pdm_edge PDM sampling mode.
| __STATIC_INLINE void nrf_pdm_psel_connect | ( | uint32_t | psel_clk , |
| uint32_t | psel_din | ||
| ) |
Function for setting up the PDM pins.
- Parameters
-
[in] psel_clk CLK pin number. [in] psel_din DIN pin number.
| __STATIC_INLINE uint32_t nrf_pdm_task_address_get | ( | nrf_pdm_task_t | pdm_task | ) |
Function for getting the address of a PDM task register.
- Parameters
-
[in] pdm_task PDM task.
- Returns
- Address of the specified PDM task.
| __STATIC_INLINE void nrf_pdm_task_trigger | ( | nrf_pdm_task_t | pdm_task | ) |
Function for triggering a PDM task.
- Parameters
-
[in] pdm_task PDM task.